]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/Ipf/InternalSwitchStack.c
Update EBC sub-dir of BaseLib according to code review comments.
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ipf / InternalSwitchStack.c
CommitLineData
f1baef62 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
f1baef62 13**/\r
14\r
15#include <BaseLibInternals.h>\r
16\r
17/**
18 Transfers control to a function starting with a new stack.
19
20 Transfers control to the function specified by EntryPoint using the
21 new stack specified by NewStack and passing in the parameters specified
22 by Context1 and Context2. Context1 and Context2 are optional and may
23 be NULL. The function EntryPoint must never return.
24 Marker will be ignored on IA-32, x64, and EBC.
25 IPF CPUs expect one additional parameter of type VOID * that specifies
26 the new backing store pointer.\r
27
28 If EntryPoint is NULL, then ASSERT().\r
29 If NewStack is NULL, then ASSERT().\r
30
31 @param EntryPoint A pointer to function to call with the new stack.
32 @param Context1 A pointer to the context to pass into the EntryPoint
33 function.
34 @param Context2 A pointer to the context to pass into the EntryPoint
35 function.
36 @param NewStack A pointer to the new stack to use for the EntryPoint
37 function.\r
38 @param Marker VA_LIST marker for the variable argument list.
39
40**/\r
41VOID
42EFIAPI
43InternalSwitchStack (
44 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
45 IN VOID *Context1, OPTIONAL
46 IN VOID *Context2, OPTIONAL
47 IN VOID *NewStack,
48 IN VA_LIST Marker
49 )\r
50\r
51{\r
52 VOID *NewBsp;\r
53\r
54 //\r
55 // Get new backing store pointer from variable list\r
56 //\r
57 NewBsp = VA_ARG (Marker, VOID *);\r
58\r
59 //\r
60 // Stack should be aligned with CPU_STACK_ALIGNMENT\r
61 //\r
62 ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);\r
63 ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0);\r
64\r
65 AsmSwitchStackAndBackingStore (EntryPoint, Context1, Context2, NewStack, NewBsp);\r
66}\r