]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/SetJump.asm
e6ddeafa7b0ae40603d24a576557708838a4ac5a
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseLib / X64 / SetJump.asm
1 ; Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
2 ; This program and the accompanying materials
3 ; are licensed and made available under the terms and conditions of the BSD License
4 ; which accompanies this distribution. The full text of the license may be found at
5 ; http://opensource.org/licenses/bsd-license.php
6 ;
7 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
8 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
9 ;
10 ; Module Name:
11 ;
12 ; SetJump.Asm
13 ;
14 ; Abstract:
15 ;
16 ; Implementation of SetJump() on x64.
17 ;
18 ;------------------------------------------------------------------------------
19
20 .code
21
22 EXTERNDEF InternalAssertJumpBuffer:PROC
23
24 ;------------------------------------------------------------------------------
25 ; UINTN
26 ; EFIAPI
27 ; SetJump (
28 ; OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
29 ; );
30 ;------------------------------------------------------------------------------
31 SetJump PROC
32 push rcx
33 add rsp, -20h
34 call InternalAssertJumpBuffer
35 add rsp, 20h
36 pop rcx
37 pop rdx
38 mov [rcx], rbx
39 mov [rcx + 8], rsp
40 mov [rcx + 10h], rbp
41 mov [rcx + 18h], rdi
42 mov [rcx + 20h], rsi
43 mov [rcx + 28h], r12
44 mov [rcx + 30h], r13
45 mov [rcx + 38h], r14
46 mov [rcx + 40h], r15
47 mov [rcx + 48h], rdx
48 ; save non-volatile fp registers
49 stmxcsr [rcx + 50h]
50 movdqu [rcx + 58h], xmm6
51 movdqu [rcx + 68h], xmm7
52 movdqu [rcx + 78h], xmm8
53 movdqu [rcx + 88h], xmm9
54 movdqu [rcx + 98h], xmm10
55 movdqu [rcx + 0A8h], xmm11
56 movdqu [rcx + 0B8h], xmm12
57 movdqu [rcx + 0C8h], xmm13
58 movdqu [rcx + 0D8h], xmm14
59 movdqu [rcx + 0E8h], xmm15
60 xor rax, rax
61 jmp rdx
62 SetJump ENDP
63
64 END