2 * Copyright (c) 2007,2009 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #if defined(__x86_64__)
26 #include <architecture/i386/asm_help.h>
28 #define MCONTEXT_SS_RAX 16
29 #define MCONTEXT_SS_RBX 24
30 #define MCONTEXT_SS_RCX 32
31 #define MCONTEXT_SS_RDX 40
32 #define MCONTEXT_SS_RDI 48
33 #define MCONTEXT_SS_RSI 56
34 #define MCONTEXT_SS_RBP 64
35 #define MCONTEXT_SS_RSP 72
36 #define MCONTEXT_SS_R8 80
37 #define MCONTEXT_SS_RIP 144
38 #define MCONTEXT_SS_RFLAGS 152
42 /* struct ucontext_t * $rdi */
46 CALL_EXTERN(_getmcontext) /* getmcontext(uctx, sp) */
50 movq $0, MCONTEXT_SS_RAX(%rax)
51 movq $0, MCONTEXT_SS_RDX(%rax)
52 movq $0, MCONTEXT_SS_RCX(%rax)
53 movq $0, MCONTEXT_SS_RDI(%rax)
54 movq $0, MCONTEXT_SS_RSI(%rax)
55 movq $0, MCONTEXT_SS_R8(%rax)
56 movq $0, MCONTEXT_SS_R8+8(%rax)
57 movq $0, MCONTEXT_SS_R8+16(%rax)
58 movq $0, MCONTEXT_SS_R8+24(%rax)
59 movq $0, MCONTEXT_SS_RFLAGS(%rax)
62 movq %rbp, MCONTEXT_SS_RBP(%rax)
63 movq %rbx, MCONTEXT_SS_RBX(%rax)
64 movq %r12, MCONTEXT_SS_R8+32(%rax)
65 movq %r13, MCONTEXT_SS_R8+40(%rax)
66 movq %r14, MCONTEXT_SS_R8+48(%rax)
67 movq %r15, MCONTEXT_SS_R8+56(%rax)
68 movq (%rsp), %rcx /* return address */
69 movq %rcx, MCONTEXT_SS_RIP(%rax)
71 movq %rcx, MCONTEXT_SS_RSP(%rax)
75 #endif /* __x86_64__ */