From 5152f6426cb80b70eb7c39e372105e050946eb85 Mon Sep 17 00:00:00 2001 From: Chen Fan Date: Sun, 28 Sep 2014 06:22:03 +0000 Subject: [PATCH] EmulatorPkg/MpService: Check Processor State when Set Procedure Due to the state of processor could be set blocked by SingleThread parameter, so we ought to add a READY state check, only let the processor in READY state to invoke procedure. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16185 6f19259b-4bc3-4df7-8a09-765794883524 --- EmulatorPkg/CpuRuntimeDxe/MpService.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/EmulatorPkg/CpuRuntimeDxe/MpService.c b/EmulatorPkg/CpuRuntimeDxe/MpService.c index 866028b4c2..5ddd4e761e 100644 --- a/EmulatorPkg/CpuRuntimeDxe/MpService.c +++ b/EmulatorPkg/CpuRuntimeDxe/MpService.c @@ -465,7 +465,13 @@ CpuMpServicesStartupAllAps ( continue; } - SetApProcedure (ProcessorData, Procedure, ProcedureArgument); + gThread->MutexLock (ProcessorData->StateLock); + ProcessorState = ProcessorData->State; + gThread->MutexUnlock (ProcessorData->StateLock); + + if (ProcessorState == CPU_STATE_READY) { + SetApProcedure (ProcessorData, Procedure, ProcedureArgument); + } } // -- 2.39.2