parallel compile, SMP, swapgs, cleanup, remove useless Reserved fields
This commit is contained in:
1 parent
b17c9ac854
commit
bfe2b55142
42 files changed
+2131
-426
No files matched your search
@@ -5,6 +5,10 @@
|
||||
#include <ntlite/syscall.h>
|
||||
|
||||
#define MAX_CMD 256
|
||||
#define MAX_PIDS 64 // Maximum number of PIDs we will fetch at once
|
||||
|
||||
// External Syscall Prototypes
|
||||
uint32_t SysGetProcessList(uint32_t* pidsOut, size_t maxCount, size_t* countOut);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Output helpers
|
||||
@@ -91,6 +95,7 @@ static void cmd_help() {
|
||||
print("Available commands:\n"
|
||||
" help - Show this list\n"
|
||||
" mem - Show memory usage\n"
|
||||
" ps - List running process IDs\n"
|
||||
" dir [path] - List directory contents\n"
|
||||
" cd <path> - Change directory\n"
|
||||
" type <file> - Display file contents\n"
|
||||
@@ -122,6 +127,34 @@ static void cmd_mem(void) {
|
||||
print("\n");
|
||||
}
|
||||
|
||||
static void cmd_ps(void) {
|
||||
uint32_t pids[MAX_PIDS];
|
||||
size_t count = 0;
|
||||
|
||||
uint32_t status = SysGetProcessList(pids, MAX_PIDS, &count);
|
||||
if (status != 0) {
|
||||
print("ps: failed to retrieve process list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
print("Running Processes (Count: ");
|
||||
printUInt((uint32_t)count);
|
||||
print("):\n");
|
||||
|
||||
size_t displayCount = count < MAX_PIDS ? count : MAX_PIDS;
|
||||
for (size_t i = 0; i < displayCount; i++) {
|
||||
print(" PID: ");
|
||||
printUInt(pids[i]);
|
||||
print("\n");
|
||||
}
|
||||
|
||||
if (count > MAX_PIDS) {
|
||||
print(" ... and ");
|
||||
printUInt((uint32_t)(count - MAX_PIDS));
|
||||
print(" more processes.\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void cmd_write(const char* args) {
|
||||
char filename[MAX_CMD]; int i = 0;
|
||||
while (args[i] != ' ' && args[i] != '\0' && i < MAX_CMD - 1) {
|
||||
@@ -247,6 +280,7 @@ static int runCommand(const char* cmd) {
|
||||
}
|
||||
}
|
||||
if (strcmp(cmd, "mem") == 0) { cmd_mem(); return 0; }
|
||||
if (strcmp(cmd, "ps") == 0) { cmd_ps(); return 0; }
|
||||
if (strcmp(cmd, "dir") == 0) { cmd_dir("."); return 0; }
|
||||
if (strncmp(cmd, "dir ", 4) == 0) { cmd_dir(cmd + 4); return 0; }
|
||||
if (strncmp(cmd, "cd ", 3) == 0) { if (set_cwd(cmd + 3) != 0) print("cd: failed\n"); return 0; }
|
||||
|
||||
Reference in new issue
Block a user