diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2013-01-17 09:28:31 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-02-01 04:00:20 -0500 |
commit | 85dfaf0831d292aa19fa3f230a73f3081d7d7067 (patch) | |
tree | d27f1c74e217ea6098d89dcd0ebcd7fa11e77aff /arch/mips/include | |
parent | 90e8cacdbe0c7f07221ed500f0eb23fe1ee93699 (diff) |
MIPS: inst.h: Eleminate per endianess structure definitions.
This makes space for further growth of the header without excessive bloat.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include')
-rw-r--r-- | arch/mips/include/uapi/asm/inst.h | 226 |
1 files changed, 86 insertions, 140 deletions
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index 96c409e8b137..9d8651a13acc 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h | |||
@@ -196,154 +196,100 @@ enum lx_func { | |||
196 | * Damn ... bitfields depend from byteorder :-( | 196 | * Damn ... bitfields depend from byteorder :-( |
197 | */ | 197 | */ |
198 | #ifdef __MIPSEB__ | 198 | #ifdef __MIPSEB__ |
199 | struct j_format { /* Jump format */ | 199 | #define BITFIELD_FIELD(field, more) \ |
200 | unsigned int opcode : 6; | 200 | field; \ |
201 | unsigned int target : 26; | 201 | more |
202 | }; | ||
203 | |||
204 | struct i_format { /* Immediate format (addi, lw, ...) */ | ||
205 | unsigned int opcode : 6; | ||
206 | unsigned int rs : 5; | ||
207 | unsigned int rt : 5; | ||
208 | signed int simmediate : 16; | ||
209 | }; | ||
210 | |||
211 | struct u_format { /* Unsigned immediate format (ori, xori, ...) */ | ||
212 | unsigned int opcode : 6; | ||
213 | unsigned int rs : 5; | ||
214 | unsigned int rt : 5; | ||
215 | unsigned int uimmediate : 16; | ||
216 | }; | ||
217 | |||
218 | struct c_format { /* Cache (>= R6000) format */ | ||
219 | unsigned int opcode : 6; | ||
220 | unsigned int rs : 5; | ||
221 | unsigned int c_op : 3; | ||
222 | unsigned int cache : 2; | ||
223 | unsigned int simmediate : 16; | ||
224 | }; | ||
225 | |||
226 | struct r_format { /* Register format */ | ||
227 | unsigned int opcode : 6; | ||
228 | unsigned int rs : 5; | ||
229 | unsigned int rt : 5; | ||
230 | unsigned int rd : 5; | ||
231 | unsigned int re : 5; | ||
232 | unsigned int func : 6; | ||
233 | }; | ||
234 | |||
235 | struct p_format { /* Performance counter format (R10000) */ | ||
236 | unsigned int opcode : 6; | ||
237 | unsigned int rs : 5; | ||
238 | unsigned int rt : 5; | ||
239 | unsigned int rd : 5; | ||
240 | unsigned int re : 5; | ||
241 | unsigned int func : 6; | ||
242 | }; | ||
243 | |||
244 | struct f_format { /* FPU register format */ | ||
245 | unsigned int opcode : 6; | ||
246 | unsigned int : 1; | ||
247 | unsigned int fmt : 4; | ||
248 | unsigned int rt : 5; | ||
249 | unsigned int rd : 5; | ||
250 | unsigned int re : 5; | ||
251 | unsigned int func : 6; | ||
252 | }; | ||
253 | |||
254 | struct ma_format { /* FPU multiply and add format (MIPS IV) */ | ||
255 | unsigned int opcode : 6; | ||
256 | unsigned int fr : 5; | ||
257 | unsigned int ft : 5; | ||
258 | unsigned int fs : 5; | ||
259 | unsigned int fd : 5; | ||
260 | unsigned int func : 4; | ||
261 | unsigned int fmt : 2; | ||
262 | }; | ||
263 | |||
264 | struct b_format { /* BREAK and SYSCALL */ | ||
265 | unsigned int opcode:6; | ||
266 | unsigned int code:20; | ||
267 | unsigned int func:6; | ||
268 | }; | ||
269 | 202 | ||
270 | #elif defined(__MIPSEL__) | 203 | #elif defined(__MIPSEL__) |
271 | 204 | ||
272 | struct j_format { /* Jump format */ | 205 | #define BITFIELD_FIELD(field, more) \ |
273 | unsigned int target : 26; | 206 | more \ |
274 | unsigned int opcode : 6; | 207 | field; |
275 | }; | ||
276 | |||
277 | struct i_format { /* Immediate format */ | ||
278 | signed int simmediate : 16; | ||
279 | unsigned int rt : 5; | ||
280 | unsigned int rs : 5; | ||
281 | unsigned int opcode : 6; | ||
282 | }; | ||
283 | |||
284 | struct u_format { /* Unsigned immediate format */ | ||
285 | unsigned int uimmediate : 16; | ||
286 | unsigned int rt : 5; | ||
287 | unsigned int rs : 5; | ||
288 | unsigned int opcode : 6; | ||
289 | }; | ||
290 | |||
291 | struct c_format { /* Cache (>= R6000) format */ | ||
292 | unsigned int simmediate : 16; | ||
293 | unsigned int cache : 2; | ||
294 | unsigned int c_op : 3; | ||
295 | unsigned int rs : 5; | ||
296 | unsigned int opcode : 6; | ||
297 | }; | ||
298 | |||
299 | struct r_format { /* Register format */ | ||
300 | unsigned int func : 6; | ||
301 | unsigned int re : 5; | ||
302 | unsigned int rd : 5; | ||
303 | unsigned int rt : 5; | ||
304 | unsigned int rs : 5; | ||
305 | unsigned int opcode : 6; | ||
306 | }; | ||
307 | |||
308 | struct p_format { /* Performance counter format (R10000) */ | ||
309 | unsigned int func : 6; | ||
310 | unsigned int re : 5; | ||
311 | unsigned int rd : 5; | ||
312 | unsigned int rt : 5; | ||
313 | unsigned int rs : 5; | ||
314 | unsigned int opcode : 6; | ||
315 | }; | ||
316 | |||
317 | struct f_format { /* FPU register format */ | ||
318 | unsigned int func : 6; | ||
319 | unsigned int re : 5; | ||
320 | unsigned int rd : 5; | ||
321 | unsigned int rt : 5; | ||
322 | unsigned int fmt : 4; | ||
323 | unsigned int : 1; | ||
324 | unsigned int opcode : 6; | ||
325 | }; | ||
326 | |||
327 | struct ma_format { /* FPU multiply and add format (MIPS IV) */ | ||
328 | unsigned int fmt : 2; | ||
329 | unsigned int func : 4; | ||
330 | unsigned int fd : 5; | ||
331 | unsigned int fs : 5; | ||
332 | unsigned int ft : 5; | ||
333 | unsigned int fr : 5; | ||
334 | unsigned int opcode : 6; | ||
335 | }; | ||
336 | |||
337 | struct b_format { /* BREAK and SYSCALL */ | ||
338 | unsigned int func:6; | ||
339 | unsigned int code:20; | ||
340 | unsigned int opcode:6; | ||
341 | }; | ||
342 | 208 | ||
343 | #else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */ | 209 | #else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */ |
344 | #error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" | 210 | #error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" |
345 | #endif | 211 | #endif |
346 | 212 | ||
213 | struct j_format { | ||
214 | BITFIELD_FIELD(unsigned int opcode : 6, /* Jump format */ | ||
215 | BITFIELD_FIELD(unsigned int target : 26, | ||
216 | ;)) | ||
217 | }; | ||
218 | |||
219 | struct i_format { /* signed immediate format */ | ||
220 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
221 | BITFIELD_FIELD(unsigned int rs : 5, | ||
222 | BITFIELD_FIELD(unsigned int rt : 5, | ||
223 | BITFIELD_FIELD(signed int simmediate : 16, | ||
224 | ;)))) | ||
225 | }; | ||
226 | |||
227 | struct u_format { /* unsigned immediate format */ | ||
228 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
229 | BITFIELD_FIELD(unsigned int rs : 5, | ||
230 | BITFIELD_FIELD(unsigned int rt : 5, | ||
231 | BITFIELD_FIELD(unsigned int uimmediate : 16, | ||
232 | ;)))) | ||
233 | }; | ||
234 | |||
235 | struct c_format { /* Cache (>= R6000) format */ | ||
236 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
237 | BITFIELD_FIELD(unsigned int rs : 5, | ||
238 | BITFIELD_FIELD(unsigned int c_op : 3, | ||
239 | BITFIELD_FIELD(unsigned int cache : 2, | ||
240 | BITFIELD_FIELD(unsigned int simmediate : 16, | ||
241 | ;))))) | ||
242 | }; | ||
243 | |||
244 | struct r_format { /* Register format */ | ||
245 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
246 | BITFIELD_FIELD(unsigned int rs : 5, | ||
247 | BITFIELD_FIELD(unsigned int rt : 5, | ||
248 | BITFIELD_FIELD(unsigned int rd : 5, | ||
249 | BITFIELD_FIELD(unsigned int re : 5, | ||
250 | BITFIELD_FIELD(unsigned int func : 6, | ||
251 | ;)))))) | ||
252 | }; | ||
253 | |||
254 | struct p_format { /* Performance counter format (R10000) */ | ||
255 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
256 | BITFIELD_FIELD(unsigned int rs : 5, | ||
257 | BITFIELD_FIELD(unsigned int rt : 5, | ||
258 | BITFIELD_FIELD(unsigned int rd : 5, | ||
259 | BITFIELD_FIELD(unsigned int re : 5, | ||
260 | BITFIELD_FIELD(unsigned int func : 6, | ||
261 | ;)))))) | ||
262 | }; | ||
263 | |||
264 | struct f_format { /* FPU register format */ | ||
265 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
266 | BITFIELD_FIELD(unsigned int : 1, | ||
267 | BITFIELD_FIELD(unsigned int fmt : 4, | ||
268 | BITFIELD_FIELD(unsigned int rt : 5, | ||
269 | BITFIELD_FIELD(unsigned int rd : 5, | ||
270 | BITFIELD_FIELD(unsigned int re : 5, | ||
271 | BITFIELD_FIELD(unsigned int func : 6, | ||
272 | ;))))))) | ||
273 | }; | ||
274 | |||
275 | struct ma_format { /* FPU multiply and add format (MIPS IV) */ | ||
276 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
277 | BITFIELD_FIELD(unsigned int fr : 5, | ||
278 | BITFIELD_FIELD(unsigned int ft : 5, | ||
279 | BITFIELD_FIELD(unsigned int fs : 5, | ||
280 | BITFIELD_FIELD(unsigned int fd : 5, | ||
281 | BITFIELD_FIELD(unsigned int func : 4, | ||
282 | BITFIELD_FIELD(unsigned int fmt : 2, | ||
283 | ;))))))) | ||
284 | }; | ||
285 | |||
286 | struct b_format { /* BREAK and SYSCALL */ | ||
287 | BITFIELD_FIELD(unsigned int opcode : 6, | ||
288 | BITFIELD_FIELD(unsigned int code : 20, | ||
289 | BITFIELD_FIELD(unsigned int func : 6, | ||
290 | ;))) | ||
291 | }; | ||
292 | |||
347 | union mips_instruction { | 293 | union mips_instruction { |
348 | unsigned int word; | 294 | unsigned int word; |
349 | unsigned short halfword[2]; | 295 | unsigned short halfword[2]; |