s390_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, gdb_byte *buf)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
switch (regnum)
{
case S390_PC_REGNUM:
regcache_raw_read_unsigned (regcache, S390_PSWA_REGNUM, &val);
- store_unsigned_integer (buf, 4, val & 0x7fffffff);
+ store_unsigned_integer (buf, 4, byte_order, val & 0x7fffffff);
break;
case S390_CC_REGNUM:
regcache_raw_read_unsigned (regcache, S390_PSWM_REGNUM, &val);
- store_unsigned_integer (buf, 4, (val >> 12) & 3);
+ store_unsigned_integer (buf, 4, byte_order, (val >> 12) & 3);
break;
default:
s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val, psw;
switch (regnum)
{
case S390_PC_REGNUM:
- val = extract_unsigned_integer (buf, 4);
+ val = extract_unsigned_integer (buf, 4, byte_order);
regcache_raw_read_unsigned (regcache, S390_PSWA_REGNUM, &psw);
psw = (psw & 0x80000000) | (val & 0x7fffffff);
regcache_raw_write_unsigned (regcache, S390_PSWA_REGNUM, psw);
break;
case S390_CC_REGNUM:
- val = extract_unsigned_integer (buf, 4);
+ val = extract_unsigned_integer (buf, 4, byte_order);
regcache_raw_read_unsigned (regcache, S390_PSWM_REGNUM, &psw);
psw = (psw & ~((ULONGEST)3 << 12)) | ((val & 3) << 12);
regcache_raw_write_unsigned (regcache, S390_PSWM_REGNUM, psw);
s390x_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, gdb_byte *buf)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val;
switch (regnum)
case S390_CC_REGNUM:
regcache_raw_read_unsigned (regcache, S390_PSWM_REGNUM, &val);
- store_unsigned_integer (buf, 4, (val >> 44) & 3);
+ store_unsigned_integer (buf, 4, byte_order, (val >> 44) & 3);
break;
default:
s390x_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val, psw;
switch (regnum)
break;
case S390_CC_REGNUM:
- val = extract_unsigned_integer (buf, 4);
+ val = extract_unsigned_integer (buf, 4, byte_order);
regcache_raw_read_unsigned (regcache, S390_PSWM_REGNUM, &psw);
psw = (psw & ~((ULONGEST)3 << 44)) | ((val & 3) << 44);
regcache_raw_write_unsigned (regcache, S390_PSWM_REGNUM, psw);
/* The stack. */
struct pv_area *stack;
- /* The size of a GPR or FPR. */
+ /* The size and byte-order of a GPR or FPR. */
int gpr_size;
int fpr_size;
+ enum bfd_endian byte_order;
/* The general-purpose registers. */
pv_t gpr[S390_NUM_GPRS];
if (secp != NULL
&& (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)
& SEC_READONLY))
- return pv_constant (read_memory_integer (addr.k, size));
+ return pv_constant (read_memory_integer (addr.k, size,
+ data->byte_order));
}
/* Check whether we are accessing one of our save slots. */
(i.e. when running a 32-bit binary under a 64-bit kernel). */
data->gpr_size = word_size;
data->fpr_size = 8;
+ data->byte_order = gdbarch_byte_order (gdbarch);
for (i = 0; i < S390_NUM_GPRS; i++)
data->gpr[i] = pv_register (S390_R0_REGNUM + i, 0);
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR backchain;
ULONGEST reg;
LONGEST sp;
/* Get the backchain. */
reg = get_frame_register_unsigned (this_frame, S390_SP_REGNUM);
- backchain = read_memory_unsigned_integer (reg, word_size);
+ backchain = read_memory_unsigned_integer (reg, word_size, byte_order);
/* A zero backchain terminates the frame chain. As additional
sanity check, let's verify that the spill slot for SP in the
save area pointed to by the backchain in fact links back to
the save area. */
if (backchain != 0
- && safe_read_memory_integer (backchain + 15*word_size, word_size, &sp)
+ && safe_read_memory_integer (backchain + 15*word_size,
+ word_size, byte_order, &sp)
&& (CORE_ADDR)sp == backchain)
{
/* We don't know which registers were saved, but it will have
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct s390_sigtramp_unwind_cache *info;
ULONGEST this_sp, prev_sp;
CORE_ADDR next_ra, next_cfa, sigreg_ptr;
pointer to sigregs */
else
{
- sigreg_ptr = read_memory_unsigned_integer (next_cfa + 8, word_size);
+ sigreg_ptr = read_memory_unsigned_integer (next_cfa + 8,
+ word_size, byte_order);
}
/* The sigregs structure looks like this:
/* Restore the previous frame's SP. */
prev_sp = read_memory_unsigned_integer (
info->saved_regs[S390_SP_REGNUM].addr,
- word_size);
+ word_size, byte_order);
/* Determine our frame base. */
info->frame_base = prev_sp + 16*word_size + 32;
/* Return ARG, a `SIMPLE_ARG', sign-extended or zero-extended to a full
word as required for the ABI. */
static LONGEST
-extend_simple_arg (struct value *arg)
+extend_simple_arg (struct gdbarch *gdbarch, struct value *arg)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct type *type = value_type (arg);
/* Even structs get passed in the least significant bits of the
an integer, but it does take care of the extension. */
if (TYPE_UNSIGNED (type))
return extract_unsigned_integer (value_contents (arg),
- TYPE_LENGTH (type));
+ TYPE_LENGTH (type), byte_order);
else
return extract_signed_integer (value_contents (arg),
- TYPE_LENGTH (type));
+ TYPE_LENGTH (type), byte_order);
}
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST orig_sp;
int i;
}
else
{
- write_memory_unsigned_integer (starg, word_size, copy_addr[i]);
+ write_memory_unsigned_integer (starg, word_size, byte_order,
+ copy_addr[i]);
starg += word_size;
}
}
{
/* Integer arguments are always extended to word size. */
regcache_cooked_write_signed (regcache, S390_R0_REGNUM + gr,
- extend_simple_arg (arg));
+ extend_simple_arg (gdbarch, arg));
gr++;
}
else
{
/* Integer arguments are always extended to word size. */
- write_memory_signed_integer (starg, word_size,
- extend_simple_arg (arg));
+ write_memory_signed_integer (starg, word_size, byte_order,
+ extend_simple_arg (gdbarch, arg));
starg += word_size;
}
}
struct type *type, struct regcache *regcache,
gdb_byte *out, const gdb_byte *in)
{
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
int length = TYPE_LENGTH (type);
enum return_value_convention rvc =
/* Integer arguments are always extended to word size. */
if (TYPE_UNSIGNED (type))
regcache_cooked_write_unsigned (regcache, S390_R2_REGNUM,
- extract_unsigned_integer (in, length));
+ extract_unsigned_integer (in, length, byte_order));
else
regcache_cooked_write_signed (regcache, S390_R2_REGNUM,
- extract_signed_integer (in, length));
+ extract_signed_integer (in, length, byte_order));
}
else if (length == 2*word_size)
{