]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFsp2Pkg/Library/BaseFspSwitchStackLib/FspSwitchStackLib.c
IntelFsp2Pkg: X64 compatible changes to support PEI in 64bit
[mirror_edk2.git] / IntelFsp2Pkg / Library / BaseFspSwitchStackLib / FspSwitchStackLib.c
1 /** @file
2
3 Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 **/
7
8 #include <Base.h>
9 #include <Library/BaseLib.h>
10 #include <Library/FspCommonLib.h>
11
12 /**
13
14 Switch the current stack to the previous saved stack.
15
16 @param[in] NewStack The new stack to be switched.
17
18 @return OldStack After switching to the saved stack,
19 this value will be saved in eax before returning.
20
21
22 **/
23 UINTN
24 EFIAPI
25 SwapStack (
26 IN UINTN NewStack
27 )
28 {
29 FSP_GLOBAL_DATA *FspData;
30 UINTN OldStack;
31
32 FspData = GetFspGlobalDataPointer ();
33 OldStack = FspData->CoreStack;
34 FspData->CoreStack = (UINTN) NewStack;
35 return OldStack;
36 }