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 .586p 19 .model flat,C 20 .code 21 22;------------------------------------------------------------------------------ 23; UINT32 24; EFIAPI 25; Pei2LoaderSwitchStack ( 26; VOID 27; ) 28;------------------------------------------------------------------------------ 29EXTERNDEF C MeasurePoint:PROC 30Pei2LoaderSwitchStack PROC C PUBLIC 31 xor eax, eax 32 jmp FspSwitchStack 33Pei2LoaderSwitchStack ENDP 34 35;------------------------------------------------------------------------------ 36; UINT32 37; EFIAPI 38; Loader2PeiSwitchStack ( 39; VOID 40; ) 41;------------------------------------------------------------------------------ 42Loader2PeiSwitchStack PROC C PUBLIC 43 jmp FspSwitchStack 44Loader2PeiSwitchStack ENDP 45 46;------------------------------------------------------------------------------ 47; UINT32 48; EFIAPI 49; FspSwitchStack ( 50; VOID 51; ) 52;------------------------------------------------------------------------------ 53EXTERNDEF C SwapStack:PROC 54FspSwitchStack PROC C PUBLIC 55 ; Save current contexts 56 push eax 57 pushfd 58 cli 59 pushad 60 sub esp, 8 61 sidt fword ptr [esp] 62 63 ; Load new stack 64 push esp 65 call SwapStack 66 mov esp, eax 67 68 ; Restore previous contexts 69 lidt fword ptr [esp] 70 add esp, 8 71 popad 72 popfd 73 add esp, 4 74 ret 75FspSwitchStack ENDP 76 77 END 78