]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/SwitchStack.c
1. Remove #ifdef _MSC_EXTENSION_ from all source files
[mirror_edk2.git] / MdePkg / Library / BaseLib / SwitchStack.c
index 73b8edb1afae601487986ab73301120bcb13f996..98d832dfd6746dd71d4a84e2e79479e19296ee85 100644 (file)
@@ -14,6 +14,8 @@
 \r
 **/\r
 \r
+#include <BaseLibInternals.h>\r
+\r
 /**\r
   Transfers control to a function starting with a new stack.\r
 \r
@@ -24,6 +26,7 @@
 \r
   If EntryPoint is NULL, then ASSERT().\r
   If NewStack is NULL, then ASSERT().\r
+  For IPF CPUs, if NewStack is not aligned on a 16-byte boundary, then ASSERT().\r
 \r
   @param  EntryPoint  A pointer to function to call with the new stack.\r
   @param  Context1    A pointer to the context to pass into the EntryPoint\r
@@ -38,15 +41,16 @@ VOID
 EFIAPI\r
 SwitchStack (\r
   IN      SWITCH_STACK_ENTRY_POINT  EntryPoint,\r
-  IN      VOID                      *Context1,  OPTIONAL\r
-  IN      VOID                      *Context2,  OPTIONAL\r
+  IN      VOID                      *Context1,\r
+  IN      VOID                      *Context2,\r
   IN      VOID                      *NewStack\r
   )\r
 {\r
-  //\r
-  // This version of this function does not actually change the stack pointer\r
-  // This is to support compilation of CPU types that do not support assemblers\r
-  // such as EBC\r
-  //\r
-  EntryPoint (Context1, Context2);\r
+  ASSERT (EntryPoint != NULL && NewStack != NULL);\r
+\r
+#ifdef MDE_CPU_IPF\r
+  ASSERT (((UINTN)NewStack & 0xf) == 0);\r
+#endif\r
+\r
+  InternalSwitchStack (EntryPoint, Context1, Context2, NewStack);\r
 }\r