diff options
Diffstat (limited to 'arch/mips/mm/uasm.c')
-rw-r--r-- | arch/mips/mm/uasm.c | 162 |
1 files changed, 109 insertions, 53 deletions
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c index 611d564fdcf1..d2647a4e012b 100644 --- a/arch/mips/mm/uasm.c +++ b/arch/mips/mm/uasm.c | |||
@@ -62,12 +62,13 @@ enum opcode { | |||
62 | insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, | 62 | insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, |
63 | insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0, | 63 | insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0, |
64 | insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, | 64 | insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, |
65 | insn_dsrl32, insn_drotr, insn_dsubu, insn_eret, insn_j, insn_jal, | 65 | insn_dsrl32, insn_drotr, insn_drotr32, insn_dsubu, insn_eret, |
66 | insn_jr, insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0, | 66 | insn_j, insn_jal, insn_jr, insn_ld, insn_ll, insn_lld, |
67 | insn_mtc0, insn_or, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd, | 67 | insn_lui, insn_lw, insn_mfc0, insn_mtc0, insn_or, insn_ori, |
68 | insn_sd, insn_sll, insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, | 68 | insn_pref, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll, |
69 | insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, | 69 | insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, insn_tlbp, |
70 | insn_dins, insn_syscall | 70 | insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, |
71 | insn_dins, insn_syscall, insn_bbit0, insn_bbit1 | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | struct insn { | 74 | struct insn { |
@@ -85,7 +86,7 @@ struct insn { | |||
85 | | (e) << RE_SH \ | 86 | | (e) << RE_SH \ |
86 | | (f) << FUNC_SH) | 87 | | (f) << FUNC_SH) |
87 | 88 | ||
88 | static struct insn insn_table[] __cpuinitdata = { | 89 | static struct insn insn_table[] __uasminitdata = { |
89 | { 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 }, |
90 | { 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 }, |
91 | { 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 }, |
@@ -108,6 +109,7 @@ static struct insn insn_table[] __cpuinitdata = { | |||
108 | { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, | 109 | { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, |
109 | { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, | 110 | { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, |
110 | { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE }, | 111 | { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE }, |
112 | { insn_drotr32, M(spec_op, 1, 0, 0, 0, dsrl32_op), RT | RD | RE }, | ||
111 | { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, | 113 | { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, |
112 | { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, | 114 | { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, |
113 | { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, | 115 | { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, |
@@ -141,12 +143,14 @@ static struct insn insn_table[] __cpuinitdata = { | |||
141 | { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, | 143 | { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, |
142 | { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, | 144 | { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, |
143 | { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, | 145 | { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, |
146 | { insn_bbit0, M(lwc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | ||
147 | { insn_bbit1, M(swc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM }, | ||
144 | { insn_invalid, 0, 0 } | 148 | { insn_invalid, 0, 0 } |
145 | }; | 149 | }; |
146 | 150 | ||
147 | #undef M | 151 | #undef M |
148 | 152 | ||
149 | static inline __cpuinit u32 build_rs(u32 arg) | 153 | static inline __uasminit u32 build_rs(u32 arg) |
150 | { | 154 | { |
151 | if (arg & ~RS_MASK) | 155 | if (arg & ~RS_MASK) |
152 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 156 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -154,7 +158,7 @@ static inline __cpuinit u32 build_rs(u32 arg) | |||
154 | return (arg & RS_MASK) << RS_SH; | 158 | return (arg & RS_MASK) << RS_SH; |
155 | } | 159 | } |
156 | 160 | ||
157 | static inline __cpuinit u32 build_rt(u32 arg) | 161 | static inline __uasminit u32 build_rt(u32 arg) |
158 | { | 162 | { |
159 | if (arg & ~RT_MASK) | 163 | if (arg & ~RT_MASK) |
160 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 164 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -162,7 +166,7 @@ static inline __cpuinit u32 build_rt(u32 arg) | |||
162 | return (arg & RT_MASK) << RT_SH; | 166 | return (arg & RT_MASK) << RT_SH; |
163 | } | 167 | } |
164 | 168 | ||
165 | static inline __cpuinit u32 build_rd(u32 arg) | 169 | static inline __uasminit u32 build_rd(u32 arg) |
166 | { | 170 | { |
167 | if (arg & ~RD_MASK) | 171 | if (arg & ~RD_MASK) |
168 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 172 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -170,7 +174,7 @@ static inline __cpuinit u32 build_rd(u32 arg) | |||
170 | return (arg & RD_MASK) << RD_SH; | 174 | return (arg & RD_MASK) << RD_SH; |
171 | } | 175 | } |
172 | 176 | ||
173 | static inline __cpuinit u32 build_re(u32 arg) | 177 | static inline __uasminit u32 build_re(u32 arg) |
174 | { | 178 | { |
175 | if (arg & ~RE_MASK) | 179 | if (arg & ~RE_MASK) |
176 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 180 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -178,7 +182,7 @@ static inline __cpuinit u32 build_re(u32 arg) | |||
178 | return (arg & RE_MASK) << RE_SH; | 182 | return (arg & RE_MASK) << RE_SH; |
179 | } | 183 | } |
180 | 184 | ||
181 | static inline __cpuinit u32 build_simm(s32 arg) | 185 | static inline __uasminit u32 build_simm(s32 arg) |
182 | { | 186 | { |
183 | if (arg > 0x7fff || arg < -0x8000) | 187 | if (arg > 0x7fff || arg < -0x8000) |
184 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 188 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -186,7 +190,7 @@ static inline __cpuinit u32 build_simm(s32 arg) | |||
186 | return arg & 0xffff; | 190 | return arg & 0xffff; |
187 | } | 191 | } |
188 | 192 | ||
189 | static inline __cpuinit u32 build_uimm(u32 arg) | 193 | static inline __uasminit u32 build_uimm(u32 arg) |
190 | { | 194 | { |
191 | if (arg & ~IMM_MASK) | 195 | if (arg & ~IMM_MASK) |
192 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 196 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -194,7 +198,7 @@ static inline __cpuinit u32 build_uimm(u32 arg) | |||
194 | return arg & IMM_MASK; | 198 | return arg & IMM_MASK; |
195 | } | 199 | } |
196 | 200 | ||
197 | static inline __cpuinit u32 build_bimm(s32 arg) | 201 | static inline __uasminit u32 build_bimm(s32 arg) |
198 | { | 202 | { |
199 | if (arg > 0x1ffff || arg < -0x20000) | 203 | if (arg > 0x1ffff || arg < -0x20000) |
200 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 204 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -205,7 +209,7 @@ static inline __cpuinit u32 build_bimm(s32 arg) | |||
205 | return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); | 209 | return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); |
206 | } | 210 | } |
207 | 211 | ||
208 | static inline __cpuinit u32 build_jimm(u32 arg) | 212 | static inline __uasminit u32 build_jimm(u32 arg) |
209 | { | 213 | { |
210 | if (arg & ~((JIMM_MASK) << 2)) | 214 | if (arg & ~((JIMM_MASK) << 2)) |
211 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 215 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -213,7 +217,7 @@ static inline __cpuinit u32 build_jimm(u32 arg) | |||
213 | return (arg >> 2) & JIMM_MASK; | 217 | return (arg >> 2) & JIMM_MASK; |
214 | } | 218 | } |
215 | 219 | ||
216 | static inline __cpuinit u32 build_scimm(u32 arg) | 220 | static inline __uasminit u32 build_scimm(u32 arg) |
217 | { | 221 | { |
218 | if (arg & ~SCIMM_MASK) | 222 | if (arg & ~SCIMM_MASK) |
219 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 223 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -221,7 +225,7 @@ static inline __cpuinit u32 build_scimm(u32 arg) | |||
221 | return (arg & SCIMM_MASK) << SCIMM_SH; | 225 | return (arg & SCIMM_MASK) << SCIMM_SH; |
222 | } | 226 | } |
223 | 227 | ||
224 | static inline __cpuinit u32 build_func(u32 arg) | 228 | static inline __uasminit u32 build_func(u32 arg) |
225 | { | 229 | { |
226 | if (arg & ~FUNC_MASK) | 230 | if (arg & ~FUNC_MASK) |
227 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 231 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -229,7 +233,7 @@ static inline __cpuinit u32 build_func(u32 arg) | |||
229 | return arg & FUNC_MASK; | 233 | return arg & FUNC_MASK; |
230 | } | 234 | } |
231 | 235 | ||
232 | static inline __cpuinit u32 build_set(u32 arg) | 236 | static inline __uasminit u32 build_set(u32 arg) |
233 | { | 237 | { |
234 | if (arg & ~SET_MASK) | 238 | if (arg & ~SET_MASK) |
235 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | 239 | printk(KERN_WARNING "Micro-assembler field overflow\n"); |
@@ -241,7 +245,7 @@ static inline __cpuinit u32 build_set(u32 arg) | |||
241 | * The order of opcode arguments is implicitly left to right, | 245 | * The order of opcode arguments is implicitly left to right, |
242 | * starting with RS and ending with FUNC or IMM. | 246 | * starting with RS and ending with FUNC or IMM. |
243 | */ | 247 | */ |
244 | static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...) | 248 | static void __uasminit build_insn(u32 **buf, enum opcode opc, ...) |
245 | { | 249 | { |
246 | struct insn *ip = NULL; | 250 | struct insn *ip = NULL; |
247 | unsigned int i; | 251 | unsigned int i; |
@@ -291,67 +295,78 @@ static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...) | |||
291 | Ip_u1u2u3(op) \ | 295 | Ip_u1u2u3(op) \ |
292 | { \ | 296 | { \ |
293 | build_insn(buf, insn##op, a, b, c); \ | 297 | build_insn(buf, insn##op, a, b, c); \ |
294 | } | 298 | } \ |
299 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
295 | 300 | ||
296 | #define I_u2u1u3(op) \ | 301 | #define I_u2u1u3(op) \ |
297 | Ip_u2u1u3(op) \ | 302 | Ip_u2u1u3(op) \ |
298 | { \ | 303 | { \ |
299 | build_insn(buf, insn##op, b, a, c); \ | 304 | build_insn(buf, insn##op, b, a, c); \ |
300 | } | 305 | } \ |
306 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
301 | 307 | ||
302 | #define I_u3u1u2(op) \ | 308 | #define I_u3u1u2(op) \ |
303 | Ip_u3u1u2(op) \ | 309 | Ip_u3u1u2(op) \ |
304 | { \ | 310 | { \ |
305 | build_insn(buf, insn##op, b, c, a); \ | 311 | build_insn(buf, insn##op, b, c, a); \ |
306 | } | 312 | } \ |
313 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
307 | 314 | ||
308 | #define I_u1u2s3(op) \ | 315 | #define I_u1u2s3(op) \ |
309 | Ip_u1u2s3(op) \ | 316 | Ip_u1u2s3(op) \ |
310 | { \ | 317 | { \ |
311 | build_insn(buf, insn##op, a, b, c); \ | 318 | build_insn(buf, insn##op, a, b, c); \ |
312 | } | 319 | } \ |
320 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
313 | 321 | ||
314 | #define I_u2s3u1(op) \ | 322 | #define I_u2s3u1(op) \ |
315 | Ip_u2s3u1(op) \ | 323 | Ip_u2s3u1(op) \ |
316 | { \ | 324 | { \ |
317 | build_insn(buf, insn##op, c, a, b); \ | 325 | build_insn(buf, insn##op, c, a, b); \ |
318 | } | 326 | } \ |
327 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
319 | 328 | ||
320 | #define I_u2u1s3(op) \ | 329 | #define I_u2u1s3(op) \ |
321 | Ip_u2u1s3(op) \ | 330 | Ip_u2u1s3(op) \ |
322 | { \ | 331 | { \ |
323 | build_insn(buf, insn##op, b, a, c); \ | 332 | build_insn(buf, insn##op, b, a, c); \ |
324 | } | 333 | } \ |
334 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
325 | 335 | ||
326 | #define I_u2u1msbu3(op) \ | 336 | #define I_u2u1msbu3(op) \ |
327 | Ip_u2u1msbu3(op) \ | 337 | Ip_u2u1msbu3(op) \ |
328 | { \ | 338 | { \ |
329 | build_insn(buf, insn##op, b, a, c+d-1, c); \ | 339 | build_insn(buf, insn##op, b, a, c+d-1, c); \ |
330 | } | 340 | } \ |
341 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
331 | 342 | ||
332 | #define I_u1u2(op) \ | 343 | #define I_u1u2(op) \ |
333 | Ip_u1u2(op) \ | 344 | Ip_u1u2(op) \ |
334 | { \ | 345 | { \ |
335 | build_insn(buf, insn##op, a, b); \ | 346 | build_insn(buf, insn##op, a, b); \ |
336 | } | 347 | } \ |
348 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
337 | 349 | ||
338 | #define I_u1s2(op) \ | 350 | #define I_u1s2(op) \ |
339 | Ip_u1s2(op) \ | 351 | Ip_u1s2(op) \ |
340 | { \ | 352 | { \ |
341 | build_insn(buf, insn##op, a, b); \ | 353 | build_insn(buf, insn##op, a, b); \ |
342 | } | 354 | } \ |
355 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
343 | 356 | ||
344 | #define I_u1(op) \ | 357 | #define I_u1(op) \ |
345 | Ip_u1(op) \ | 358 | Ip_u1(op) \ |
346 | { \ | 359 | { \ |
347 | build_insn(buf, insn##op, a); \ | 360 | build_insn(buf, insn##op, a); \ |
348 | } | 361 | } \ |
362 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
349 | 363 | ||
350 | #define I_0(op) \ | 364 | #define I_0(op) \ |
351 | Ip_0(op) \ | 365 | Ip_0(op) \ |
352 | { \ | 366 | { \ |
353 | build_insn(buf, insn##op); \ | 367 | build_insn(buf, insn##op); \ |
354 | } | 368 | } \ |
369 | UASM_EXPORT_SYMBOL(uasm_i##op); | ||
355 | 370 | ||
356 | I_u2u1s3(_addiu) | 371 | I_u2u1s3(_addiu) |
357 | I_u3u1u2(_addu) | 372 | I_u3u1u2(_addu) |
@@ -375,6 +390,7 @@ I_u2u1u3(_dsra) | |||
375 | I_u2u1u3(_dsrl) | 390 | I_u2u1u3(_dsrl) |
376 | I_u2u1u3(_dsrl32) | 391 | I_u2u1u3(_dsrl32) |
377 | I_u2u1u3(_drotr) | 392 | I_u2u1u3(_drotr) |
393 | I_u2u1u3(_drotr32) | ||
378 | I_u3u1u2(_dsubu) | 394 | I_u3u1u2(_dsubu) |
379 | I_0(_eret) | 395 | I_0(_eret) |
380 | I_u1(_j) | 396 | I_u1(_j) |
@@ -408,16 +424,19 @@ I_u3u1u2(_xor) | |||
408 | I_u2u1u3(_xori) | 424 | I_u2u1u3(_xori) |
409 | I_u2u1msbu3(_dins); | 425 | I_u2u1msbu3(_dins); |
410 | I_u1(_syscall); | 426 | I_u1(_syscall); |
427 | I_u1u2s3(_bbit0); | ||
428 | I_u1u2s3(_bbit1); | ||
411 | 429 | ||
412 | /* Handle labels. */ | 430 | /* Handle labels. */ |
413 | 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) |
414 | { | 432 | { |
415 | (*lab)->addr = addr; | 433 | (*lab)->addr = addr; |
416 | (*lab)->lab = lid; | 434 | (*lab)->lab = lid; |
417 | (*lab)++; | 435 | (*lab)++; |
418 | } | 436 | } |
437 | UASM_EXPORT_SYMBOL(uasm_build_label); | ||
419 | 438 | ||
420 | int __cpuinit uasm_in_compat_space_p(long addr) | 439 | int __uasminit uasm_in_compat_space_p(long addr) |
421 | { | 440 | { |
422 | /* Is this address in 32bit compat space? */ | 441 | /* Is this address in 32bit compat space? */ |
423 | #ifdef CONFIG_64BIT | 442 | #ifdef CONFIG_64BIT |
@@ -426,8 +445,9 @@ int __cpuinit uasm_in_compat_space_p(long addr) | |||
426 | return 1; | 445 | return 1; |
427 | #endif | 446 | #endif |
428 | } | 447 | } |
448 | UASM_EXPORT_SYMBOL(uasm_in_compat_space_p); | ||
429 | 449 | ||
430 | static int __cpuinit uasm_rel_highest(long val) | 450 | static int __uasminit uasm_rel_highest(long val) |
431 | { | 451 | { |
432 | #ifdef CONFIG_64BIT | 452 | #ifdef CONFIG_64BIT |
433 | return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; | 453 | return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; |
@@ -436,7 +456,7 @@ static int __cpuinit uasm_rel_highest(long val) | |||
436 | #endif | 456 | #endif |
437 | } | 457 | } |
438 | 458 | ||
439 | static int __cpuinit uasm_rel_higher(long val) | 459 | static int __uasminit uasm_rel_higher(long val) |
440 | { | 460 | { |
441 | #ifdef CONFIG_64BIT | 461 | #ifdef CONFIG_64BIT |
442 | return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; | 462 | return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; |
@@ -445,17 +465,19 @@ static int __cpuinit uasm_rel_higher(long val) | |||
445 | #endif | 465 | #endif |
446 | } | 466 | } |
447 | 467 | ||
448 | int __cpuinit uasm_rel_hi(long val) | 468 | int __uasminit uasm_rel_hi(long val) |
449 | { | 469 | { |
450 | return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; | 470 | return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; |
451 | } | 471 | } |
472 | UASM_EXPORT_SYMBOL(uasm_rel_hi); | ||
452 | 473 | ||
453 | int __cpuinit uasm_rel_lo(long val) | 474 | int __uasminit uasm_rel_lo(long val) |
454 | { | 475 | { |
455 | return ((val & 0xffff) ^ 0x8000) - 0x8000; | 476 | return ((val & 0xffff) ^ 0x8000) - 0x8000; |
456 | } | 477 | } |
478 | UASM_EXPORT_SYMBOL(uasm_rel_lo); | ||
457 | 479 | ||
458 | 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) |
459 | { | 481 | { |
460 | if (!uasm_in_compat_space_p(addr)) { | 482 | if (!uasm_in_compat_space_p(addr)) { |
461 | uasm_i_lui(buf, rs, uasm_rel_highest(addr)); | 483 | uasm_i_lui(buf, rs, uasm_rel_highest(addr)); |
@@ -470,8 +492,9 @@ void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr) | |||
470 | } else | 492 | } else |
471 | uasm_i_lui(buf, rs, uasm_rel_hi(addr)); | 493 | uasm_i_lui(buf, rs, uasm_rel_hi(addr)); |
472 | } | 494 | } |
495 | UASM_EXPORT_SYMBOL(UASM_i_LA_mostly); | ||
473 | 496 | ||
474 | 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) |
475 | { | 498 | { |
476 | UASM_i_LA_mostly(buf, rs, addr); | 499 | UASM_i_LA_mostly(buf, rs, addr); |
477 | if (uasm_rel_lo(addr)) { | 500 | if (uasm_rel_lo(addr)) { |
@@ -481,9 +504,10 @@ void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr) | |||
481 | uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr)); | 504 | uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr)); |
482 | } | 505 | } |
483 | } | 506 | } |
507 | UASM_EXPORT_SYMBOL(UASM_i_LA); | ||
484 | 508 | ||
485 | /* Handle relocations. */ | 509 | /* Handle relocations. */ |
486 | void __cpuinit | 510 | void __uasminit |
487 | 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) |
488 | { | 512 | { |
489 | (*rel)->addr = addr; | 513 | (*rel)->addr = addr; |
@@ -491,8 +515,9 @@ uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid) | |||
491 | (*rel)->lab = lid; | 515 | (*rel)->lab = lid; |
492 | (*rel)++; | 516 | (*rel)++; |
493 | } | 517 | } |
518 | UASM_EXPORT_SYMBOL(uasm_r_mips_pc16); | ||
494 | 519 | ||
495 | static inline void __cpuinit | 520 | static inline void __uasminit |
496 | __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | 521 | __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) |
497 | { | 522 | { |
498 | long laddr = (long)lab->addr; | 523 | long laddr = (long)lab->addr; |
@@ -509,7 +534,7 @@ __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | |||
509 | } | 534 | } |
510 | } | 535 | } |
511 | 536 | ||
512 | void __cpuinit | 537 | void __uasminit |
513 | uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | 538 | uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) |
514 | { | 539 | { |
515 | struct uasm_label *l; | 540 | struct uasm_label *l; |
@@ -519,24 +544,27 @@ uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) | |||
519 | if (rel->lab == l->lab) | 544 | if (rel->lab == l->lab) |
520 | __resolve_relocs(rel, l); | 545 | __resolve_relocs(rel, l); |
521 | } | 546 | } |
547 | UASM_EXPORT_SYMBOL(uasm_resolve_relocs); | ||
522 | 548 | ||
523 | void __cpuinit | 549 | void __uasminit |
524 | 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) |
525 | { | 551 | { |
526 | for (; rel->lab != UASM_LABEL_INVALID; rel++) | 552 | for (; rel->lab != UASM_LABEL_INVALID; rel++) |
527 | if (rel->addr >= first && rel->addr < end) | 553 | if (rel->addr >= first && rel->addr < end) |
528 | rel->addr += off; | 554 | rel->addr += off; |
529 | } | 555 | } |
556 | UASM_EXPORT_SYMBOL(uasm_move_relocs); | ||
530 | 557 | ||
531 | void __cpuinit | 558 | void __uasminit |
532 | 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) |
533 | { | 560 | { |
534 | for (; lab->lab != UASM_LABEL_INVALID; lab++) | 561 | for (; lab->lab != UASM_LABEL_INVALID; lab++) |
535 | if (lab->addr >= first && lab->addr < end) | 562 | if (lab->addr >= first && lab->addr < end) |
536 | lab->addr += off; | 563 | lab->addr += off; |
537 | } | 564 | } |
565 | UASM_EXPORT_SYMBOL(uasm_move_labels); | ||
538 | 566 | ||
539 | void __cpuinit | 567 | void __uasminit |
540 | 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, |
541 | u32 *end, u32 *target) | 569 | u32 *end, u32 *target) |
542 | { | 570 | { |
@@ -547,8 +575,9 @@ uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, | |||
547 | uasm_move_relocs(rel, first, end, off); | 575 | uasm_move_relocs(rel, first, end, off); |
548 | uasm_move_labels(lab, first, end, off); | 576 | uasm_move_labels(lab, first, end, off); |
549 | } | 577 | } |
578 | UASM_EXPORT_SYMBOL(uasm_copy_handler); | ||
550 | 579 | ||
551 | 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) |
552 | { | 581 | { |
553 | for (; rel->lab != UASM_LABEL_INVALID; rel++) { | 582 | for (; rel->lab != UASM_LABEL_INVALID; rel++) { |
554 | if (rel->addr == addr | 583 | if (rel->addr == addr |
@@ -559,61 +588,88 @@ int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr) | |||
559 | 588 | ||
560 | return 0; | 589 | return 0; |
561 | } | 590 | } |
591 | UASM_EXPORT_SYMBOL(uasm_insn_has_bdelay); | ||
562 | 592 | ||
563 | /* Convenience functions for labeled branches. */ | 593 | /* Convenience functions for labeled branches. */ |
564 | void __cpuinit | 594 | void __uasminit |
565 | 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) |
566 | { | 596 | { |
567 | uasm_r_mips_pc16(r, *p, lid); | 597 | uasm_r_mips_pc16(r, *p, lid); |
568 | uasm_i_bltz(p, reg, 0); | 598 | uasm_i_bltz(p, reg, 0); |
569 | } | 599 | } |
600 | UASM_EXPORT_SYMBOL(uasm_il_bltz); | ||
570 | 601 | ||
571 | void __cpuinit | 602 | void __uasminit |
572 | uasm_il_b(u32 **p, struct uasm_reloc **r, int lid) | 603 | uasm_il_b(u32 **p, struct uasm_reloc **r, int lid) |
573 | { | 604 | { |
574 | uasm_r_mips_pc16(r, *p, lid); | 605 | uasm_r_mips_pc16(r, *p, lid); |
575 | uasm_i_b(p, 0); | 606 | uasm_i_b(p, 0); |
576 | } | 607 | } |
608 | UASM_EXPORT_SYMBOL(uasm_il_b); | ||
577 | 609 | ||
578 | void __cpuinit | 610 | void __uasminit |
579 | 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) |
580 | { | 612 | { |
581 | uasm_r_mips_pc16(r, *p, lid); | 613 | uasm_r_mips_pc16(r, *p, lid); |
582 | uasm_i_beqz(p, reg, 0); | 614 | uasm_i_beqz(p, reg, 0); |
583 | } | 615 | } |
616 | UASM_EXPORT_SYMBOL(uasm_il_beqz); | ||
584 | 617 | ||
585 | void __cpuinit | 618 | void __uasminit |
586 | 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) |
587 | { | 620 | { |
588 | uasm_r_mips_pc16(r, *p, lid); | 621 | uasm_r_mips_pc16(r, *p, lid); |
589 | uasm_i_beqzl(p, reg, 0); | 622 | uasm_i_beqzl(p, reg, 0); |
590 | } | 623 | } |
624 | UASM_EXPORT_SYMBOL(uasm_il_beqzl); | ||
591 | 625 | ||
592 | void __cpuinit | 626 | void __uasminit |
593 | 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, |
594 | unsigned int reg2, int lid) | 628 | unsigned int reg2, int lid) |
595 | { | 629 | { |
596 | uasm_r_mips_pc16(r, *p, lid); | 630 | uasm_r_mips_pc16(r, *p, lid); |
597 | uasm_i_bne(p, reg1, reg2, 0); | 631 | uasm_i_bne(p, reg1, reg2, 0); |
598 | } | 632 | } |
633 | UASM_EXPORT_SYMBOL(uasm_il_bne); | ||
599 | 634 | ||
600 | void __cpuinit | 635 | void __uasminit |
601 | 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) |
602 | { | 637 | { |
603 | uasm_r_mips_pc16(r, *p, lid); | 638 | uasm_r_mips_pc16(r, *p, lid); |
604 | uasm_i_bnez(p, reg, 0); | 639 | uasm_i_bnez(p, reg, 0); |
605 | } | 640 | } |
641 | UASM_EXPORT_SYMBOL(uasm_il_bnez); | ||
606 | 642 | ||
607 | void __cpuinit | 643 | void __uasminit |
608 | 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) |
609 | { | 645 | { |
610 | uasm_r_mips_pc16(r, *p, lid); | 646 | uasm_r_mips_pc16(r, *p, lid); |
611 | uasm_i_bgezl(p, reg, 0); | 647 | uasm_i_bgezl(p, reg, 0); |
612 | } | 648 | } |
649 | UASM_EXPORT_SYMBOL(uasm_il_bgezl); | ||
613 | 650 | ||
614 | void __cpuinit | 651 | void __uasminit |
615 | 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) |
616 | { | 653 | { |
617 | uasm_r_mips_pc16(r, *p, lid); | 654 | uasm_r_mips_pc16(r, *p, lid); |
618 | uasm_i_bgez(p, reg, 0); | 655 | uasm_i_bgez(p, reg, 0); |
619 | } | 656 | } |
657 | UASM_EXPORT_SYMBOL(uasm_il_bgez); | ||
658 | |||
659 | void __uasminit | ||
660 | uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, | ||
661 | unsigned int bit, int lid) | ||
662 | { | ||
663 | uasm_r_mips_pc16(r, *p, lid); | ||
664 | uasm_i_bbit0(p, reg, bit, 0); | ||
665 | } | ||
666 | UASM_EXPORT_SYMBOL(uasm_il_bbit0); | ||
667 | |||
668 | void __uasminit | ||
669 | uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, | ||
670 | unsigned int bit, int lid) | ||
671 | { | ||
672 | uasm_r_mips_pc16(r, *p, lid); | ||
673 | uasm_i_bbit1(p, reg, bit, 0); | ||
674 | } | ||
675 | UASM_EXPORT_SYMBOL(uasm_il_bbit1); | ||