1;------------------------------------------------------------------------------
2;
3; Copyright (c) 2006, 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; Module Name:
13;
14;   SetJump.Asm
15;
16; Abstract:
17;
18;   Implementation of SetJump() on IA-32.
19;
20;------------------------------------------------------------------------------
21
22    .386
23    .model  flat,C
24    .code
25
26InternalAssertJumpBuffer    PROTO   C
27
28;------------------------------------------------------------------------------
29; UINTN
30; EFIAPI
31; SetJump (
32;   OUT     BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer
33;   );
34;------------------------------------------------------------------------------
35SetJump     PROC
36    push    [esp + 4]
37    call    InternalAssertJumpBuffer    ; To validate JumpBuffer
38    pop     ecx
39    pop     ecx                         ; ecx <- return address
40    mov     edx, [esp]
41    mov     [edx], ebx
42    mov     [edx + 4], esi
43    mov     [edx + 8], edi
44    mov     [edx + 12], ebp
45    mov     [edx + 16], esp
46    mov     [edx + 20], ecx             ; eip value to restore in LongJump
47    xor     eax, eax
48    jmp     ecx
49SetJump     ENDP
50
51    END
52