diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-07-23 21:41:43 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-08-05 08:26:21 -0400 |
commit | 22b0763a2328434ac68cca884e1b7d350ca61332 (patch) | |
tree | 59635ba7ba3368d40defdebc07c94d61d5941491 /arch/mips | |
parent | 5b97c3f7ae0ad0eea1eb90d649420a1a180f2bdf (diff) |
MIPS: uasm: Add option to export uasm API.
A 'select EXPORT_UASM' in Kconfig will cause the uasm to be exported
for use in modules. When it is exported, all the uasm data and code
cease to be __init and __initdata.
Also daddiu_bug cannot be __cpuinitdata if uasm is exported. The
cleanest thing is to just make it normal data.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: wim@iguana.be
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/1500/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/Kconfig | 3 | ||||
-rw-r--r-- | arch/mips/include/asm/uasm.h | 37 | ||||
-rw-r--r-- | arch/mips/kernel/cpu-bugs64.c | 2 | ||||
-rw-r--r-- | arch/mips/mm/uasm.c | 131 |
4 files changed, 110 insertions, 63 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 295e8c55fb3a..aaca439010df 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -915,6 +915,9 @@ config CPU_LITTLE_ENDIAN | |||
915 | 915 | ||
916 | endchoice | 916 | endchoice |
917 | 917 | ||
918 | config EXPORT_UASM | ||
919 | bool | ||
920 | |||
918 | config SYS_SUPPORTS_APM_EMULATION | 921 | config SYS_SUPPORTS_APM_EMULATION |
919 | bool | 922 | bool |
920 | 923 | ||
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index db9d449b51e5..892062d6d748 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
@@ -10,44 +10,55 @@ | |||
10 | 10 | ||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | 12 | ||
13 | #ifdef CONFIG_EXPORT_UASM | ||
14 | #include <linux/module.h> | ||
15 | #define __uasminit | ||
16 | #define __uasminitdata | ||
17 | #define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym) | ||
18 | #else | ||
19 | #define __uasminit __cpuinit | ||
20 | #define __uasminitdata __cpuinitdata | ||
21 | #define UASM_EXPORT_SYMBOL(sym) | ||
22 | #endif | ||
23 | |||
13 | #define Ip_u1u2u3(op) \ | 24 | #define Ip_u1u2u3(op) \ |
14 | void __cpuinit \ | 25 | void __uasminit \ |
15 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 26 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
16 | 27 | ||
17 | #define Ip_u2u1u3(op) \ | 28 | #define Ip_u2u1u3(op) \ |
18 | void __cpuinit \ | 29 | void __uasminit \ |
19 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 30 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
20 | 31 | ||
21 | #define Ip_u3u1u2(op) \ | 32 | #define Ip_u3u1u2(op) \ |
22 | void __cpuinit \ | 33 | void __uasminit \ |
23 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 34 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
24 | 35 | ||
25 | #define Ip_u1u2s3(op) \ | 36 | #define Ip_u1u2s3(op) \ |
26 | void __cpuinit \ | 37 | void __uasminit \ |
27 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) | 38 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) |
28 | 39 | ||
29 | #define Ip_u2s3u1(op) \ | 40 | #define Ip_u2s3u1(op) \ |
30 | void __cpuinit \ | 41 | void __uasminit \ |
31 | uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c) | 42 | uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c) |
32 | 43 | ||
33 | #define Ip_u2u1s3(op) \ | 44 | #define Ip_u2u1s3(op) \ |
34 | void __cpuinit \ | 45 | void __uasminit \ |
35 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) | 46 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) |
36 | 47 | ||
37 | #define Ip_u2u1msbu3(op) \ | 48 | #define Ip_u2u1msbu3(op) \ |
38 | void __cpuinit \ | 49 | void __uasminit \ |
39 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ | 50 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ |
40 | unsigned int d) | 51 | unsigned int d) |
41 | 52 | ||
42 | #define Ip_u1u2(op) \ | 53 | #define Ip_u1u2(op) \ |
43 | void __cpuinit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) | 54 | void __uasminit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) |
44 | 55 | ||
45 | #define Ip_u1s2(op) \ | 56 | #define Ip_u1s2(op) \ |
46 | void __cpuinit uasm_i##op(u32 **buf, unsigned int a, signed int b) | 57 | void __uasminit uasm_i##op(u32 **buf, unsigned int a, signed int b) |
47 | 58 | ||
48 | #define Ip_u1(op) void __cpuinit uasm_i##op(u32 **buf, unsigned int a) | 59 | #define Ip_u1(op) void __uasminit uasm_i##op(u32 **buf, unsigned int a) |
49 | 60 | ||
50 | #define Ip_0(op) void __cpuinit uasm_i##op(u32 **buf) | 61 | #define Ip_0(op) void __uasminit uasm_i##op(u32 **buf) |
51 | 62 | ||
52 | Ip_u2u1s3(_addiu); | 63 | Ip_u2u1s3(_addiu); |
53 | Ip_u3u1u2(_addu); | 64 | Ip_u3u1u2(_addu); |
@@ -112,7 +123,7 @@ struct uasm_label { | |||
112 | int lab; | 123 | int lab; |
113 | }; | 124 | }; |
114 | 125 | ||
115 | void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid); | 126 | void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid); |
116 | #ifdef CONFIG_64BIT | 127 | #ifdef CONFIG_64BIT |
117 | int uasm_in_compat_space_p(long addr); | 128 | int uasm_in_compat_space_p(long addr); |
118 | #endif | 129 | #endif |
@@ -122,7 +133,7 @@ void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr); | |||
122 | void UASM_i_LA(u32 **buf, unsigned int rs, long addr); | 133 | void UASM_i_LA(u32 **buf, unsigned int rs, long addr); |
123 | 134 | ||
124 | #define UASM_L_LA(lb) \ | 135 | #define UASM_L_LA(lb) \ |
125 | static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ | 136 | static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ |
126 | { \ | 137 | { \ |
127 | uasm_build_label(lab, addr, label##lb); \ | 138 | uasm_build_label(lab, addr, label##lb); \ |
128 | } | 139 | } |
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c index 408d0a07b3a3..b8bb8ba60869 100644 --- a/arch/mips/kernel/cpu-bugs64.c +++ b/arch/mips/kernel/cpu-bugs64.c | |||
@@ -239,7 +239,7 @@ static inline void check_daddi(void) | |||
239 | panic(bug64hit, !DADDI_WAR ? daddiwar : nowar); | 239 | panic(bug64hit, !DADDI_WAR ? daddiwar : nowar); |
240 | } | 240 | } |
241 | 241 | ||
242 | int daddiu_bug __cpuinitdata = -1; | 242 | int daddiu_bug = -1; |
243 | 243 | ||
244 | static inline void check_daddiu(void) | 244 | static inline void check_daddiu(void) |
245 | { | 245 | { |
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c index 636b817d3905..d2647a4e012b 100644 --- a/arch/mips/mm/uasm.c +++ b/arch/mips/mm/uasm.c | |||
@@ -86,7 +86,7 @@ struct insn { | |||
86 | | (e) << RE_SH \ | 86 | | (e) << RE_SH \ |
87 | | (f) << FUNC_SH) | 87 | | (f) << FUNC_SH) |
88 | 88 | ||
89 | static struct insn insn_table[] __cpuinitdata = { | 89 | static struct insn insn_table[] __uasminitdata = { |
90 | { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, | 90 | { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, |
91 | { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, | 91 | { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, |
92 | { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, | 92 | { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, |
@@ -150,7 +150,7 @@ static struct insn insn_table[] __cpuinitdata = { | |||
150 | 150 | ||
151 | #undef M | 151 | #undef M |
152 | 152 | ||
153 | static inline __cpuinit u32 build_rs(u32 arg) | 153 | static inline __uasminit u32 build_rs(u32 arg) |
154 | { | 154 | { |
155 | if (arg & ~RS_MASK) | 155 | if (arg & ~RS_MASK) |
156 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 156 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -158,7 +158,7 @@ static inline __cpuinit u32 build_rs(u32 arg) | |||
158 | return (arg & RS_MASK) << RS_SH; | 158 | return (arg & RS_MASK) << RS_SH; |
159 | } | 159 | } |
160 | 160 | ||
161 | static inline __cpuinit u32 build_rt(u32 arg) | 161 | static inline __uasminit u32 build_rt(u32 arg) |
162 | { | 162 | { |
163 | if (arg & ~RT_MASK) | 163 | if (arg & ~RT_MASK) |
164 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 164 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -166,7 +166,7 @@ static inline __cpuinit u32 build_rt(u32 arg) | |||
166 | return (arg & RT_MASK) << RT_SH; | 166 | return (arg & RT_MASK) << RT_SH; |
167 | } | 167 | } |
168 | 168 | ||
169 | static inline __cpuinit u32 build_rd(u32 arg) | 169 | static inline __uasminit u32 build_rd(u32 arg) |
170 | { | 170 | { |
171 | if (arg & ~RD_MASK) | 171 | if (arg & ~RD_MASK) |
172 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 172 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -174,7 +174,7 @@ static inline __cpuinit u32 build_rd(u32 arg) | |||
174 | return (arg & RD_MASK) << RD_SH; | 174 | return (arg & RD_MASK) << RD_SH; |
175 | } | 175 | } |
176 | 176 | ||
177 | static inline __cpuinit u32 build_re(u32 arg) | 177 | static inline __uasminit u32 build_re(u32 arg) |
178 | { | 178 | { |
179 | if (arg & ~RE_MASK) | 179 | if (arg & ~RE_MASK) |
180 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 180 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -182,7 +182,7 @@ static inline __cpuinit u32 build_re(u32 arg) | |||
182 | return (arg & RE_MASK) << RE_SH; | 182 | return (arg & RE_MASK) << RE_SH; |
183 | } | 183 | } |
184 | 184 | ||
185 | static inline __cpuinit u32 build_simm(s32 arg) | 185 | static inline __uasminit u32 build_simm(s32 arg) |
186 | { | 186 | { |
187 | if (arg > 0x7fff || arg < -0x8000) | 187 | if (arg > 0x7fff || arg < -0x8000) |
188 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 188 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -190,7 +190,7 @@ static inline __cpuinit u32 build_simm(s32 arg) | |||
190 | return arg & 0xffff; | 190 | return arg & 0xffff; |
191 | } | 191 | } |
192 | 192 | ||
193 | static inline __cpuinit u32 build_uimm(u32 arg) | 193 | static inline __uasminit u32 build_uimm(u32 arg) |
194 | { | 194 | { |
195 | if (arg & ~IMM_MASK) | 195 | if (arg & ~IMM_MASK) |
196 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 196 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -198,7 +198,7 @@ static inline __cpuinit u32 build_uimm(u32 arg) | |||
198 | return arg & IMM_MASK; | 198 | return arg & IMM_MASK; |
199 | } | 199 | } |
200 | 200 | ||
201 | static inline __cpuinit u32 build_bimm(s32 arg) | 201 | static inline __uasminit u32 build_bimm(s32 arg) |
202 | { | 202 | { |
203 | if (arg > 0x1ffff || arg < -0x20000) | 203 | if (arg > 0x1ffff || arg < -0x20000) |
204 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 204 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -209,7 +209,7 @@ static inline __cpuinit u32 build_bimm(s32 arg) | |||
209 | return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); | 209 | return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); |
210 | } | 210 | } |
211 | 211 | ||
212 | static inline __cpuinit u32 build_jimm(u32 arg) | 212 | static inline __uasminit u32 build_jimm(u32 arg) |
213 | { | 213 | { |
214 | if (arg & ~((JIMM_MASK) << 2)) | 214 | if (arg & ~((JIMM_MASK) << 2)) |
215 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 215 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -217,7 +217,7 @@ static inline __cpuinit u32 build_jimm(u32 arg) | |||
217 | return (arg >> 2) & JIMM_MASK; | 217 | return (arg >> 2) & JIMM_MASK; |
218 | } | 218 | } |
219 | 219 | ||
220 | static inline __cpuinit u32 build_scimm(u32 arg) | 220 | static inline __uasminit u32 build_scimm(u32 arg) |
221 | { | 221 | { |
222 | if (arg & ~SCIMM_MASK) | 222 | if (arg & ~SCIMM_MASK) |
223 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 223 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -225,7 +225,7 @@ static inline __cpuinit u32 build_scimm(u32 arg) | |||
225 | return (arg & SCIMM_MASK) << SCIMM_SH; | 225 | return (arg & SCIMM_MASK) << SCIMM_SH; |
226 | } | 226 | } |
227 | 227 | ||
228 | static inline __cpuinit u32 build_func(u32 arg) | 228 | static inline __uasminit u32 build_func(u32 arg) |
229 | { | 229 | { |
230 | if (arg & ~FUNC_MASK) | 230 | if (arg & ~FUNC_MASK) |
231 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 231 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -233,7 +233,7 @@ static inline __cpuinit u32 build_func(u32 arg) | |||
233 | return arg & FUNC_MASK; | 233 | return arg & FUNC_MASK; |
234 | } | 234 | } |
235 | 235 | ||
236 | static inline __cpuinit u32 build_set(u32 arg) | 236 | static inline __uasminit u32 build_set(u32 arg) |
237 | { | 237 | { |
238 | if (arg & ~SET_MASK) | 238 | if (arg & ~SET_MASK) |
239 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 239 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -245,7 +245,7 @@ static inline __cpuinit u32 build_set(u32 arg) | |||
245 | * The order of opcode arguments is implicitly left to right, | 245 | * The order of opcode arguments is implicitly left to right, |
246 | * starting with RS and ending with FUNC or IMM. | 246 | * starting with RS and ending with FUNC or IMM. |
247 | */ | 247 | */ |
248 | static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...) | 248 | static void __uasminit build_insn(u32 **buf, enum opcode opc, ...) |
249 | { | 249 | { |
250 | struct insn *ip = NULL; | 250 | struct insn *ip = NULL; |
251 | unsigned int i; | 251 | unsigned int i; |
@@ -295,67 +295,78 @@ static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...) | |||
295 | Ip_u1u2u3(op) \ | 295 | Ip_u1u2u3(op) \ |
296 | { \ | 296 | { \ |
297 | build_insn(buf, insn##op, a, b, c); \ | 297 | build_insn(buf, insn##op, a, b, c); \ |
298 | } | 298 | } \ |
299 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
299 | 300 | ||
300 | #define I_u2u1u3(op) \ | 301 | #define I_u2u1u3(op) \ |
301 | Ip_u2u1u3(op) \ | 302 | Ip_u2u1u3(op) \ |
302 | { \ | 303 | { \ |
303 | build_insn(buf, insn##op, b, a, c); \ | 304 | build_insn(buf, insn##op, b, a, c); \ |
304 | } | 305 | } \ |
306 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
305 | 307 | ||
306 | #define I_u3u1u2(op) \ | 308 | #define I_u3u1u2(op) \ |
307 | Ip_u3u1u2(op) \ | 309 | Ip_u3u1u2(op) \ |
308 | { \ | 310 | { \ |
309 | build_insn(buf, insn##op, b, c, a); \ | 311 | build_insn(buf, insn##op, b, c, a); \ |
310 | } | 312 | } \ |
313 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
311 | 314 | ||
312 | #define I_u1u2s3(op) \ | 315 | #define I_u1u2s3(op) \ |
313 | Ip_u1u2s3(op) \ | 316 | Ip_u1u2s3(op) \ |
314 | { \ | 317 | { \ |
315 | build_insn(buf, insn##op, a, b, c); \ | 318 | build_insn(buf, insn##op, a, b, c); \ |
316 | } | 319 | } \ |
320 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
317 | 321 | ||
318 | #define I_u2s3u1(op) \ | 322 | #define I_u2s3u1(op) \ |
319 | Ip_u2s3u1(op) \ | 323 | Ip_u2s3u1(op) \ |
320 | { \ | 324 | { \ |
321 | build_insn(buf, insn##op, c, a, b); \ | 325 | build_insn(buf, insn##op, c, a, b); \ |
322 | } | 326 | } \ |
327 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
323 | 328 | ||
324 | #define I_u2u1s3(op) \ | 329 | #define I_u2u1s3(op) \ |
325 | Ip_u2u1s3(op) \ | 330 | Ip_u2u1s3(op) \ |
326 | { \ | 331 | { \ |
327 | build_insn(buf, insn##op, b, a, c); \ | 332 | build_insn(buf, insn##op, b, a, c); \ |
328 | } | 333 | } \ |
334 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
329 | 335 | ||
330 | #define I_u2u1msbu3(op) \ | 336 | #define I_u2u1msbu3(op) \ |
331 | Ip_u2u1msbu3(op) \ | 337 | Ip_u2u1msbu3(op) \ |
332 | { \ | 338 | { \ |
333 | build_insn(buf, insn##op, b, a, c+d-1, c); \ | 339 | build_insn(buf, insn##op, b, a, c+d-1, c); \ |
334 | } | 340 | } \ |
341 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
335 | 342 | ||
336 | #define I_u1u2(op) \ | 343 | #define I_u1u2(op) \ |
337 | Ip_u1u2(op) \ | 344 | Ip_u1u2(op) \ |
338 | { \ | 345 | { \ |
339 | build_insn(buf, insn##op, a, b); \ | 346 | build_insn(buf, insn##op, a, b); \ |
340 | } | 347 | } \ |
348 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
341 | 349 | ||
342 | #define I_u1s2(op) \ | 350 | #define I_u1s2(op) \ |
343 | Ip_u1s2(op) \ | 351 | Ip_u1s2(op) \ |
344 | { \ | 352 | { \ |
345 | build_insn(buf, insn##op, a, b); \ | 353 | build_insn(buf, insn##op, a, b); \ |
346 | } | 354 | } \ |
355 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
347 | 356 | ||
348 | #define I_u1(op) \ | 357 | #define I_u1(op) \ |
349 | Ip_u1(op) \ | 358 | Ip_u1(op) \ |
350 | { \ | 359 | { \ |
351 | build_insn(buf, insn##op, a); \ | 360 | build_insn(buf, insn##op, a); \ |
352 | } | 361 | } \ |
362 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
353 | 363 | ||
354 | #define I_0(op) \ | 364 | #define I_0(op) \ |
355 | Ip_0(op) \ | 365 | Ip_0(op) \ |
356 | { \ | 366 | { \ |
357 | build_insn(buf, insn##op); \ | 367 | build_insn(buf, insn##op); \ |
358 | } | 368 | } \ |
369 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
359 | 370 | ||
360 | I_u2u1s3(_addiu) | 371 | I_u2u1s3(_addiu) |
361 | I_u3u1u2(_addu) | 372 | I_u3u1u2(_addu) |
@@ -417,14 +428,15 @@ I_u1u2s3(_bbit0); | |||
417 | I_u1u2s3(_bbit1); | 428 | I_u1u2s3(_bbit1); |
418 | 429 | ||
419 | /* Handle labels. */ | 430 | /* Handle labels. */ |
420 | void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) | 431 | void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) |
421 | { | 432 | { |
422 | (*lab)->addr = addr; | 433 | (*lab)->addr = addr; |
423 | (*lab)->lab = lid; | 434 | (*lab)->lab = lid; |
424 | (*lab)++; | 435 | (*lab)++; |
425 | } | 436 | } |
437 | UASM_EXPORT_SYMBOL(uasm_build_label); | ||
426 | 438 | ||
427 | int __cpuinit uasm_in_compat_space_p(long addr) | 439 | int __uasminit uasm_in_compat_space_p(long addr) |
428 | { | 440 | { |
429 | /* Is this address in 32bit compat space? */ | 441 | /* Is this address in 32bit compat space? */ |
430 | #ifdef CONFIG_64BIT | 442 | #ifdef CONFIG_64BIT |
@@ -433,8 +445,9 @@ int __cpuinit uasm_in_compat_space_p(long addr) | |||
433 | return 1; | 445 | return 1; |
434 | #endif | 446 | #endif |
435 | } | 447 | } |
448 | UASM_EXPORT_SYMBOL(uasm_in_compat_space_p); | ||
436 | 449 | ||
437 | static int __cpuinit uasm_rel_highest(long val) | 450 | static int __uasminit uasm_rel_highest(long val) |
438 | { | 451 | { |
439 | #ifdef CONFIG_64BIT | 452 | #ifdef CONFIG_64BIT |
440 | return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; | 453 | return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; |
@@ -443,7 +456,7 @@ static int __cpuinit uasm_rel_highest(long val) | |||
443 | #endif | 456 | #endif |
444 | } | 457 | } |
445 | 458 | ||
446 | static int __cpuinit uasm_rel_higher(long val) | 459 | static int __uasminit uasm_rel_higher(long val) |
447 | { | 460 | { |
448 | #ifdef CONFIG_64BIT | 461 | #ifdef CONFIG_64BIT |
449 | return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; | 462 | return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; |
@@ -452,17 +465,19 @@ static int __cpuinit uasm_rel_higher(long val) | |||
452 | #endif | 465 | #endif |
453 | } | 466 | } |
454 | 467 | ||
455 | int __cpuinit uasm_rel_hi(long val) | 468 | int __uasminit uasm_rel_hi(long val) |
456 | { | 469 | { |
457 | return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; | 470 | return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; |
458 | } | 471 | } |
472 | UASM_EXPORT_SYMBOL(uasm_rel_hi); | ||
459 | 473 | ||
460 | int __cpuinit uasm_rel_lo(long val) | 474 | int __uasminit uasm_rel_lo(long val) |
461 | { | 475 | { |
462 | return ((val & 0xffff) ^ 0x8000) - 0x8000; | 476 | return ((val & 0xffff) ^ 0x8000) - 0x8000; |
463 | } | 477 | } |
478 | UASM_EXPORT_SYMBOL(uasm_rel_lo); | ||
464 | 479 | ||
465 | void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr) | 480 | void __uasminit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr) |
466 | { | 481 | { |
467 | if (!uasm_in_compat_space_p(addr)) { | 482 | if (!uasm_in_compat_space_p(addr)) { |
468 | uasm_i_lui(buf, rs, uasm_rel_highest(addr)); | 483 | uasm_i_lui(buf, rs, uasm_rel_highest(addr)); |
@@ -477,8 +492,9 @@ void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr) | |||
477 | } else | 492 | } else |
478 | uasm_i_lui(buf, rs, uasm_rel_hi(addr)); | 493 | uasm_i_lui(buf, rs, uasm_rel_hi(addr)); |
479 | } | 494 | } |
495 | UASM_EXPORT_SYMBOL(UASM_i_LA_mostly); | ||
480 | 496 | ||
481 | void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr) | 497 | void __uasminit UASM_i_LA(u32 **buf, unsigned int rs, long addr) |
482 | { | 498 | { |
483 | UASM_i_LA_mostly(buf, rs, addr); | 499 | UASM_i_LA_mostly(buf, rs, addr); |
484 | if (uasm_rel_lo(addr)) { | 500 | if (uasm_rel_lo(addr)) { |
@@ -488,9 +504,10 @@ void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr) | |||
488 | uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr)); | 504 | uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr)); |
489 | } | 505 | } |
490 | } | 506 | } |
507 | UASM_EXPORT_SYMBOL(UASM_i_LA); | ||
491 | 508 | ||
492 | /* Handle relocations. */ | 509 | /* Handle relocations. */ |
493 | void __cpuinit | 510 | void __uasminit |
494 | uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid) | 511 | uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid) |
495 | { | 512 | { |
496 | (*rel)->addr = addr; | 513 | (*rel)->addr = addr; |
@@ -498,8 +515,9 @@ uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid) | |||
498 | (*rel)->lab = lid; | 515 | (*rel)->lab = lid; |
499 | (*rel)++; | 516 | (*rel)++; |
500 | } | 517 | } |
518 | UASM_EXPORT_SYMBOL(uasm_r_mips_pc16); | ||
501 | 519 | ||
502 | static inline void __cpuinit | 520 | static inline void __uasminit |
503 | __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | 521 | __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) |
504 | { | 522 | { |
505 | long laddr = (long)lab->addr; | 523 | long laddr = (long)lab->addr; |
@@ -516,7 +534,7 @@ __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | |||
516 | } | 534 | } |
517 | } | 535 | } |
518 | 536 | ||
519 | void __cpuinit | 537 | void __uasminit |
520 | uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | 538 | uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) |
521 | { | 539 | { |
522 | struct uasm_label *l; | 540 | struct uasm_label *l; |
@@ -526,24 +544,27 @@ uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | |||
526 | if (rel->lab == l->lab) | 544 | if (rel->lab == l->lab) |
527 | __resolve_relocs(rel, l); | 545 | __resolve_relocs(rel, l); |
528 | } | 546 | } |
547 | UASM_EXPORT_SYMBOL(uasm_resolve_relocs); | ||
529 | 548 | ||
530 | void __cpuinit | 549 | void __uasminit |
531 | uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off) | 550 | uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off) |
532 | { | 551 | { |
533 | for (; rel->lab != UASM_LABEL_INVALID; rel++) | 552 | for (; rel->lab != UASM_LABEL_INVALID; rel++) |
534 | if (rel->addr >= first && rel->addr < end) | 553 | if (rel->addr >= first && rel->addr < end) |
535 | rel->addr += off; | 554 | rel->addr += off; |
536 | } | 555 | } |
556 | UASM_EXPORT_SYMBOL(uasm_move_relocs); | ||
537 | 557 | ||
538 | void __cpuinit | 558 | void __uasminit |
539 | uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off) | 559 | uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off) |
540 | { | 560 | { |
541 | for (; lab->lab != UASM_LABEL_INVALID; lab++) | 561 | for (; lab->lab != UASM_LABEL_INVALID; lab++) |
542 | if (lab->addr >= first && lab->addr < end) | 562 | if (lab->addr >= first && lab->addr < end) |
543 | lab->addr += off; | 563 | lab->addr += off; |
544 | } | 564 | } |
565 | UASM_EXPORT_SYMBOL(uasm_move_labels); | ||
545 | 566 | ||
546 | void __cpuinit | 567 | void __uasminit |
547 | uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, | 568 | uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, |
548 | u32 *end, u32 *target) | 569 | u32 *end, u32 *target) |
549 | { | 570 | { |
@@ -554,8 +575,9 @@ uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, | |||
554 | uasm_move_relocs(rel, first, end, off); | 575 | uasm_move_relocs(rel, first, end, off); |
555 | uasm_move_labels(lab, first, end, off); | 576 | uasm_move_labels(lab, first, end, off); |
556 | } | 577 | } |
578 | UASM_EXPORT_SYMBOL(uasm_copy_handler); | ||
557 | 579 | ||
558 | int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr) | 580 | int __uasminit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr) |
559 | { | 581 | { |
560 | for (; rel->lab != UASM_LABEL_INVALID; rel++) { | 582 | for (; rel->lab != UASM_LABEL_INVALID; rel++) { |
561 | if (rel->addr == addr | 583 | if (rel->addr == addr |
@@ -566,77 +588,88 @@ int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr) | |||
566 | 588 | ||
567 | return 0; | 589 | return 0; |
568 | } | 590 | } |
591 | UASM_EXPORT_SYMBOL(uasm_insn_has_bdelay); | ||
569 | 592 | ||
570 | /* Convenience functions for labeled branches. */ | 593 | /* Convenience functions for labeled branches. */ |
571 | void __cpuinit | 594 | void __uasminit |
572 | uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) | 595 | uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) |
573 | { | 596 | { |
574 | uasm_r_mips_pc16(r, *p, lid); | 597 | uasm_r_mips_pc16(r, *p, lid); |
575 | uasm_i_bltz(p, reg, 0); | 598 | uasm_i_bltz(p, reg, 0); |
576 | } | 599 | } |
600 | UASM_EXPORT_SYMBOL(uasm_il_bltz); | ||
577 | 601 | ||
578 | void __cpuinit | 602 | void __uasminit |
579 | uasm_il_b(u32 **p, struct uasm_reloc **r, int lid) | 603 | uasm_il_b(u32 **p, struct uasm_reloc **r, int lid) |
580 | { | 604 | { |
581 | uasm_r_mips_pc16(r, *p, lid); | 605 | uasm_r_mips_pc16(r, *p, lid); |
582 | uasm_i_b(p, 0); | 606 | uasm_i_b(p, 0); |
583 | } | 607 | } |
608 | UASM_EXPORT_SYMBOL(uasm_il_b); | ||
584 | 609 | ||
585 | void __cpuinit | 610 | void __uasminit |
586 | uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) | 611 | uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) |
587 | { | 612 | { |
588 | uasm_r_mips_pc16(r, *p, lid); | 613 | uasm_r_mips_pc16(r, *p, lid); |
589 | uasm_i_beqz(p, reg, 0); | 614 | uasm_i_beqz(p, reg, 0); |
590 | } | 615 | } |
616 | UASM_EXPORT_SYMBOL(uasm_il_beqz); | ||
591 | 617 | ||
592 | void __cpuinit | 618 | void __uasminit |
593 | uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) | 619 | uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) |
594 | { | 620 | { |
595 | uasm_r_mips_pc16(r, *p, lid); | 621 | uasm_r_mips_pc16(r, *p, lid); |
596 | uasm_i_beqzl(p, reg, 0); | 622 | uasm_i_beqzl(p, reg, 0); |
597 | } | 623 | } |
624 | UASM_EXPORT_SYMBOL(uasm_il_beqzl); | ||
598 | 625 | ||
599 | void __cpuinit | 626 | void __uasminit |
600 | uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, | 627 | uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, |
601 | unsigned int reg2, int lid) | 628 | unsigned int reg2, int lid) |
602 | { | 629 | { |
603 | uasm_r_mips_pc16(r, *p, lid); | 630 | uasm_r_mips_pc16(r, *p, lid); |
604 | uasm_i_bne(p, reg1, reg2, 0); | 631 | uasm_i_bne(p, reg1, reg2, 0); |
605 | } | 632 | } |
633 | UASM_EXPORT_SYMBOL(uasm_il_bne); | ||
606 | 634 | ||
607 | void __cpuinit | 635 | void __uasminit |
608 | uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) | 636 | uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) |
609 | { | 637 | { |
610 | uasm_r_mips_pc16(r, *p, lid); | 638 | uasm_r_mips_pc16(r, *p, lid); |
611 | uasm_i_bnez(p, reg, 0); | 639 | uasm_i_bnez(p, reg, 0); |
612 | } | 640 | } |
641 | UASM_EXPORT_SYMBOL(uasm_il_bnez); | ||
613 | 642 | ||
614 | void __cpuinit | 643 | void __uasminit |
615 | uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) | 644 | uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) |
616 | { | 645 | { |
617 | uasm_r_mips_pc16(r, *p, lid); | 646 | uasm_r_mips_pc16(r, *p, lid); |
618 | uasm_i_bgezl(p, reg, 0); | 647 | uasm_i_bgezl(p, reg, 0); |
619 | } | 648 | } |
649 | UASM_EXPORT_SYMBOL(uasm_il_bgezl); | ||
620 | 650 | ||
621 | void __cpuinit | 651 | void __uasminit |
622 | uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) | 652 | uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) |
623 | { | 653 | { |
624 | uasm_r_mips_pc16(r, *p, lid); | 654 | uasm_r_mips_pc16(r, *p, lid); |
625 | uasm_i_bgez(p, reg, 0); | 655 | uasm_i_bgez(p, reg, 0); |
626 | } | 656 | } |
657 | UASM_EXPORT_SYMBOL(uasm_il_bgez); | ||
627 | 658 | ||
628 | void __cpuinit | 659 | void __uasminit |
629 | uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, | 660 | uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, |
630 | unsigned int bit, int lid) | 661 | unsigned int bit, int lid) |
631 | { | 662 | { |
632 | uasm_r_mips_pc16(r, *p, lid); | 663 | uasm_r_mips_pc16(r, *p, lid); |
633 | uasm_i_bbit0(p, reg, bit, 0); | 664 | uasm_i_bbit0(p, reg, bit, 0); |
634 | } | 665 | } |
666 | UASM_EXPORT_SYMBOL(uasm_il_bbit0); | ||
635 | 667 | ||
636 | void __cpuinit | 668 | void __uasminit |
637 | uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, | 669 | uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, |
638 | unsigned int bit, int lid) | 670 | unsigned int bit, int lid) |
639 | { | 671 | { |
640 | uasm_r_mips_pc16(r, *p, lid); | 672 | uasm_r_mips_pc16(r, *p, lid); |
641 | uasm_i_bbit1(p, reg, bit, 0); | 673 | uasm_i_bbit1(p, reg, bit, 0); |
642 | } | 674 | } |
675 | UASM_EXPORT_SYMBOL(uasm_il_bbit1); | ||