From a048f2a350824bb7e0b8191bcf16addd1543b882 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 27 Sep 2009 11:11:25 +0800 Subject: [PATCH] Turned debug on for binary loader to trace Proc_Execve --- Kernel/binary.c | 13 +------------ Usermode/Applications/init_src/main.c | 7 ++++++- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Kernel/binary.c b/Kernel/binary.c index ae8207bf..d6960e3f 100644 --- a/Kernel/binary.c +++ b/Kernel/binary.c @@ -2,21 +2,10 @@ * Acess2 * Common Binary Loader */ +#define DEBUG 1 #include #include -#define DEBUG 0 - -#if DEBUG -#else -# undef ENTER -# undef LOG -# undef LEAVE -# define ENTER(...) -# define LOG(...) -# define LEAVE(...) -#endif - // === CONSTANTS === #define BIN_LOWEST MM_USER_MIN // 1MiB #define BIN_GRANUALITY 0x10000 // 64KiB diff --git a/Usermode/Applications/init_src/main.c b/Usermode/Applications/init_src/main.c index e701b44e..55c48012 100644 --- a/Usermode/Applications/init_src/main.c +++ b/Usermode/Applications/init_src/main.c @@ -14,17 +14,22 @@ */ int main(int argc, char *argv[]) { + int tid; open(DEFAULT_TERMINAL, OPENFLAG_READ); // Stdin open(DEFAULT_TERMINAL, OPENFLAG_WRITE); // Stdout open(DEFAULT_TERMINAL, OPENFLAG_WRITE); // Stderr write(1, 13, "Hello, World!"); - if(clone(CLONE_VM, 0) == 0) + tid = clone(CLONE_VM, 0); + if(tid == 0) { execve(DEFAULT_SHELL, NULL, NULL); + for(;;) __asm__ __volatile__("hlt"); } + __asm__ __volatile__("xchg %%bx, %%bx"::"a"(tid)); + for(;;) sleep(); return 42; -- 2.20.1