[IPV4]: Correct rp_filter help text.
[linux-2.6/verdex.git] / arch / um / sys-x86_64 / user-offsets.c
blob0d5fd764c21fa13dd2c3d7eb323edaac387103e9
1 #include <stdio.h>
2 #include <stddef.h>
3 #include <signal.h>
4 #include <sys/poll.h>
5 #include <sys/mman.h>
6 #define __FRAME_OFFSETS
7 #include <asm/ptrace.h>
8 #include <asm/types.h>
9 /* For some reason, x86_64 defines u64 and u32 only in <pci/types.h>, which I
10 * refuse to include here, even though they're used throughout the headers.
11 * These are used in asm/user.h, and that include can't be avoided because of
12 * the sizeof(struct user_regs_struct) below.
14 typedef __u64 u64;
15 typedef __u32 u32;
16 #include <asm/user.h>
18 #define DEFINE(sym, val) \
19 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
21 #define DEFINE_LONGS(sym, val) \
22 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
24 #define OFFSET(sym, str, mem) \
25 DEFINE(sym, offsetof(struct str, mem));
27 void foo(void)
29 OFFSET(HOST_SC_RBX, sigcontext, rbx);
30 OFFSET(HOST_SC_RCX, sigcontext, rcx);
31 OFFSET(HOST_SC_RDX, sigcontext, rdx);
32 OFFSET(HOST_SC_RSI, sigcontext, rsi);
33 OFFSET(HOST_SC_RDI, sigcontext, rdi);
34 OFFSET(HOST_SC_RBP, sigcontext, rbp);
35 OFFSET(HOST_SC_RAX, sigcontext, rax);
36 OFFSET(HOST_SC_R8, sigcontext, r8);
37 OFFSET(HOST_SC_R9, sigcontext, r9);
38 OFFSET(HOST_SC_R10, sigcontext, r10);
39 OFFSET(HOST_SC_R11, sigcontext, r11);
40 OFFSET(HOST_SC_R12, sigcontext, r12);
41 OFFSET(HOST_SC_R13, sigcontext, r13);
42 OFFSET(HOST_SC_R14, sigcontext, r14);
43 OFFSET(HOST_SC_R15, sigcontext, r15);
44 OFFSET(HOST_SC_IP, sigcontext, rip);
45 OFFSET(HOST_SC_SP, sigcontext, rsp);
46 OFFSET(HOST_SC_CR2, sigcontext, cr2);
47 OFFSET(HOST_SC_ERR, sigcontext, err);
48 OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
49 OFFSET(HOST_SC_CS, sigcontext, cs);
50 OFFSET(HOST_SC_FS, sigcontext, fs);
51 OFFSET(HOST_SC_GS, sigcontext, gs);
52 OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
53 OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
54 #if 0
55 OFFSET(HOST_SC_ORIG_RAX, sigcontext, orig_rax);
56 OFFSET(HOST_SC_DS, sigcontext, ds);
57 OFFSET(HOST_SC_ES, sigcontext, es);
58 OFFSET(HOST_SC_SS, sigcontext, ss);
59 #endif
61 DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
62 DEFINE(HOST_XFP_SIZE, 0);
63 DEFINE_LONGS(HOST_RBX, RBX);
64 DEFINE_LONGS(HOST_RCX, RCX);
65 DEFINE_LONGS(HOST_RDI, RDI);
66 DEFINE_LONGS(HOST_RSI, RSI);
67 DEFINE_LONGS(HOST_RDX, RDX);
68 DEFINE_LONGS(HOST_RBP, RBP);
69 DEFINE_LONGS(HOST_RAX, RAX);
70 DEFINE_LONGS(HOST_R8, R8);
71 DEFINE_LONGS(HOST_R9, R9);
72 DEFINE_LONGS(HOST_R10, R10);
73 DEFINE_LONGS(HOST_R11, R11);
74 DEFINE_LONGS(HOST_R12, R12);
75 DEFINE_LONGS(HOST_R13, R13);
76 DEFINE_LONGS(HOST_R14, R14);
77 DEFINE_LONGS(HOST_R15, R15);
78 DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX);
79 DEFINE_LONGS(HOST_CS, CS);
80 DEFINE_LONGS(HOST_SS, SS);
81 DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
82 #if 0
83 DEFINE_LONGS(HOST_FS, FS);
84 DEFINE_LONGS(HOST_GS, GS);
85 DEFINE_LONGS(HOST_DS, DS);
86 DEFINE_LONGS(HOST_ES, ES);
87 #endif
89 DEFINE_LONGS(HOST_IP, RIP);
90 DEFINE_LONGS(HOST_SP, RSP);
91 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
93 /* XXX Duplicated between i386 and x86_64 */
94 DEFINE(UM_POLLIN, POLLIN);
95 DEFINE(UM_POLLPRI, POLLPRI);
96 DEFINE(UM_POLLOUT, POLLOUT);
98 DEFINE(UM_PROT_READ, PROT_READ);
99 DEFINE(UM_PROT_WRITE, PROT_WRITE);
100 DEFINE(UM_PROT_EXEC, PROT_EXEC);