1#------------------------------------------------------------------------------
2#
3# Copyright (c) 2006 - 2008, 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.S
15#
16# Abstract:
17#
18#   Implementation of SetJump() on x86_64
19#
20#------------------------------------------------------------------------------
21
22ASM_GLOBAL ASM_PFX(SetJump)
23ASM_PFX(SetJump):
24    push   %rcx
25    add    $0xffffffffffffffe0,%rsp
26    call   ASM_PFX(InternalAssertJumpBuffer)
27    add    $0x20,%rsp
28    pop    %rcx
29    pop    %rdx
30    mov    %rbx,(%rcx)
31    mov    %rsp,0x8(%rcx)
32    mov    %rbp,0x10(%rcx)
33    mov    %rdi,0x18(%rcx)
34    mov    %rsi,0x20(%rcx)
35    mov    %r12,0x28(%rcx)
36    mov    %r13,0x30(%rcx)
37    mov    %r14,0x38(%rcx)
38    mov    %r15,0x40(%rcx)
39    mov    %rdx,0x48(%rcx)
40    # save non-volatile fp registers
41    stmxcsr 0x50(%rcx)
42    movdqu  %xmm6, 0x58(%rcx)
43    movdqu  %xmm7, 0x68(%rcx)
44    movdqu  %xmm8, 0x78(%rcx)
45    movdqu  %xmm9, 0x88(%rcx)
46    movdqu  %xmm10, 0x98(%rcx)
47    movdqu  %xmm11, 0xA8(%rcx)
48    movdqu  %xmm12, 0xB8(%rcx)
49    movdqu  %xmm13, 0xC8(%rcx)
50    movdqu  %xmm14, 0xD8(%rcx)
51    movdqu  %xmm15, 0xE8(%rcx)
52    xor    %rax,%rax
53    jmpq   *%rdx
54