thread = gCurrentThread;
#endif
- // NOTE:
- // 2011-04-05
- // Bug may be caused by DR0 not being maintained somewhere, hence
- // login is getting loaded with the idle state.
if( thread )
{
tRegs *regs;
__asm__ __volatile__ ( "mov %%esp, %0" : "=r" (esp) );
__asm__ __volatile__ ( "mov %%ebp, %0" : "=r" (ebp) );
eip = GetEIP();
- if(eip == SWITCH_MAGIC) return; // Check if a switch happened
+ if(eip == SWITCH_MAGIC) {
+ __asm__ __volatile__ ( "nop" : : : "eax","ebx","ecx","edx","edi","esi");
+ regs = (tRegs*)(ebp+(2+2)*4); // EBP,Ret + CPU,CurThread
+ #if USE_MP
+ thread = gaCPUs[CPU].Current;
+ #else
+ thread = gCurrentThread;
+ #endif
+ if(thread->bInstrTrace) {
+ regs->eflags |= 0x100; // Set TF
+// LogF("Tracing enabled\n");
+ Log("%p Scheduled (EIP = %p)", thread, thread->SavedState.EIP);
+ }
+ else
+ regs->eflags &= ~0x100;
+
+ return; // Check if a switch happened
+ }
// Save machine state
thread->SavedState.ESP = esp;
#endif
if( thread->bInstrTrace ) {
- Log("%p Scheduled", thread);
+ Log("%p Scheduled (EIP = %p)", thread, thread->SavedState.EIP);
}
// Set thread pointer