File: gen-offsets.c

package info (click to toggle)
libunwind 1.1-3.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,540 kB
  • ctags: 5,665
  • sloc: ansic: 31,521; sh: 18,062; asm: 1,851; makefile: 866; cpp: 118
file content (68 lines) | stat: -rw-r--r-- 1,567 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <stdio.h>
#include <stddef.h>
#include <ucontext.h>
#include <asm/sigcontext.h>

#define UC(N,X) \
  printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X))

#define SC(N,X) \
  printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X))

int
main (void)
{
  printf (
"/* Linux-specific definitions: */\n\n"

"/* Define various structure offsets to simplify cross-compilation.  */\n\n"

"/* Offsets for AArch64 Linux \"ucontext_t\":  */\n\n");

  UC ("FLAGS", uc_flags);
  UC ("LINK", uc_link);
  UC ("STACK", uc_stack);
  UC ("MCONTEXT", uc_mcontext);
  UC ("SIGMASK", uc_sigmask);

  printf ("\n/* Offsets for AArch64 Linux \"struct sigcontext\":  */\n\n");

  SC ("R0",  regs[0]);
  SC ("R1",  regs[1]);
  SC ("R2",  regs[2]);
  SC ("R3",  regs[3]);
  SC ("R4",  regs[4]);
  SC ("R5",  regs[5]);
  SC ("R6",  regs[6]);
  SC ("R7",  regs[7]);
  SC ("R8",  regs[8]);
  SC ("R9",  regs[9]);
  SC ("R10", regs[10]);
  SC ("R11", regs[11]);
  SC ("R12", regs[12]);
  SC ("R13", regs[13]);
  SC ("R14", regs[14]);
  SC ("R15", regs[15]);
  SC ("R16", regs[16]);
  SC ("R17", regs[17]);
  SC ("R18", regs[18]);
  SC ("R19", regs[19]);
  SC ("R20", regs[20]);
  SC ("R21", regs[21]);
  SC ("R22", regs[22]);
  SC ("R23", regs[23]);
  SC ("R24", regs[24]);
  SC ("R25", regs[25]);
  SC ("R26", regs[26]);
  SC ("R27", regs[27]);
  SC ("R28", regs[28]);
  SC ("R29", regs[29]);
  SC ("R30", regs[30]);
  SC ("R31", regs[31]);

  SC ("PC", pc);
  SC ("SP", sp);
  SC ("Fault", fault_address);
  SC ("state", pstate);
  return 0;
}