FreezeProcessor(ref SpillContext threadContext) { ProcessorContext *context = Processor.GetCurrentProcessorContext(); if (context->ipiFreeze == Uninitialized) { // Processor was still being initialized when IPI issued while (FreezeRequested == true) { ; // just spin until thaw occurs } return; } context->ipiFreeze = TargetFrozen; while (context->ipiFreeze != TargetThaw && FreezeRequested) { if ((context->ipiFreeze & FreezeActive) == FreezeActive) { // // This processor has been made the active processor // activeCpuContext = context; // Pass state over to debugger stub if (DebugStub.TrapForProcessorSwitch(ref threadContext)) { // We're returning to Freeze owner, make it active context->ipiFreeze &= ~FreezeActive; ownerCpuContext->ipiFreeze |= FreezeActive; } } } context->ipiFreeze = Running; }