]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/X64/SetJump.nasm
MdePkg BaseLib: Convert X64/ReadCr3.asm to NASM
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / SetJump.nasm
CommitLineData
e3d50cc4
JJ
1;------------------------------------------------------------------------------\r
2;\r
3; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4; This program and the accompanying materials\r
5; are licensed and made available under the terms and conditions of the BSD License\r
6; which accompanies this distribution. The full text of the license may be found at\r
7; http://opensource.org/licenses/bsd-license.php.\r
8;\r
9; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11;\r
12; Module Name:\r
13;\r
14; SetJump.Asm\r
15;\r
16; Abstract:\r
17;\r
18; Implementation of SetJump() on x64.\r
19;\r
20;------------------------------------------------------------------------------\r
21\r
22 DEFAULT REL\r
23 SECTION .text\r
24\r
25extern ASM_PFX(InternalAssertJumpBuffer)\r
26\r
27;------------------------------------------------------------------------------\r
28; UINTN\r
29; EFIAPI\r
30; SetJump (\r
31; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r
32; );\r
33;------------------------------------------------------------------------------\r
34global ASM_PFX(SetJump)\r
35ASM_PFX(SetJump):\r
36 push rcx\r
37 add rsp, -0x20\r
38 call ASM_PFX(InternalAssertJumpBuffer)\r
39 add rsp, 0x20\r
40 pop rcx\r
41 pop rdx\r
42 mov [rcx], rbx\r
43 mov [rcx + 8], rsp\r
44 mov [rcx + 0x10], rbp\r
45 mov [rcx + 0x18], rdi\r
46 mov [rcx + 0x20], rsi\r
47 mov [rcx + 0x28], r12\r
48 mov [rcx + 0x30], r13\r
49 mov [rcx + 0x38], r14\r
50 mov [rcx + 0x40], r15\r
51 mov [rcx + 0x48], rdx\r
52 ; save non-volatile fp registers\r
53 stmxcsr [rcx + 0x50]\r
54 movdqu [rcx + 0x58], xmm6\r
55 movdqu [rcx + 0x68], xmm7\r
56 movdqu [rcx + 0x78], xmm8\r
57 movdqu [rcx + 0x88], xmm9\r
58 movdqu [rcx + 0x98], xmm10\r
59 movdqu [rcx + 0xA8], xmm11\r
60 movdqu [rcx + 0xB8], xmm12\r
61 movdqu [rcx + 0xC8], xmm13\r
62 movdqu [rcx + 0xD8], xmm14\r
63 movdqu [rcx + 0xE8], xmm15\r
64 xor rax, rax\r
65 jmp rdx\r
66\r