1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
8 ; Switch the stack from temporary memory to permanent memory.
10 ;------------------------------------------------------------------------------
14 %include "PushPopRegsNasm.inc"
16 extern ASM_PFX(SwapStack)
18 ;------------------------------------------------------------------------------
21 ; Pei2LoaderSwitchStack (
24 ;------------------------------------------------------------------------------
25 global ASM_PFX(Pei2LoaderSwitchStack)
26 ASM_PFX(Pei2LoaderSwitchStack):
28 jmp ASM_PFX(FspSwitchStack)
30 ;------------------------------------------------------------------------------
33 ; Loader2PeiSwitchStack (
36 ;------------------------------------------------------------------------------
37 global ASM_PFX(Loader2PeiSwitchStack)
38 ASM_PFX(Loader2PeiSwitchStack):
39 jmp ASM_PFX(FspSwitchStack)
41 ;------------------------------------------------------------------------------
47 ;------------------------------------------------------------------------------
48 global ASM_PFX(FspSwitchStack)
49 ASM_PFX(FspSwitchStack):
50 ; Save current contexts. The format must align with CONTEXT_STACK_64.
51 push rdx ; Reserved QWORD for stack alignment
54 push rax ; FspInfoHeader
63 call ASM_PFX(SwapStack)
66 ; Restore previous contexts
71 add rsp, 32 ; FspInfoHeader + ApiParam[2] + Reserved QWORD