+2002-08-02 Andrew Cagney <ac131313@redhat.com>
+
+ * regcache.c (regcache_cooked_read): New function.
+ (regcache_cooked_write): New function.
+ (read_register_gen): Rewrite using regcache_cooked_read.
+ (write_register_gen): Rewrite using regcache_cooked_write.
+
+ * regcache.h (regcache_cooked_read, regcache_cooked_write):
+ Declare.
+
2002-08-02 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (pseudo_register_read, pseudo_register_write):
legacy_read_register_gen (regnum, buf);
return;
}
+ regcache_cooked_read (current_regcache, regnum, buf);
+}
+
+void
+regcache_cooked_read (struct regcache *regcache, int rawnum, void *buf)
+{
gdb_assert (regnum >= 0);
- gdb_assert (regnum < current_regcache->descr->nr_cooked_registers);
- if (regnum < current_regcache->descr->nr_raw_registers)
- regcache_raw_read (current_regcache, regnum, buf);
+ gdb_assert (regnum < regcache->descr->nr_cooked_registers);
+ if (regnum < regcache->descr->nr_raw_registers)
+ regcache_raw_read (regcache, regnum, buf);
else
- gdbarch_pseudo_register_read (current_gdbarch, current_regcache,
- regnum, buf);
+ gdbarch_pseudo_register_read (regcache->descr->gdbarch, regcache,
+ regnum, buf);
}
-
/* Write register REGNUM at MYADDR to the target. MYADDR points at
REGISTER_RAW_BYTES(REGNUM), which must be in target byte-order. */
legacy_write_register_gen (regnum, buf);
return;
}
+ regcache_cooked_write (current_regcache, regnum, buf);
+}
+
+void
+regcache_cooked_write (struct regcache *regcache, int rawnum,
+ const void *buf)
+{
gdb_assert (regnum >= 0);
- gdb_assert (regnum < current_regcache->descr->nr_cooked_registers);
- if (regnum < current_regcache->descr->nr_raw_registers)
- regcache_raw_write (current_regcache, regnum, buf);
+ gdb_assert (regnum < regcache->descr->nr_cooked_registers);
+ if (regnum < regcache->descr->nr_raw_registers)
+ regcache_raw_write (regcache, regnum, buf);
else
- gdbarch_pseudo_register_write (current_gdbarch, current_regcache,
+ gdbarch_pseudo_register_write (regcache->descr->gdbarch, regcache,
regnum, buf);
}
int regcache_valid_p (struct regcache *regcache, int regnum);
CORE_ADDR regcache_raw_read_as_address (struct regcache *regcache, int rawnum);
+/* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS). */
+void regcache_cooked_read (struct regcache *regcache, int rawnum, void *buf);
+void regcache_cooked_write (struct regcache *regcache, int rawnum,
+ const void *buf);
+
/* Transfer a raw register [0..NUM_REGS) between the regcache and the
target. These functions are called by the target in response to a
target_fetch_registers() or target_store_registers(). */