]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/SwitchStack.c
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Library / BaseLib / SwitchStack.c
CommitLineData
e1f414b6 1/** @file\r
2 Switch Stack functions.\r
3\r
bb817c56
HT
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
e1f414b6 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
e1f414b6 13**/\r
14\r
47fc17d8 15#include "BaseLibInternals.h"\r
e1f414b6 16\r
17/**\r
18 Transfers control to a function starting with a new stack.\r
19\r
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. This function\r
24 supports a variable number of arguments following the NewStack parameter.\r
25 These additional arguments are ignored on IA-32, x64, and EBC.\r
26 IPF CPUs expect one additional parameter of type VOID * that specifies\r
27 the new backing store pointer.\r
28\r
29 If EntryPoint is NULL, then ASSERT().\r
30 If NewStack is NULL, then ASSERT().\r
31\r
32 @param EntryPoint A pointer to function to call with the new stack.\r
33 @param Context1 A pointer to the context to pass into the EntryPoint\r
34 function.\r
35 @param Context2 A pointer to the context to pass into the EntryPoint\r
36 function.\r
37 @param NewStack A pointer to the new stack to use for the EntryPoint\r
38 function.\r
285010e7 39 @param ... This variable argument list is ignored for IA32, x64, and EBC. \r
40 For IPF, this variable argument list is expected to contain \r
41 a single parameter of type VOID * that specifies the new backing \r
42 store pointer.\r
e1f414b6 43\r
2fc60b70 44\r
e1f414b6 45**/\r
46VOID\r
47EFIAPI\r
48SwitchStack (\r
49 IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
50 IN VOID *Context1, OPTIONAL\r
51 IN VOID *Context2, OPTIONAL\r
52 IN VOID *NewStack,\r
53 ...\r
54 )\r
55{\r
56 VA_LIST Marker;\r
57\r
58 ASSERT (EntryPoint != NULL);\r
59 ASSERT (NewStack != NULL);\r
60\r
7f22d351 61 //\r
62 // New stack must be aligned with CPU_STACK_ALIGNMENT\r
63 //\r
64 ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);\r
65\r
e1f414b6 66 VA_START (Marker, NewStack);\r
67\r
68 InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);\r
69\r
7f22d351 70 VA_END (Marker);\r
71\r
e1f414b6 72 //\r
73 // InternalSwitchStack () will never return\r
74 //\r
75 ASSERT (FALSE);\r
76}\r