• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * generate definitions needed by assembly language modules
3  *
4  * Copyright 2004-2009 Analog Devices Inc.
5  *
6  * Licensed under the GPL-2 or later
7  */
8 
9 #include <linux/stddef.h>
10 #include <linux/sched.h>
11 #include <linux/kernel_stat.h>
12 #include <linux/ptrace.h>
13 #include <linux/hardirq.h>
14 #include <linux/irq.h>
15 #include <linux/thread_info.h>
16 #include <linux/kbuild.h>
17 #include <asm/pda.h>
18 
main(void)19 int main(void)
20 {
21 	/* offsets into the task struct */
22 	DEFINE(TASK_STATE, offsetof(struct task_struct, state));
23 	DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
24 	DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
25 	DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
26 	DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
27 	DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));
28 	DEFINE(TASK_MM, offsetof(struct task_struct, mm));
29 	DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
30 	DEFINE(TASK_SIGPENDING, offsetof(struct task_struct, pending));
31 
32 	/* offsets into the irq_cpustat_t struct */
33 	DEFINE(CPUSTAT_SOFTIRQ_PENDING,
34 	       offsetof(irq_cpustat_t, __softirq_pending));
35 
36 	/* offsets into the thread struct */
37 	DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
38 	DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
39 	DEFINE(THREAD_SR, offsetof(struct thread_struct, seqstat));
40 	DEFINE(PT_SR, offsetof(struct thread_struct, seqstat));
41 	DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0));
42 	DEFINE(THREAD_PC, offsetof(struct thread_struct, pc));
43 	DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE);
44 
45 	/* offsets into the pt_regs */
46 	DEFINE(PT_ORIG_R0, offsetof(struct pt_regs, orig_r0));
47 	DEFINE(PT_ORIG_P0, offsetof(struct pt_regs, orig_p0));
48 	DEFINE(PT_ORIG_PC, offsetof(struct pt_regs, orig_pc));
49 	DEFINE(PT_R0, offsetof(struct pt_regs, r0));
50 	DEFINE(PT_R1, offsetof(struct pt_regs, r1));
51 	DEFINE(PT_R2, offsetof(struct pt_regs, r2));
52 	DEFINE(PT_R3, offsetof(struct pt_regs, r3));
53 	DEFINE(PT_R4, offsetof(struct pt_regs, r4));
54 	DEFINE(PT_R5, offsetof(struct pt_regs, r5));
55 	DEFINE(PT_R6, offsetof(struct pt_regs, r6));
56 	DEFINE(PT_R7, offsetof(struct pt_regs, r7));
57 
58 	DEFINE(PT_P0, offsetof(struct pt_regs, p0));
59 	DEFINE(PT_P1, offsetof(struct pt_regs, p1));
60 	DEFINE(PT_P2, offsetof(struct pt_regs, p2));
61 	DEFINE(PT_P3, offsetof(struct pt_regs, p3));
62 	DEFINE(PT_P4, offsetof(struct pt_regs, p4));
63 	DEFINE(PT_P5, offsetof(struct pt_regs, p5));
64 
65 	DEFINE(PT_FP, offsetof(struct pt_regs, fp));
66 	DEFINE(PT_USP, offsetof(struct pt_regs, usp));
67 	DEFINE(PT_I0, offsetof(struct pt_regs, i0));
68 	DEFINE(PT_I1, offsetof(struct pt_regs, i1));
69 	DEFINE(PT_I2, offsetof(struct pt_regs, i2));
70 	DEFINE(PT_I3, offsetof(struct pt_regs, i3));
71 	DEFINE(PT_M0, offsetof(struct pt_regs, m0));
72 	DEFINE(PT_M1, offsetof(struct pt_regs, m1));
73 	DEFINE(PT_M2, offsetof(struct pt_regs, m2));
74 	DEFINE(PT_M3, offsetof(struct pt_regs, m3));
75 	DEFINE(PT_L0, offsetof(struct pt_regs, l0));
76 	DEFINE(PT_L1, offsetof(struct pt_regs, l1));
77 	DEFINE(PT_L2, offsetof(struct pt_regs, l2));
78 	DEFINE(PT_L3, offsetof(struct pt_regs, l3));
79 	DEFINE(PT_B0, offsetof(struct pt_regs, b0));
80 	DEFINE(PT_B1, offsetof(struct pt_regs, b1));
81 	DEFINE(PT_B2, offsetof(struct pt_regs, b2));
82 	DEFINE(PT_B3, offsetof(struct pt_regs, b3));
83 	DEFINE(PT_A0X, offsetof(struct pt_regs, a0x));
84 	DEFINE(PT_A0W, offsetof(struct pt_regs, a0w));
85 	DEFINE(PT_A1X, offsetof(struct pt_regs, a1x));
86 	DEFINE(PT_A1W, offsetof(struct pt_regs, a1w));
87 	DEFINE(PT_LC0, offsetof(struct pt_regs, lc0));
88 	DEFINE(PT_LC1, offsetof(struct pt_regs, lc1));
89 	DEFINE(PT_LT0, offsetof(struct pt_regs, lt0));
90 	DEFINE(PT_LT1, offsetof(struct pt_regs, lt1));
91 	DEFINE(PT_LB0, offsetof(struct pt_regs, lb0));
92 	DEFINE(PT_LB1, offsetof(struct pt_regs, lb1));
93 	DEFINE(PT_ASTAT, offsetof(struct pt_regs, astat));
94 	DEFINE(PT_RESERVED, offsetof(struct pt_regs, reserved));
95 	DEFINE(PT_RETS, offsetof(struct pt_regs, rets));
96 	DEFINE(PT_PC, offsetof(struct pt_regs, pc));
97 	DEFINE(PT_RETX, offsetof(struct pt_regs, retx));
98 	DEFINE(PT_RETN, offsetof(struct pt_regs, retn));
99 	DEFINE(PT_RETE, offsetof(struct pt_regs, rete));
100 	DEFINE(PT_SEQSTAT, offsetof(struct pt_regs, seqstat));
101 	DEFINE(PT_SYSCFG, offsetof(struct pt_regs, syscfg));
102 	DEFINE(PT_IPEND, offsetof(struct pt_regs, ipend));
103 	DEFINE(SIZEOF_PTREGS, sizeof(struct pt_regs));
104 	DEFINE(PT_TEXT_ADDR, sizeof(struct pt_regs));        /* Needed by gdb */
105 	DEFINE(PT_TEXT_END_ADDR, 4 + sizeof(struct pt_regs));/* Needed by gdb */
106 	DEFINE(PT_DATA_ADDR, 8 + sizeof(struct pt_regs));    /* Needed by gdb */
107 	DEFINE(PT_FDPIC_EXEC, 12 + sizeof(struct pt_regs));  /* Needed by gdb */
108 	DEFINE(PT_FDPIC_INTERP, 16 + sizeof(struct pt_regs));/* Needed by gdb */
109 
110 	/* signal defines */
111 	DEFINE(SIGSEGV, SIGSEGV);
112 	DEFINE(SIGTRAP, SIGTRAP);
113 
114 	/* PDA management (in L1 scratchpad) */
115 	DEFINE(PDA_SYSCFG, offsetof(struct blackfin_pda, syscfg));
116 #ifdef CONFIG_SMP
117 	DEFINE(PDA_IRQFLAGS, offsetof(struct blackfin_pda, imask));
118 #endif
119 	DEFINE(PDA_IPDT, offsetof(struct blackfin_pda, ipdt));
120 	DEFINE(PDA_IPDT_SWAPCOUNT, offsetof(struct blackfin_pda, ipdt_swapcount));
121 	DEFINE(PDA_DPDT, offsetof(struct blackfin_pda, dpdt));
122 	DEFINE(PDA_DPDT_SWAPCOUNT, offsetof(struct blackfin_pda, dpdt_swapcount));
123 	DEFINE(PDA_EXIPTR, offsetof(struct blackfin_pda, ex_iptr));
124 	DEFINE(PDA_EXOPTR, offsetof(struct blackfin_pda, ex_optr));
125 	DEFINE(PDA_EXBUF, offsetof(struct blackfin_pda, ex_buf));
126 	DEFINE(PDA_EXIMASK, offsetof(struct blackfin_pda, ex_imask));
127 	DEFINE(PDA_EXSTACK, offsetof(struct blackfin_pda, ex_stack));
128 	DEFINE(PDA_EXIPEND, offsetof(struct blackfin_pda, ex_ipend));
129 #ifdef ANOMALY_05000261
130 	DEFINE(PDA_LFRETX, offsetof(struct blackfin_pda, last_cplb_fault_retx));
131 #endif
132 	DEFINE(PDA_DCPLB, offsetof(struct blackfin_pda, dcplb_fault_addr));
133 	DEFINE(PDA_ICPLB, offsetof(struct blackfin_pda, icplb_fault_addr));
134 	DEFINE(PDA_RETX, offsetof(struct blackfin_pda, retx));
135 	DEFINE(PDA_SEQSTAT, offsetof(struct blackfin_pda, seqstat));
136 #ifdef CONFIG_DEBUG_DOUBLEFAULT
137 	DEFINE(PDA_DF_DCPLB, offsetof(struct blackfin_pda, dcplb_doublefault_addr));
138 	DEFINE(PDA_DF_ICPLB, offsetof(struct blackfin_pda, icplb_doublefault_addr));
139 	DEFINE(PDA_DF_SEQSTAT, offsetof(struct blackfin_pda, seqstat_doublefault));
140 	DEFINE(PDA_DF_RETX, offsetof(struct blackfin_pda, retx_doublefault));
141 #endif
142 
143 	/* PDA initial management */
144 	DEFINE(PDA_INIT_RETX, offsetof(struct blackfin_initial_pda, retx));
145 #ifdef CONFIG_DEBUG_DOUBLEFAULT
146 	DEFINE(PDA_INIT_DF_DCPLB, offsetof(struct blackfin_initial_pda, dcplb_doublefault_addr));
147 	DEFINE(PDA_INIT_DF_ICPLB, offsetof(struct blackfin_initial_pda, icplb_doublefault_addr));
148 	DEFINE(PDA_INIT_DF_SEQSTAT, offsetof(struct blackfin_initial_pda, seqstat_doublefault));
149 	DEFINE(PDA_INIT_DF_RETX, offsetof(struct blackfin_initial_pda, retx_doublefault));
150 #endif
151 
152 #ifdef CONFIG_SMP
153 	/* Inter-core lock (in L2 SRAM) */
154 	DEFINE(SIZEOF_CORELOCK, sizeof(struct corelock_slot));
155 #endif
156 
157 	return 0;
158 }
159