Turned debug on for binary loader to trace Proc_Execve
authorJohn Hodge <[email protected]>
Sun, 27 Sep 2009 03:11:25 +0000 (11:11 +0800)
committerJohn Hodge <[email protected]>
Sun, 27 Sep 2009 03:11:25 +0000 (11:11 +0800)
Kernel/binary.c
Usermode/Applications/init_src/main.c

index ae8207b..d6960e3 100644 (file)
@@ -2,21 +2,10 @@
  * Acess2\r
  * Common Binary Loader\r
  */\r
+#define DEBUG  1\r
 #include <common.h>\r
 #include <binary.h>\r
 \r
-#define DEBUG  0\r
-\r
-#if DEBUG\r
-#else\r
-# undef ENTER\r
-# undef LOG\r
-# undef LEAVE\r
-# define ENTER(...)\r
-# define LOG(...)\r
-# define LEAVE(...)\r
-#endif\r
-\r
 // === CONSTANTS ===\r
 #define BIN_LOWEST     MM_USER_MIN             // 1MiB\r
 #define BIN_GRANUALITY 0x10000         // 64KiB\r
index e701b44..55c4801 100644 (file)
  */
 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;

UCC git Repository :: git.ucc.asn.au