X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fproc.c;h=76e96c93630607f8c69767ec72cd7ea8ed63f07e;hb=3d261aba7f8108798d731d6cd85c445f46a41024;hp=d468d11a215f3b64aaeb40d7f50cf2a19586219e;hpb=3688167daa33f39c82d30563f7dae7ef57f57072;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/proc.c b/Kernel/arch/x86/proc.c index d468d11a..76e96c93 100644 --- a/Kernel/arch/x86/proc.c +++ b/Kernel/arch/x86/proc.c @@ -10,6 +10,9 @@ # include #endif +// === FLAGS === +#define DEBUG_TRACE_SWITCH 0 + // === CONSTANTS === #define SWITCH_MAGIC 0xFFFACE55 // There is no code in this area #define TIMER_DIVISOR 11931 //~100Hz @@ -306,12 +309,7 @@ int Proc_Clone(Uint *Err, Uint Flags) newThread->SavedState.EIP = eip; // Lock list and add to active - LOCK( &giThreadListLock ); - newThread->Next = gActiveThreads; - gActiveThreads = newThread; - giNumActiveThreads ++; - giTotalTickets += newThread->NumTickets; - RELEASE( &giThreadListLock ); + Threads_AddActive(newThread); Threads_Dump(); @@ -497,6 +495,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;