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/ApStartup.c | 6 ------
 UefiCpuPkg/CpuDxe/CpuMp.c     | 4 ++++
 UefiCpuPkg/CpuDxe/CpuMp.h     | 6 ++++++
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/ApStartup.c b/UefiCpuPkg/CpuDxe/ApStartup.c
index d159280..7c0a224 100644
--- a/UefiCpuPkg/CpuDxe/ApStartup.c
+++ b/UefiCpuPkg/CpuDxe/ApStartup.c
@@ -184,12 +184,6 @@ StartApsStackless (
 
   SendInitSipiSipiAllExcludingSelf ((UINT32)(UINTN)(VOID*) StartupCode);
 
-  DisableInterrupts ();
-  CpuSleep ();
-  CpuDeadLoop ();
-
-  gBS->FreePages (StartAddress, EFI_SIZE_TO_PAGES (sizeof (*StartupCode)));
-
   return EFI_SUCCESS;
 }
 
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c
index 1d1ed3a..154c824 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.c
+++ b/UefiCpuPkg/CpuDxe/CpuMp.c
@@ -25,6 +25,10 @@ ApEntryPointInC (
   VOID
   )
 {
+  /* Ap initialization */
+  AsmApDoneWithCommonStack ();
+
+  CpuDeadLoop ();
 }
 
 
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.h b/UefiCpuPkg/CpuDxe/CpuMp.h
index 884d87b..c133c5f 100644
--- a/UefiCpuPkg/CpuDxe/CpuMp.h
+++ b/UefiCpuPkg/CpuDxe/CpuMp.h
@@ -36,5 +36,11 @@ AsmApEntryPoint (
   VOID
   );
 
+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