]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/SetJump.nasm
MdePkg BaseLib: Convert Ia32/SetJump.asm to NASM
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / SetJump.nasm
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 SECTION .text
23
24 extern ASM_PFX(InternalAssertJumpBuffer)
25
26 ;------------------------------------------------------------------------------
27 ; UINTN
28 ; EFIAPI
29 ; SetJump (
30 ; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
31 ; );
32 ;------------------------------------------------------------------------------
33 global ASM_PFX(SetJump)
34 ASM_PFX(SetJump):
35 push DWORD [esp + 4]
36 call ASM_PFX(InternalAssertJumpBuffer) ; To validate JumpBuffer
37 pop ecx
38 pop ecx ; ecx <- return address
39 mov edx, [esp]
40 mov [edx], ebx
41 mov [edx + 4], esi
42 mov [edx + 8], edi
43 mov [edx + 12], ebp
44 mov [edx + 16], esp
45 mov [edx + 20], ecx ; eip value to restore in LongJump
46 xor eax, eax
47 jmp ecx
48