aboutsummaryrefslogtreecommitdiff
path: root/gdb/m32c-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/m32c-tdep.c')
-rw-r--r--gdb/m32c-tdep.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 9eb7257..c2a2f25 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2003,6 +2003,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
CORE_ADDR struct_addr)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
CORE_ADDR cfa;
int i;
@@ -2040,7 +2041,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
int ptr_len = TYPE_LENGTH (tdep->ptr_voyd);
sp -= ptr_len;
- write_memory_unsigned_integer (sp, ptr_len, struct_addr);
+ write_memory_unsigned_integer (sp, ptr_len, byte_order, struct_addr);
}
/* Push the arguments. */
@@ -2061,7 +2062,8 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sure it ends up in the least significant end of r1. (GDB
should avoid assuming endianness, even on uni-endian
processors.) */
- ULONGEST u = extract_unsigned_integer (arg_bits, arg_size);
+ ULONGEST u = extract_unsigned_integer (arg_bits, arg_size,
+ byte_order);
struct m32c_reg *reg = (mach == bfd_mach_m16c) ? tdep->r1 : tdep->r0;
regcache_cooked_write_unsigned (regcache, reg->num, u);
}
@@ -2092,7 +2094,8 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Push the return address. */
sp -= tdep->ret_addr_bytes;
- write_memory_unsigned_integer (sp, tdep->ret_addr_bytes, bp_addr);
+ write_memory_unsigned_integer (sp, tdep->ret_addr_bytes, byte_order,
+ bp_addr);
/* Update the stack pointer. */
regcache_cooked_write_unsigned (regcache, tdep->sp->num, sp);
@@ -2178,6 +2181,7 @@ m32c_return_value (struct gdbarch *gdbarch,
const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum return_value_convention conv;
ULONGEST valtype_len = TYPE_LENGTH (valtype);
@@ -2200,7 +2204,7 @@ m32c_return_value (struct gdbarch *gdbarch,
{
ULONGEST u;
regcache_cooked_read_unsigned (regcache, tdep->r0->num, &u);
- store_unsigned_integer (readbuf, valtype_len, u);
+ store_unsigned_integer (readbuf, valtype_len, byte_order, u);
}
else
{
@@ -2230,7 +2234,8 @@ m32c_return_value (struct gdbarch *gdbarch,
/* Anything that fits in r0 is returned there. */
if (valtype_len <= TYPE_LENGTH (tdep->r0->type))
{
- ULONGEST u = extract_unsigned_integer (writebuf, valtype_len);
+ ULONGEST u = extract_unsigned_integer (writebuf, valtype_len,
+ byte_order);
regcache_cooked_write_unsigned (regcache, tdep->r0->num, u);
}
else
@@ -2306,7 +2311,9 @@ m32c_return_value (struct gdbarch *gdbarch,
static CORE_ADDR
m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
+ struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* It would be nicer to simply look up the addresses of known
trampolines once, and then compare stop_pc with them. However,
@@ -2329,13 +2336,14 @@ m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc)
m32c_jsri*16*. */
CORE_ADDR sp = get_frame_sp (get_current_frame ());
CORE_ADDR target
- = read_memory_unsigned_integer (sp + tdep->ret_addr_bytes, 2);
+ = read_memory_unsigned_integer (sp + tdep->ret_addr_bytes,
+ 2, byte_order);
/* What we have now is the address of a jump instruction.
What we need is the destination of that jump.
The opcode is 1 byte, and the destination is the next 3 bytes.
*/
- target = read_memory_unsigned_integer (target + 1, 3);
+ target = read_memory_unsigned_integer (target + 1, 3, byte_order);
return target;
}
}
@@ -2403,6 +2411,7 @@ static void
m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
struct type *type, gdb_byte *buf, CORE_ADDR addr)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target_code;
gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR ||
TYPE_CODE (type) == TYPE_CODE_REF);
@@ -2444,7 +2453,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
addr = SYMBOL_VALUE_ADDRESS (tramp_msym);
}
- store_unsigned_integer (buf, TYPE_LENGTH (type), addr);
+ store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
}
@@ -2452,13 +2461,14 @@ static CORE_ADDR
m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR ptr;
enum type_code target_code;
gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR ||
TYPE_CODE (type) == TYPE_CODE_REF);
- ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
+ ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
target_code = TYPE_CODE (TYPE_TARGET_TYPE (type));