diff options
Diffstat (limited to 'arch/mips/include/asm/uasm.h')
-rw-r--r-- | arch/mips/include/asm/uasm.h | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index 058e941626a6..f7d8f1509c4d 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer | 6 | * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer |
7 | * Copyright (C) 2005 Maciej W. Rozycki | 7 | * Copyright (C) 2005 Maciej W. Rozycki |
8 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) | 8 | * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) |
9 | * Copyright (C) 2012 MIPS Technologies, Inc. | 9 | * Copyright (C) 2012, 2013 MIPS Technologies, Inc. All rights reserved. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
@@ -22,44 +22,57 @@ | |||
22 | #define UASM_EXPORT_SYMBOL(sym) | 22 | #define UASM_EXPORT_SYMBOL(sym) |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #define _UASM_ISA_CLASSIC 0 | ||
26 | |||
27 | #ifndef UASM_ISA | ||
28 | #define UASM_ISA _UASM_ISA_CLASSIC | ||
29 | #endif | ||
30 | |||
31 | #if (UASM_ISA == _UASM_ISA_CLASSIC) | ||
32 | #define ISAOPC(op) uasm_i##op | ||
33 | #define ISAFUNC(x) x | ||
34 | #else | ||
35 | #error Unsupported micro-assembler ISA!!! | ||
36 | #endif | ||
37 | |||
25 | #define Ip_u1u2u3(op) \ | 38 | #define Ip_u1u2u3(op) \ |
26 | void __uasminit \ | 39 | void __uasminit \ |
27 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 40 | ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
28 | 41 | ||
29 | #define Ip_u2u1u3(op) \ | 42 | #define Ip_u2u1u3(op) \ |
30 | void __uasminit \ | 43 | void __uasminit \ |
31 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 44 | ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
32 | 45 | ||
33 | #define Ip_u3u1u2(op) \ | 46 | #define Ip_u3u1u2(op) \ |
34 | void __uasminit \ | 47 | void __uasminit \ |
35 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) | 48 | ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c) |
36 | 49 | ||
37 | #define Ip_u1u2s3(op) \ | 50 | #define Ip_u1u2s3(op) \ |
38 | void __uasminit \ | 51 | void __uasminit \ |
39 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) | 52 | ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) |
40 | 53 | ||
41 | #define Ip_u2s3u1(op) \ | 54 | #define Ip_u2s3u1(op) \ |
42 | void __uasminit \ | 55 | void __uasminit \ |
43 | uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c) | 56 | ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c) |
44 | 57 | ||
45 | #define Ip_u2u1s3(op) \ | 58 | #define Ip_u2u1s3(op) \ |
46 | void __uasminit \ | 59 | void __uasminit \ |
47 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) | 60 | ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c) |
48 | 61 | ||
49 | #define Ip_u2u1msbu3(op) \ | 62 | #define Ip_u2u1msbu3(op) \ |
50 | void __uasminit \ | 63 | void __uasminit \ |
51 | uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ | 64 | ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ |
52 | unsigned int d) | 65 | unsigned int d) |
53 | 66 | ||
54 | #define Ip_u1u2(op) \ | 67 | #define Ip_u1u2(op) \ |
55 | void __uasminit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) | 68 | void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b) |
56 | 69 | ||
57 | #define Ip_u1s2(op) \ | 70 | #define Ip_u1s2(op) \ |
58 | void __uasminit uasm_i##op(u32 **buf, unsigned int a, signed int b) | 71 | void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, signed int b) |
59 | 72 | ||
60 | #define Ip_u1(op) void __uasminit uasm_i##op(u32 **buf, unsigned int a) | 73 | #define Ip_u1(op) void __uasminit ISAOPC(op)(u32 **buf, unsigned int a) |
61 | 74 | ||
62 | #define Ip_0(op) void __uasminit uasm_i##op(u32 **buf) | 75 | #define Ip_0(op) void __uasminit ISAOPC(op)(u32 **buf) |
63 | 76 | ||
64 | Ip_u2u1s3(_addiu); | 77 | Ip_u2u1s3(_addiu); |
65 | Ip_u3u1u2(_addu); | 78 | Ip_u3u1u2(_addu); |
@@ -132,14 +145,15 @@ struct uasm_label { | |||
132 | int lab; | 145 | int lab; |
133 | }; | 146 | }; |
134 | 147 | ||
135 | void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid); | 148 | void __uasminit ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr, |
149 | int lid); | ||
136 | #ifdef CONFIG_64BIT | 150 | #ifdef CONFIG_64BIT |
137 | int uasm_in_compat_space_p(long addr); | 151 | int ISAFUNC(uasm_in_compat_space_p)(long addr); |
138 | #endif | 152 | #endif |
139 | int uasm_rel_hi(long val); | 153 | int ISAFUNC(uasm_rel_hi)(long val); |
140 | int uasm_rel_lo(long val); | 154 | int ISAFUNC(uasm_rel_lo)(long val); |
141 | void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr); | 155 | void ISAFUNC(UASM_i_LA_mostly)(u32 **buf, unsigned int rs, long addr); |
142 | void UASM_i_LA(u32 **buf, unsigned int rs, long addr); | 156 | void ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr); |
143 | 157 | ||
144 | #define UASM_L_LA(lb) \ | 158 | #define UASM_L_LA(lb) \ |
145 | static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ | 159 | static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ |
@@ -196,27 +210,27 @@ static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1, | |||
196 | unsigned int a2, unsigned int a3) | 210 | unsigned int a2, unsigned int a3) |
197 | { | 211 | { |
198 | if (a3 < 32) | 212 | if (a3 < 32) |
199 | uasm_i_drotr(p, a1, a2, a3); | 213 | ISAOPC(_drotr)(p, a1, a2, a3); |
200 | else | 214 | else |
201 | uasm_i_drotr32(p, a1, a2, a3 - 32); | 215 | ISAOPC(_drotr32)(p, a1, a2, a3 - 32); |
202 | } | 216 | } |
203 | 217 | ||
204 | static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1, | 218 | static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1, |
205 | unsigned int a2, unsigned int a3) | 219 | unsigned int a2, unsigned int a3) |
206 | { | 220 | { |
207 | if (a3 < 32) | 221 | if (a3 < 32) |
208 | uasm_i_dsll(p, a1, a2, a3); | 222 | ISAOPC(_dsll)(p, a1, a2, a3); |
209 | else | 223 | else |
210 | uasm_i_dsll32(p, a1, a2, a3 - 32); | 224 | ISAOPC(_dsll32)(p, a1, a2, a3 - 32); |
211 | } | 225 | } |
212 | 226 | ||
213 | static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, | 227 | static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, |
214 | unsigned int a2, unsigned int a3) | 228 | unsigned int a2, unsigned int a3) |
215 | { | 229 | { |
216 | if (a3 < 32) | 230 | if (a3 < 32) |
217 | uasm_i_dsrl(p, a1, a2, a3); | 231 | ISAOPC(_dsrl)(p, a1, a2, a3); |
218 | else | 232 | else |
219 | uasm_i_dsrl32(p, a1, a2, a3 - 32); | 233 | ISAOPC(_dsrl32)(p, a1, a2, a3 - 32); |
220 | } | 234 | } |
221 | 235 | ||
222 | /* Handle relocations. */ | 236 | /* Handle relocations. */ |