diff --git a/hal/halx86/apic/apicsmp.c b/hal/halx86/apic/apicsmp.c index 735efbf5d23e7..a0775e75db5b2 100644 --- a/hal/halx86/apic/apicsmp.c +++ b/hal/halx86/apic/apicsmp.c @@ -67,6 +67,13 @@ ApicRequestGlobalInterrupt( _In_ APIC_DSH DestinationShortHand) { APIC_INTERRUPT_COMMAND_REGISTER Icr; + APIC_INTERRUPT_COMMAND_REGISTER IcrStatus; + + /* Wait for the APIC to be idle */ + do + { + IcrStatus.Long0 = ApicRead(APIC_ICR0); + } while (IcrStatus.DeliveryStatus); /* Setup the command register */ Icr.LongLong = 0; @@ -107,6 +114,10 @@ ApicStartApplicationProcessor(ULONG NTProcessorNumber, PHYSICAL_ADDRESS StartupL ApicRequestGlobalInterrupt(HalpProcessorIdentity[NTProcessorNumber].LapicId, 0, APIC_MT_INIT, APIC_TGM_Edge, APIC_DSH_Destination); + /* De-Assert Init IPI */ + ApicRequestGlobalInterrupt(HalpProcessorIdentity[NTProcessorNumber].LapicId, 0, + APIC_MT_INIT, APIC_TGM_Level, APIC_DSH_Destination); + /* Stall execution for a bit to give APIC time: MPS Spec - B.4 */ KeStallExecutionProcessor(200); diff --git a/hal/halx86/smp/i386/spinup.c b/hal/halx86/smp/i386/spinup.c index a9a222b9696cb..9546d35058766 100644 --- a/hal/halx86/smp/i386/spinup.c +++ b/hal/halx86/smp/i386/spinup.c @@ -113,7 +113,6 @@ HalStartNextProcessor( _In_ PLOADER_PARAMETER_BLOCK LoaderBlock, _In_ PKPROCESSOR_STATE ProcessorState) { - /* Write KeLoaderBlock into Stack */ ProcessorState->ContextFrame.Esp = (ULONG)((ULONG_PTR)ProcessorState->ContextFrame.Esp - sizeof(AP_SETUP_STACK)); PAP_SETUP_STACK ApStack = (PAP_SETUP_STACK)ProcessorState->ContextFrame.Esp; diff --git a/ntoskrnl/ke/i386/mproc.c b/ntoskrnl/ke/i386/mproc.c index 81c61b5c5c9c8..0ab213e83741c 100644 --- a/ntoskrnl/ke/i386/mproc.c +++ b/ntoskrnl/ke/i386/mproc.c @@ -120,7 +120,7 @@ KeStartAllProcessors(VOID) KeLoaderBlock->Thread = (ULONG_PTR)&APInfo->Pcr.Prcb->IdleThread; // Start the CPU - DPRINT("Starting CPU: #%u\n", ProcessorCount); + DPRINT("Attempting to Start a CPU with number: %u\n", ProcessorCount); if (!HalStartNextProcessor(KeLoaderBlock, ProcessorState)) { break;