]> git.proxmox.com Git - mirror_edk2.git/blame - OldMdePkg/Library/BaseLib/Ebc/SwitchStack.c
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Library / BaseLib / Ebc / SwitchStack.c
CommitLineData
d17412e3 1/** @file\r
2 Switch Stack functions.\r
3\r
cb41bea7 4 Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
d17412e3 5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Module Name: SwitchStack.c\r
14\r
15**/\r
16\r
17/**\r
18 Transfers control to a function starting with a new stack.\r
19\r
cb41bea7 20 Transfers control to the function specified by EntryPoint using the\r
21 new stack specified by NewStack and passing in the parameters specified\r
22 by Context1 and Context2. Context1 and Context2 are optional and may\r
23 be NULL. The function EntryPoint must never return.\r
24 Marker will be ignored on IA-32, x64, and EBC.\r
25 IPF CPUs expect one additional parameter of type VOID * that specifies\r
26 the new backing store pointer.\r
d17412e3 27\r
28 If EntryPoint is NULL, then ASSERT().\r
29 If NewStack is NULL, then ASSERT().\r
30\r
31 @param EntryPoint A pointer to function to call with the new stack.\r
32 @param Context1 A pointer to the context to pass into the EntryPoint\r
33 function.\r
34 @param Context2 A pointer to the context to pass into the EntryPoint\r
35 function.\r
36 @param NewStack A pointer to the new stack to use for the EntryPoint\r
37 function.\r
cb41bea7 38 @param Marker VA_LIST marker for the variable argument list.\r
d17412e3 39\r
40**/\r
41VOID\r
bda7fbcc 42EFIAPI\r
4cbd2175 43InternalSwitchStack (\r
d17412e3 44 IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
cb41bea7 45 IN VOID *Context1, OPTIONAL\r
46 IN VOID *Context2, OPTIONAL\r
47 IN VOID *NewStack,\r
48 IN VA_LIST Marker\r
d17412e3 49 )\r
cb41bea7 50\r
d17412e3 51{\r
52 //\r
53 // This version of this function does not actually change the stack pointer\r
54 // This is to support compilation of CPU types that do not support assemblers\r
55 // such as EBC\r
56 //\r
cb41bea7 57\r
58 //\r
59 // Stack should be aligned with CPU_STACK_ALIGNMENT\r
60 //\r
61 ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);\r
62\r
d17412e3 63 EntryPoint (Context1, Context2);\r
64}\r