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