]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Pei/Ipf/InternalSwitchStack.c
PI Enable:
[mirror_edk2.git] / MdeModulePkg / Core / Pei / Ipf / InternalSwitchStack.c
1 /** @file
2 SwitchStack() function for IPF.
3
4 Copyright (c) 2007, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <PeiMain.h>
16
17 VOID
18 EFIAPI
19 IpfAsmSwitchStack (
20 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
21 IN VOID *ConText1, OPTIONAL
22 IN VOID *Context2, OPTIONAL
23 IN VOID *Context3, OPTIONAL
24 IN VOID *NewStack,
25 IN VOID *NewBsp
26 );
27
28 /**
29 Transfers control to a function starting with a new stack.
30
31 Transfers control to the function specified by EntryPoint using the
32 new stack specified by NewStack and passing in the parameters specified
33 by Context1 and Context2. Context1 and Context2 are optional and may
34 be NULL. The function EntryPoint must never return.
35 Marker will be ignored on IA-32, x64, and EBC.
36 IPF CPUs expect one additional parameter of type VOID * that specifies
37 the new backing store pointer.
38
39 If EntryPoint is NULL, then ASSERT().
40 If NewStack is NULL, then ASSERT().
41
42 @param EntryPoint A pointer to function to call with the new stack.
43 @param Context1 A pointer to the context to pass into the EntryPoint
44 function.
45 @param Context2 A pointer to the context to pass into the EntryPoint
46 function.
47 @param NewStack A pointer to the new stack to use for the EntryPoint
48 function.
49 @param Marker VA_LIST marker for the variable argument list.
50
51 **/
52 VOID
53 EFIAPI
54 InternalSwitchStack (
55 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
56 IN VOID *Context1, OPTIONAL
57 IN VOID *Context2, OPTIONAL
58 IN VOID *Context3, OPTIONAL
59 IN VOID *NewStack,
60 IN VA_LIST Marker
61 )
62
63 {
64 VOID *NewBsp;
65
66 //
67 // Get new backing store pointer from variable list
68 //
69 NewBsp = VA_ARG (Marker, VOID *);
70
71 //
72 // Stack should be aligned with CPU_STACK_ALIGNMENT
73 //
74 ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
75 ASSERT (((UINTN)NewBsp & (CPU_STACK_ALIGNMENT - 1)) == 0);
76
77 IpfAsmSwitchStack (EntryPoint, Context1, Context2, Context3, NewStack, NewBsp);
78 }