2 * BK Id: SCCS/s.mk_defs.c 1.24 09/02/02 12:29:57 paulus
5 * This program is used to generate definitions needed by
6 * assembly language modules.
8 * We use the technique used in the OSF Mach kernel code:
9 * generate asm statements containing #defines,
10 * compile this file to assembler, and then extract the
11 * #defines from the assembly-language output.
15 #include <linux/config.h>
16 #include <linux/signal.h>
17 #include <linux/sched.h>
18 #include <linux/kernel.h>
19 #include <linux/errno.h>
20 #include <linux/string.h>
21 #include <linux/types.h>
22 #include <linux/ptrace.h>
23 #include <linux/mman.h>
27 #include <asm/pgtable.h>
28 #include <asm/processor.h>
29 #include <asm/cputable.h>
31 #ifdef CONFIG_PPC_ISERIES
32 #include <asm/iSeries/Paca.h>
33 #include <asm/iSeries/ItLpPaca.h>
34 #include <asm/iSeries/ItLpQueue.h>
35 #include <asm/iSeries/HvLpEvent.h>
36 #endif /* CONFIG_PPC_ISERIES */
38 #define DEFINE(sym, val) \
39 asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
44 /*DEFINE(KERNELBASE, KERNELBASE);*/
45 DEFINE(STATE, offsetof(struct task_struct, state));
46 DEFINE(NEXT_TASK, offsetof(struct task_struct, next_task));
47 DEFINE(COUNTER, offsetof(struct task_struct, counter));
48 DEFINE(PROCESSOR, offsetof(struct task_struct, processor));
49 DEFINE(SIGPENDING, offsetof(struct task_struct, sigpending));
50 DEFINE(THREAD, offsetof(struct task_struct, thread));
51 DEFINE(MM, offsetof(struct task_struct, mm));
52 DEFINE(ACTIVE_MM, offsetof(struct task_struct, active_mm));
53 DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
54 DEFINE(KSP, offsetof(struct thread_struct, ksp));
55 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
56 DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
57 DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
58 DEFINE(PT_TRACESYS, PT_TRACESYS);
59 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
60 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
61 DEFINE(NEED_RESCHED, offsetof(struct task_struct, need_resched));
62 DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
63 DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0]));
64 DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr));
66 DEFINE(THREAD_VR0, offsetof(struct thread_struct, vr[0]));
67 DEFINE(THREAD_VRSAVE, offsetof(struct thread_struct, vrsave));
68 DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
69 #endif /* CONFIG_ALTIVEC */
71 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
73 /* Interrupt register frame */
74 DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
75 DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
76 DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
77 /* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
78 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0]));
79 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1]));
80 DEFINE(GPR2, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[2]));
81 DEFINE(GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[3]));
82 DEFINE(GPR4, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[4]));
83 DEFINE(GPR5, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[5]));
84 DEFINE(GPR6, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[6]));
85 DEFINE(GPR7, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[7]));
86 DEFINE(GPR8, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[8]));
87 DEFINE(GPR9, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[9]));
88 DEFINE(GPR10, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[10]));
89 DEFINE(GPR11, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[11]));
90 DEFINE(GPR12, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[12]));
91 DEFINE(GPR13, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[13]));
92 DEFINE(GPR14, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[14]));
93 DEFINE(GPR15, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[15]));
94 DEFINE(GPR16, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[16]));
95 DEFINE(GPR17, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[17]));
96 DEFINE(GPR18, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[18]));
97 DEFINE(GPR19, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[19]));
98 DEFINE(GPR20, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[20]));
99 DEFINE(GPR21, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[21]));
100 DEFINE(GPR22, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[22]));
101 DEFINE(GPR23, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[23]));
102 DEFINE(GPR24, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[24]));
103 DEFINE(GPR25, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[25]));
104 DEFINE(GPR26, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[26]));
105 DEFINE(GPR27, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[27]));
106 DEFINE(GPR28, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[28]));
107 DEFINE(GPR29, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[29]));
108 DEFINE(GPR30, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[30]));
109 DEFINE(GPR31, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[31]));
110 /* Note: these symbols include _ because they overlap with special
113 DEFINE(_NIP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, nip));
114 DEFINE(_MSR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, msr));
115 DEFINE(_CTR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ctr));
116 DEFINE(_LINK, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, link));
117 DEFINE(_CCR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ccr));
118 DEFINE(_MQ, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, mq));
119 DEFINE(_XER, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, xer));
120 DEFINE(_DAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
121 DEFINE(_DSISR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
122 /* The PowerPC 400-class processors have neither the DAR nor the DSISR
123 * SPRs. Hence, we overload them to hold the similar DEAR and ESR SPRs
124 * for such processors.
126 DEFINE(_DEAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar));
127 DEFINE(_ESR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr));
128 DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3));
129 DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result));
130 DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap));
131 DEFINE(CLONE_VM, CLONE_VM);
132 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd));
134 /* About the CPU features table */
135 DEFINE(CPU_SPEC_ENTRY_SIZE, sizeof(struct cpu_spec));
136 DEFINE(CPU_SPEC_PVR_MASK, offsetof(struct cpu_spec, pvr_mask));
137 DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
138 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
139 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
141 #ifdef CONFIG_PPC_ISERIES
142 DEFINE(PACAPROCENABLED, offsetof(struct Paca, xProcEnabled));
143 DEFINE(PACAPACAINDEX, offsetof(struct Paca, xPacaIndex));
144 DEFINE(PACAPROCSTART, offsetof(struct Paca, xProcStart));
145 DEFINE(PACAKSAVE, offsetof(struct Paca, xKsave));
146 DEFINE(PACASAVEDMSR, offsetof(struct Paca, xSavedMsr));
147 DEFINE(PACASAVEDLR, offsetof(struct Paca, xSavedLr));
148 DEFINE(PACACONTEXTOVERFLOW, offsetof(struct Paca, xContextOverflow));
149 DEFINE(PACAR21, offsetof(struct Paca, xR21));
150 DEFINE(PACAR22, offsetof(struct Paca, xR22));
151 DEFINE(PACALPQUEUE, offsetof(struct Paca, lpQueuePtr));
152 DEFINE(PACALPPACA, offsetof(struct Paca, xLpPaca));
153 DEFINE(PACA_STRUCT_SIZE, sizeof(struct Paca));
154 DEFINE(LPREGSAV, offsetof(struct Paca, xRegSav));
155 DEFINE(PACADEFAULTDECR, offsetof(struct Paca, default_decr));
156 DEFINE(LPPACAANYINT, offsetof(struct ItLpPaca, xRsvd));
157 DEFINE(LPPACASRR0, offsetof(struct ItLpPaca, xSavedSrr0));
158 DEFINE(LPPACASRR1, offsetof(struct ItLpPaca, xSavedSrr1));
159 DEFINE(LPPACADECRINT, offsetof(struct ItLpPaca, xDecrInt));
160 DEFINE(LPPACAIPIINT, offsetof(struct ItLpPaca, xIpiCnt));
161 DEFINE(LPQCUREVENTPTR, offsetof(struct ItLpQueue, xSlicCurEventPtr));
162 DEFINE(LPQOVERFLOW, offsetof(struct ItLpQueue, xPlicOverflowIntPending));
163 DEFINE(LPQINUSEWORD, offsetof(struct ItLpQueue, xInUseWord));
164 DEFINE(LPEVENTFLAGS, offsetof(struct HvLpEvent, xFlags));
165 DEFINE(CONTEXT, offsetof(struct mm_struct, context));
166 DEFINE(_SOFTE, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, mq));
167 DEFINE(PACA_EXT_INTS, offsetof(struct Paca, ext_ints));
168 #endif /* CONFIG_PPC_ISERIES */
170 DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28);