+2018-02-21 Yao Qi <yao.qi@linaro.org>
+
+ * aarch64-tdep.c (aarch64_pseudo_register_read_value): Change
+ parameter type to 'readable_regcache *'.
+ * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise.
+ * arm-tdep.c (arm_neon_quad_read): Likewise.
+ (arm_pseudo_read): Likewise.
+ * avr-tdep.c (avr_pseudo_register_read): Likewise.
+ * bfin-tdep.c (bfin_pseudo_register_read): Likewise.
+ * frv-tdep.c (frv_pseudo_register_read): Likewise.
+ * gdbarch.c: Re-generated.
+ * gdbarch.h: Re-generated.
+ * gdbarch.sh (pseudo_register_read): Change parameter type to
+ 'readable_regcache *'.
+ (pseudo_register_read_value): Likewise.
+ * h8300-tdep.c (pseudo_from_raw_register): Likewise.
+ (h8300_pseudo_register_read): Likewise.
+ * hppa-tdep.c (hppa_pseudo_register_read): Likewise.
+ * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise.
+ (i386_pseudo_register_read_into_value): Likewise.
+ (i386_pseudo_register_read_value): Likewise.
+ * i386-tdep.h (i386_pseudo_register_read_into_value): Update
+ declaration.
+ * ia64-tdep.c (ia64_pseudo_register_read): Likewise.
+ * m32c-tdep.c (m32c_raw_read): Likewise.
+ (m32c_read_flg): Likewise.
+ (m32c_banked_register): Likewise.
+ (m32c_banked_read): Likewise.
+ (m32c_sb_read): Likewise.
+ (m32c_part_read): Likewise.
+ (m32c_cat_read): Likewise.
+ (m32c_r3r2r1r0_read): Likewise.
+ (m32c_pseudo_register_read): Likewise.
+ * m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise.
+ * mep-tdep.c (mep_pseudo_cr32_read): Likewise.
+ (mep_pseudo_cr64_read): Likewise.
+ (mep_pseudo_register_read): Likewise.
+ * mips-tdep.c (mips_pseudo_register_read): Likewise.
+ * msp430-tdep.c (msp430_pseudo_register_read): Likewise.
+ * nds32-tdep.c (nds32_pseudo_register_read): Likewise.
+ * regcache.c (regcache::raw_read): Move it to readable_regcache.
+ (regcache::cooked_read): Likewise.
+ (regcache::cooked_read_value): Likewise.
+ (regcache_cooked_read_signed):
+ (regcache::cooked_read): Likewise.
+ * regcache.h (readable_regcache): New class.
+ (regcache): Inherit readable_regcache. Move some methods to
+ readable_regcache.
+ * rl78-tdep.c (rl78_pseudo_register_read): Change
+ parameter type to 'readable_regcache *'.
+ * rs6000-tdep.c (do_regcache_raw_read): Remove.
+ (e500_pseudo_register_read): Change parameter type to
+ 'readable_regcache *'.
+ (dfp_pseudo_register_read): Likewise.
+ (vsx_pseudo_register_read): Likewise.
+ (efpr_pseudo_register_read): Likewise.
+ * s390-tdep.c (s390_pseudo_register_read): Likewise.
+ * sh-tdep.c (sh_pseudo_register_read): Likewise.
+ * sh64-tdep.c (pseudo_register_read_portions): Likewise.
+ (sh64_pseudo_register_read): Likewise.
+ * sparc-tdep.c (sparc32_pseudo_register_read): Likewise.
+ * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise.
+ * spu-tdep.c (spu_pseudo_register_read_spu): Likewise.
+ (spu_pseudo_register_read): Likewise.
+ * xtensa-tdep.c (xtensa_register_read_masked): Likewise.
+ (xtensa_pseudo_register_read): Likewise.
+
2018-02-21 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::regcache): Call reg_buffer ctor.
static struct value *
aarch64_pseudo_read_value (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum)
{
gdb_byte reg_buf[V_REGISTER_SIZE];
static struct value *
amd64_pseudo_register_read_value (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum)
{
gdb_byte *raw_buf = (gdb_byte *) alloca (register_size (gdbarch, regnum));
const char *);
static enum register_status arm_neon_quad_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum, gdb_byte *buf);
static void arm_neon_quad_write (struct gdbarch *gdbarch,
struct regcache *regcache,
the quad register, in [0, 15]. */
static enum register_status
-arm_neon_quad_read (struct gdbarch *gdbarch, struct regcache *regcache,
+arm_neon_quad_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
char name_buf[4];
}
static enum register_status
-arm_pseudo_read (struct gdbarch *gdbarch, struct regcache *regcache,
+arm_pseudo_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
const int num_regs = gdbarch_num_regs (gdbarch);
}
static enum register_status
-avr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+avr_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
ULONGEST val;
}
static enum register_status
-bfin_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+bfin_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buffer)
{
gdb_byte buf[BFIN_MAX_REGISTER_SIZE];
}
static enum register_status
-frv_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+frv_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg, gdb_byte *buffer)
{
enum register_status status;
}
enum register_status
-gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf)
+gdbarch_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->pseudo_register_read != NULL);
}
struct value *
-gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum)
+gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->pseudo_register_read_value != NULL);
extern int gdbarch_pseudo_register_read_p (struct gdbarch *gdbarch);
-typedef enum register_status (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf);
-extern enum register_status gdbarch_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum, gdb_byte *buf);
+typedef enum register_status (gdbarch_pseudo_register_read_ftype) (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf);
+extern enum register_status gdbarch_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum, gdb_byte *buf);
extern void set_gdbarch_pseudo_register_read (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype *pseudo_register_read);
/* Read a register into a new struct value. If the register is wholly
extern int gdbarch_pseudo_register_read_value_p (struct gdbarch *gdbarch);
-typedef struct value * (gdbarch_pseudo_register_read_value_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum);
-extern struct value * gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, struct regcache *regcache, int cookednum);
+typedef struct value * (gdbarch_pseudo_register_read_value_ftype) (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum);
+extern struct value * gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, readable_regcache *regcache, int cookednum);
extern void set_gdbarch_pseudo_register_read_value (struct gdbarch *gdbarch, gdbarch_pseudo_register_read_value_ftype *pseudo_register_read_value);
extern int gdbarch_pseudo_register_write_p (struct gdbarch *gdbarch);
# serious shakedown.
m;void;virtual_frame_pointer;CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset;pc, frame_regnum, frame_offset;0;legacy_virtual_frame_pointer;;0
#
-M;enum register_status;pseudo_register_read;struct regcache *regcache, int cookednum, gdb_byte *buf;regcache, cookednum, buf
+M;enum register_status;pseudo_register_read;readable_regcache *regcache, int cookednum, gdb_byte *buf;regcache, cookednum, buf
# Read a register into a new struct value. If the register is wholly
# or partly unavailable, this should call mark_value_bytes_unavailable
# as appropriate. If this is defined, then pseudo_register_read will
# never be called.
-M;struct value *;pseudo_register_read_value;struct regcache *regcache, int cookednum;regcache, cookednum
+M;struct value *;pseudo_register_read_value;readable_regcache *regcache, int cookednum;regcache, cookednum
M;void;pseudo_register_write;struct regcache *regcache, int cookednum, const gdb_byte *buf;regcache, cookednum, buf
#
v;int;num_regs;;;0;-1
raw registers. These helpers extend/narrow the values. */
static enum register_status
-pseudo_from_raw_register (struct gdbarch *gdbarch, struct regcache *regcache,
+pseudo_from_raw_register (struct gdbarch *gdbarch, readable_regcache *regcache,
gdb_byte *buf, int pseudo_regno, int raw_regno)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
static enum register_status
h8300_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache, int regno,
+ readable_regcache *regcache, int regno,
gdb_byte *buf)
{
if (regno == E_PSEUDO_CCR_REGNUM (gdbarch))
}
static enum register_status
-hppa_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+hppa_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
the MMX registers need to be mapped onto floating point registers. */
static int
-i386_mmx_regnum_to_fp_regnum (struct regcache *regcache, int regnum)
+i386_mmx_regnum_to_fp_regnum (readable_regcache *regcache, int regnum)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (regcache->arch ());
int mmxreg, fpreg;
void
i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum,
struct value *result_value)
{
static struct value *
i386_pseudo_register_read_value (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum)
{
struct value *result;
int regnum);
extern void i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum,
struct value *result);
}
static enum register_status
-ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ia64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const gdb_byte *buf);
typedef enum register_status (m32c_read_reg_t) (struct m32c_reg *reg,
- struct regcache *cache,
+ readable_regcache *cache,
gdb_byte *buf);
struct m32c_reg
/* Copy the value of the raw register REG from CACHE to BUF. */
static enum register_status
-m32c_raw_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf)
+m32c_raw_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
return cache->raw_read (reg->num, buf);
}
/* Return the value of the 'flg' register in CACHE. */
static int
-m32c_read_flg (struct regcache *cache)
+m32c_read_flg (readable_regcache *cache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (cache->arch ());
ULONGEST flg;
/* Evaluate the real register number of a banked register. */
static struct m32c_reg *
-m32c_banked_register (struct m32c_reg *reg, struct regcache *cache)
+m32c_banked_register (struct m32c_reg *reg, readable_regcache *cache)
{
return ((m32c_read_flg (cache) & reg->n) ? reg->ry : reg->rx);
}
masked in REG->n set, then read REG->ry. Otherwise, read
REG->rx. */
static enum register_status
-m32c_banked_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf)
+m32c_banked_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
struct m32c_reg *bank_reg = m32c_banked_register (reg, cache);
return cache->raw_read (bank_reg->num, buf);
/* Move the value of SB from CACHE to BUF. On bfd_mach_m32c, SB is a
banked register; on bfd_mach_m16c, it's not. */
static enum register_status
-m32c_sb_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf)
+m32c_sb_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
if (gdbarch_bfd_arch_info (reg->arch)->mach == bfd_mach_m16c)
return m32c_raw_read (reg->rx, cache, buf);
REG->type values, where higher indices refer to more significant
bits, read the value of the REG->n'th element. */
static enum register_status
-m32c_part_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf)
+m32c_part_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
int offset, len;
concatenation of the values of the registers REG->rx and REG->ry,
with REG->rx contributing the more significant bits. */
static enum register_status
-m32c_cat_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf)
+m32c_cat_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
int high_bytes = TYPE_LENGTH (reg->rx->type);
int low_bytes = TYPE_LENGTH (reg->ry->type);
the concatenation (from most significant to least) of r3, r2, r1,
and r0. */
static enum register_status
-m32c_r3r2r1r0_read (struct m32c_reg *reg, struct regcache *cache, gdb_byte *buf)
+m32c_r3r2r1r0_read (struct m32c_reg *reg, readable_regcache *cache, gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (reg->arch);
int len = TYPE_LENGTH (tdep->r0->type);
static enum register_status
m32c_pseudo_register_read (struct gdbarch *arch,
- struct regcache *cache,
+ readable_regcache *cache,
int cookednum,
gdb_byte *buf)
{
fetch into a memory read. */
static enum register_status
m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regno, gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
static enum register_status
mep_pseudo_cr32_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int cookednum,
gdb_byte *buf)
{
static enum register_status
mep_pseudo_cr64_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int cookednum,
gdb_byte *buf)
{
static enum register_status
mep_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int cookednum,
gdb_byte *buf)
{
registers. Take care of alignment and size problems. */
static enum register_status
-mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+mips_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int cookednum, gdb_byte *buf)
{
int rawnum = cookednum % gdbarch_num_regs (gdbarch);
static enum register_status
msp430_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum, gdb_byte *buffer)
{
if (MSP430_NUM_REGS <= regnum && regnum < MSP430_NUM_TOTAL_REGS)
static enum register_status
nds32_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache, int regnum,
+ readable_regcache *regcache, int regnum,
gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* The register buffers. A read-only register cache can hold the
full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) while a
read/write register cache can only hold [0 .. gdbarch_num_regs). */
- : reg_buffer (gdbarch, readonly_p_),
+ : readable_regcache (gdbarch, readonly_p_),
m_aspace (aspace_), m_readonly_p (readonly_p_)
{
m_ptid = minus_one_ptid;
}
enum register_status
-regcache::raw_read (int regnum, gdb_byte *buf)
+readable_regcache::raw_read (int regnum, gdb_byte *buf)
{
gdb_assert (buf != NULL);
raw_update (regnum);
template<typename T, typename>
enum register_status
-regcache::raw_read (int regnum, T *val)
+readable_regcache::raw_read (int regnum, T *val)
{
gdb_byte *buf;
enum register_status status;
}
enum register_status
-regcache::cooked_read (int regnum, gdb_byte *buf)
+readable_regcache::cooked_read (int regnum, gdb_byte *buf)
{
gdb_assert (regnum >= 0);
gdb_assert (regnum < m_descr->nr_cooked_registers);
if (regnum < num_raw_registers ())
return raw_read (regnum, buf);
- else if (m_readonly_p
+ else if (m_has_pseudo
&& m_register_status[regnum] != REG_UNKNOWN)
{
- /* Read-only register cache, perhaps the cooked value was
- cached? */
if (m_register_status[regnum] == REG_VALID)
memcpy (buf, register_buffer (regnum),
m_descr->sizeof_register[regnum]);
}
struct value *
-regcache::cooked_read_value (int regnum)
+readable_regcache::cooked_read_value (int regnum)
{
gdb_assert (regnum >= 0);
gdb_assert (regnum < m_descr->nr_cooked_registers);
if (regnum < num_raw_registers ()
- || (m_readonly_p && m_register_status[regnum] != REG_UNKNOWN)
+ || (m_has_pseudo && m_register_status[regnum] != REG_UNKNOWN)
|| !gdbarch_pseudo_register_read_value_p (m_descr->gdbarch))
{
struct value *result;
template<typename T, typename>
enum register_status
-regcache::cooked_read (int regnum, T *val)
+readable_regcache::cooked_read (int regnum, T *val)
{
enum register_status status;
gdb_byte *buf;
const void *buf);
enum register_status
-regcache::xfer_part (int regnum, int offset, int len, void *in,
+readable_regcache::read_part (int regnum, int offset, int len, void *in,
+ bool is_raw)
+{
+ struct gdbarch *gdbarch = arch ();
+ gdb_byte *reg = (gdb_byte *) alloca (register_size (gdbarch, regnum));
+
+ gdb_assert (in != NULL);
+ gdb_assert (offset >= 0 && offset <= m_descr->sizeof_register[regnum]);
+ gdb_assert (len >= 0 && offset + len <= m_descr->sizeof_register[regnum]);
+ /* Something to do? */
+ if (offset + len == 0)
+ return REG_VALID;
+ /* Read (when needed) ... */
+ enum register_status status;
+
+ if (is_raw)
+ status = raw_read (regnum, reg);
+ else
+ status = cooked_read (regnum, reg);
+ if (status != REG_VALID)
+ return status;
+
+ /* ... modify ... */
+ memcpy (in, reg + offset, len);
+
+ return REG_VALID;
+}
+
+enum register_status
+regcache::write_part (int regnum, int offset, int len,
const void *out, bool is_raw)
{
struct gdbarch *gdbarch = arch ();
gdb_byte *reg = (gdb_byte *) alloca (register_size (gdbarch, regnum));
+ gdb_assert (out != NULL);
gdb_assert (offset >= 0 && offset <= m_descr->sizeof_register[regnum]);
gdb_assert (len >= 0 && offset + len <= m_descr->sizeof_register[regnum]);
/* Something to do? */
if (offset + len == 0)
return REG_VALID;
/* Read (when needed) ... */
- if (in != NULL
- || offset > 0
+ if (offset > 0
|| offset + len < m_descr->sizeof_register[regnum])
{
enum register_status status;
if (status != REG_VALID)
return status;
}
- /* ... modify ... */
- if (in != NULL)
- memcpy (in, reg + offset, len);
- if (out != NULL)
- memcpy (reg + offset, out, len);
+
+ memcpy (reg + offset, out, len);
/* ... write (when needed). */
- if (out != NULL)
- {
- if (is_raw)
- raw_write (regnum, reg);
- else
- cooked_write (regnum, reg);
- }
+ if (is_raw)
+ raw_write (regnum, reg);
+ else
+ cooked_write (regnum, reg);
return REG_VALID;
}
}
enum register_status
-regcache::raw_read_part (int regnum, int offset, int len, gdb_byte *buf)
+readable_regcache::raw_read_part (int regnum, int offset, int len, gdb_byte *buf)
{
assert_regnum (regnum);
- return xfer_part (regnum, offset, len, buf, NULL, true);
+ return read_part (regnum, offset, len, buf, true);
}
void
const gdb_byte *buf)
{
assert_regnum (regnum);
- xfer_part (regnum, offset, len, NULL, buf, true);
+ write_part (regnum, offset, len, buf, true);
}
enum register_status
enum register_status
-regcache::cooked_read_part (int regnum, int offset, int len, gdb_byte *buf)
+readable_regcache::cooked_read_part (int regnum, int offset, int len,
+ gdb_byte *buf)
{
gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers);
- return xfer_part (regnum, offset, len, buf, NULL, false);
+ return read_part (regnum, offset, len, buf, false);
}
void
const gdb_byte *buf)
{
gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers);
- xfer_part (regnum, offset, len, NULL, buf, false);
+ write_part (regnum, offset, len, buf, false);
}
/* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */
signed char *m_register_status;
};
+/* An abstract class which only has methods doing read. */
+
+class readable_regcache : public reg_buffer
+{
+public:
+ readable_regcache (gdbarch *gdbarch, bool has_pseudo)
+ : reg_buffer (gdbarch, has_pseudo)
+ {}
+
+ 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);
+
+ enum register_status raw_read_part (int regnum, int offset, int len,
+ gdb_byte *buf);
+
+ virtual void raw_update (int regnum) = 0;
+
+ enum register_status cooked_read (int regnum, gdb_byte *buf);
+ template<typename T, typename = RequireLongest<T>>
+ enum register_status cooked_read (int regnum, T *val);
+
+ enum register_status cooked_read_part (int regnum, int offset, int len,
+ gdb_byte *buf);
+
+ struct value *cooked_read_value (int regnum);
+
+protected:
+ enum register_status read_part (int regnum, int offset, int len, void *in,
+ bool is_raw);
+};
+
/* The register cache for storing raw register values. */
-class regcache : public reg_buffer
+class regcache : public readable_regcache
{
public:
regcache (gdbarch *gdbarch)
void save (regcache_cooked_read_ftype *cooked_read, void *src);
- enum register_status cooked_read (int regnum, gdb_byte *buf);
void cooked_write (int regnum, const gdb_byte *buf);
- enum register_status raw_read (int regnum, gdb_byte *buf);
-
void raw_write (int regnum, const gdb_byte *buf);
- template<typename T, typename = RequireLongest<T>>
- enum register_status raw_read (int regnum, T *val);
-
template<typename T, typename = RequireLongest<T>>
void raw_write (int regnum, T val);
- struct value *cooked_read_value (int regnum);
-
- template<typename T, typename = RequireLongest<T>>
- enum register_status cooked_read (int regnum, T *val);
-
template<typename T, typename = RequireLongest<T>>
void cooked_write (int regnum, T val);
- void raw_update (int regnum);
+ void raw_update (int regnum) override;
void raw_collect (int regnum, void *buf) const;
void invalidate (int regnum);
- enum register_status raw_read_part (int regnum, int offset, int len,
- gdb_byte *buf);
-
void raw_write_part (int regnum, int offset, int len, const gdb_byte *buf);
- enum register_status cooked_read_part (int regnum, int offset, int len,
- gdb_byte *buf);
-
void cooked_write_part (int regnum, int offset, int len,
const gdb_byte *buf);
private:
void restore (struct regcache *src);
- enum register_status xfer_part (int regnum, int offset, int len, void *in,
- const void *out, bool is_raw);
-
void transfer_regset (const struct regset *regset,
struct regcache *out_regcache,
int regnum, const void *in_buf,
void *out_buf, size_t size) const;
+ enum register_status write_part (int regnum, int offset, int len,
+ const void *out, bool is_raw);
+
+
/* The address space of this register cache (for registers where it
makes sense, like PC or SP). */
const address_space * const m_aspace;
static enum register_status
rl78_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int reg, gdb_byte *buffer)
{
enum register_status status;
return status;
}
-static enum register_status
-do_regcache_raw_read (struct regcache *regcache, int regnum, void *buffer)
-{
- return regcache_raw_read (regcache, regnum, (gdb_byte *) buffer);
-}
-
static enum register_status
do_regcache_raw_write (struct regcache *regcache, int regnum, void *buffer)
{
}
static enum register_status
-e500_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
- int reg_nr, gdb_byte *buffer)
+e500_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
+ int ev_reg, gdb_byte *buffer)
{
- return e500_move_ev_register (do_regcache_raw_read, regcache, reg_nr, buffer);
+ struct gdbarch *arch = regcache->arch ();
+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
+ int reg_index;
+ enum register_status status;
+
+ gdb_assert (IS_SPE_PSEUDOREG (tdep, ev_reg));
+
+ reg_index = ev_reg - tdep->ppc_ev0_regnum;
+
+ if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
+ {
+ status = regcache->raw_read (tdep->ppc_ev0_upper_regnum + reg_index,
+ buffer);
+ if (status == REG_VALID)
+ status = regcache->raw_read (tdep->ppc_gp0_regnum + reg_index,
+ buffer + 4);
+ }
+ else
+ {
+ status = regcache->raw_read (tdep->ppc_gp0_regnum + reg_index, buffer);
+ if (status == REG_VALID)
+ status = regcache->raw_read (tdep->ppc_ev0_upper_regnum + reg_index,
+ buffer + 4);
+ }
+
+ return status;
+
}
static void
/* Read method for DFP pseudo-registers. */
static enum register_status
-dfp_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+dfp_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Read method for POWER7 VSX pseudo-registers. */
static enum register_status
-vsx_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+vsx_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Read method for POWER7 Extended FP pseudo-registers. */
static enum register_status
-efpr_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+efpr_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int offset = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 0 : 8;
/* Read the portion that overlaps the VMX register. */
- return regcache_raw_read_part (regcache, tdep->ppc_vr0_regnum + reg_index,
- offset, register_size (gdbarch, reg_nr),
- buffer);
+ return regcache->raw_read_part (tdep->ppc_vr0_regnum + reg_index,
+ offset, register_size (gdbarch, reg_nr),
+ buffer);
}
/* Write method for POWER7 Extended FP pseudo-registers. */
static enum register_status
rs6000_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
struct gdbarch *regcache_arch = regcache->arch ();
/* Implement pseudo_register_read gdbarch method. */
static enum register_status
-s390_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+s390_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
static enum register_status
pseudo_register_read_portions (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int portions,
int base_regnum, gdb_byte *buffer)
{
}
static enum register_status
-sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+sh_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
int base_regnum;
static enum register_status
pseudo_register_read_portions (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int portions,
int base_regnum, gdb_byte *buffer)
{
}
static enum register_status
-sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+sh64_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
static enum register_status
sparc32_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
enum register_status status;
static enum register_status
sparc64_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Pseudo registers for preferred slots - stack pointer. */
static enum register_status
-spu_pseudo_register_read_spu (struct regcache *regcache, const char *regname,
+spu_pseudo_register_read_spu (readable_regcache *regcache, const char *regname,
gdb_byte *buf)
{
struct gdbarch *gdbarch = regcache->arch ();
}
static enum register_status
-spu_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+spu_pseudo_register_read (struct gdbarch *gdbarch, readable_regcache *regcache,
int regnum, gdb_byte *buf)
{
gdb_byte reg[16];
of the registers and assemble them into a single value. */
static enum register_status
-xtensa_register_read_masked (struct regcache *regcache,
+xtensa_register_read_masked (readable_regcache *regcache,
xtensa_register_t *reg, gdb_byte *buffer)
{
unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
static enum register_status
xtensa_pseudo_register_read (struct gdbarch *gdbarch,
- struct regcache *regcache,
+ readable_regcache *regcache,
int regnum,
gdb_byte *buffer)
{