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