]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
Update IntelFspPkg according to FSP1.1.
[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 jmp ASM_PFX(Loader2PeiSwitchStack)
29
30 #------------------------------------------------------------------------------
31 # UINT32
32 # EFIAPI
33 # Loader2PeiSwitchStack (
34 # )
35 #------------------------------------------------------------------------------
36 ASM_GLOBAL ASM_PFX(Loader2PeiSwitchStack)
37 ASM_PFX(Loader2PeiSwitchStack):
38 #
39 #Save current contexts
40 #
41 push $exit
42 pushf
43 cli
44 pusha
45 sub $0x08, %esp
46 sidt (%esp)
47
48 #
49 # Load new stack
50 #
51 push %esp
52 call ASM_PFX(SwapStack)
53 movl %eax, %esp
54
55 #
56 # Restore previous contexts
57 #
58 lidt (%esp)
59 add $0x08,%esp
60 popa
61 popf
62 exit:
63 ret
64
65