From 2c4e2813c105e40b962e7982b40a348dc0b272e6 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 26 Sep 2009 23:03:58 +0800 Subject: [PATCH] Implemented SYS_CHDIR at user level. Added process dump key combo to KB driver --- Kernel/drv/kb.c | 4 ++++ Usermode/Applications/CLIShell_src/main.c | 22 +++++++++++++++++++--- Usermode/Libraries/libacess.so_src/vfs.asm | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Kernel/drv/kb.c b/Kernel/drv/kb.c index 0de8fe12..fc078974 100644 --- a/Kernel/drv/kb.c +++ b/Kernel/drv/kb.c @@ -12,6 +12,9 @@ // === CONSTANTS === #define KB_BUFFER_SIZE 1024 +// === IMPORTS === +void Threads_Dump(); + // === PROTOTYPES === int KB_Install(char **Arguments); void KB_IRQHandler(); @@ -178,6 +181,7 @@ void KB_IRQHandler() switch(ch) { case 'D': __asm__ __volatile__ ("xchg %bx, %bx"); break; + case 'P': Threads_Dump(); break; } } diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index 5c431bd8..24c93ddf 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[], char *envp[]) int bCached = 1; t_sysFInfo info; - //Command_Clear(0, NULL); + Command_Clear(0, NULL); { char *tmp = getenv("CWD"); @@ -70,7 +70,6 @@ int main(int argc, char *argv[], char *envp[]) if(saArgs[0]) free(saArgs); if(!bCached) free(sCommandStr); bCached = 0; - write(_stdout, 1, "\n"); write(_stdout, strlen(gsCurrentDirectory), gsCurrentDirectory); write(_stdout, 3, "$ "); @@ -131,6 +130,7 @@ int main(int argc, char *argv[], char *envp[]) } // Load new executable pid = clone(CLONE_VM, 0); + printf("pid = %i\n", pid); if(pid == 0) execve(gsTmpBuffer, &saArgs[1], envp); if(pid <= 0) { Print("Unablt to create process: `");Print(gsTmpBuffer);Print("'\n"); // Error Message @@ -155,6 +155,7 @@ char *ReadCommandLine(int *Length) // Preset Variables ret = malloc( space+1 ); + if(!ret) return NULL; len = 0; pos = 0; @@ -162,7 +163,22 @@ char *ReadCommandLine(int *Length) do { read(_stdin, 1, &ch); // Read Character from stdin (read is a blocking call) // Ignore control characters - if(ch < 0) continue; + if(ch == '\x1B') { + read(_stdin, 1, &ch); // Read control character + switch(ch) + { + case 'D': if(pos) pos--; break; + case 'C': if(pos