Пример #1
0
        public static void StopApProcessors()
        {
            //
            // Note: This should go into a HAL interface and this
            //       code confined to Platform.cs
            //

            // At this point the BSP and APs are running.
            Tracing.Log(Tracing.Debug, "Processor.StopApProcessors()");

            if (Processor.GetRunningProcessorCount() > 1)
            {
                //
                // This stops them in MpExecution in a halt state with
                // interrupts off.
                //
                Platform.BroadcastFixedIPI((byte)Isal.IX.EVectors.HaltApProcessors, true);
            }

            while (GetRunningProcessorCount() != 1)
            {
                // Thread.Sleep(100); Thread.Sleep needs NoHeapAllocation annotation
                Thread.Yield();
            }

            //
            // We must reset the AP Processors since a debug entry
            // will generated a NMI which will wake them up from HALT,
            // and they may start executing code again while the kernel
            // is still shutting down.
            //
            Platform.ResetApProcessors();

            DebugStub.RevertToUniprocessor();
            // At this point only the BSP is running.
        }