Home | History | Annotate | Download | only in Ia32
      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 ;------------------------------------------------------------------------------
     29 EXTERNDEF  C   MeasurePoint:PROC
     30 Pei2LoaderSwitchStack   PROC C PUBLIC
     31     xor     eax, eax
     32     jmp     FspSwitchStack
     33 Pei2LoaderSwitchStack   ENDP
     34 
     35 ;------------------------------------------------------------------------------
     36 ; UINT32
     37 ; EFIAPI
     38 ; Loader2PeiSwitchStack (
     39 ;   VOID
     40 ;   )
     41 ;------------------------------------------------------------------------------
     42 Loader2PeiSwitchStack   PROC C PUBLIC
     43     jmp     FspSwitchStack
     44 Loader2PeiSwitchStack   ENDP
     45 
     46 ;------------------------------------------------------------------------------
     47 ; UINT32
     48 ; EFIAPI
     49 ; FspSwitchStack (
     50 ;   VOID
     51 ;   )
     52 ;------------------------------------------------------------------------------
     53 EXTERNDEF  C   SwapStack:PROC
     54 FspSwitchStack   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
     75 FspSwitchStack   ENDP
     76 
     77     END
     78