5aae0aa7 |
1 | /** @file\r |
2 | SwitchStack() function for IPF.\r |
3 | \r |
4 | Copyright (c) 2007, Intel Corporation<BR>\r |
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 | **/\r |
14 | \r |
15 | #include <PeiMain.h>\r |
16 | \r |
17 | VOID\r |
18 | EFIAPI\r |
19 | IpfAsmSwitchStack (\r |
20 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r |
21 | IN VOID *ConText1, OPTIONAL\r |
22 | IN VOID *Context2, OPTIONAL\r |
23 | IN VOID *Context3, OPTIONAL\r |
24 | IN VOID *NewStack,\r |
25 | IN VOID *NewBsp\r |
26 | );\r |
27 | \r |
28 | /**\r |
29 | Transfers control to a function starting with a new stack.\r |
30 | \r |
31 | Transfers control to the function specified by EntryPoint using the\r |
32 | new stack specified by NewStack and passing in the parameters specified\r |
33 | by Context1 and Context2. Context1 and Context2 are optional and may\r |
34 | be NULL. The function EntryPoint must never return.\r |
35 | Marker will be ignored on IA-32, x64, and EBC.\r |
36 | IPF CPUs expect one additional parameter of type VOID * that specifies\r |
37 | the new backing store pointer.\r |
38 | \r |
39 | If EntryPoint is NULL, then ASSERT().\r |
40 | If NewStack is NULL, then ASSERT().\r |
41 | \r |
42 | @param EntryPoint A pointer to function to call with the new stack.\r |
43 | @param Context1 A pointer to the context to pass into the EntryPoint\r |
44 | function.\r |
45 | @param Context2 A pointer to the context to pass into the EntryPoint\r |
46 | function.\r |
47 | @param NewStack A pointer to the new stack to use for the EntryPoint\r |
48 | function.\r |
49 | @param Marker VA_LIST marker for the variable argument list.\r |
50 | \r |
51 | **/\r |
52 | VOID\r |
53 | EFIAPI\r |
54 | InternalSwitchStack (\r |
55 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r |
56 | IN VOID *Context1, OPTIONAL\r |
57 | IN VOID *Context2, OPTIONAL\r |
58 | IN VOID *Context3, OPTIONAL\r |
59 | IN VOID *NewStack,\r |
60 | IN VA_LIST Marker\r |
61 | )\r |
62 | \r |
63 | {\r |
64 | VOID *NewBsp;\r |
65 | \r |
66 | //\r |
67 | // Get new backing store pointer from variable list\r |
68 | //\r |
69 | NewBsp = VA_ARG (Marker, VOID *);\r |
70 | \r |
71 | //\r |
72 | // Stack should be aligned with CPU_STACK_ALIGNMENT\r |
73 | //\r |
74 | ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);\r |
75 | ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0);\r |
76 | \r |
77 | IpfAsmSwitchStack (EntryPoint, Context1, Context2, Context3, NewStack, NewBsp);\r |
78 | }\r |