summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c')
-rw-r--r--MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c b/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
index b78424c163..cac183636d 100644
--- a/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
+++ b/MdePkg/Library/BaseLib/RiscV64/InternalSwitchStack.c
@@ -11,6 +11,30 @@
/**
Transfers control to a function starting with a new stack.
+ This internal worker function transfers control to the function
+ specified by EntryPoint using the new stack specified by NewStack,
+ and passes in the parameters specified by Context1 and Context2.
+ Context1 and Context2 are optional and may be NULL.
+ The function EntryPoint must never return.
+
+ @param Context1 The first parameter to pass in.
+ @param Context2 The second Parameter to pass in
+ @param EntryPoint The pointer to the function to enter.
+ @param NewStack The new Location of the stack
+
+**/
+VOID
+EFIAPI
+InternalSwitchStackAsm (
+ IN VOID *Context1 OPTIONAL,
+ IN VOID *Context2 OPTIONAL,
+ IN SWITCH_STACK_ENTRY_POINT EntryPoint,
+ IN VOID *NewStack
+ );
+
+/**
+ Transfers control to a function starting with a new stack.
+
Transfers control to the function specified by EntryPoint using the
new stack specified by NewStack and passing in the parameters specified
by Context1 and Context2. Context1 and Context2 are optional and may
@@ -42,12 +66,6 @@ InternalSwitchStack (
IN VA_LIST Marker
)
{
- BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
-
- JumpBuffer.RA = (UINTN)EntryPoint;
- JumpBuffer.SP = (UINTN)NewStack - sizeof (VOID *);
- JumpBuffer.S0 = (UINT64)(UINTN)Context1;
- JumpBuffer.S1 = (UINT64)(UINTN)Context2;
- LongJump (&JumpBuffer, (UINTN)-1);
+ InternalSwitchStackAsm (Context1, Context2, EntryPoint, (VOID *)((UINTN)NewStack - sizeof (VOID *)));
ASSERT (FALSE);
}