• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 #include <stddef.h>
3 #include <ucontext.h>
4 #include <asm/sigcontext.h>
5 
6 #define UC(N,X) \
7   printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))
8 
9 #define SC(N,X) \
10   printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))
11 
12 int
main(void)13 main (void)
14 {
15   printf (
16 "/* Linux-specific definitions: */\n\n"
17 
18 "/* Define various structure offsets to simplify cross-compilation.  */\n\n"
19 
20 "/* Offsets for SH Linux \"ucontext_t\":  */\n\n");
21 
22   UC ("FLAGS", uc_flags);
23   UC ("LINK", uc_link);
24   UC ("STACK", uc_stack);
25   UC ("MCONTEXT", uc_mcontext);
26   UC ("SIGMASK", uc_sigmask);
27 
28   printf ("\n/* Offsets for SH Linux \"struct sigcontext\":  */\n\n");
29 
30   SC ("R0",  sc_regs[0]);
31   SC ("R1",  sc_regs[1]);
32   SC ("R2",  sc_regs[2]);
33   SC ("R3",  sc_regs[3]);
34   SC ("R4",  sc_regs[4]);
35   SC ("R5",  sc_regs[5]);
36   SC ("R6",  sc_regs[6]);
37   SC ("R7",  sc_regs[7]);
38   SC ("R8",  sc_regs[8]);
39   SC ("R9",  sc_regs[9]);
40   SC ("R10", sc_regs[10]);
41   SC ("R11", sc_regs[11]);
42   SC ("R12", sc_regs[12]);
43   SC ("R13", sc_regs[13]);
44   SC ("R14", sc_regs[14]);
45   SC ("R15", sc_regs[15]);
46 
47   SC ("PC", sc_pc);
48   SC ("PR", sc_pr);
49 
50   return 0;
51 }
52