X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fproc.c;h=7366520ffe8cb6b7563c21dae3f2517f0e3e74bc;hb=22e816cf8f9562e10f42d5cb6c4a9b63e6f35ba3;hp=55b9b1704a0bab1d7b69ab6722d58944b7e5b3c4;hpb=a7164ebcef521bd1abcd70f1716e894afd01520f;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/proc.c b/Kernel/arch/x86/proc.c index 55b9b170..7366520f 100644 --- a/Kernel/arch/x86/proc.c +++ b/Kernel/arch/x86/proc.c @@ -925,13 +925,6 @@ void Proc_Scheduler(int CPU) // Update Kernel Stack pointer gTSSs[CPU].ESP0 = thread->KernelStack-4; - // Set address space - #if USE_PAE - # error "Todo: Implement PAE Address space switching" - #else - __asm__ __volatile__ ("mov %0, %%cr3" : : "a" (thread->MemState.CR3)); - #endif - #if 0 if(thread->SavedState.ESP > 0xC0000000 && thread->SavedState.ESP < thread->KernelStack-0x2000) { @@ -939,14 +932,20 @@ void Proc_Scheduler(int CPU) } #endif + #if USE_PAE + # error "Todo: Implement PAE Address space switching" + #else // Switch threads __asm__ __volatile__ ( + "mov %4, %%cr3\n\t" // Set address space "mov %1, %%esp\n\t" // Restore ESP "mov %2, %%ebp\n\t" // and EBP "jmp *%3" : : // And return to where we saved state (Proc_Clone or Proc_Scheduler) "a"(SWITCH_MAGIC), "b"(thread->SavedState.ESP), - "d"(thread->SavedState.EBP), "c"(thread->SavedState.EIP) + "d"(thread->SavedState.EBP), "c"(thread->SavedState.EIP), + "r"(thread->MemState.CR3) ); + #endif for(;;); // Shouldn't reach here }