fed up with those stupid warnings
[mmotm.git] / arch / um / sys-x86_64 / user-offsets.c
blob973585414a66372e3f5e3e30f57a2842e10fed3f
1 #include <stdio.h>
2 #include <stddef.h>
3 #include <signal.h>
4 #include <sys/poll.h>
5 #include <sys/mman.h>
6 #include <sys/user.h>
7 #define __FRAME_OFFSETS
8 #include <asm/ptrace.h>
9 #include <asm/types.h>
11 #define DEFINE(sym, val) \
12 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
14 #define DEFINE_LONGS(sym, val) \
15 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
17 #define OFFSET(sym, str, mem) \
18 DEFINE(sym, offsetof(struct str, mem));
20 void foo(void)
22 OFFSET(HOST_SC_CR2, sigcontext, cr2);
23 OFFSET(HOST_SC_ERR, sigcontext, err);
24 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
26 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
27 DEFINE_LONGS(HOST_RBX, RBX);
28 DEFINE_LONGS(HOST_RCX, RCX);
29 DEFINE_LONGS(HOST_RDI, RDI);
30 DEFINE_LONGS(HOST_RSI, RSI);
31 DEFINE_LONGS(HOST_RDX, RDX);
32 DEFINE_LONGS(HOST_RBP, RBP);
33 DEFINE_LONGS(HOST_RAX, RAX);
34 DEFINE_LONGS(HOST_R8, R8);
35 DEFINE_LONGS(HOST_R9, R9);
36 DEFINE_LONGS(HOST_R10, R10);
37 DEFINE_LONGS(HOST_R11, R11);
38 DEFINE_LONGS(HOST_R12, R12);
39 DEFINE_LONGS(HOST_R13, R13);
40 DEFINE_LONGS(HOST_R14, R14);
41 DEFINE_LONGS(HOST_R15, R15);
42 DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX);
43 DEFINE_LONGS(HOST_CS, CS);
44 DEFINE_LONGS(HOST_SS, SS);
45 DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
46 #if 0
47 DEFINE_LONGS(HOST_FS, FS);
48 DEFINE_LONGS(HOST_GS, GS);
49 DEFINE_LONGS(HOST_DS, DS);
50 DEFINE_LONGS(HOST_ES, ES);
51 #endif
53 DEFINE_LONGS(HOST_IP, RIP);
54 DEFINE_LONGS(HOST_SP, RSP);
55 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
57 /* XXX Duplicated between i386 and x86_64 */
58 DEFINE(UM_POLLIN, POLLIN);
59 DEFINE(UM_POLLPRI, POLLPRI);
60 DEFINE(UM_POLLOUT, POLLOUT);
62 DEFINE(UM_PROT_READ, PROT_READ);
63 DEFINE(UM_PROT_WRITE, PROT_WRITE);
64 DEFINE(UM_PROT_EXEC, PROT_EXEC);