PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/arch/um/sys-x86_64/util/mk_sc.c

https://bitbucket.org/evzijst/gittest
C | 58 lines | 50 code | 5 blank | 3 comment | 0 complexity | cefd965322d46549fea8362d09c9142c MD5 | raw file
 1/* Copyright (C) 2003 - 2004 PathScale, Inc
 2 * Released under the GPL
 3 */
 4
 5#include <stdio.h>
 6#include <signal.h>
 7#include <linux/stddef.h>
 8
 9#define SC_OFFSET(name, field) \
10  printf("#define " name \
11	 "(sc) *((unsigned long *) &(((char *) (sc))[%ld]))\n",\
12	 offsetof(struct sigcontext, field))
13
14#define SC_FP_OFFSET(name, field) \
15  printf("#define " name \
16	 "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%ld]))\n",\
17	 offsetof(struct _fpstate, field))
18
19#define SC_FP_OFFSET_PTR(name, field, type) \
20  printf("#define " name \
21	 "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
22	 offsetof(struct _fpstate, field))
23
24int main(int argc, char **argv)
25{
26  SC_OFFSET("SC_RBX", rbx);
27  SC_OFFSET("SC_RCX", rcx);
28  SC_OFFSET("SC_RDX", rdx);
29  SC_OFFSET("SC_RSI", rsi);
30  SC_OFFSET("SC_RDI", rdi);
31  SC_OFFSET("SC_RBP", rbp);
32  SC_OFFSET("SC_RAX", rax);
33  SC_OFFSET("SC_R8", r8);
34  SC_OFFSET("SC_R9", r9);
35  SC_OFFSET("SC_R10", r10);
36  SC_OFFSET("SC_R11", r11);
37  SC_OFFSET("SC_R12", r12);
38  SC_OFFSET("SC_R13", r13);
39  SC_OFFSET("SC_R14", r14);
40  SC_OFFSET("SC_R15", r15);
41  SC_OFFSET("SC_IP", rip);
42  SC_OFFSET("SC_SP", rsp);
43  SC_OFFSET("SC_CR2", cr2);
44  SC_OFFSET("SC_ERR", err);
45  SC_OFFSET("SC_TRAPNO", trapno);
46  SC_OFFSET("SC_CS", cs);
47  SC_OFFSET("SC_FS", fs);
48  SC_OFFSET("SC_GS", gs);
49  SC_OFFSET("SC_EFLAGS", eflags);
50  SC_OFFSET("SC_SIGMASK", oldmask);
51#if 0
52  SC_OFFSET("SC_ORIG_RAX", orig_rax);
53  SC_OFFSET("SC_DS", ds);
54  SC_OFFSET("SC_ES", es);
55  SC_OFFSET("SC_SS", ss);
56#endif
57  return(0);
58}