when Ap graps a lock and call CpuMp.c:ApEntryPointInC,
it should switch to stack of its' own and release the
lock to let others Ap call CpuMp.c:ApEntryPointInC
sequential. and StartCode should be not freed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
---
 UefiCpuPkg/CpuDxe/CpuMp.c |  4 ++++
 UefiCpuPkg/CpuDxe/CpuMp.h | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index f8d00df..f732ae5 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -29,6 +29,10 @@ ApEntryPointInC (
   VOID
   )
 {
+  /* Ap initialization */
+  AsmApDoneWithCommonStack ();
+
+  CpuDeadLoop ();
 }
 
 
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.h b/UefiCpuPkg/CpuDxe/CpuMp.h
index 41b3ef5..d7bd825 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.h
+++ b/UefiCpuPkg/CpuDxe/CpuMp.h
@@ -60,5 +60,20 @@ AsmApEntryPoint (
   VOID
   );
 
+/**
+  Indicate that the AP is no longer using the common stack, and another
+  may therefore proceed to use the common stack and then call
+  ApEntryPointInC().
+
+  The processor jumps to this code in flat mode, but the processor's
+  stack is not initialized.
+
+**/
+VOID
+EFIAPI
+AsmApDoneWithCommonStack (
+  VOID
+  );
+
 #endif // _CPU_MP_H_
 
-- 
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