]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X64/SetJump.nasm
MdePkg BaseLib: Convert X64/SetJump.asm to NASM
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / 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 x64.
19 ;
20 ;------------------------------------------------------------------------------
21
22 DEFAULT REL
23 SECTION .text
24
25 extern ASM_PFX(InternalAssertJumpBuffer)
26
27 ;------------------------------------------------------------------------------
28 ; UINTN
29 ; EFIAPI
30 ; SetJump (
31 ; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
32 ; );
33 ;------------------------------------------------------------------------------
34 global ASM_PFX(SetJump)
35 ASM_PFX(SetJump):
36 push rcx
37 add rsp, -0x20
38 call ASM_PFX(InternalAssertJumpBuffer)
39 add rsp, 0x20
40 pop rcx
41 pop rdx
42 mov [rcx], rbx
43 mov [rcx + 8], rsp
44 mov [rcx + 0x10], rbp
45 mov [rcx + 0x18], rdi
46 mov [rcx + 0x20], rsi
47 mov [rcx + 0x28], r12
48 mov [rcx + 0x30], r13
49 mov [rcx + 0x38], r14
50 mov [rcx + 0x40], r15
51 mov [rcx + 0x48], rdx
52 ; save non-volatile fp registers
53 stmxcsr [rcx + 0x50]
54 movdqu [rcx + 0x58], xmm6
55 movdqu [rcx + 0x68], xmm7
56 movdqu [rcx + 0x78], xmm8
57 movdqu [rcx + 0x88], xmm9
58 movdqu [rcx + 0x98], xmm10
59 movdqu [rcx + 0xA8], xmm11
60 movdqu [rcx + 0xB8], xmm12
61 movdqu [rcx + 0xC8], xmm13
62 movdqu [rcx + 0xD8], xmm14
63 movdqu [rcx + 0xE8], xmm15
64 xor rax, rax
65 jmp rdx
66