Commit | Line | Data |
---|---|---|
6bc9a396 CL |
1 | /* |
2 | * arch/score/kernel/asm-offsets.c | |
3 | * | |
4 | * Score Processor version. | |
5 | * | |
6 | * Copyright (C) 2009 Sunplus Core Technology Co., Ltd. | |
7 | * Chen Liqin <liqin.chen@sunplusct.com> | |
8 | * Lennox Wu <lennox.wu@sunplusct.com> | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, see the file COPYING, or write | |
22 | * to the Free Software Foundation, Inc., | |
23 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
24 | */ | |
25 | ||
26 | #include <linux/kbuild.h> | |
27 | #include <linux/interrupt.h> | |
28 | #include <linux/mm.h> | |
29 | #include <linux/sched.h> | |
30 | ||
31 | #include <asm-generic/cmpxchg-local.h> | |
32 | ||
33 | void output_ptreg_defines(void) | |
34 | { | |
35 | COMMENT("SCORE pt_regs offsets."); | |
36 | OFFSET(PT_R0, pt_regs, regs[0]); | |
37 | OFFSET(PT_R1, pt_regs, regs[1]); | |
38 | OFFSET(PT_R2, pt_regs, regs[2]); | |
39 | OFFSET(PT_R3, pt_regs, regs[3]); | |
40 | OFFSET(PT_R4, pt_regs, regs[4]); | |
41 | OFFSET(PT_R5, pt_regs, regs[5]); | |
42 | OFFSET(PT_R6, pt_regs, regs[6]); | |
43 | OFFSET(PT_R7, pt_regs, regs[7]); | |
44 | OFFSET(PT_R8, pt_regs, regs[8]); | |
45 | OFFSET(PT_R9, pt_regs, regs[9]); | |
46 | OFFSET(PT_R10, pt_regs, regs[10]); | |
47 | OFFSET(PT_R11, pt_regs, regs[11]); | |
48 | OFFSET(PT_R12, pt_regs, regs[12]); | |
49 | OFFSET(PT_R13, pt_regs, regs[13]); | |
50 | OFFSET(PT_R14, pt_regs, regs[14]); | |
51 | OFFSET(PT_R15, pt_regs, regs[15]); | |
52 | OFFSET(PT_R16, pt_regs, regs[16]); | |
53 | OFFSET(PT_R17, pt_regs, regs[17]); | |
54 | OFFSET(PT_R18, pt_regs, regs[18]); | |
55 | OFFSET(PT_R19, pt_regs, regs[19]); | |
56 | OFFSET(PT_R20, pt_regs, regs[20]); | |
57 | OFFSET(PT_R21, pt_regs, regs[21]); | |
58 | OFFSET(PT_R22, pt_regs, regs[22]); | |
59 | OFFSET(PT_R23, pt_regs, regs[23]); | |
60 | OFFSET(PT_R24, pt_regs, regs[24]); | |
61 | OFFSET(PT_R25, pt_regs, regs[25]); | |
62 | OFFSET(PT_R26, pt_regs, regs[26]); | |
63 | OFFSET(PT_R27, pt_regs, regs[27]); | |
64 | OFFSET(PT_R28, pt_regs, regs[28]); | |
65 | OFFSET(PT_R29, pt_regs, regs[29]); | |
66 | OFFSET(PT_R30, pt_regs, regs[30]); | |
67 | OFFSET(PT_R31, pt_regs, regs[31]); | |
68 | ||
69 | OFFSET(PT_ORIG_R4, pt_regs, orig_r4); | |
70 | OFFSET(PT_ORIG_R7, pt_regs, orig_r7); | |
71 | OFFSET(PT_CEL, pt_regs, cel); | |
72 | OFFSET(PT_CEH, pt_regs, ceh); | |
73 | OFFSET(PT_SR0, pt_regs, sr0); | |
74 | OFFSET(PT_SR1, pt_regs, sr1); | |
75 | OFFSET(PT_SR2, pt_regs, sr2); | |
76 | OFFSET(PT_EPC, pt_regs, cp0_epc); | |
77 | OFFSET(PT_EMA, pt_regs, cp0_ema); | |
78 | OFFSET(PT_PSR, pt_regs, cp0_psr); | |
79 | OFFSET(PT_ECR, pt_regs, cp0_ecr); | |
80 | OFFSET(PT_CONDITION, pt_regs, cp0_condition); | |
81 | OFFSET(PT_IS_SYSCALL, pt_regs, is_syscall); | |
82 | ||
83 | DEFINE(PT_SIZE, sizeof(struct pt_regs)); | |
84 | BLANK(); | |
85 | } | |
86 | ||
87 | void output_task_defines(void) | |
88 | { | |
89 | COMMENT("SCORE task_struct offsets."); | |
90 | OFFSET(TASK_STATE, task_struct, state); | |
91 | OFFSET(TASK_THREAD_INFO, task_struct, stack); | |
92 | OFFSET(TASK_FLAGS, task_struct, flags); | |
93 | OFFSET(TASK_MM, task_struct, mm); | |
94 | OFFSET(TASK_PID, task_struct, pid); | |
95 | DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct)); | |
96 | BLANK(); | |
97 | } | |
98 | ||
99 | void output_thread_info_defines(void) | |
100 | { | |
101 | COMMENT("SCORE thread_info offsets."); | |
102 | OFFSET(TI_TASK, thread_info, task); | |
6bc9a396 CL |
103 | OFFSET(TI_FLAGS, thread_info, flags); |
104 | OFFSET(TI_TP_VALUE, thread_info, tp_value); | |
105 | OFFSET(TI_CPU, thread_info, cpu); | |
106 | OFFSET(TI_PRE_COUNT, thread_info, preempt_count); | |
107 | OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit); | |
6bc9a396 CL |
108 | OFFSET(TI_REGS, thread_info, regs); |
109 | DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE); | |
110 | DEFINE(KERNEL_STACK_MASK, THREAD_MASK); | |
111 | BLANK(); | |
112 | } | |
113 | ||
114 | void output_thread_defines(void) | |
115 | { | |
116 | COMMENT("SCORE specific thread_struct offsets."); | |
117 | OFFSET(THREAD_REG0, task_struct, thread.reg0); | |
118 | OFFSET(THREAD_REG2, task_struct, thread.reg2); | |
119 | OFFSET(THREAD_REG3, task_struct, thread.reg3); | |
120 | OFFSET(THREAD_REG12, task_struct, thread.reg12); | |
121 | OFFSET(THREAD_REG13, task_struct, thread.reg13); | |
122 | OFFSET(THREAD_REG14, task_struct, thread.reg14); | |
123 | OFFSET(THREAD_REG15, task_struct, thread.reg15); | |
124 | OFFSET(THREAD_REG16, task_struct, thread.reg16); | |
125 | OFFSET(THREAD_REG17, task_struct, thread.reg17); | |
126 | OFFSET(THREAD_REG18, task_struct, thread.reg18); | |
127 | OFFSET(THREAD_REG19, task_struct, thread.reg19); | |
128 | OFFSET(THREAD_REG20, task_struct, thread.reg20); | |
129 | OFFSET(THREAD_REG21, task_struct, thread.reg21); | |
130 | OFFSET(THREAD_REG29, task_struct, thread.reg29); | |
131 | ||
132 | OFFSET(THREAD_PSR, task_struct, thread.cp0_psr); | |
133 | OFFSET(THREAD_EMA, task_struct, thread.cp0_ema); | |
134 | OFFSET(THREAD_BADUADDR, task_struct, thread.cp0_baduaddr); | |
135 | OFFSET(THREAD_ECODE, task_struct, thread.error_code); | |
136 | OFFSET(THREAD_TRAPNO, task_struct, thread.trap_no); | |
137 | BLANK(); | |
138 | } | |
139 | ||
140 | void output_mm_defines(void) | |
141 | { | |
142 | COMMENT("Size of struct page"); | |
143 | DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page)); | |
144 | BLANK(); | |
145 | COMMENT("Linux mm_struct offsets."); | |
146 | OFFSET(MM_USERS, mm_struct, mm_users); | |
147 | OFFSET(MM_PGD, mm_struct, pgd); | |
148 | OFFSET(MM_CONTEXT, mm_struct, context); | |
149 | BLANK(); | |
150 | DEFINE(_PAGE_SIZE, PAGE_SIZE); | |
151 | DEFINE(_PAGE_SHIFT, PAGE_SHIFT); | |
152 | BLANK(); | |
153 | DEFINE(_PGD_T_SIZE, sizeof(pgd_t)); | |
154 | DEFINE(_PTE_T_SIZE, sizeof(pte_t)); | |
155 | BLANK(); | |
156 | DEFINE(_PGD_ORDER, PGD_ORDER); | |
157 | DEFINE(_PTE_ORDER, PTE_ORDER); | |
158 | BLANK(); | |
159 | DEFINE(_PGDIR_SHIFT, PGDIR_SHIFT); | |
160 | BLANK(); | |
161 | DEFINE(_PTRS_PER_PGD, PTRS_PER_PGD); | |
162 | DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE); | |
163 | BLANK(); | |
164 | } | |
165 | ||
166 | void output_sc_defines(void) | |
167 | { | |
168 | COMMENT("Linux sigcontext offsets."); | |
169 | OFFSET(SC_REGS, sigcontext, sc_regs); | |
170 | OFFSET(SC_MDCEH, sigcontext, sc_mdceh); | |
171 | OFFSET(SC_MDCEL, sigcontext, sc_mdcel); | |
172 | OFFSET(SC_PC, sigcontext, sc_pc); | |
173 | OFFSET(SC_PSR, sigcontext, sc_psr); | |
174 | OFFSET(SC_ECR, sigcontext, sc_ecr); | |
175 | OFFSET(SC_EMA, sigcontext, sc_ema); | |
176 | BLANK(); | |
177 | } | |
178 | ||
179 | void output_signal_defined(void) | |
180 | { | |
181 | COMMENT("Linux signal numbers."); | |
182 | DEFINE(_SIGHUP, SIGHUP); | |
183 | DEFINE(_SIGINT, SIGINT); | |
184 | DEFINE(_SIGQUIT, SIGQUIT); | |
185 | DEFINE(_SIGILL, SIGILL); | |
186 | DEFINE(_SIGTRAP, SIGTRAP); | |
187 | DEFINE(_SIGIOT, SIGIOT); | |
188 | DEFINE(_SIGABRT, SIGABRT); | |
189 | DEFINE(_SIGFPE, SIGFPE); | |
190 | DEFINE(_SIGKILL, SIGKILL); | |
191 | DEFINE(_SIGBUS, SIGBUS); | |
192 | DEFINE(_SIGSEGV, SIGSEGV); | |
193 | DEFINE(_SIGSYS, SIGSYS); | |
194 | DEFINE(_SIGPIPE, SIGPIPE); | |
195 | DEFINE(_SIGALRM, SIGALRM); | |
196 | DEFINE(_SIGTERM, SIGTERM); | |
197 | DEFINE(_SIGUSR1, SIGUSR1); | |
198 | DEFINE(_SIGUSR2, SIGUSR2); | |
199 | DEFINE(_SIGCHLD, SIGCHLD); | |
200 | DEFINE(_SIGPWR, SIGPWR); | |
201 | DEFINE(_SIGWINCH, SIGWINCH); | |
202 | DEFINE(_SIGURG, SIGURG); | |
203 | DEFINE(_SIGIO, SIGIO); | |
204 | DEFINE(_SIGSTOP, SIGSTOP); | |
205 | DEFINE(_SIGTSTP, SIGTSTP); | |
206 | DEFINE(_SIGCONT, SIGCONT); | |
207 | DEFINE(_SIGTTIN, SIGTTIN); | |
208 | DEFINE(_SIGTTOU, SIGTTOU); | |
209 | DEFINE(_SIGVTALRM, SIGVTALRM); | |
210 | DEFINE(_SIGPROF, SIGPROF); | |
211 | DEFINE(_SIGXCPU, SIGXCPU); | |
212 | DEFINE(_SIGXFSZ, SIGXFSZ); | |
213 | BLANK(); | |
214 | } |