X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Fproc.c;h=a66a540c82cf4e2a018d8dd2393df4dc50b80210;hb=246ff98ae5b16ef0e19fe082a9c900e9169a1f7b;hp=9ad06a53dc8fea253327f9388afb6905d7b933ae;hpb=8d062ceb17eb6cfb2e3db8af6794d38391c245d3;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/proc.c b/Kernel/arch/x86/proc.c index 9ad06a53..a66a540c 100644 --- a/Kernel/arch/x86/proc.c +++ b/Kernel/arch/x86/proc.c @@ -52,6 +52,7 @@ void Proc_Scheduler(); // === GLOBALS === // --- Multiprocessing --- #if USE_MP +volatile int giNumInitingCPUs = 0; tMPInfo *gMPFloatPtr = NULL; tAPIC *gpMP_LocalAPIC = NULL; Uint8 gaAPIC_to_CPU[256] = {0}; @@ -244,7 +245,11 @@ void ArchThreads_Init() if( giNumCPUs > MAX_CPUS ) { Warning("Too many CPUs detected (%i), only using %i of them", giNumCPUs, MAX_CPUS); + giNumCPUs = MAX_CPUS; } + + while( giNumInitingCPUs ) + MM_FinishVirtualInit(); Panic("Uh oh... MP Table Parsing is unimplemented\n"); } @@ -256,6 +261,7 @@ void ArchThreads_Init() #else giNumCPUs = 1; gTSSs = &gTSS0; + MM_FinishVirtualInit(); #endif // Initialise Double Fault TSS @@ -325,6 +331,7 @@ void MP_StartAP(int CPU) *(Uint16*)(KERNEL_BASE|0x469) = 0xFFFF; outb(0x70, 0x0F); outb(0x71, 0x0A); // Warm Reset MP_SendIPI(gaCPUs[CPU].APICID, 0, 5); + giNumInitingCPUs ++; } void MP_SendIPI(Uint8 APICID, int Vector, int DeliveryMode) @@ -739,7 +746,7 @@ void Proc_Scheduler(int CPU) #endif // Update Kernel Stack pointer - gTSSs[CPU].ESP0 = thread->KernelStack; + gTSSs[CPU].ESP0 = thread->KernelStack-4; // Set address space #if USE_PAE