GNU Binutils with patches for OS216
Revisão | e9bffec9afc45cf7c49308f0b4b8cc6bf68f58f2 (tree) |
---|---|
Hora | 2020-06-04 23:17:42 |
Autor | Jose E. Marchesi <jose.marchesi@orac...> |
Commiter | Jose E. Marchesi |
opcodes: discriminate endianness and insn-endianness in CGEN ports
The CGEN support code in opcodes accesses instruction contents using a
couple of functions defined in cgen-opc.c: cgen_get_insn_value and
cgen_put_insn_value. These functions use the "instruction endianness"
in the CPU description to order the read/written bytes.
The process of writing an instruction to the object file is:
Likewise, the process of reading an instruction from the object file
is:
As can be seen above, cgen_{get,put}_insn_value are used to both
process the instruction opcodes (the constant fields conforming the
base instruction) and also the values of the instruction operands,
such as immediates.
This is problematic for architectures in which the endianness of
instructions is different to the endianness of data. An example is
BPF, where instructions are always encoded big-endian but the data may
be either big or little.
This patch changes the cgen_{get,put}_insn_value functions in order to
get an extra argument with the endianness to use, and adapts the
existin callers to these functions in order to provide cd->endian or
cd->insn_endian, whatever appropriate. Callers like extract_1 and
insert_1 pass cd->endian (since they are reading/writing operand
values) while callers reading/writing the base instruction pass
cd->insn_endian instead.
A few little adjustments have been needed in some existing CGEN based
ports:
* The BPF assembler uses cgen_put_insn_value. It has been adapted to
* The mep port has code in mep.opc that uses cgen_{get,put}_insn_value.
Tested with --enable-targets=all.
Regested in all supported targets.
No regressions.
include/ChangeLog:
2020-06-04 Jose E. Marchesi <jose.marchesi@oracle.com>
* opcode/cgen.h: Get an endian' argument in both
cgen_get_insn_value and cgen_put_insn_value.
opcodes/ChangeLog:
2020-06-04 Jose E. Marchesi <jose.marchesi@oracle.com>
* cgen-opc.c (cgen_get_insn_value): Get an endian' argument.
(cgen_put_insn_value): Likewise.
(cgen_lookup_insn): Pass endianness to cgen_{get,put}_insn_value.
* cgen-dis.in (print_insn): Likewise.
* cgen-ibld.in (insert_1): Likewise.
(insert_1): Likewise.
(insert_insn_normal): Likewise.
(extract_1): Likewise.
* bpf-dis.c: Regenerate.
* bpf-ibld.c: Likewise.
* bpf-ibld.c: Likewise.
* cgen-dis.in: Likewise.
* cgen-ibld.in: Likewise.
* cgen-opc.c: Likewise.
* epiphany-dis.c: Likewise.
* epiphany-ibld.c: Likewise.
* fr30-dis.c: Likewise.
* fr30-ibld.c: Likewise.
* frv-dis.c: Likewise.
* frv-ibld.c: Likewise.
* ip2k-dis.c: Likewise.
* ip2k-ibld.c: Likewise.
* iq2000-dis.c: Likewise.
* iq2000-ibld.c: Likewise.
* lm32-dis.c: Likewise.
* lm32-ibld.c: Likewise.
* m32c-dis.c: Likewise.
* m32c-ibld.c: Likewise.
* m32r-dis.c: Likewise.
* m32r-ibld.c: Likewise.
* mep-dis.c: Likewise.
* mep-ibld.c: Likewise.
* mt-dis.c: Likewise.
* mt-ibld.c: Likewise.
* or1k-dis.c: Likewise.
* or1k-ibld.c: Likewise.
* xc16x-dis.c: Likewise.
* xc16x-ibld.c: Likewise.
* xstormy16-dis.c: Likewise.
* xstormy16-ibld.c: Likewise.
gas/ChangeLog:
2020-06-04 Jose E. Marchesi <jose.marchesi@oracle.com>
* cgen.c (gas_cgen_finish_insn): Pass the endianness to
cgen_put_insn_value.
(gas_cgen_md_apply_fix): Likewise.
(gas_cgen_md_apply_fix): Likewise.
* config/tc-bpf.c (md_apply_fix): Pass data endianness to
cgen_put_insn_value.
* config/tc-mep.c (mep_check_ivc2_scheduling): Pass endianness to
cgen_put_insn_value.
cpu/ChangeLog:
2020-06-02 Jose E. Marchesi <jose.marchesi@oracle.com>
* mep.opc (print_slot_insn): Pass the insn endianness to
cgen_get_insn_value.
@@ -1,3 +1,8 @@ | ||
1 | +2020-06-02 Jose E. Marchesi <jose.marchesi@oracle.com> | |
2 | + | |
3 | + * mep.opc (print_slot_insn): Pass the insn endianness to | |
4 | + cgen_get_insn_value. | |
5 | + | |
1 | 6 | 2020-05-28 Jose E. Marchesi <jose.marchesi@oracle.com> |
2 | 7 | David Faust <david.faust@oracle.com> |
3 | 8 |
@@ -1271,7 +1271,7 @@ print_slot_insn (CGEN_CPU_DESC cd, | ||
1271 | 1271 | CGEN_INSN_INT insn_value; |
1272 | 1272 | CGEN_EXTRACT_INFO ex_info; |
1273 | 1273 | |
1274 | - insn_value = cgen_get_insn_value (cd, buf, 32); | |
1274 | + insn_value = cgen_get_insn_value (cd, buf, 32, cd->insn_endian); | |
1275 | 1275 | |
1276 | 1276 | /* Fill in ex_info fields like read_insn would. Don't actually call |
1277 | 1277 | read_insn, since the incoming buffer is already read (and possibly |
@@ -1,3 +1,14 @@ | ||
1 | +2020-06-04 Jose E. Marchesi <jose.marchesi@oracle.com> | |
2 | + | |
3 | + * cgen.c (gas_cgen_finish_insn): Pass the endianness to | |
4 | + cgen_put_insn_value. | |
5 | + (gas_cgen_md_apply_fix): Likewise. | |
6 | + (gas_cgen_md_apply_fix): Likewise. | |
7 | + * config/tc-bpf.c (md_apply_fix): Pass data endianness to | |
8 | + cgen_put_insn_value. | |
9 | + * config/tc-mep.c (mep_check_ivc2_scheduling): Pass endianness to | |
10 | + cgen_put_insn_value. | |
11 | + | |
1 | 12 | 2020-06-04 Alan Modra <amodra@gmail.com> |
2 | 13 | |
3 | 14 | * testsuite/config/default.exp: Remove global directive outside |
@@ -621,7 +621,8 @@ gas_cgen_finish_insn (const CGEN_INSN *insn, CGEN_INSN_BYTES_PTR buf, | ||
621 | 621 | /* If we're recording insns as numbers (rather than a string of bytes), |
622 | 622 | target byte order handling is deferred until now. */ |
623 | 623 | #if CGEN_INT_INSN_P |
624 | - cgen_put_insn_value (gas_cgen_cpu_desc, (unsigned char *) f, length, *buf); | |
624 | + cgen_put_insn_value (gas_cgen_cpu_desc, (unsigned char *) f, length, *buf, | |
625 | + gas_cgen_cpu_desc->insn_endian); | |
625 | 626 | #else |
626 | 627 | memcpy (f, buf, byte_len); |
627 | 628 | #endif |
@@ -906,13 +907,15 @@ gas_cgen_md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) | ||
906 | 907 | { |
907 | 908 | CGEN_INSN_INT insn_value = |
908 | 909 | cgen_get_insn_value (cd, (unsigned char *) where, |
909 | - CGEN_INSN_BITSIZE (insn)); | |
910 | + CGEN_INSN_BITSIZE (insn), | |
911 | + cd->insn_endian); | |
910 | 912 | |
911 | 913 | /* ??? 0 is passed for `pc'. */ |
912 | 914 | errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields, |
913 | 915 | &insn_value, (bfd_vma) 0); |
914 | 916 | cgen_put_insn_value (cd, (unsigned char *) where, |
915 | - CGEN_INSN_BITSIZE (insn), insn_value); | |
917 | + CGEN_INSN_BITSIZE (insn), insn_value, | |
918 | + cd->insn_endian); | |
916 | 919 | } |
917 | 920 | #else |
918 | 921 | /* ??? 0 is passed for `pc'. */ |
@@ -324,7 +324,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) | ||
324 | 324 | this code is executed only once per instruction. */ |
325 | 325 | where = fixP->fx_frag->fr_literal + fixP->fx_where; |
326 | 326 | cgen_put_insn_value (gas_cgen_cpu_desc, (unsigned char *) where + 1, 8, |
327 | - target_big_endian ? 0x01 : 0x10); | |
327 | + target_big_endian ? 0x01 : 0x10, | |
328 | + gas_cgen_cpu_desc->endian); | |
328 | 329 | /* Fallthrough. */ |
329 | 330 | case BPF_OPERAND_DISP16: |
330 | 331 | /* The PC-relative displacement fields in jump instructions |
@@ -1111,7 +1111,7 @@ mep_check_ivc2_scheduling (void) | ||
1111 | 1111 | |
1112 | 1112 | #if CGEN_INT_INSN_P |
1113 | 1113 | cgen_put_insn_value (gas_cgen_cpu_desc, (unsigned char *) temp, 32, |
1114 | - m->buffer[0]); | |
1114 | + m->buffer[0], gas_cgen_cpu_desc->insn_endian); | |
1115 | 1115 | #else |
1116 | 1116 | memcpy (temp, m->buffer, byte_len); |
1117 | 1117 | #endif |
@@ -1,3 +1,8 @@ | ||
1 | +2020-06-04 Jose E. Marchesi <jose.marchesi@oracle.com> | |
2 | + | |
3 | + * opcode/cgen.h: Get an `endian' argument in both | |
4 | + cgen_get_insn_value and cgen_put_insn_value. | |
5 | + | |
1 | 6 | 2020-06-04 Jose E. Marchesi <jemarch@gnu.org> |
2 | 7 | |
3 | 8 | * opcode/cgen.h (enum cgen_cpu_open_arg): New value |
@@ -1463,9 +1463,9 @@ extern const CGEN_INSN * cgen_lookup_get_insn_operands | ||
1463 | 1463 | /* Cover fns to bfd_get/set. */ |
1464 | 1464 | |
1465 | 1465 | extern CGEN_INSN_INT cgen_get_insn_value |
1466 | - (CGEN_CPU_DESC, unsigned char *, int); | |
1466 | + (CGEN_CPU_DESC, unsigned char *, int, int); | |
1467 | 1467 | extern void cgen_put_insn_value |
1468 | - (CGEN_CPU_DESC, unsigned char *, int, CGEN_INSN_INT); | |
1468 | + (CGEN_CPU_DESC, unsigned char *, int, CGEN_INSN_INT, int); | |
1469 | 1469 | |
1470 | 1470 | extern CGEN_INSN_INT cgen_get_base_insn_value |
1471 | 1471 | (CGEN_CPU_DESC, unsigned char *, int); |
@@ -1,3 +1,46 @@ | ||
1 | +2020-06-03 Jose E. Marchesi <jose.marchesi@oracle.com> | |
2 | + | |
3 | + * cgen-opc.c (cgen_get_insn_value): Get an `endian' argument. | |
4 | + (cgen_put_insn_value): Likewise. | |
5 | + (cgen_lookup_insn): Pass endianness to cgen_{get,put}_insn_value. | |
6 | + * cgen-dis.in (print_insn): Likewise. | |
7 | + * cgen-ibld.in (insert_1): Likewise. | |
8 | + (insert_1): Likewise. | |
9 | + (insert_insn_normal): Likewise. | |
10 | + (extract_1): Likewise. | |
11 | + * bpf-dis.c: Regenerate. | |
12 | + * bpf-ibld.c: Likewise. | |
13 | + * bpf-ibld.c: Likewise. | |
14 | + * cgen-dis.in: Likewise. | |
15 | + * cgen-ibld.in: Likewise. | |
16 | + * cgen-opc.c: Likewise. | |
17 | + * epiphany-dis.c: Likewise. | |
18 | + * epiphany-ibld.c: Likewise. | |
19 | + * fr30-dis.c: Likewise. | |
20 | + * fr30-ibld.c: Likewise. | |
21 | + * frv-dis.c: Likewise. | |
22 | + * frv-ibld.c: Likewise. | |
23 | + * ip2k-dis.c: Likewise. | |
24 | + * ip2k-ibld.c: Likewise. | |
25 | + * iq2000-dis.c: Likewise. | |
26 | + * iq2000-ibld.c: Likewise. | |
27 | + * lm32-dis.c: Likewise. | |
28 | + * lm32-ibld.c: Likewise. | |
29 | + * m32c-dis.c: Likewise. | |
30 | + * m32c-ibld.c: Likewise. | |
31 | + * m32r-dis.c: Likewise. | |
32 | + * m32r-ibld.c: Likewise. | |
33 | + * mep-dis.c: Likewise. | |
34 | + * mep-ibld.c: Likewise. | |
35 | + * mt-dis.c: Likewise. | |
36 | + * mt-ibld.c: Likewise. | |
37 | + * or1k-dis.c: Likewise. | |
38 | + * or1k-ibld.c: Likewise. | |
39 | + * xc16x-dis.c: Likewise. | |
40 | + * xc16x-ibld.c: Likewise. | |
41 | + * xstormy16-dis.c: Likewise. | |
42 | + * xstormy16-ibld.c: Likewise. | |
43 | + | |
1 | 44 | 2020-06-04 Jose E. Marchesi <jemarch@gnu.org> |
2 | 45 | |
3 | 46 | * cgen-dis.in (cpu_desc_list): New field `insn_endian'. |
@@ -376,7 +376,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
376 | 376 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
377 | 377 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
378 | 378 | cd->base_insn_bitsize : buflen * 8; |
379 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
379 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
380 | 380 | |
381 | 381 | |
382 | 382 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -210,7 +210,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
210 | 210 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
211 | 211 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
212 | 212 | cd->base_insn_bitsize : buflen * 8; |
213 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
213 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
214 | 214 | |
215 | 215 | |
216 | 216 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -87,7 +87,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
87 | 87 | unsigned long x,mask; |
88 | 88 | int shift; |
89 | 89 | |
90 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
90 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
91 | 91 | |
92 | 92 | /* Written this way to avoid undefined behaviour. */ |
93 | 93 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -97,7 +97,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
97 | 97 | shift = (word_length - (start + length)); |
98 | 98 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
99 | 99 | |
100 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
100 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
101 | 101 | } |
102 | 102 | |
103 | 103 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -268,8 +268,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
268 | 268 | #else |
269 | 269 | |
270 | 270 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
271 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
272 | - value); | |
271 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
272 | + value, cd->insn_endian); | |
273 | 273 | |
274 | 274 | #endif /* ! CGEN_INT_INSN_P */ |
275 | 275 |
@@ -386,7 +386,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
386 | 386 | unsigned long x; |
387 | 387 | int shift; |
388 | 388 | |
389 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
389 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
390 | 390 | |
391 | 391 | if (CGEN_INSN_LSB0_P) |
392 | 392 | shift = (start + 1) - length; |
@@ -357,9 +357,10 @@ cgen_macro_insn_count (CGEN_CPU_DESC cd) | ||
357 | 357 | /* Cover function to read and properly byteswap an insn value. */ |
358 | 358 | |
359 | 359 | CGEN_INSN_INT |
360 | -cgen_get_insn_value (CGEN_CPU_DESC cd, unsigned char *buf, int length) | |
360 | +cgen_get_insn_value (CGEN_CPU_DESC cd, unsigned char *buf, int length, | |
361 | + int endian) | |
361 | 362 | { |
362 | - int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG); | |
363 | + int big_p = (endian == CGEN_ENDIAN_BIG); | |
363 | 364 | int insn_chunk_bitsize = cd->insn_chunk_bitsize; |
364 | 365 | CGEN_INSN_INT value = 0; |
365 | 366 |
@@ -385,7 +386,7 @@ cgen_get_insn_value (CGEN_CPU_DESC cd, unsigned char *buf, int length) | ||
385 | 386 | } |
386 | 387 | else |
387 | 388 | { |
388 | - value = bfd_get_bits (buf, length, cd->insn_endian == CGEN_ENDIAN_BIG); | |
389 | + value = bfd_get_bits (buf, length, endian == CGEN_ENDIAN_BIG); | |
389 | 390 | } |
390 | 391 | |
391 | 392 | return value; |
@@ -397,9 +398,10 @@ void | ||
397 | 398 | cgen_put_insn_value (CGEN_CPU_DESC cd, |
398 | 399 | unsigned char *buf, |
399 | 400 | int length, |
400 | - CGEN_INSN_INT value) | |
401 | + CGEN_INSN_INT value, | |
402 | + int endian) | |
401 | 403 | { |
402 | - int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG); | |
404 | + int big_p = (endian == CGEN_ENDIAN_BIG); | |
403 | 405 | int insn_chunk_bitsize = cd->insn_chunk_bitsize; |
404 | 406 | |
405 | 407 | if (insn_chunk_bitsize != 0 && insn_chunk_bitsize < length) |
@@ -459,7 +461,8 @@ cgen_lookup_insn (CGEN_CPU_DESC cd, | ||
459 | 461 | { |
460 | 462 | info = NULL; |
461 | 463 | insn_bytes_value = (unsigned char *) xmalloc (cd->max_insn_bitsize / 8); |
462 | - cgen_put_insn_value (cd, insn_bytes_value, length, insn_int_value); | |
464 | + cgen_put_insn_value (cd, insn_bytes_value, length, insn_int_value, | |
465 | + cd->insn_endian); | |
463 | 466 | } |
464 | 467 | else |
465 | 468 | { |
@@ -467,7 +470,8 @@ cgen_lookup_insn (CGEN_CPU_DESC cd, | ||
467 | 470 | ex_info.dis_info = NULL; |
468 | 471 | ex_info.insn_bytes = insn_bytes_value; |
469 | 472 | ex_info.valid = -1; |
470 | - insn_int_value = cgen_get_insn_value (cd, insn_bytes_value, length); | |
473 | + insn_int_value = cgen_get_insn_value (cd, insn_bytes_value, length, | |
474 | + cd->insn_endian); | |
471 | 475 | } |
472 | 476 | |
473 | 477 | if (!insn) |
@@ -451,7 +451,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
451 | 451 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
452 | 452 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
453 | 453 | cd->base_insn_bitsize : buflen * 8; |
454 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
454 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
455 | 455 | |
456 | 456 | |
457 | 457 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -472,7 +472,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
472 | 472 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
473 | 473 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
474 | 474 | cd->base_insn_bitsize : buflen * 8; |
475 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
475 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
476 | 476 | |
477 | 477 | |
478 | 478 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -569,7 +569,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
569 | 569 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
570 | 570 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
571 | 571 | cd->base_insn_bitsize : buflen * 8; |
572 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
572 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
573 | 573 | |
574 | 574 | |
575 | 575 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -461,7 +461,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
461 | 461 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
462 | 462 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
463 | 463 | cd->base_insn_bitsize : buflen * 8; |
464 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
464 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
465 | 465 | |
466 | 466 | |
467 | 467 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -362,7 +362,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
362 | 362 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
363 | 363 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
364 | 364 | cd->base_insn_bitsize : buflen * 8; |
365 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
365 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
366 | 366 | |
367 | 367 | |
368 | 368 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -320,7 +320,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
320 | 320 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
321 | 321 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
322 | 322 | cd->base_insn_bitsize : buflen * 8; |
323 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
323 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
324 | 324 | |
325 | 325 | |
326 | 326 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -1064,7 +1064,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
1064 | 1064 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
1065 | 1065 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
1066 | 1066 | cd->base_insn_bitsize : buflen * 8; |
1067 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
1067 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
1068 | 1068 | |
1069 | 1069 | |
1070 | 1070 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -452,7 +452,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
452 | 452 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
453 | 453 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
454 | 454 | cd->base_insn_bitsize : buflen * 8; |
455 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
455 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
456 | 456 | |
457 | 457 | |
458 | 458 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -467,7 +467,7 @@ print_slot_insn (CGEN_CPU_DESC cd, | ||
467 | 467 | CGEN_INSN_INT insn_value; |
468 | 468 | CGEN_EXTRACT_INFO ex_info; |
469 | 469 | |
470 | - insn_value = cgen_get_insn_value (cd, buf, 32); | |
470 | + insn_value = cgen_get_insn_value (cd, buf, 32, cd->insn_endian); | |
471 | 471 | |
472 | 472 | /* Fill in ex_info fields like read_insn would. Don't actually call |
473 | 473 | read_insn, since the incoming buffer is already read (and possibly |
@@ -1360,7 +1360,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
1360 | 1360 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
1361 | 1361 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
1362 | 1362 | cd->base_insn_bitsize : buflen * 8; |
1363 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
1363 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
1364 | 1364 | |
1365 | 1365 | |
1366 | 1366 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -463,7 +463,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
463 | 463 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
464 | 464 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
465 | 465 | cd->base_insn_bitsize : buflen * 8; |
466 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
466 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
467 | 467 | |
468 | 468 | |
469 | 469 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -347,7 +347,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
347 | 347 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
348 | 348 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
349 | 349 | cd->base_insn_bitsize : buflen * 8; |
350 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
350 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
351 | 351 | |
352 | 352 | |
353 | 353 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -593,7 +593,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
593 | 593 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
594 | 594 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
595 | 595 | cd->base_insn_bitsize : buflen * 8; |
596 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
596 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
597 | 597 | |
598 | 598 | |
599 | 599 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |
@@ -341,7 +341,7 @@ print_insn (CGEN_CPU_DESC cd, | ||
341 | 341 | /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */ |
342 | 342 | basesize = cd->base_insn_bitsize < buflen * 8 ? |
343 | 343 | cd->base_insn_bitsize : buflen * 8; |
344 | - insn_value = cgen_get_insn_value (cd, buf, basesize); | |
344 | + insn_value = cgen_get_insn_value (cd, buf, basesize, cd->insn_endian); | |
345 | 345 | |
346 | 346 | |
347 | 347 | /* Fill in ex_info fields like read_insn would. Don't actually call |
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
88 | 88 | unsigned long x,mask; |
89 | 89 | int shift; |
90 | 90 | |
91 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
91 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
92 | 92 | |
93 | 93 | /* Written this way to avoid undefined behaviour. */ |
94 | 94 | mask = (((1L << (length - 1)) - 1) << 1) | 1; |
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd, | ||
98 | 98 | shift = (word_length - (start + length)); |
99 | 99 | x = (x & ~(mask << shift)) | ((value & mask) << shift); |
100 | 100 | |
101 | - cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x); | |
101 | + cgen_put_insn_value (cd, bufp, word_length, (bfd_vma) x, cd->endian); | |
102 | 102 | } |
103 | 103 | |
104 | 104 | #endif /* ! CGEN_INT_INSN_P */ |
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd, | ||
269 | 269 | #else |
270 | 270 | |
271 | 271 | cgen_put_insn_value (cd, buffer, min ((unsigned) cd->base_insn_bitsize, |
272 | - (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | - value); | |
272 | + (unsigned) CGEN_FIELDS_BITSIZE (fields)), | |
273 | + value, cd->insn_endian); | |
274 | 274 | |
275 | 275 | #endif /* ! CGEN_INT_INSN_P */ |
276 | 276 |
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd, | ||
387 | 387 | unsigned long x; |
388 | 388 | int shift; |
389 | 389 | |
390 | - x = cgen_get_insn_value (cd, bufp, word_length); | |
390 | + x = cgen_get_insn_value (cd, bufp, word_length, cd->endian); | |
391 | 391 | |
392 | 392 | if (CGEN_INSN_LSB0_P) |
393 | 393 | shift = (start + 1) - length; |