aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorDavid Daney <ddaney@caviumnetworks.com>2010-07-23 21:41:43 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-08-05 08:26:21 -0400
commit22b0763a2328434ac68cca884e1b7d350ca61332 (patch)
tree59635ba7ba3368d40defdebc07c94d61d5941491 /arch/mips
parent5b97c3f7ae0ad0eea1eb90d649420a1a180f2bdf (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/Kconfig3
-rw-r--r--arch/mips/include/asm/uasm.h37
-rw-r--r--arch/mips/kernel/cpu-bugs64.c2
-rw-r--r--arch/mips/mm/uasm.c131
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
916endchoice 916endchoice
917 917
918config EXPORT_UASM
919 bool
920
918config SYS_SUPPORTS_APM_EMULATION 921config 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) \
14void __cpuinit \ 25void __uasminit \
15uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 26uasm_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) \
18void __cpuinit \ 29void __uasminit \
19uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 30uasm_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) \
22void __cpuinit \ 33void __uasminit \
23uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 34uasm_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) \
26void __cpuinit \ 37void __uasminit \
27uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 38uasm_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) \
30void __cpuinit \ 41void __uasminit \
31uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c) 42uasm_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) \
34void __cpuinit \ 45void __uasminit \
35uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 46uasm_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) \
38void __cpuinit \ 49void __uasminit \
39uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ 50uasm_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) \
43void __cpuinit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) 54void __uasminit uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
44 55
45#define Ip_u1s2(op) \ 56#define Ip_u1s2(op) \
46void __cpuinit uasm_i##op(u32 **buf, unsigned int a, signed int b) 57void __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
52Ip_u2u1s3(_addiu); 63Ip_u2u1s3(_addiu);
53Ip_u3u1u2(_addu); 64Ip_u3u1u2(_addu);
@@ -112,7 +123,7 @@ struct uasm_label {
112 int lab; 123 int lab;
113}; 124};
114 125
115void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid); 126void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid);
116#ifdef CONFIG_64BIT 127#ifdef CONFIG_64BIT
117int uasm_in_compat_space_p(long addr); 128int 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);
122void UASM_i_LA(u32 **buf, unsigned int rs, long addr); 133void UASM_i_LA(u32 **buf, unsigned int rs, long addr);
123 134
124#define UASM_L_LA(lb) \ 135#define UASM_L_LA(lb) \
125static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ 136static 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
242int daddiu_bug __cpuinitdata = -1; 242int daddiu_bug = -1;
243 243
244static inline void check_daddiu(void) 244static 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
89static struct insn insn_table[] __cpuinitdata = { 89static 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
153static inline __cpuinit u32 build_rs(u32 arg) 153static 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
161static inline __cpuinit u32 build_rt(u32 arg) 161static 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
169static inline __cpuinit u32 build_rd(u32 arg) 169static 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
177static inline __cpuinit u32 build_re(u32 arg) 177static 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
185static inline __cpuinit u32 build_simm(s32 arg) 185static 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
193static inline __cpuinit u32 build_uimm(u32 arg) 193static 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
201static inline __cpuinit u32 build_bimm(s32 arg) 201static 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
212static inline __cpuinit u32 build_jimm(u32 arg) 212static 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
220static inline __cpuinit u32 build_scimm(u32 arg) 220static 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
228static inline __cpuinit u32 build_func(u32 arg) 228static 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
236static inline __cpuinit u32 build_set(u32 arg) 236static 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 */
248static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...) 248static 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, ...)
295Ip_u1u2u3(op) \ 295Ip_u1u2u3(op) \
296{ \ 296{ \
297 build_insn(buf, insn##op, a, b, c); \ 297 build_insn(buf, insn##op, a, b, c); \
298} 298} \
299UASM_EXPORT_SYMBOL(uasm_i##op);
299 300
300#define I_u2u1u3(op) \ 301#define I_u2u1u3(op) \
301Ip_u2u1u3(op) \ 302Ip_u2u1u3(op) \
302{ \ 303{ \
303 build_insn(buf, insn##op, b, a, c); \ 304 build_insn(buf, insn##op, b, a, c); \
304} 305} \
306UASM_EXPORT_SYMBOL(uasm_i##op);
305 307
306#define I_u3u1u2(op) \ 308#define I_u3u1u2(op) \
307Ip_u3u1u2(op) \ 309Ip_u3u1u2(op) \
308{ \ 310{ \
309 build_insn(buf, insn##op, b, c, a); \ 311 build_insn(buf, insn##op, b, c, a); \
310} 312} \
313UASM_EXPORT_SYMBOL(uasm_i##op);
311 314
312#define I_u1u2s3(op) \ 315#define I_u1u2s3(op) \
313Ip_u1u2s3(op) \ 316Ip_u1u2s3(op) \
314{ \ 317{ \
315 build_insn(buf, insn##op, a, b, c); \ 318 build_insn(buf, insn##op, a, b, c); \
316} 319} \
320UASM_EXPORT_SYMBOL(uasm_i##op);
317 321
318#define I_u2s3u1(op) \ 322#define I_u2s3u1(op) \
319Ip_u2s3u1(op) \ 323Ip_u2s3u1(op) \
320{ \ 324{ \
321 build_insn(buf, insn##op, c, a, b); \ 325 build_insn(buf, insn##op, c, a, b); \
322} 326} \
327UASM_EXPORT_SYMBOL(uasm_i##op);
323 328
324#define I_u2u1s3(op) \ 329#define I_u2u1s3(op) \
325Ip_u2u1s3(op) \ 330Ip_u2u1s3(op) \
326{ \ 331{ \
327 build_insn(buf, insn##op, b, a, c); \ 332 build_insn(buf, insn##op, b, a, c); \
328} 333} \
334UASM_EXPORT_SYMBOL(uasm_i##op);
329 335
330#define I_u2u1msbu3(op) \ 336#define I_u2u1msbu3(op) \
331Ip_u2u1msbu3(op) \ 337Ip_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} \
341UASM_EXPORT_SYMBOL(uasm_i##op);
335 342
336#define I_u1u2(op) \ 343#define I_u1u2(op) \
337Ip_u1u2(op) \ 344Ip_u1u2(op) \
338{ \ 345{ \
339 build_insn(buf, insn##op, a, b); \ 346 build_insn(buf, insn##op, a, b); \
340} 347} \
348UASM_EXPORT_SYMBOL(uasm_i##op);
341 349
342#define I_u1s2(op) \ 350#define I_u1s2(op) \
343Ip_u1s2(op) \ 351Ip_u1s2(op) \
344{ \ 352{ \
345 build_insn(buf, insn##op, a, b); \ 353 build_insn(buf, insn##op, a, b); \
346} 354} \
355UASM_EXPORT_SYMBOL(uasm_i##op);
347 356
348#define I_u1(op) \ 357#define I_u1(op) \
349Ip_u1(op) \ 358Ip_u1(op) \
350{ \ 359{ \
351 build_insn(buf, insn##op, a); \ 360 build_insn(buf, insn##op, a); \
352} 361} \
362UASM_EXPORT_SYMBOL(uasm_i##op);
353 363
354#define I_0(op) \ 364#define I_0(op) \
355Ip_0(op) \ 365Ip_0(op) \
356{ \ 366{ \
357 build_insn(buf, insn##op); \ 367 build_insn(buf, insn##op); \
358} 368} \
369UASM_EXPORT_SYMBOL(uasm_i##op);
359 370
360I_u2u1s3(_addiu) 371I_u2u1s3(_addiu)
361I_u3u1u2(_addu) 372I_u3u1u2(_addu)
@@ -417,14 +428,15 @@ I_u1u2s3(_bbit0);
417I_u1u2s3(_bbit1); 428I_u1u2s3(_bbit1);
418 429
419/* Handle labels. */ 430/* Handle labels. */
420void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) 431void __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}
437UASM_EXPORT_SYMBOL(uasm_build_label);
426 438
427int __cpuinit uasm_in_compat_space_p(long addr) 439int __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}
448UASM_EXPORT_SYMBOL(uasm_in_compat_space_p);
436 449
437static int __cpuinit uasm_rel_highest(long val) 450static 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
446static int __cpuinit uasm_rel_higher(long val) 459static 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
455int __cpuinit uasm_rel_hi(long val) 468int __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}
472UASM_EXPORT_SYMBOL(uasm_rel_hi);
459 473
460int __cpuinit uasm_rel_lo(long val) 474int __uasminit uasm_rel_lo(long val)
461{ 475{
462 return ((val & 0xffff) ^ 0x8000) - 0x8000; 476 return ((val & 0xffff) ^ 0x8000) - 0x8000;
463} 477}
478UASM_EXPORT_SYMBOL(uasm_rel_lo);
464 479
465void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr) 480void __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}
495UASM_EXPORT_SYMBOL(UASM_i_LA_mostly);
480 496
481void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr) 497void __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}
507UASM_EXPORT_SYMBOL(UASM_i_LA);
491 508
492/* Handle relocations. */ 509/* Handle relocations. */
493void __cpuinit 510void __uasminit
494uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid) 511uasm_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}
518UASM_EXPORT_SYMBOL(uasm_r_mips_pc16);
501 519
502static inline void __cpuinit 520static 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
519void __cpuinit 537void __uasminit
520uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) 538uasm_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}
547UASM_EXPORT_SYMBOL(uasm_resolve_relocs);
529 548
530void __cpuinit 549void __uasminit
531uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off) 550uasm_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}
556UASM_EXPORT_SYMBOL(uasm_move_relocs);
537 557
538void __cpuinit 558void __uasminit
539uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off) 559uasm_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}
565UASM_EXPORT_SYMBOL(uasm_move_labels);
545 566
546void __cpuinit 567void __uasminit
547uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, 568uasm_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}
578UASM_EXPORT_SYMBOL(uasm_copy_handler);
557 579
558int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr) 580int __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}
591UASM_EXPORT_SYMBOL(uasm_insn_has_bdelay);
569 592
570/* Convenience functions for labeled branches. */ 593/* Convenience functions for labeled branches. */
571void __cpuinit 594void __uasminit
572uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 595uasm_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}
600UASM_EXPORT_SYMBOL(uasm_il_bltz);
577 601
578void __cpuinit 602void __uasminit
579uasm_il_b(u32 **p, struct uasm_reloc **r, int lid) 603uasm_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}
608UASM_EXPORT_SYMBOL(uasm_il_b);
584 609
585void __cpuinit 610void __uasminit
586uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 611uasm_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}
616UASM_EXPORT_SYMBOL(uasm_il_beqz);
591 617
592void __cpuinit 618void __uasminit
593uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 619uasm_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}
624UASM_EXPORT_SYMBOL(uasm_il_beqzl);
598 625
599void __cpuinit 626void __uasminit
600uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, 627uasm_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}
633UASM_EXPORT_SYMBOL(uasm_il_bne);
606 634
607void __cpuinit 635void __uasminit
608uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 636uasm_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}
641UASM_EXPORT_SYMBOL(uasm_il_bnez);
613 642
614void __cpuinit 643void __uasminit
615uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 644uasm_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}
649UASM_EXPORT_SYMBOL(uasm_il_bgezl);
620 650
621void __cpuinit 651void __uasminit
622uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 652uasm_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}
657UASM_EXPORT_SYMBOL(uasm_il_bgez);
627 658
628void __cpuinit 659void __uasminit
629uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg, 660uasm_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}
666UASM_EXPORT_SYMBOL(uasm_il_bbit0);
635 667
636void __cpuinit 668void __uasminit
637uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg, 669uasm_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}
675UASM_EXPORT_SYMBOL(uasm_il_bbit1);