diff options
Diffstat (limited to 'arch/um/sys-i386/util/mk_sc.c')
-rw-r--r-- | arch/um/sys-i386/util/mk_sc.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/um/sys-i386/util/mk_sc.c b/arch/um/sys-i386/util/mk_sc.c new file mode 100644 index 000000000000..85cbd30396f7 --- /dev/null +++ b/arch/um/sys-i386/util/mk_sc.c | |||
@@ -0,0 +1,52 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <signal.h> | ||
3 | #include <linux/stddef.h> | ||
4 | |||
5 | #define SC_OFFSET(name, field) \ | ||
6 | printf("#define " name "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\ | ||
7 | offsetof(struct sigcontext, field)) | ||
8 | |||
9 | #define SC_FP_OFFSET(name, field) \ | ||
10 | printf("#define " name \ | ||
11 | "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ | ||
12 | offsetof(struct _fpstate, field)) | ||
13 | |||
14 | #define SC_FP_OFFSET_PTR(name, field, type) \ | ||
15 | printf("#define " name \ | ||
16 | "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ | ||
17 | offsetof(struct _fpstate, field)) | ||
18 | |||
19 | int main(int argc, char **argv) | ||
20 | { | ||
21 | SC_OFFSET("SC_IP", eip); | ||
22 | SC_OFFSET("SC_SP", esp); | ||
23 | SC_OFFSET("SC_FS", fs); | ||
24 | SC_OFFSET("SC_GS", gs); | ||
25 | SC_OFFSET("SC_DS", ds); | ||
26 | SC_OFFSET("SC_ES", es); | ||
27 | SC_OFFSET("SC_SS", ss); | ||
28 | SC_OFFSET("SC_CS", cs); | ||
29 | SC_OFFSET("SC_EFLAGS", eflags); | ||
30 | SC_OFFSET("SC_EAX", eax); | ||
31 | SC_OFFSET("SC_EBX", ebx); | ||
32 | SC_OFFSET("SC_ECX", ecx); | ||
33 | SC_OFFSET("SC_EDX", edx); | ||
34 | SC_OFFSET("SC_EDI", edi); | ||
35 | SC_OFFSET("SC_ESI", esi); | ||
36 | SC_OFFSET("SC_EBP", ebp); | ||
37 | SC_OFFSET("SC_TRAPNO", trapno); | ||
38 | SC_OFFSET("SC_ERR", err); | ||
39 | SC_OFFSET("SC_CR2", cr2); | ||
40 | SC_OFFSET("SC_FPSTATE", fpstate); | ||
41 | SC_OFFSET("SC_SIGMASK", oldmask); | ||
42 | SC_FP_OFFSET("SC_FP_CW", cw); | ||
43 | SC_FP_OFFSET("SC_FP_SW", sw); | ||
44 | SC_FP_OFFSET("SC_FP_TAG", tag); | ||
45 | SC_FP_OFFSET("SC_FP_IPOFF", ipoff); | ||
46 | SC_FP_OFFSET("SC_FP_CSSEL", cssel); | ||
47 | SC_FP_OFFSET("SC_FP_DATAOFF", dataoff); | ||
48 | SC_FP_OFFSET("SC_FP_DATASEL", datasel); | ||
49 | SC_FP_OFFSET_PTR("SC_FP_ST", _st, "struct _fpstate"); | ||
50 | SC_FP_OFFSET_PTR("SC_FXSR_ENV", _fxsr_env, "void"); | ||
51 | return(0); | ||
52 | } | ||