Home | History | Annotate | Download | only in Ia32
      1 /** @file
      2   Implementation of _LongJump() on IA-32.
      3 
      4   Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
      5   This program and the accompanying materials
      6   are licensed and made available under the terms and conditions of the BSD License
      7   which accompanies this distribution.  The full text of the license may be found at
      8   http://opensource.org/licenses/bsd-license.php.
      9 
     10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     12 
     13 **/
     14 
     15 
     16 #include "BaseLibInternals.h"
     17 
     18 
     19 /**
     20   Restores the CPU context that was saved with SetJump().
     21 
     22   Restores the CPU context from the buffer specified by JumpBuffer.
     23   This function never returns to the caller.
     24   Instead is resumes execution based on the state of JumpBuffer.
     25 
     26   @param  JumpBuffer    A pointer to CPU context buffer.
     27   @param  Value         The value to return when the SetJump() context is restored.
     28 
     29 **/
     30 __declspec (naked)
     31 VOID
     32 EFIAPI
     33 InternalLongJump (
     34   IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer,
     35   IN      UINTN                     Value
     36   )
     37 {
     38   _asm {
     39     pop     eax                         ; skip return address
     40     pop     edx                         ; edx <- JumpBuffer
     41     pop     eax                         ; eax <- Value
     42     mov     ebx, [edx]
     43     mov     esi, [edx + 4]
     44     mov     edi, [edx + 8]
     45     mov     ebp, [edx + 12]
     46     mov     esp, [edx + 16]
     47     jmp     dword ptr [edx + 20]
     48   }
     49 }
     50 
     51