X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Farch%2Fx86%2Fproc.c;h=281b628879b1b159013b2e1b4004cda194e8ebb7;hb=ff00630ed805237683c2f8fa47765a1cf5a07578;hp=8d856086930cd6670baf830527ce5269d2038027;hpb=934d0f535e1929fd90ae0606e77794484aa55284;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/arch/x86/proc.c b/KernelLand/Kernel/arch/x86/proc.c index 8d856086..281b6288 100644 --- a/KernelLand/Kernel/arch/x86/proc.c +++ b/KernelLand/Kernel/arch/x86/proc.c @@ -18,6 +18,7 @@ #define DEBUG_TRACE_SWITCH 0 #define DEBUG_DISABLE_DOUBLEFAULT 1 #define DEBUG_VERY_SLOW_PERIOD 0 +#define DEBUG_NOPREEMPT 1 // === CONSTANTS === // Base is 1193182 @@ -978,14 +979,26 @@ void Proc_Reschedule(void) */ void Proc_Scheduler(int CPU) { + #if USE_MP + if( GetCPUNum() ) + gpMP_LocalAPIC->EOI.Val = 0; + else + #endif + outb(0x20, 0x20); + __asm__ __volatile__ ("sti"); + + // Call the timer update code + Timer_CallTimers(); + + #if !DEBUG_NOPREEMPT // If two ticks happen within the same task, and it's not an idle task, swap if( gaCPUs[CPU].Current->TID > giNumCPUs && gaCPUs[CPU].Current == gaCPUs[CPU].LastTimerThread ) { Proc_Reschedule(); } + gaCPUs[CPU].LastTimerThread = gaCPUs[CPU].Current; - // Call the timer update code - Timer_CallTimers(); + #endif } // === EXPORTS ===