# 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
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;
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;