Revision: 16351
          http://sourceforge.net/p/edk2/code/16351
Author:   jljusten
Date:     2014-11-13 18:26:03 +0000 (Thu, 13 Nov 2014)
Log Message:
-----------
UefiCpuPkg/CpuDxe: Switch Ap Stack to NewStack

All APs use the same common stack to initialization. after
initialization, APs should switch to the stack of its own.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <[email protected]>
Reviewed-by: Jeff Fan <[email protected]>

Modified Paths:
--------------
    trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c

Modified: trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c
===================================================================
--- trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c        2014-11-13 18:25:48 UTC (rev 
16350)
+++ trunk/edk2/UefiCpuPkg/CpuDxe/CpuMp.c        2014-11-13 18:26:03 UTC (rev 
16351)
@@ -25,6 +25,28 @@
 volatile UINTN mNumberOfProcessors;
 
 /**
+  Application Processors do loop routine
+  after switch to its own stack.
+
+  @param  Context1    A pointer to the context to pass into the function.
+  @param  Context2    A pointer to the context to pass into the function.
+
+**/
+VOID
+ProcessorToIdleState (
+  IN      VOID                      *Context1,  OPTIONAL
+  IN      VOID                      *Context2   OPTIONAL
+  )
+{
+  DEBUG ((DEBUG_INFO, "Ap apicid is %d\n", GetApicId ()));
+
+  AsmApDoneWithCommonStack ();
+
+  CpuSleep ();
+  CpuDeadLoop ();
+}
+
+/**
   Application Processor C code entry point.
 
 **/
@@ -35,6 +57,13 @@
   )
 {
   mNumberOfProcessors++;
+  mApStackStart = (UINT8*)mApStackStart + gApStackSize;
+
+  SwitchStack (
+    (SWITCH_STACK_ENTRY_POINT)(UINTN)ProcessorToIdleState,
+    NULL,
+    NULL,
+    mApStackStart);
 }
 
 


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to