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;   LongJump.Asm
15;
16; Abstract:
17;
18;   Implementation of _LongJump() on x64.
19;
20;------------------------------------------------------------------------------
21
22    DEFAULT REL
23    SECTION .text
24
25;------------------------------------------------------------------------------
26; VOID
27; EFIAPI
28; InternalLongJump (
29;   IN      BASE_LIBRARY_JUMP_BUFFER  *JumpBuffer,
30;   IN      UINTN                     Value
31;   );
32;------------------------------------------------------------------------------
33global ASM_PFX(InternalLongJump)
34ASM_PFX(InternalLongJump):
35    mov     rbx, [rcx]
36    mov     rsp, [rcx + 8]
37    mov     rbp, [rcx + 0x10]
38    mov     rdi, [rcx + 0x18]
39    mov     rsi, [rcx + 0x20]
40    mov     r12, [rcx + 0x28]
41    mov     r13, [rcx + 0x30]
42    mov     r14, [rcx + 0x38]
43    mov     r15, [rcx + 0x40]
44    ; load non-volatile fp registers
45    ldmxcsr [rcx + 0x50]
46    movdqu  xmm6,  [rcx + 0x58]
47    movdqu  xmm7,  [rcx + 0x68]
48    movdqu  xmm8,  [rcx + 0x78]
49    movdqu  xmm9,  [rcx + 0x88]
50    movdqu  xmm10, [rcx + 0x98]
51    movdqu  xmm11, [rcx + 0xA8]
52    movdqu  xmm12, [rcx + 0xB8]
53    movdqu  xmm13, [rcx + 0xC8]
54    movdqu  xmm14, [rcx + 0xD8]
55    movdqu  xmm15, [rcx + 0xE8]
56    mov     rax, rdx               ; set return value
57    jmp     qword [rcx + 0x48]
58
59