Added tracing of task switches
authorJohn Hodge <[email protected]>
Sun, 27 Sep 2009 05:37:56 +0000 (13:37 +0800)
committerJohn Hodge <[email protected]>
Sun, 27 Sep 2009 05:37:56 +0000 (13:37 +0800)
Kernel/arch/x86/proc.c
Kernel/syscalls.c

index d468d11..f04793a 100644 (file)
@@ -10,6 +10,9 @@
 # include <mp.h>
 #endif
 
+// === FLAGS ===
+#define DEBUG_TRACE_SWITCH     1
+
 // === CONSTANTS ===
 #define        SWITCH_MAGIC    0xFFFACE55      // There is no code in this area
 #define TIMER_DIVISOR  11931   //~100Hz
@@ -497,6 +500,14 @@ void Proc_Scheduler(int CPU)
                return;
        }
        
+       #if DEBUG_TRACE_SWITCH
+       Log("Switching to task %i, CR3 = 0x%x, EIP = %p",
+               thread->TID,
+               thread->MemState.CR3,
+               thread->SavedState.EIP
+               );
+       #endif
+       
        // Set current thread
        gCurrentThread = thread;
        
index f655707..74eaaea 100644 (file)
@@ -57,8 +57,8 @@ void SyscallHandler(tSyscallRegs *Regs)
        case SYS_CLONE:
                // Call clone system call
                ret = Proc_Clone(&err, Regs->Arg1);
-               // Change user stack if requested
-               if(ret == 0 && !(Regs->Arg1 & CLONE_VM))
+               // Change user stack if a new stack address is passed
+               if(ret == 0 && Regs->Arg2)
                        Regs->StackPointer = Regs->Arg2;
                break;
        

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