+2018-05-30 Simon Marchi <simon.marchi@ericsson.com>
+
+ * regcache.h (regcache_raw_read): Remove, update callers to use
+ readable_regcache::raw_read instead.
+ * regcache.c (regcache_raw_read): Remove.
+
2018-05-30 Simon Marchi <simon.marchi@ericsson.com>
* regcache.h (regcache_raw_update): Remove, update callers to
if (gpnum >= AMD64_NUM_LOWER_BYTE_REGS)
{
/* Read ... AH, BH, CH, DH. */
- regcache_raw_read (regcache,
- gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
+ regcache->raw_read (gpnum - AMD64_NUM_LOWER_BYTE_REGS, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf + 1, buf, 1);
/* ... Write. */
else
{
/* Read ... */
- regcache_raw_read (regcache, gpnum, raw_buf);
+ regcache->raw_read (gpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, 1);
/* ... Write. */
int gpnum = regnum - tdep->eax_regnum;
/* Read ... */
- regcache_raw_read (regcache, gpnum, raw_buf);
+ regcache->raw_read (gpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, 4);
/* ... Write. */
{
if (readbuf)
{
- regcache_raw_read (regcache, AMD64_ST0_REGNUM, readbuf);
- regcache_raw_read (regcache, AMD64_ST1_REGNUM, readbuf + 16);
+ regcache->raw_read (AMD64_ST0_REGNUM, readbuf);
+ regcache->raw_read (AMD64_ST1_REGNUM, readbuf + 16);
}
if (writebuf)
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
- regcache_raw_read (regcache, double_regnum, reg_buf);
+ regcache->raw_read (double_regnum, reg_buf);
memcpy (reg_buf + offset, buf, 4);
regcache_raw_write (regcache, double_regnum, reg_buf);
}
_("invalid register number %d"), regnum);
/* Overlay the CC bit in the ASTAT register. */
- regcache_raw_read (regcache, BFIN_ASTAT_REGNUM, buf);
+ regcache->raw_read (BFIN_ASTAT_REGNUM, buf);
buf[0] = (buf[0] & ~ASTAT_CC) | ((buffer[0] & 1) << ASTAT_CC_POS);
regcache_raw_write (regcache, BFIN_ASTAT_REGNUM, buf);
}
int byte_num = (reg - accg0_regnum) % 4;
gdb_byte buf[4];
- regcache_raw_read (regcache, raw_regnum, buf);
+ regcache->raw_read (raw_regnum, buf);
buf[byte_num] = ((bfd_byte *) buffer)[0];
regcache_raw_write (regcache, raw_regnum, buf);
}
its contents to the desired type. This is probably not
exactly how it would happen on the target itself, but it is
the best we can do. */
- regcache_raw_read (regcache, I386_ST0_REGNUM, buf);
+ regcache->raw_read (I386_ST0_REGNUM, buf);
target_float_convert (buf, i387_ext_type (gdbarch), valbuf, type);
}
else
if (len <= low_size)
{
- regcache_raw_read (regcache, LOW_RETURN_REGNUM, buf);
+ regcache->raw_read (LOW_RETURN_REGNUM, buf);
memcpy (valbuf, buf, len);
}
else if (len <= (low_size + high_size))
{
- regcache_raw_read (regcache, LOW_RETURN_REGNUM, buf);
+ regcache->raw_read (LOW_RETURN_REGNUM, buf);
memcpy (valbuf, buf, low_size);
- regcache_raw_read (regcache, HIGH_RETURN_REGNUM, buf);
+ regcache->raw_read (HIGH_RETURN_REGNUM, buf);
memcpy (valbuf + low_size, buf, len - low_size);
}
else
int fpnum = i386_mmx_regnum_to_fp_regnum (regcache, regnum);
/* Read ... */
- regcache_raw_read (regcache, fpnum, raw_buf);
+ regcache->raw_read (fpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, register_size (gdbarch, regnum));
/* ... Write. */
upper = extract_unsigned_integer (buf + size, size, byte_order);
/* Fetching register buffer. */
- regcache_raw_read (regcache,
- I387_BND0R_REGNUM (tdep) + regnum,
- raw_buf);
+ regcache->raw_read (I387_BND0R_REGNUM (tdep) + regnum,
+ raw_buf);
upper = ~upper;
int gpnum = regnum - tdep->ax_regnum;
/* Read ... */
- regcache_raw_read (regcache, gpnum, raw_buf);
+ regcache->raw_read (gpnum, raw_buf);
/* ... Modify ... (always little endian). */
memcpy (raw_buf, buf, 2);
/* ... Write. */
int gpnum = regnum - tdep->al_regnum;
/* Read ... We read both lower and upper registers. */
- regcache_raw_read (regcache, gpnum % 4, raw_buf);
+ regcache->raw_read (gpnum % 4, raw_buf);
/* ... Modify ... (always little endian). */
if (gpnum >= 4)
memcpy (raw_buf + 1, buf, 1);
{
gdb_byte buf[M68HC11_REG_SIZE];
- regcache_raw_read (regcache, HARD_D_REGNUM, buf);
+ regcache->raw_read (HARD_D_REGNUM, buf);
switch (TYPE_LENGTH (type))
{
case 1:
case 3:
memcpy ((char*) valbuf + 1, buf, 2);
- regcache_raw_read (regcache, HARD_X_REGNUM, buf);
+ regcache->raw_read (HARD_X_REGNUM, buf);
memcpy (valbuf, buf + 1, 1);
break;
case 4:
memcpy ((char*) valbuf + 2, buf, 2);
- regcache_raw_read (regcache, HARD_X_REGNUM, buf);
+ regcache->raw_read (HARD_X_REGNUM, buf);
memcpy (valbuf, buf, 2);
break;
if (len <= 4)
{
- regcache_raw_read (regcache, M68K_D0_REGNUM, buf);
+ regcache->raw_read (M68K_D0_REGNUM, buf);
memcpy (valbuf, buf + (4 - len), len);
}
else if (len <= 8)
{
- regcache_raw_read (regcache, M68K_D0_REGNUM, buf);
+ regcache->raw_read (M68K_D0_REGNUM, buf);
memcpy (valbuf, buf + (8 - len), len - 4);
- regcache_raw_read (regcache, M68K_D1_REGNUM, valbuf + (len - 4));
+ regcache->raw_read (M68K_D1_REGNUM, valbuf + (len - 4));
}
else
internal_error (__FILE__, __LINE__,
if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT)
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
- regcache_raw_read (regcache, M68K_FP0_REGNUM, buf);
+ regcache->raw_read (M68K_FP0_REGNUM, buf);
target_float_convert (buf, fpreg_type, valbuf, type);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
- regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf);
+ regcache->raw_read (M68K_A0_REGNUM, valbuf);
else
m68k_extract_return_value (type, regcache, valbuf);
}
gdb_assert (regsz <= MN10300_MAX_REGISTER_SIZE);
if (len <= regsz)
{
- regcache_raw_read (regcache, reg, buf);
+ regcache->raw_read (reg, buf);
memcpy (valbuf, buf, len);
}
else if (len <= 2 * regsz)
{
- regcache_raw_read (regcache, reg, buf);
+ regcache->raw_read (reg, buf);
memcpy (valbuf, buf, regsz);
gdb_assert (regsz == register_size (gdbarch, reg + 1));
- regcache_raw_read (regcache, reg + 1, buf);
+ regcache->raw_read (reg + 1, buf);
memcpy ((char *) valbuf + regsz, buf, len - regsz);
}
else
case 0x19: /* jsr */
case 0x25: /* jmp */
- regcache_raw_read (regcache,
- (inst >> 4) & 0xf, (gdb_byte *) & tmpu32);
+ regcache->raw_read ((inst >> 4) & 0xf, (gdb_byte *) & tmpu32);
next_pcs.push_back (tmpu32);
break;
break;
case 0x03: /* jsra */
{
- regcache_raw_read (regcache,
+ regcache->raw_read (
MOXIE_SP_REGNUM, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
case 0x06: /* push */
{
int reg = (inst >> 4) & 0xf;
- regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
+ regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_reg (regcache, reg)
case 0x0b: /* st.l */
{
int reg = (inst >> 4) & 0xf;
- regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
+ regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 4))
int reg = (inst >> 4) & 0xf;
uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
byte_order)) << 16 ) >> 16;
- regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
+ regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
tmpu32 += offset;
}
case 0x19: /* jsr */
{
- regcache_raw_read (regcache,
+ regcache->raw_read (
MOXIE_SP_REGNUM, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
case 0x1e: /* st.b */
{
int reg = (inst >> 4) & 0xf;
- regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
+ regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 1))
case 0x23: /* st.s */
{
int reg = (inst >> 4) & 0xf;
- regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
+ regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
if (record_full_arch_list_add_mem (tmpu32, 2))
uint32_t length, ptr;
/* Read buffer pointer is in $r1. */
- regcache_raw_read (regcache, 3, (gdb_byte *) & ptr);
+ regcache->raw_read (3, (gdb_byte *) & ptr);
ptr = extract_unsigned_integer ((gdb_byte *) & ptr,
4, byte_order);
/* String length is at 0x12($fp). */
- regcache_raw_read (regcache,
+ regcache->raw_read (
MOXIE_FP_REGNUM, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
int reg = (inst >> 4) & 0xf;
uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
byte_order)) << 16 ) >> 16;
- regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
+ regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
tmpu32 += offset;
int reg = (inst >> 4) & 0xf;
uint32_t offset = (((int16_t) moxie_process_readu (addr+2, buf, 2,
byte_order)) << 16 ) >> 16;
- regcache_raw_read (regcache, reg, (gdb_byte *) & tmpu32);
+ regcache->raw_read (reg, (gdb_byte *) & tmpu32);
tmpu32 = extract_unsigned_integer ((gdb_byte *) & tmpu32,
4, byte_order);
tmpu32 += offset;
offset = (regnum & 1) ? 0 : 4;
fdr_regnum = NDS32_FD0_REGNUM + (regnum >> 1);
- regcache_raw_read (regcache, fdr_regnum, reg_buf);
+ regcache->raw_read (fdr_regnum, reg_buf);
memcpy (reg_buf + offset, buf, 4);
regcache_raw_write (regcache, fdr_regnum, reg_buf);
return;
rec = record_full_reg_alloc (regcache, regnum);
- regcache_raw_read (regcache, regnum, record_full_get_loc (rec));
+ regcache->raw_read (regnum, record_full_get_loc (rec));
record_full_arch_list_add (rec);
}
}
-enum register_status
-regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
-{
- return regcache->raw_read (regnum, buf);
-}
-
enum register_status
readable_regcache::raw_read (int regnum, gdb_byte *buf)
{
/* Transfer a raw register [0..NUM_REGS) between core-gdb and the
regcache. The read variants return the status of the register. */
-enum register_status regcache_raw_read (struct regcache *regcache,
- int rawnum, gdb_byte *buf);
void regcache_raw_write (struct regcache *regcache, int rawnum,
const gdb_byte *buf);
extern enum register_status
: reg_buffer (gdbarch, has_pseudo)
{}
+ /* Transfer a raw register [0..NUM_REGS) from core-gdb to this regcache,
+ return its value in *BUF and return its availability status. */
+
enum register_status raw_read (int regnum, gdb_byte *buf);
template<typename T, typename = RequireLongest<T>>
enum register_status raw_read (int regnum, T *val);
if (vx < 16)
regcache_cooked_read (regcache, tdep->v0_full_regnum + vx, buf);
else
- regcache_raw_read (regcache, S390_V16_REGNUM + vx - 16, buf);
+ regcache->raw_read (S390_V16_REGNUM + vx - 16, buf);
x = extract_unsigned_integer (buf + el * es, es, byte_order);
*res = s390_record_calc_disp_common (gdbarch, regcache, x, bd, dh);
return 0;
{
int i, regnum = R0_REGNUM;
for (i = 0; i < len; i += 4)
- regcache_raw_read (regcache, regnum++, valbuf + i);
+ regcache->raw_read (regnum++, valbuf + i);
}
else
error (_("bad size for return value"));
int i, regnum = gdbarch_fp0_regnum (gdbarch);
for (i = 0; i < len; i += 4)
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
- regcache_raw_read (regcache, regnum++,
+ regcache->raw_read (regnum++,
valbuf + len - 4 - i);
else
- regcache_raw_read (regcache, regnum++, valbuf + i);
+ regcache->raw_read (regnum++, valbuf + i);
}
else
sh_extract_return_value_nofpu (type, regcache, valbuf);
switch (regnum)
{
case SPU_SP_REGNUM:
- regcache_raw_read (regcache, SPU_RAW_SP_REGNUM, reg);
+ regcache->raw_read (SPU_RAW_SP_REGNUM, reg);
memcpy (reg, buf, 4);
regcache_raw_write (regcache, SPU_RAW_SP_REGNUM, reg);
break;
int i, regnum = TILEGX_R0_REGNUM;
for (i = 0; i < len; i += tilegx_reg_size)
- regcache_raw_read (regcache, regnum++, valbuf + i);
+ regcache->raw_read (regnum++, valbuf + i);
}
/* Copy the function return value from VALBUF into the proper
gdb_byte buf[v850_reg_size];
for (i = 0; len > 0; i += 4, len -= 4)
{
- regcache_raw_read (regcache, regnum++, buf);
+ regcache->raw_read (regnum++, buf);
memcpy (valbuf + i, buf, len > 4 ? 4 : len);
}
}
int i, regnum = E_1ST_ARG_REGNUM;
for (i = 0; i < len; i += xstormy16_reg_size)
- regcache_raw_read (regcache, regnum++, valbuf + i);
+ regcache->raw_read (regnum++, valbuf + i);
}
/* Function: xstormy16_store_return_value
if (len < 4)
regcache_raw_read_part (regcache, areg, offset, len, valbuf);
else
- regcache_raw_read (regcache, areg, valbuf);
+ regcache->raw_read (areg, valbuf);
}
}
to modify WINDOWSTART register to make it look like there
is only one register window corresponding to WINDOWEBASE. */
- regcache_raw_read (regcache, gdbarch_tdep (gdbarch)->wb_regnum, buf);
+ regcache->raw_read (gdbarch_tdep (gdbarch)->wb_regnum, buf);
regcache_cooked_write_unsigned
(regcache, gdbarch_tdep (gdbarch)->ws_regnum,
1 << extract_unsigned_integer (buf, 4, byte_order));