]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
d04f229a6b41ba733b8c2ab2b48cbf8aaf7861a9
[mirror_edk2.git] / IntelFspPkg / Library / BaseFspSwitchStackLib / Ia32 / Stack.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2014, 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 .586p
19 .model flat,C
20 .code
21
22 ;------------------------------------------------------------------------------
23 ; UINT32
24 ; EFIAPI
25 ; Pei2LoaderSwitchStack (
26 ; VOID
27 ; )
28 ;------------------------------------------------------------------------------
29 EXTERNDEF C MeasurePoint:PROC
30 Pei2LoaderSwitchStack PROC C PUBLIC
31 jmp Loader2PeiSwitchStack
32 Pei2LoaderSwitchStack ENDP
33
34 ;------------------------------------------------------------------------------
35 ; UINT32
36 ; EFIAPI
37 ; Loader2PeiSwitchStack (
38 ; VOID
39 ; )
40 ;------------------------------------------------------------------------------
41 EXTERNDEF C SwapStack:PROC
42 Loader2PeiSwitchStack PROC C PUBLIC
43 ; Save current contexts
44 push offset exit
45 pushfd
46 cli
47 pushad
48 sub esp, 8
49 sidt fword ptr [esp]
50
51 ; Load new stack
52 push esp
53 call SwapStack
54 mov esp, eax
55
56 ; Restore previous contexts
57 lidt fword ptr [esp]
58 add esp, 8
59 popad
60 popfd
61 exit:
62 ret
63 Loader2PeiSwitchStack ENDP
64
65 END