2 * This program is used to generate definitions needed by
3 * assembly language modules.
5 * We use the technique used in the OSF Mach kernel code:
6 * generate asm statements containing #defines,
7 * compile this file to assembler, and then extract the
8 * #defines from the assembly-language output.
12 #include <linux/signal.h>
13 #include <linux/sched.h>
14 #include <linux/kernel.h>
15 #include <linux/errno.h>
16 #include <linux/string.h>
17 #include <linux/types.h>
18 #include <linux/ptrace.h>
19 #include <linux/mman.h>
23 #include <asm/pgtable.h>
24 #include <asm/processor.h>
26 #define DEFINE(sym, val) \
27 asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
32 /*DEFINE(KERNELBASE, KERNELBASE);*/
33 DEFINE(STATE
, offsetof(struct task_struct
, state
));
34 DEFINE(NEXT_TASK
, offsetof(struct task_struct
, next_task
));
35 DEFINE(COUNTER
, offsetof(struct task_struct
, counter
));
36 DEFINE(PROCESSOR
, offsetof(struct task_struct
, processor
));
37 DEFINE(SIGPENDING
, offsetof(struct task_struct
, sigpending
));
38 DEFINE(THREAD
, offsetof(struct task_struct
, thread
));
39 DEFINE(MM
, offsetof(struct task_struct
, mm
));
40 DEFINE(ACTIVE_MM
, offsetof(struct task_struct
, active_mm
));
41 DEFINE(TASK_STRUCT_SIZE
, sizeof(struct task_struct
));
42 DEFINE(KSP
, offsetof(struct thread_struct
, ksp
));
43 DEFINE(PGDIR
, offsetof(struct thread_struct
, pgdir
));
44 DEFINE(LAST_SYSCALL
, offsetof(struct thread_struct
, last_syscall
));
45 DEFINE(PT_REGS
, offsetof(struct thread_struct
, regs
));
46 DEFINE(PF_TRACESYS
, PF_TRACESYS
);
47 DEFINE(TASK_FLAGS
, offsetof(struct task_struct
, flags
));
48 DEFINE(NEED_RESCHED
, offsetof(struct task_struct
, need_resched
));
49 DEFINE(THREAD_FPR0
, offsetof(struct thread_struct
, fpr
[0]));
50 DEFINE(THREAD_FPSCR
, offsetof(struct thread_struct
, fpscr
));
51 /* Interrupt register frame */
52 DEFINE(TASK_UNION_SIZE
, sizeof(union task_union
));
53 DEFINE(STACK_FRAME_OVERHEAD
, STACK_FRAME_OVERHEAD
);
54 DEFINE(INT_FRAME_SIZE
, STACK_FRAME_OVERHEAD
+ sizeof(struct pt_regs
));
55 /* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
56 DEFINE(GPR0
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[0]));
57 DEFINE(GPR1
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[1]));
58 DEFINE(GPR2
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[2]));
59 DEFINE(GPR3
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[3]));
60 DEFINE(GPR4
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[4]));
61 DEFINE(GPR5
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[5]));
62 DEFINE(GPR6
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[6]));
63 DEFINE(GPR7
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[7]));
64 DEFINE(GPR8
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[8]));
65 DEFINE(GPR9
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[9]));
66 DEFINE(GPR10
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[10]));
67 DEFINE(GPR11
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[11]));
68 DEFINE(GPR12
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[12]));
69 DEFINE(GPR13
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[13]));
70 DEFINE(GPR14
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[14]));
71 DEFINE(GPR15
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[15]));
72 DEFINE(GPR16
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[16]));
73 DEFINE(GPR17
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[17]));
74 DEFINE(GPR18
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[18]));
75 DEFINE(GPR19
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[19]));
76 DEFINE(GPR20
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[20]));
77 DEFINE(GPR21
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[21]));
78 DEFINE(GPR22
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[22]));
79 DEFINE(GPR23
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[23]));
80 DEFINE(GPR24
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[24]));
81 DEFINE(GPR25
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[25]));
82 DEFINE(GPR26
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[26]));
83 DEFINE(GPR27
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[27]));
84 DEFINE(GPR28
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[28]));
85 DEFINE(GPR29
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[29]));
86 DEFINE(GPR30
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[30]));
87 DEFINE(GPR31
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, gpr
[31]));
88 /* Note: these symbols include _ because they overlap with special register names */
89 DEFINE(_NIP
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, nip
));
90 DEFINE(_MSR
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, msr
));
91 DEFINE(_CTR
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, ctr
));
92 DEFINE(_LINK
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, link
));
93 DEFINE(_CCR
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, ccr
));
94 DEFINE(_XER
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, xer
));
95 DEFINE(_DAR
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, dar
));
96 DEFINE(_DSISR
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, dsisr
));
97 DEFINE(ORIG_GPR3
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, orig_gpr3
));
98 DEFINE(RESULT
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, result
));
99 DEFINE(TRAP
, STACK_FRAME_OVERHEAD
+offsetof(struct pt_regs
, trap
));
100 DEFINE(CLONE_VM
, CLONE_VM
);