4 #define __FRAME_OFFSETS
5 #include <asm/ptrace.h>
7 /* For some reason, x86_64 defines u64 and u32 only in <pci/types.h>, which I
8 * refuse to include here, even though they're used throughout the headers.
9 * These are used in asm/user.h, and that include can't be avoided because of
10 * the sizeof(struct user_regs_struct) below.
16 #define DEFINE(sym, val) \
17 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
19 #define DEFINE_LONGS(sym, val) \
20 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
22 #define OFFSET(sym, str, mem) \
23 DEFINE(sym, offsetof(struct str, mem));
27 OFFSET(HOST_SC_RBX, sigcontext, rbx);
28 OFFSET(HOST_SC_RCX, sigcontext, rcx);
29 OFFSET(HOST_SC_RDX, sigcontext, rdx);
30 OFFSET(HOST_SC_RSI, sigcontext, rsi);
31 OFFSET(HOST_SC_RDI, sigcontext, rdi);
32 OFFSET(HOST_SC_RBP, sigcontext, rbp);
33 OFFSET(HOST_SC_RAX, sigcontext, rax);
34 OFFSET(HOST_SC_R8, sigcontext, r8);
35 OFFSET(HOST_SC_R9, sigcontext, r9);
36 OFFSET(HOST_SC_R10, sigcontext, r10);
37 OFFSET(HOST_SC_R11, sigcontext, r11);
38 OFFSET(HOST_SC_R12, sigcontext, r12);
39 OFFSET(HOST_SC_R13, sigcontext, r13);
40 OFFSET(HOST_SC_R14, sigcontext, r14);
41 OFFSET(HOST_SC_R15, sigcontext, r15);
42 OFFSET(HOST_SC_IP, sigcontext, rip);
43 OFFSET(HOST_SC_SP, sigcontext, rsp);
44 OFFSET(HOST_SC_CR2, sigcontext, cr2);
45 OFFSET(HOST_SC_ERR, sigcontext, err);
46 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
47 OFFSET(HOST_SC_CS, sigcontext, cs);
48 OFFSET(HOST_SC_FS, sigcontext, fs);
49 OFFSET(HOST_SC_GS, sigcontext, gs);
50 OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
51 OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
53 OFFSET(HOST_SC_ORIG_RAX, sigcontext, orig_rax);
54 OFFSET(HOST_SC_DS, sigcontext, ds);
55 OFFSET(HOST_SC_ES, sigcontext, es);
56 OFFSET(HOST_SC_SS, sigcontext, ss);
59 DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE);
60 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
61 DEFINE(HOST_XFP_SIZE, 0);
62 DEFINE_LONGS(HOST_RBX, RBX);
63 DEFINE_LONGS(HOST_RCX, RCX);
64 DEFINE_LONGS(HOST_RDI, RDI);
65 DEFINE_LONGS(HOST_RSI, RSI);
66 DEFINE_LONGS(HOST_RDX, RDX);
67 DEFINE_LONGS(HOST_RBP, RBP);
68 DEFINE_LONGS(HOST_RAX, RAX);
69 DEFINE_LONGS(HOST_R8, R8);
70 DEFINE_LONGS(HOST_R9, R9);
71 DEFINE_LONGS(HOST_R10, R10);
72 DEFINE_LONGS(HOST_R11, R11);
73 DEFINE_LONGS(HOST_R12, R12);
74 DEFINE_LONGS(HOST_R13, R13);
75 DEFINE_LONGS(HOST_R14, R14);
76 DEFINE_LONGS(HOST_R15, R15);
77 DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX);
78 DEFINE_LONGS(HOST_CS, CS);
79 DEFINE_LONGS(HOST_SS, SS);
80 DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
82 DEFINE_LONGS(HOST_FS, FS);
83 DEFINE_LONGS(HOST_GS, GS);
84 DEFINE_LONGS(HOST_DS, DS);
85 DEFINE_LONGS(HOST_ES, ES);
88 DEFINE_LONGS(HOST_IP, RIP);
89 DEFINE_LONGS(HOST_SP, RSP);
90 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));