1. Removed #ifndef to enable Capsule architecture protocol on IPF.
[mirror_edk2.git] / MdePkg / Library / BaseLib / SwitchStack.c
CommitLineData
7d7c2b46 1/** @file\r
2 Switch Stack functions.\r
3\r
cb41bea7 4 Copyright (c) 2006 - 2007, Intel Corporation<BR>\r
7d7c2b46 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#include <BaseLibInternals.h>\r
18\r
19/**\r
20 Transfers control to a function starting with a new stack.\r
21\r
cb41bea7 22 Transfers control to the function specified by EntryPoint using the\r
23 new stack specified by NewStack and passing in the parameters specified\r
24 by Context1 and Context2. Context1 and Context2 are optional and may\r
25 be NULL. The function EntryPoint must never return. This function\r
26 supports a variable number of arguments following the NewStack parameter.\r
27 These additional arguments are ignored on IA-32, x64, and EBC.\r
28 IPF CPUs expect one additional parameter of type VOID * that specifies\r
29 the new backing store pointer.\r
7d7c2b46 30\r
31 If EntryPoint is NULL, then ASSERT().\r
32 If NewStack is NULL, then ASSERT().\r
33\r
34 @param EntryPoint A pointer to function to call with the new stack.\r
35 @param Context1 A pointer to the context to pass into the EntryPoint\r
36 function.\r
37 @param Context2 A pointer to the context to pass into the EntryPoint\r
38 function.\r
39 @param NewStack A pointer to the new stack to use for the EntryPoint\r
40 function.\r
41\r
42**/\r
43VOID\r
44EFIAPI\r
45SwitchStack (\r
46 IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
cb41bea7 47 IN VOID *Context1, OPTIONAL\r
48 IN VOID *Context2, OPTIONAL\r
49 IN VOID *NewStack,\r
50 ...\r
7d7c2b46 51 )\r
52{\r
cb41bea7 53 VA_LIST Marker;\r
54\r
7d7c2b46 55 ASSERT (EntryPoint != NULL && NewStack != NULL);\r
56\r
cb41bea7 57 VA_START (Marker, NewStack);\r
58\r
59 InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);\r
4cbd2175 60\r
0f6b6f75 61 //\r
62 // InternalSwitchStack () will never return\r
63 //\r
64 ASSERT (FALSE);\r
7d7c2b46 65}\r