]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFsp2Pkg/Library/BaseFspSwitchStackLib/FspSwitchStackLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / IntelFsp2Pkg / Library / BaseFspSwitchStackLib / FspSwitchStackLib.c
CommitLineData
cf1d4549
JY
1/** @file\r
2\r
630df8c8 3 Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
9672cd30 4 SPDX-License-Identifier: BSD-2-Clause-Patent\r
cf1d4549
JY
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
411b3ff6 23UINTN\r
630df8c8 24EFIAPI\r
cf1d4549 25SwapStack (\r
411b3ff6 26 IN UINTN NewStack\r
cf1d4549
JY
27 )\r
28{\r
29 FSP_GLOBAL_DATA *FspData;\r
411b3ff6 30 UINTN OldStack;\r
cf1d4549 31\r
111f2228
MK
32 FspData = GetFspGlobalDataPointer ();\r
33 OldStack = FspData->CoreStack;\r
629709a5 34 FspData->CoreStack = (UINTN)NewStack;\r
cf1d4549
JY
35 return OldStack;\r
36}\r