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 porcessor in READY state to invoke procedure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
---
 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 866028b..5ddd4e7 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);
+      }
     }
 
     //
-- 
1.9.3


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to