1 #include <stdio.h>
2 #include <stddef.h>
3 #include <ucontext.h>
4 #include <signal.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 ARM 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 UC ("REGSPACE", uc_regspace);
28
29 printf ("\n/* Offsets for ARM Linux \"struct sigcontext\": */\n\n");
30
31 SC ("TRAPNO", trap_no);
32 SC ("ERRORCODE", error_code);
33 SC ("OLDMASK", oldmask);
34 SC ("R0", arm_r0);
35 SC ("R1", arm_r1);
36 SC ("R2", arm_r2);
37 SC ("R3", arm_r3);
38 SC ("R4", arm_r4);
39 SC ("R5", arm_r5);
40 SC ("R6", arm_r6);
41 SC ("R7", arm_r7);
42 SC ("R8", arm_r8);
43 SC ("R9", arm_r9);
44 SC ("R10", arm_r10);
45 SC ("FP", arm_fp);
46 SC ("IP", arm_ip);
47 SC ("SP", arm_sp);
48 SC ("LR", arm_lr);
49 SC ("PC", arm_pc);
50 SC ("CPSR", arm_cpsr);
51 SC ("FAULTADDR", fault_address);
52
53 return 0;
54 }
55