X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseLib%2FSwitchStack.c;h=98d832dfd6746dd71d4a84e2e79479e19296ee85;hb=e5f461a8507ffcc89cd99ca43a09b76dca136ab5;hp=73b8edb1afae601487986ab73301120bcb13f996;hpb=878ddf1fc3540a715f63594ed22b6929e881afb4;p=mirror_edk2.git diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLib/SwitchStack.c index 73b8edb1af..98d832dfd6 100644 --- a/MdePkg/Library/BaseLib/SwitchStack.c +++ b/MdePkg/Library/BaseLib/SwitchStack.c @@ -14,6 +14,8 @@ **/ +#include + /** Transfers control to a function starting with a new stack. @@ -24,6 +26,7 @@ If EntryPoint is NULL, then ASSERT(). If NewStack is NULL, then ASSERT(). + For IPF CPUs, if NewStack is not aligned on a 16-byte boundary, then ASSERT(). @param EntryPoint A pointer to function to call with the new stack. @param Context1 A pointer to the context to pass into the EntryPoint @@ -38,15 +41,16 @@ VOID EFIAPI SwitchStack ( IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL + IN VOID *Context1, + IN VOID *Context2, IN VOID *NewStack ) { - // - // This version of this function does not actually change the stack pointer - // This is to support compilation of CPU types that do not support assemblers - // such as EBC - // - EntryPoint (Context1, Context2); + ASSERT (EntryPoint != NULL && NewStack != NULL); + +#ifdef MDE_CPU_IPF + ASSERT (((UINTN)NewStack & 0xf) == 0); +#endif + + InternalSwitchStack (EntryPoint, Context1, Context2, NewStack); }