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 AArch64 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 AArch64 Linux \"struct sigcontext\": */\n\n");
29
30 SC ("R0", regs[0]);
31 SC ("R1", regs[1]);
32 SC ("R2", regs[2]);
33 SC ("R3", regs[3]);
34 SC ("R4", regs[4]);
35 SC ("R5", regs[5]);
36 SC ("R6", regs[6]);
37 SC ("R7", regs[7]);
38 SC ("R8", regs[8]);
39 SC ("R9", regs[9]);
40 SC ("R10", regs[10]);
41 SC ("R11", regs[11]);
42 SC ("R12", regs[12]);
43 SC ("R13", regs[13]);
44 SC ("R14", regs[14]);
45 SC ("R15", regs[15]);
46 SC ("R16", regs[16]);
47 SC ("R17", regs[17]);
48 SC ("R18", regs[18]);
49 SC ("R19", regs[19]);
50 SC ("R20", regs[20]);
51 SC ("R21", regs[21]);
52 SC ("R22", regs[22]);
53 SC ("R23", regs[23]);
54 SC ("R24", regs[24]);
55 SC ("R25", regs[25]);
56 SC ("R26", regs[26]);
57 SC ("R27", regs[27]);
58 SC ("R28", regs[28]);
59 SC ("R29", regs[29]);
60 SC ("R30", regs[30]);
61 SC ("R31", regs[31]);
62
63 SC ("PC", pc);
64 SC ("SP", sp);
65 SC ("Fault", fault_address);
66 SC ("state", pstate);
67 return 0;
68 }
69