]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
DynamicTablesPkg: GTDT updates for ACPI 6.3
[mirror_edk2.git] / IntelFspPkg / Library / BaseFspSwitchStackLib / Ia32 / Stack.s
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
4 # SPDX-License-Identifier: BSD-2-Clause-Patent
5 #
6 # Abstract:
7 #
8 # Switch the stack from temporary memory to permenent memory.
9 #
10 #------------------------------------------------------------------------------
11
12
13 #------------------------------------------------------------------------------
14 # UINT32
15 # EFIAPI
16 # Pei2LoaderSwitchStack (
17 # VOID
18 # )
19 #------------------------------------------------------------------------------
20 ASM_GLOBAL ASM_PFX(Pei2LoaderSwitchStack)
21 ASM_PFX(Pei2LoaderSwitchStack):
22 xorl %eax, %eax
23 jmp ASM_PFX(FspSwitchStack)
24
25 #------------------------------------------------------------------------------
26 # UINT32
27 # EFIAPI
28 # Loader2PeiSwitchStack (
29 # VOID
30 # )
31 #------------------------------------------------------------------------------
32 ASM_GLOBAL ASM_PFX(Loader2PeiSwitchStack)
33 ASM_PFX(Loader2PeiSwitchStack):
34 jmp ASM_PFX(FspSwitchStack)
35
36 #------------------------------------------------------------------------------
37 # UINT32
38 # EFIAPI
39 # FspSwitchStack (
40 # VOID
41 # )
42 #------------------------------------------------------------------------------
43 ASM_GLOBAL ASM_PFX(FspSwitchStack)
44 ASM_PFX(FspSwitchStack):
45 #
46 #Save current contexts
47 #
48 push %eax
49 pushf
50 cli
51 pusha
52 sub $0x08, %esp
53 sidt (%esp)
54
55 #
56 # Load new stack
57 #
58 push %esp
59 call ASM_PFX(SwapStack)
60 movl %eax, %esp
61
62 #
63 # Restore previous contexts
64 #
65 lidt (%esp)
66 add $0x08,%esp
67 popa
68 popf
69 add $0x04,%esp
70 ret
71
72