aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-x86_64/user-offsets.c
diff options
context:
space:
mode:
authorAl Viro <viro@parcelfarce.linux.theplanet.co.uk>2005-05-05 19:15:23 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 19:36:34 -0400
commit8d0b9dc9be3919e9979eac59fd12e8f82b098325 (patch)
tree190a2421938f7bb94b5ab830b0513ef435bbcab1 /arch/um/sys-x86_64/user-offsets.c
parentfcddd72e3e2565f8b838ae71a3e716a67f616160 (diff)
[PATCH] uml: start cross-build support : mk_user_constants
Beginning of cross-build fixes. Instead of expecting that mk_user_constants (compiled and executed on the build box) will see the sizeof, etc. for target box, we do what every architecture already does for asm-offsets. Namely, have user-offsets.c compiled *for* *target* into user-offsets.s and sed it into the header with relevant constants. We don't need to reinvent any wheels - all tools are already there. This patch deals with mk_user_constants. It doesn't assume any relationship between target and build environment anymore - we pick all defines we need from user-offsets.h. Later patches will deal with the rest of mk_... helpers in the same way. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/sys-x86_64/user-offsets.c')
-rw-r--r--arch/um/sys-x86_64/user-offsets.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
new file mode 100644
index 000000000000..5e14792e4838
--- /dev/null
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -0,0 +1,78 @@
1#include <stdio.h>
2#include <stddef.h>
3#include <signal.h>
4#define __FRAME_OFFSETS
5#include <asm/ptrace.h>
6#include <asm/user.h>
7
8#define DEFINE(sym, val) \
9 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
10
11#define OFFSET(sym, str, mem) \
12 DEFINE(sym, offsetof(struct str, mem));
13
14void foo(void)
15{
16 OFFSET(SC_RBX, sigcontext, rbx);
17 OFFSET(SC_RCX, sigcontext, rcx);
18 OFFSET(SC_RDX, sigcontext, rdx);
19 OFFSET(SC_RSI, sigcontext, rsi);
20 OFFSET(SC_RDI, sigcontext, rdi);
21 OFFSET(SC_RBP, sigcontext, rbp);
22 OFFSET(SC_RAX, sigcontext, rax);
23 OFFSET(SC_R8, sigcontext, r8);
24 OFFSET(SC_R9, sigcontext, r9);
25 OFFSET(SC_R10, sigcontext, r10);
26 OFFSET(SC_R11, sigcontext, r11);
27 OFFSET(SC_R12, sigcontext, r12);
28 OFFSET(SC_R13, sigcontext, r13);
29 OFFSET(SC_R14, sigcontext, r14);
30 OFFSET(SC_R15, sigcontext, r15);
31 OFFSET(SC_IP, sigcontext, rip);
32 OFFSET(SC_SP, sigcontext, rsp);
33 OFFSET(SC_CR2, sigcontext, cr2);
34 OFFSET(SC_ERR, sigcontext, err);
35 OFFSET(SC_TRAPNO, sigcontext, trapno);
36 OFFSET(SC_CS, sigcontext, cs);
37 OFFSET(SC_FS, sigcontext, fs);
38 OFFSET(SC_GS, sigcontext, gs);
39 OFFSET(SC_EFLAGS, sigcontext, eflags);
40 OFFSET(SC_SIGMASK, sigcontext, oldmask);
41#if 0
42 OFFSET(SC_ORIG_RAX, sigcontext, orig_rax);
43 OFFSET(SC_DS, sigcontext, ds);
44 OFFSET(SC_ES, sigcontext, es);
45 OFFSET(SC_SS, sigcontext, ss);
46#endif
47
48 DEFINE(HOST_FRAME_SIZE, FRAME_SIZE);
49 DEFINE(HOST_RBX, RBX);
50 DEFINE(HOST_RCX, RCX);
51 DEFINE(HOST_RDI, RDI);
52 DEFINE(HOST_RSI, RSI);
53 DEFINE(HOST_RDX, RDX);
54 DEFINE(HOST_RBP, RBP);
55 DEFINE(HOST_RAX, RAX);
56 DEFINE(HOST_R8, R8);
57 DEFINE(HOST_R9, R9);
58 DEFINE(HOST_R10, R10);
59 DEFINE(HOST_R11, R11);
60 DEFINE(HOST_R12, R12);
61 DEFINE(HOST_R13, R13);
62 DEFINE(HOST_R14, R14);
63 DEFINE(HOST_R15, R15);
64 DEFINE(HOST_ORIG_RAX, ORIG_RAX);
65 DEFINE(HOST_CS, CS);
66 DEFINE(HOST_SS, SS);
67 DEFINE(HOST_EFLAGS, EFLAGS);
68#if 0
69 DEFINE(HOST_FS, FS);
70 DEFINE(HOST_GS, GS);
71 DEFINE(HOST_DS, DS);
72 DEFINE(HOST_ES, ES);
73#endif
74
75 DEFINE(HOST_IP, RIP);
76 DEFINE(HOST_SP, RSP);
77 DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct));
78}