aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mm/uasm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm/uasm.c')
-rw-r--r--arch/mips/mm/uasm.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index 23afdebc8e5c..5fa185151fc8 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -68,7 +68,8 @@ enum opcode {
68 insn_pref, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll, 68 insn_pref, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll,
69 insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, insn_tlbp, 69 insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, insn_tlbp,
70 insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, 70 insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori,
71 insn_dins, insn_syscall, insn_bbit0, insn_bbit1 71 insn_dins, insn_dinsm, insn_syscall, insn_bbit0, insn_bbit1,
72 insn_lwx, insn_ldx
72}; 73};
73 74
74struct insn { 75struct insn {
@@ -142,9 +143,12 @@ static struct insn insn_table[] __uasminitdata = {
142 { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, 143 { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD },
143 { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, 144 { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
144 { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, 145 { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE },
146 { insn_dinsm, M(spec3_op, 0, 0, 0, 0, dinsm_op), RS | RT | RD | RE },
145 { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, 147 { 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 }, 148 { 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 }, 149 { insn_bbit1, M(swc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM },
150 { insn_lwx, M(spec3_op, 0, 0, 0, lwx_op, lx_op), RS | RT | RD },
151 { insn_ldx, M(spec3_op, 0, 0, 0, ldx_op, lx_op), RS | RT | RD },
148 { insn_invalid, 0, 0 } 152 { insn_invalid, 0, 0 }
149}; 153};
150 154
@@ -152,91 +156,83 @@ static struct insn insn_table[] __uasminitdata = {
152 156
153static inline __uasminit u32 build_rs(u32 arg) 157static inline __uasminit u32 build_rs(u32 arg)
154{ 158{
155 if (arg & ~RS_MASK) 159 WARN(arg & ~RS_MASK, KERN_WARNING "Micro-assembler field overflow\n");
156 printk(KERN_WARNING "Micro-assembler field overflow\n");
157 160
158 return (arg & RS_MASK) << RS_SH; 161 return (arg & RS_MASK) << RS_SH;
159} 162}
160 163
161static inline __uasminit u32 build_rt(u32 arg) 164static inline __uasminit u32 build_rt(u32 arg)
162{ 165{
163 if (arg & ~RT_MASK) 166 WARN(arg & ~RT_MASK, KERN_WARNING "Micro-assembler field overflow\n");
164 printk(KERN_WARNING "Micro-assembler field overflow\n");
165 167
166 return (arg & RT_MASK) << RT_SH; 168 return (arg & RT_MASK) << RT_SH;
167} 169}
168 170
169static inline __uasminit u32 build_rd(u32 arg) 171static inline __uasminit u32 build_rd(u32 arg)
170{ 172{
171 if (arg & ~RD_MASK) 173 WARN(arg & ~RD_MASK, KERN_WARNING "Micro-assembler field overflow\n");
172 printk(KERN_WARNING "Micro-assembler field overflow\n");
173 174
174 return (arg & RD_MASK) << RD_SH; 175 return (arg & RD_MASK) << RD_SH;
175} 176}
176 177
177static inline __uasminit u32 build_re(u32 arg) 178static inline __uasminit u32 build_re(u32 arg)
178{ 179{
179 if (arg & ~RE_MASK) 180 WARN(arg & ~RE_MASK, KERN_WARNING "Micro-assembler field overflow\n");
180 printk(KERN_WARNING "Micro-assembler field overflow\n");
181 181
182 return (arg & RE_MASK) << RE_SH; 182 return (arg & RE_MASK) << RE_SH;
183} 183}
184 184
185static inline __uasminit u32 build_simm(s32 arg) 185static inline __uasminit u32 build_simm(s32 arg)
186{ 186{
187 if (arg > 0x7fff || arg < -0x8000) 187 WARN(arg > 0x7fff || arg < -0x8000,
188 printk(KERN_WARNING "Micro-assembler field overflow\n"); 188 KERN_WARNING "Micro-assembler field overflow\n");
189 189
190 return arg & 0xffff; 190 return arg & 0xffff;
191} 191}
192 192
193static inline __uasminit u32 build_uimm(u32 arg) 193static inline __uasminit u32 build_uimm(u32 arg)
194{ 194{
195 if (arg & ~IMM_MASK) 195 WARN(arg & ~IMM_MASK, KERN_WARNING "Micro-assembler field overflow\n");
196 printk(KERN_WARNING "Micro-assembler field overflow\n");
197 196
198 return arg & IMM_MASK; 197 return arg & IMM_MASK;
199} 198}
200 199
201static inline __uasminit u32 build_bimm(s32 arg) 200static inline __uasminit u32 build_bimm(s32 arg)
202{ 201{
203 if (arg > 0x1ffff || arg < -0x20000) 202 WARN(arg > 0x1ffff || arg < -0x20000,
204 printk(KERN_WARNING "Micro-assembler field overflow\n"); 203 KERN_WARNING "Micro-assembler field overflow\n");
205 204
206 if (arg & 0x3) 205 WARN(arg & 0x3, KERN_WARNING "Invalid micro-assembler branch target\n");
207 printk(KERN_WARNING "Invalid micro-assembler branch target\n");
208 206
209 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); 207 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
210} 208}
211 209
212static inline __uasminit u32 build_jimm(u32 arg) 210static inline __uasminit u32 build_jimm(u32 arg)
213{ 211{
214 if (arg & ~((JIMM_MASK) << 2)) 212 WARN(arg & ~(JIMM_MASK << 2),
215 printk(KERN_WARNING "Micro-assembler field overflow\n"); 213 KERN_WARNING "Micro-assembler field overflow\n");
216 214
217 return (arg >> 2) & JIMM_MASK; 215 return (arg >> 2) & JIMM_MASK;
218} 216}
219 217
220static inline __uasminit u32 build_scimm(u32 arg) 218static inline __uasminit u32 build_scimm(u32 arg)
221{ 219{
222 if (arg & ~SCIMM_MASK) 220 WARN(arg & ~SCIMM_MASK,
223 printk(KERN_WARNING "Micro-assembler field overflow\n"); 221 KERN_WARNING "Micro-assembler field overflow\n");
224 222
225 return (arg & SCIMM_MASK) << SCIMM_SH; 223 return (arg & SCIMM_MASK) << SCIMM_SH;
226} 224}
227 225
228static inline __uasminit u32 build_func(u32 arg) 226static inline __uasminit u32 build_func(u32 arg)
229{ 227{
230 if (arg & ~FUNC_MASK) 228 WARN(arg & ~FUNC_MASK, KERN_WARNING "Micro-assembler field overflow\n");
231 printk(KERN_WARNING "Micro-assembler field overflow\n");
232 229
233 return arg & FUNC_MASK; 230 return arg & FUNC_MASK;
234} 231}
235 232
236static inline __uasminit u32 build_set(u32 arg) 233static inline __uasminit u32 build_set(u32 arg)
237{ 234{
238 if (arg & ~SET_MASK) 235 WARN(arg & ~SET_MASK, KERN_WARNING "Micro-assembler field overflow\n");
239 printk(KERN_WARNING "Micro-assembler field overflow\n");
240 236
241 return arg & SET_MASK; 237 return arg & SET_MASK;
242} 238}
@@ -340,6 +336,13 @@ Ip_u2u1msbu3(op) \
340} \ 336} \
341UASM_EXPORT_SYMBOL(uasm_i##op); 337UASM_EXPORT_SYMBOL(uasm_i##op);
342 338
339#define I_u2u1msb32u3(op) \
340Ip_u2u1msbu3(op) \
341{ \
342 build_insn(buf, insn##op, b, a, c+d-33, c); \
343} \
344UASM_EXPORT_SYMBOL(uasm_i##op);
345
343#define I_u1u2(op) \ 346#define I_u1u2(op) \
344Ip_u1u2(op) \ 347Ip_u1u2(op) \
345{ \ 348{ \
@@ -422,9 +425,12 @@ I_0(_tlbwr)
422I_u3u1u2(_xor) 425I_u3u1u2(_xor)
423I_u2u1u3(_xori) 426I_u2u1u3(_xori)
424I_u2u1msbu3(_dins); 427I_u2u1msbu3(_dins);
428I_u2u1msb32u3(_dinsm);
425I_u1(_syscall); 429I_u1(_syscall);
426I_u1u2s3(_bbit0); 430I_u1u2s3(_bbit0);
427I_u1u2s3(_bbit1); 431I_u1u2s3(_bbit1);
432I_u3u1u2(_lwx)
433I_u3u1u2(_ldx)
428 434
429#ifdef CONFIG_CPU_CAVIUM_OCTEON 435#ifdef CONFIG_CPU_CAVIUM_OCTEON
430#include <asm/octeon/octeon.h> 436#include <asm/octeon/octeon.h>