]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
IntelFsp2Pkg BaseFspDebugLibSerialPort: Remove MASM/GAS files
[mirror_edk2.git] / IntelFsp2Pkg / Library / BaseFspSwitchStackLib / Ia32 / Stack.s
CommitLineData
cf1d4549
JY
1#------------------------------------------------------------------------------\r
2#\r
3# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
4# This program and the accompanying materials\r
5# are licensed and made available under the terms and conditions of the BSD License\r
6# which accompanies this distribution. The full text of the license may be found at\r
7# http://opensource.org/licenses/bsd-license.php.\r
8#\r
9# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11#\r
12# Abstract:\r
13#\r
14# Switch the stack from temporary memory to permenent memory.\r
15#\r
16#------------------------------------------------------------------------------\r
17\r
18\r
19#------------------------------------------------------------------------------\r
20# UINT32\r
21# EFIAPI\r
22# Pei2LoaderSwitchStack (\r
23# VOID\r
24# )\r
25#------------------------------------------------------------------------------\r
26ASM_GLOBAL ASM_PFX(Pei2LoaderSwitchStack)\r
27ASM_PFX(Pei2LoaderSwitchStack):\r
28 xorl %eax, %eax\r
29 jmp ASM_PFX(FspSwitchStack)\r
30\r
31#------------------------------------------------------------------------------\r
32# UINT32\r
33# EFIAPI\r
34# Loader2PeiSwitchStack (\r
35# VOID\r
36# )\r
37#------------------------------------------------------------------------------\r
38ASM_GLOBAL ASM_PFX(Loader2PeiSwitchStack)\r
39ASM_PFX(Loader2PeiSwitchStack):\r
40 jmp ASM_PFX(FspSwitchStack)\r
41\r
42#------------------------------------------------------------------------------\r
43# UINT32\r
44# EFIAPI\r
45# FspSwitchStack (\r
46# VOID\r
47# )\r
48#------------------------------------------------------------------------------\r
49ASM_GLOBAL ASM_PFX(FspSwitchStack)\r
50ASM_PFX(FspSwitchStack):\r
51 #\r
52 #Save current contexts\r
53 #\r
54 push %eax\r
55 pushf\r
56 cli\r
57 pusha\r
58 sub $0x08, %esp\r
59 sidt (%esp)\r
60\r
61 #\r
62 # Load new stack\r
63 #\r
64 push %esp\r
65 call ASM_PFX(SwapStack)\r
66 movl %eax, %esp\r
67\r
68 #\r
69 # Restore previous contexts\r
70 #\r
71 lidt (%esp)\r
72 add $0x08,%esp\r
73 popa\r
74 popf\r
75 add $0x04,%esp\r
76 ret\r
77\r
78\r