• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisãoe9bffec9afc45cf7c49308f0b4b8cc6bf68f58f2 (tree)
Hora2020-06-04 23:17:42
AutorJose E. Marchesi <jose.marchesi@orac...>
CommiterJose E. Marchesi

Mensagem de Log

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:

a) cgen_put_insn_value ;; Writes out the opcodes.
b) ARCH_cgen_insert_operand
insert_normal
insert_1
cgen_put_insn_value ;; Writes out the bytes of the
;; operand.

Likewise, the process of reading an instruction from the object file
is:

a) cgen_get_insn_value ;; Reads the opcodes.
b) ARCH_cgen_extract_operand
extract_normal
extract_1
cgen_get_insn_value ;; Reads in the bytes of the
;; operand.

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

pass the new endian argument.

* The mep port has code in mep.opc that uses cgen_{get,put}_insn_value.

It has been adapted to pass the new endianargument. Ditto for a
call in the assembler.

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.

Mudança Sumário

Diff

--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -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+
16 2020-05-28 Jose E. Marchesi <jose.marchesi@oracle.com>
27 David Faust <david.faust@oracle.com>
38
--- a/cpu/mep.opc
+++ b/cpu/mep.opc
@@ -1271,7 +1271,7 @@ print_slot_insn (CGEN_CPU_DESC cd,
12711271 CGEN_INSN_INT insn_value;
12721272 CGEN_EXTRACT_INFO ex_info;
12731273
1274- insn_value = cgen_get_insn_value (cd, buf, 32);
1274+ insn_value = cgen_get_insn_value (cd, buf, 32, cd->insn_endian);
12751275
12761276 /* Fill in ex_info fields like read_insn would. Don't actually call
12771277 read_insn, since the incoming buffer is already read (and possibly
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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+
112 2020-06-04 Alan Modra <amodra@gmail.com>
213
314 * testsuite/config/default.exp: Remove global directive outside
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -621,7 +621,8 @@ gas_cgen_finish_insn (const CGEN_INSN *insn, CGEN_INSN_BYTES_PTR buf,
621621 /* If we're recording insns as numbers (rather than a string of bytes),
622622 target byte order handling is deferred until now. */
623623 #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);
625626 #else
626627 memcpy (f, buf, byte_len);
627628 #endif
@@ -906,13 +907,15 @@ gas_cgen_md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
906907 {
907908 CGEN_INSN_INT insn_value =
908909 cgen_get_insn_value (cd, (unsigned char *) where,
909- CGEN_INSN_BITSIZE (insn));
910+ CGEN_INSN_BITSIZE (insn),
911+ cd->insn_endian);
910912
911913 /* ??? 0 is passed for `pc'. */
912914 errmsg = CGEN_CPU_INSERT_OPERAND (cd) (cd, opindex, fields,
913915 &insn_value, (bfd_vma) 0);
914916 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);
916919 }
917920 #else
918921 /* ??? 0 is passed for `pc'. */
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -324,7 +324,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
324324 this code is executed only once per instruction. */
325325 where = fixP->fx_frag->fr_literal + fixP->fx_where;
326326 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);
328329 /* Fallthrough. */
329330 case BPF_OPERAND_DISP16:
330331 /* The PC-relative displacement fields in jump instructions
--- a/gas/config/tc-mep.c
+++ b/gas/config/tc-mep.c
@@ -1111,7 +1111,7 @@ mep_check_ivc2_scheduling (void)
11111111
11121112 #if CGEN_INT_INSN_P
11131113 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);
11151115 #else
11161116 memcpy (temp, m->buffer, byte_len);
11171117 #endif
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -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+
16 2020-06-04 Jose E. Marchesi <jemarch@gnu.org>
27
38 * opcode/cgen.h (enum cgen_cpu_open_arg): New value
--- a/include/opcode/cgen.h
+++ b/include/opcode/cgen.h
@@ -1463,9 +1463,9 @@ extern const CGEN_INSN * cgen_lookup_get_insn_operands
14631463 /* Cover fns to bfd_get/set. */
14641464
14651465 extern CGEN_INSN_INT cgen_get_insn_value
1466- (CGEN_CPU_DESC, unsigned char *, int);
1466+ (CGEN_CPU_DESC, unsigned char *, int, int);
14671467 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);
14691469
14701470 extern CGEN_INSN_INT cgen_get_base_insn_value
14711471 (CGEN_CPU_DESC, unsigned char *, int);
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -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+
144 2020-06-04 Jose E. Marchesi <jemarch@gnu.org>
245
346 * cgen-dis.in (cpu_desc_list): New field `insn_endian'.
--- a/opcodes/bpf-dis.c
+++ b/opcodes/bpf-dis.c
@@ -376,7 +376,7 @@ print_insn (CGEN_CPU_DESC cd,
376376 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
377377 basesize = cd->base_insn_bitsize < buflen * 8 ?
378378 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);
380380
381381
382382 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/bpf-ibld.c
+++ b/opcodes/bpf-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/cgen-dis.in
+++ b/opcodes/cgen-dis.in
@@ -210,7 +210,7 @@ print_insn (CGEN_CPU_DESC cd,
210210 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
211211 basesize = cd->base_insn_bitsize < buflen * 8 ?
212212 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);
214214
215215
216216 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/cgen-ibld.in
+++ b/opcodes/cgen-ibld.in
@@ -87,7 +87,7 @@ insert_1 (CGEN_CPU_DESC cd,
8787 unsigned long x,mask;
8888 int shift;
8989
90- x = cgen_get_insn_value (cd, bufp, word_length);
90+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9191
9292 /* Written this way to avoid undefined behaviour. */
9393 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -97,7 +97,7 @@ insert_1 (CGEN_CPU_DESC cd,
9797 shift = (word_length - (start + length));
9898 x = (x & ~(mask << shift)) | ((value & mask) << shift);
9999
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);
101101 }
102102
103103 #endif /* ! CGEN_INT_INSN_P */
@@ -268,8 +268,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
268268 #else
269269
270270 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);
273273
274274 #endif /* ! CGEN_INT_INSN_P */
275275
@@ -386,7 +386,7 @@ extract_1 (CGEN_CPU_DESC cd,
386386 unsigned long x;
387387 int shift;
388388
389- x = cgen_get_insn_value (cd, bufp, word_length);
389+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
390390
391391 if (CGEN_INSN_LSB0_P)
392392 shift = (start + 1) - length;
--- a/opcodes/cgen-opc.c
+++ b/opcodes/cgen-opc.c
@@ -357,9 +357,10 @@ cgen_macro_insn_count (CGEN_CPU_DESC cd)
357357 /* Cover function to read and properly byteswap an insn value. */
358358
359359 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)
361362 {
362- int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG);
363+ int big_p = (endian == CGEN_ENDIAN_BIG);
363364 int insn_chunk_bitsize = cd->insn_chunk_bitsize;
364365 CGEN_INSN_INT value = 0;
365366
@@ -385,7 +386,7 @@ cgen_get_insn_value (CGEN_CPU_DESC cd, unsigned char *buf, int length)
385386 }
386387 else
387388 {
388- value = bfd_get_bits (buf, length, cd->insn_endian == CGEN_ENDIAN_BIG);
389+ value = bfd_get_bits (buf, length, endian == CGEN_ENDIAN_BIG);
389390 }
390391
391392 return value;
@@ -397,9 +398,10 @@ void
397398 cgen_put_insn_value (CGEN_CPU_DESC cd,
398399 unsigned char *buf,
399400 int length,
400- CGEN_INSN_INT value)
401+ CGEN_INSN_INT value,
402+ int endian)
401403 {
402- int big_p = (cd->insn_endian == CGEN_ENDIAN_BIG);
404+ int big_p = (endian == CGEN_ENDIAN_BIG);
403405 int insn_chunk_bitsize = cd->insn_chunk_bitsize;
404406
405407 if (insn_chunk_bitsize != 0 && insn_chunk_bitsize < length)
@@ -459,7 +461,8 @@ cgen_lookup_insn (CGEN_CPU_DESC cd,
459461 {
460462 info = NULL;
461463 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);
463466 }
464467 else
465468 {
@@ -467,7 +470,8 @@ cgen_lookup_insn (CGEN_CPU_DESC cd,
467470 ex_info.dis_info = NULL;
468471 ex_info.insn_bytes = insn_bytes_value;
469472 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);
471475 }
472476
473477 if (!insn)
--- a/opcodes/epiphany-dis.c
+++ b/opcodes/epiphany-dis.c
@@ -451,7 +451,7 @@ print_insn (CGEN_CPU_DESC cd,
451451 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
452452 basesize = cd->base_insn_bitsize < buflen * 8 ?
453453 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);
455455
456456
457457 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/epiphany-ibld.c
+++ b/opcodes/epiphany-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/fr30-dis.c
+++ b/opcodes/fr30-dis.c
@@ -472,7 +472,7 @@ print_insn (CGEN_CPU_DESC cd,
472472 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
473473 basesize = cd->base_insn_bitsize < buflen * 8 ?
474474 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);
476476
477477
478478 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/fr30-ibld.c
+++ b/opcodes/fr30-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/frv-dis.c
+++ b/opcodes/frv-dis.c
@@ -569,7 +569,7 @@ print_insn (CGEN_CPU_DESC cd,
569569 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
570570 basesize = cd->base_insn_bitsize < buflen * 8 ?
571571 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);
573573
574574
575575 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/frv-ibld.c
+++ b/opcodes/frv-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/ip2k-dis.c
+++ b/opcodes/ip2k-dis.c
@@ -461,7 +461,7 @@ print_insn (CGEN_CPU_DESC cd,
461461 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
462462 basesize = cd->base_insn_bitsize < buflen * 8 ?
463463 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);
465465
466466
467467 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/ip2k-ibld.c
+++ b/opcodes/ip2k-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/iq2000-dis.c
+++ b/opcodes/iq2000-dis.c
@@ -362,7 +362,7 @@ print_insn (CGEN_CPU_DESC cd,
362362 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
363363 basesize = cd->base_insn_bitsize < buflen * 8 ?
364364 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);
366366
367367
368368 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/iq2000-ibld.c
+++ b/opcodes/iq2000-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/lm32-dis.c
+++ b/opcodes/lm32-dis.c
@@ -320,7 +320,7 @@ print_insn (CGEN_CPU_DESC cd,
320320 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
321321 basesize = cd->base_insn_bitsize < buflen * 8 ?
322322 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);
324324
325325
326326 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/lm32-ibld.c
+++ b/opcodes/lm32-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/m32c-dis.c
+++ b/opcodes/m32c-dis.c
@@ -1064,7 +1064,7 @@ print_insn (CGEN_CPU_DESC cd,
10641064 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
10651065 basesize = cd->base_insn_bitsize < buflen * 8 ?
10661066 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);
10681068
10691069
10701070 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/m32c-ibld.c
+++ b/opcodes/m32c-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/m32r-dis.c
+++ b/opcodes/m32r-dis.c
@@ -452,7 +452,7 @@ print_insn (CGEN_CPU_DESC cd,
452452 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
453453 basesize = cd->base_insn_bitsize < buflen * 8 ?
454454 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);
456456
457457
458458 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/m32r-ibld.c
+++ b/opcodes/m32r-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/mep-dis.c
+++ b/opcodes/mep-dis.c
@@ -467,7 +467,7 @@ print_slot_insn (CGEN_CPU_DESC cd,
467467 CGEN_INSN_INT insn_value;
468468 CGEN_EXTRACT_INFO ex_info;
469469
470- insn_value = cgen_get_insn_value (cd, buf, 32);
470+ insn_value = cgen_get_insn_value (cd, buf, 32, cd->insn_endian);
471471
472472 /* Fill in ex_info fields like read_insn would. Don't actually call
473473 read_insn, since the incoming buffer is already read (and possibly
@@ -1360,7 +1360,7 @@ print_insn (CGEN_CPU_DESC cd,
13601360 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
13611361 basesize = cd->base_insn_bitsize < buflen * 8 ?
13621362 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);
13641364
13651365
13661366 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/mep-ibld.c
+++ b/opcodes/mep-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/mt-dis.c
+++ b/opcodes/mt-dis.c
@@ -463,7 +463,7 @@ print_insn (CGEN_CPU_DESC cd,
463463 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
464464 basesize = cd->base_insn_bitsize < buflen * 8 ?
465465 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);
467467
468468
469469 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/mt-ibld.c
+++ b/opcodes/mt-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/or1k-dis.c
+++ b/opcodes/or1k-dis.c
@@ -347,7 +347,7 @@ print_insn (CGEN_CPU_DESC cd,
347347 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
348348 basesize = cd->base_insn_bitsize < buflen * 8 ?
349349 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);
351351
352352
353353 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/or1k-ibld.c
+++ b/opcodes/or1k-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/xc16x-dis.c
+++ b/opcodes/xc16x-dis.c
@@ -593,7 +593,7 @@ print_insn (CGEN_CPU_DESC cd,
593593 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
594594 basesize = cd->base_insn_bitsize < buflen * 8 ?
595595 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);
597597
598598
599599 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/xc16x-ibld.c
+++ b/opcodes/xc16x-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;
--- a/opcodes/xstormy16-dis.c
+++ b/opcodes/xstormy16-dis.c
@@ -341,7 +341,7 @@ print_insn (CGEN_CPU_DESC cd,
341341 /* Extract base part of instruction, just in case CGEN_DIS_* uses it. */
342342 basesize = cd->base_insn_bitsize < buflen * 8 ?
343343 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);
345345
346346
347347 /* Fill in ex_info fields like read_insn would. Don't actually call
--- a/opcodes/xstormy16-ibld.c
+++ b/opcodes/xstormy16-ibld.c
@@ -88,7 +88,7 @@ insert_1 (CGEN_CPU_DESC cd,
8888 unsigned long x,mask;
8989 int shift;
9090
91- x = cgen_get_insn_value (cd, bufp, word_length);
91+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
9292
9393 /* Written this way to avoid undefined behaviour. */
9494 mask = (((1L << (length - 1)) - 1) << 1) | 1;
@@ -98,7 +98,7 @@ insert_1 (CGEN_CPU_DESC cd,
9898 shift = (word_length - (start + length));
9999 x = (x & ~(mask << shift)) | ((value & mask) << shift);
100100
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);
102102 }
103103
104104 #endif /* ! CGEN_INT_INSN_P */
@@ -269,8 +269,8 @@ insert_insn_normal (CGEN_CPU_DESC cd,
269269 #else
270270
271271 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);
274274
275275 #endif /* ! CGEN_INT_INSN_P */
276276
@@ -387,7 +387,7 @@ extract_1 (CGEN_CPU_DESC cd,
387387 unsigned long x;
388388 int shift;
389389
390- x = cgen_get_insn_value (cd, bufp, word_length);
390+ x = cgen_get_insn_value (cd, bufp, word_length, cd->endian);
391391
392392 if (CGEN_INSN_LSB0_P)
393393 shift = (start + 1) - length;