regcache_raw and use it in to_{fetch,store}_registers

This patch adds a new class regcache_raw, between reg_buffer and regcache
in the class hierarchy.  Also use it in target_ops
to_{fetch,store}_registers methods, because target_ops accesses raw
registers.  (pseudo registers are abstracted by gdbarch).

gdb:

2017-10-03  Yao Qi  <yao.qi@linaro.org>
:
	* aarch32-linux-nat.c (aarch32_gp_regcache_supply): -
	(aarch32_gp_regcache_supply): +
	(aarch32_gp_regcache_supply):
	(aarch32_gp_regcache_collect): -
	(aarch32_gp_regcache_collect): +
	(aarch32_gp_regcache_collect):
	(aarch32_vfp_regcache_supply): -
	(aarch32_vfp_regcache_supply): +
	(aarch32_vfp_regcache_supply):
	(aarch32_vfp_regcache_collect): -
	(aarch32_vfp_regcache_collect): +
	* aarch32-linux-nat.h:
	* aarch64-linux-nat.c (aarch64_get_debug_reg_state):
	(fetch_gregs_from_thread): -
	(fetch_gregs_from_thread): +
	(fetch_gregs_from_thread):
	(store_gregs_to_thread): -
	(store_gregs_to_thread): +
	(store_gregs_to_thread):
	(fetch_fpregs_from_thread): -
	(fetch_fpregs_from_thread): +
	(fetch_fpregs_from_thread):
	(store_fpregs_to_thread): -
	(store_fpregs_to_thread): +
	(store_fpregs_to_thread):
	(aarch64_linux_fetch_inferior_registers):
	* arch-utils.c (default_addressable_memory_unit_size):
	* arch-utils.h (extern const char *default_gnu_triplet_regexp):
	* arm-linux-tdep.c (static struct tramp_frame arm_kernel_linux_restart_syscall_tramp_frame = {):
	(arm_linux_supply_gregset):
	(arm_linux_collect_gregset):
	(supply_nwfpe_register): -
	(supply_nwfpe_register): +
	(supply_nwfpe_register):
	(collect_nwfpe_register): -
	(collect_nwfpe_register): +
	(collect_nwfpe_register):
	(arm_linux_supply_nwfpe):
	(arm_linux_collect_nwfpe):
	(arm_linux_supply_vfp):
	* arm-linux-tdep.h (void arm_linux_collect_gregset):
	* corelow.c (core_detach):
	(get_core_register_section): -
	(get_core_register_section): +
	(get_core_registers_cb):
	* gdbarch.c (set_gdbarch_fast_tracepoint_valid_at):
	(gdbarch_guess_tracepoint_registers): -
	(gdbarch_guess_tracepoint_registers): +
	* gdbarch.h (extern void set_gdbarch_fast_tracepoint_valid_at):
	* gdbarch.sh (m;int;fast_tracepoint_valid_at;CORE_ADDR addr, char **msg;addr, msg;;default_fas):
	* gdbcore.h (struct core_fns):
	* inf-child.c (store_waitstatus):
	(inf_child_fetch_inferior_registers):
	(inf_child_post_attach):
	* inf-ptrace.c (static CORE_ADDR):
	(inf_ptrace_fetch_register): -
	(inf_ptrace_fetch_register): +
	(inf_ptrace_fetch_register):
	(inf_ptrace_fetch_registers):
	(inf_ptrace_store_register): -
	(inf_ptrace_store_register): +
	(inf_ptrace_store_register):
	* record-btrace.c (record_btrace_remove_breakpoint):
	(record_btrace_fetch_registers):
	(record_btrace_store_registers):
	* record-full.c (static void record_full_save):
	(record_full_reg_alloc): -
	(record_full_reg_alloc): +
	(record_full_get_loc):
	(record_full_arch_list_add_reg): -
	(record_full_arch_list_add_reg): +
	(record_full_supports_stopped_by_hw_breakpoint):
	(record_full_registers_change): -
	(record_full_registers_change): +
	(record_full_registers_change):
	(record_full_core_kill):
	(record_full_core_fetch_registers):
	(record_full_core_prepare_to_store):
	* record-full.h:
	* regcache.c (regcache_register_size):
	(regcache::regcache):
	(regcache::arch):
	(regcache_get_ptid): -
	(regcache_get_ptid): +
	(class regcache_invalidator):
	(public:):
	(public:):
	(get_regcache_arch): -
	(get_regcache_arch): +
	(regcache_dup):
	(regcache_register_status): -
	(regcache_register_status): +
	(reg_buffer::set_register_status):
	(regcache_invalidate): -
	(regcache_invalidate): +
	(registers_changed):
	(regcache_raw_update): -
	(regcache_raw_update): +
	(regcache_raw_update):
	(regcache::raw_update):
	(regcache_raw_read): -
	(regcache_raw_read): +
	(regcache_raw_read_signed):
	(regcache_raw_write_signed):
	(regcache_raw_write):
	(reg_buffer::raw_supply_zeroed):
	(regcache_raw_collect): -
	(regcache_raw_collect): +
	(reg_buffer::transfer_regset):
	(reg_buffer::supply_regset):
	(regcache_write_pc):
	* regcache.h (struct regcache;):
	(extern struct regcache *get_thread_arch_aspace_regcache):
	(extern enum register_status):
	(extern void regcache_write_pc):
	(enum):
	(private:):
	(public:):
	(public:):
	(public:):
	(public:):
	(private:):
	* regset.h (struct regcache;):
	* remote.c (static int getpkt_or_notif_sane):
	(remote_wait):
	(fetch_register_using_p): -
	(fetch_register_using_p): +
	(send_g_packet):
	(process_g_packet): -
	(process_g_packet): +
	(process_g_packet):
	(fetch_registers_using_g): -
	(fetch_registers_using_g): +
	(set_remote_traceframe):
	(remote_fetch_registers):
	(remote_prepare_to_store): -
	(remote_prepare_to_store): +
	(remote_prepare_to_store):
	(store_register_using_P): -
	(store_register_using_P): +
	(store_register_using_P):
	(store_registers_using_G): -
	(store_registers_using_G): +
	(store_registers_using_G):
	* s390-linux-tdep.c (s390_write_pc):
	* target-debug.h:
	* target-delegates.c (debug_wait):
	(delegate_fetch_registers): -
	(delegate_fetch_registers): +
	(tdefault_fetch_registers): -
	(tdefault_fetch_registers): +
	(debug_fetch_registers): -
	(debug_fetch_registers): +
	(delegate_store_registers): -
	(delegate_store_registers): +
	(tdefault_store_registers): -
	(tdefault_store_registers): +
	(debug_store_registers): -
	(debug_store_registers): +
	(delegate_prepare_to_store): -
	(delegate_prepare_to_store): +
	(tdefault_prepare_to_store): -
	(tdefault_prepare_to_store): +
	(debug_prepare_to_store): -
	(debug_prepare_to_store): +
	* target.c (target_options_to_string):
	(target_fetch_registers): -
	(target_fetch_registers): +
	(target_fetch_registers):
	(target_store_registers): -
	(target_store_registers): +
	* target.h (struct target_ops):
	(extern ptid_t default_target_wait):
	* tracefile-tfile.c (traceframe_find_block_type):
	* tracefile.c (trace_save_ctf):
	(tracefile_fetch_registers): -
	(tracefile_fetch_registers): +
	* tracefile.h (extern struct trace_file_writer *tfile_trace_file_writer_new):
diff --git a/gdb/aarch32-linux-nat.c b/gdb/aarch32-linux-nat.c
index 94e348f..a7a3b85 100644
--- a/gdb/aarch32-linux-nat.c
+++ b/gdb/aarch32-linux-nat.c
@@ -28,7 +28,7 @@
    is true if the 32-bit mode is in use, otherwise, it is false.  */
 
 void
-aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs,
+aarch32_gp_regcache_supply (regcache_raw *regcache, uint32_t *regs,
 			    int arm_apcs_32)
 {
   int regno;
@@ -54,7 +54,7 @@
    true if the 32-bit mode is in use, otherwise, it is false.  */
 
 void
-aarch32_gp_regcache_collect (const struct regcache *regcache, uint32_t *regs,
+aarch32_gp_regcache_collect (const regcache_raw *regcache, uint32_t *regs,
 			     int arm_apcs_32)
 {
   int regno;
@@ -82,7 +82,7 @@
    VFP_REGISTER_COUNT is the number of VFP registers.  */
 
 void
-aarch32_vfp_regcache_supply (struct regcache *regcache, gdb_byte *regs,
+aarch32_vfp_regcache_supply (regcache_raw *regcache, gdb_byte *regs,
 			     const int vfp_register_count)
 {
   int regno;
@@ -99,7 +99,7 @@
    VFP_REGISTER_COUNT is the number VFP registers.  */
 
 void
-aarch32_vfp_regcache_collect (const struct regcache *regcache, gdb_byte *regs,
+aarch32_vfp_regcache_collect (const regcache_raw *regcache, gdb_byte *regs,
 			      const int vfp_register_count)
 {
   int regno;
diff --git a/gdb/aarch32-linux-nat.h b/gdb/aarch32-linux-nat.h
index 369fe30..d6720e4 100644
--- a/gdb/aarch32-linux-nat.h
+++ b/gdb/aarch32-linux-nat.h
@@ -20,15 +20,15 @@
    VFPv3D16 target.  */
 #define VFP_REGS_SIZE (32 * 8 + 4)
 
-void aarch32_gp_regcache_supply (struct regcache *regcache, uint32_t *regs,
+void aarch32_gp_regcache_supply (regcache_raw *regcache, uint32_t *regs,
 				 int arm_apcs_32);
 
-void aarch32_gp_regcache_collect (const struct regcache *regcache,
+void aarch32_gp_regcache_collect (const regcache_raw *regcache,
 				  uint32_t *regs, int arm_apcs_32);
 
-void aarch32_vfp_regcache_supply (struct regcache *regcache, gdb_byte *regs,
+void aarch32_vfp_regcache_supply (regcache_raw *regcache, gdb_byte *regs,
 				  const int vfp_register_count);
 
-void aarch32_vfp_regcache_collect (const struct regcache *regcache,
+void aarch32_vfp_regcache_collect (const regcache_raw *regcache,
 				   gdb_byte *regs,
 				   const int vfp_register_count);
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 2ddf85f..b98f30a 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -152,7 +152,7 @@
    from the current thread.  */
 
 static void
-fetch_gregs_from_thread (struct regcache *regcache)
+fetch_gregs_from_thread (regcache_raw *regcache)
 {
   int ret, tid;
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -190,7 +190,7 @@
    values in the GDB's register array.  */
 
 static void
-store_gregs_to_thread (const struct regcache *regcache)
+store_gregs_to_thread (const regcache_raw *regcache)
 {
   int ret, tid;
   elf_gregset_t regs;
@@ -233,7 +233,7 @@
    from the current thread.  */
 
 static void
-fetch_fpregs_from_thread (struct regcache *regcache)
+fetch_fpregs_from_thread (regcache_raw *regcache)
 {
   int ret, tid;
   elf_fpregset_t regs;
@@ -281,7 +281,7 @@
    values in the GDB's register array.  */
 
 static void
-store_fpregs_to_thread (const struct regcache *regcache)
+store_fpregs_to_thread (const regcache_raw *regcache)
 {
   int ret, tid;
   elf_fpregset_t regs;
@@ -346,7 +346,7 @@
 
 static void
 aarch64_linux_fetch_inferior_registers (struct target_ops *ops,
-					struct regcache *regcache,
+					regcache_raw *regcache,
 					int regno)
 {
   if (regno == -1)
@@ -364,7 +364,7 @@
 
 static void
 aarch64_linux_store_inferior_registers (struct target_ops *ops,
-					struct regcache *regcache,
+					regcache_raw *regcache,
 					int regno)
 {
   if (regno == -1)
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 02ffd6b..edc2e1c 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -945,7 +945,7 @@
 
 void
 default_guess_tracepoint_registers (struct gdbarch *gdbarch,
-				    struct regcache *regcache,
+				    regcache_raw *regcache,
 				    CORE_ADDR addr)
 {
   int pc_regno = gdbarch_pc_regnum (gdbarch);
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index fa2908605..74bc701 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -263,7 +263,7 @@
 extern int default_addressable_memory_unit_size (struct gdbarch *gdbarch);
 
 extern void default_guess_tracepoint_registers (struct gdbarch *gdbarch,
-						struct regcache *regcache,
+						regcache_raw *regcache,
 						CORE_ADDR addr);
 
 extern int default_print_insn (bfd_vma memaddr, disassemble_info *info);
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 056c1b9..4462210 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -475,7 +475,7 @@
 
 void
 arm_linux_supply_gregset (const struct regset *regset,
-			  struct regcache *regcache,
+			  regcache_raw *regcache,
 			  int regnum, const void *gregs_buf, size_t len)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -513,7 +513,7 @@
 
 void
 arm_linux_collect_gregset (const struct regset *regset,
-			   const struct regcache *regcache,
+			   const regcache_raw *regcache,
 			   int regnum, void *gregs_buf, size_t len)
 {
   gdb_byte *gregs = (gdb_byte *) gregs_buf;
@@ -547,7 +547,7 @@
 #define typeExtended		0x03
 
 void
-supply_nwfpe_register (struct regcache *regcache, int regno,
+supply_nwfpe_register (regcache_raw *regcache, int regno,
 		       const gdb_byte *regs)
 {
   const gdb_byte *reg_data;
@@ -582,7 +582,7 @@
 }
 
 void
-collect_nwfpe_register (const struct regcache *regcache, int regno,
+collect_nwfpe_register (const regcache_raw *regcache, int regno,
 			gdb_byte *regs)
 {
   gdb_byte *reg_data;
@@ -620,7 +620,7 @@
 
 void
 arm_linux_supply_nwfpe (const struct regset *regset,
-			struct regcache *regcache,
+			regcache_raw *regcache,
 			int regnum, const void *regs_buf, size_t len)
 {
   const gdb_byte *regs = (const gdb_byte *) regs_buf;
@@ -637,7 +637,7 @@
 
 void
 arm_linux_collect_nwfpe (const struct regset *regset,
-			 const struct regcache *regcache,
+			 const regcache_raw *regcache,
 			 int regnum, void *regs_buf, size_t len)
 {
   gdb_byte *regs = (gdb_byte *) regs_buf;
@@ -658,7 +658,7 @@
 
 static void
 arm_linux_supply_vfp (const struct regset *regset,
-		      struct regcache *regcache,
+		      regcache_raw *regcache,
 		      int regnum, const void *regs_buf, size_t len)
 {
   const gdb_byte *regs = (const gdb_byte *) regs_buf;
@@ -675,7 +675,7 @@
 
 static void
 arm_linux_collect_vfp (const struct regset *regset,
-			 const struct regcache *regcache,
+		       const regcache_raw *regcache,
 			 int regnum, void *regs_buf, size_t len)
 {
   gdb_byte *regs = (gdb_byte *) regs_buf;
diff --git a/gdb/arm-linux-tdep.h b/gdb/arm-linux-tdep.h
index 2634455..a5be461 100644
--- a/gdb/arm-linux-tdep.h
+++ b/gdb/arm-linux-tdep.h
@@ -44,9 +44,9 @@
 				const struct regcache *regcache,
 				int regnum, void *gregs_buf, size_t len);
 
-void supply_nwfpe_register (struct regcache *regcache, int regno,
+void supply_nwfpe_register (regcache_raw *regcache, int regno,
 			    const gdb_byte *regs);
-void collect_nwfpe_register (const struct regcache *regcache, int regno,
+void collect_nwfpe_register (const regcache_raw *regcache, int regno,
 			     gdb_byte *regs);
 
 void arm_linux_supply_nwfpe (const struct regset *regset,
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 594db1d..5483a78 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -493,7 +493,7 @@
    nothing.  */
 
 static void
-get_core_register_section (struct regcache *regcache,
+get_core_register_section (regcache_raw *regcache,
 			   const struct regset *regset,
 			   const char *name,
 			   int min_size,
@@ -590,7 +590,7 @@
 
 static void
 get_core_registers (struct target_ops *ops,
-		    struct regcache *regcache, int regno)
+		    regcache_raw *regcache, int regno)
 {
   int i;
   struct gdbarch *gdbarch;
diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c
index 58ed112..f9629e8 100644
--- a/gdb/gdbarch-selftests.c
+++ b/gdb/gdbarch-selftests.c
@@ -49,12 +49,12 @@
 }
 
 static void
-test_target_prepare_to_store (target_ops *self, regcache *regs)
+test_target_prepare_to_store (target_ops *self, regcache_raw *regs)
 {
 }
 
 static void
-test_target_store_registers (target_ops *self, regcache *regs, int regno)
+test_target_store_registers (target_ops *self, regcache_raw *regs, int regno)
 {
 }
 
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 5a84879..3258480 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -4677,7 +4677,7 @@
 }
 
 void
-gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr)
+gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, regcache_raw *regcache, CORE_ADDR addr)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->guess_tracepoint_registers != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 830acb2..b672a38 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1384,8 +1384,8 @@
    allowing us to guess the PC value, and perhaps some other registers.
    On entry, regcache has all registers marked as unavailable. */
 
-typedef void (gdbarch_guess_tracepoint_registers_ftype) (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
-extern void gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
+typedef void (gdbarch_guess_tracepoint_registers_ftype) (struct gdbarch *gdbarch, regcache_raw *regcache, CORE_ADDR addr);
+extern void gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, regcache_raw *regcache, CORE_ADDR addr);
 extern void set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers);
 
 /* Return the "auto" target charset. */
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index addd92d..ed3fc53 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -1056,7 +1056,7 @@
 # where no registers have been collected, but there's only one location,
 # allowing us to guess the PC value, and perhaps some other registers.
 # On entry, regcache has all registers marked as unavailable.
-m;void;guess_tracepoint_registers;struct regcache *regcache, CORE_ADDR addr;regcache, addr;;default_guess_tracepoint_registers;;0
+m;void;guess_tracepoint_registers;regcache_raw *regcache, CORE_ADDR addr;regcache, addr;;default_guess_tracepoint_registers;;0
 
 # Return the "auto" target charset.
 f;const char *;auto_charset;void;;default_auto_charset;default_auto_charset;;0
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 5c86e98..c01e7d9 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -212,7 +212,7 @@
        registers in a large upage-plus-stack ".reg" section.  Original upage
        address X is at location core_reg_sect+x+reg_addr.  */
 
-    void (*core_read_registers) (struct regcache *regcache,
+    void (*core_read_registers) (regcache_raw *regcache,
 				 char *core_reg_sect,
 				 unsigned core_reg_size,
 				 int which, CORE_ADDR reg_addr);
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index b04b52e..42de100 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -72,7 +72,7 @@
 
 static void
 inf_child_fetch_inferior_registers (struct target_ops *ops,
-				    struct regcache *regcache, int regnum)
+				    regcache_raw *regcache, int regnum)
 {
   if (regnum == -1)
     {
@@ -90,7 +90,7 @@
 
 static void
 inf_child_store_inferior_registers (struct target_ops *ops,
-				    struct regcache *regcache, int regnum)
+				    regcache_raw *regcache, int regnum)
 {
 }
 
@@ -109,7 +109,7 @@
 
 static void
 inf_child_prepare_to_store (struct target_ops *self,
-			    struct regcache *regcache)
+			    regcache_raw *regcache)
 {
 }
 
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index af181f0..9deb48d 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -711,9 +711,9 @@
 /* Fetch register REGNUM from the inferior.  */
 
 static void
-inf_ptrace_fetch_register (struct regcache *regcache, int regnum)
+inf_ptrace_fetch_register (regcache_raw *regcache, int regnum)
 {
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
+  struct gdbarch *gdbarch = regcache->arch ();
   CORE_ADDR addr;
   size_t size;
   PTRACE_TYPE_RET *buf;
@@ -755,11 +755,11 @@
 
 static void
 inf_ptrace_fetch_registers (struct target_ops *ops,
-			    struct regcache *regcache, int regnum)
+			    regcache_raw *regcache, int regnum)
 {
   if (regnum == -1)
     for (regnum = 0;
-	 regnum < gdbarch_num_regs (get_regcache_arch (regcache));
+	 regnum < gdbarch_num_regs (regcache->arch ());
 	 regnum++)
       inf_ptrace_fetch_register (regcache, regnum);
   else
@@ -769,7 +769,7 @@
 /* Store register REGNUM into the inferior.  */
 
 static void
-inf_ptrace_store_register (const struct regcache *regcache, int regnum)
+inf_ptrace_store_register (const regcache_raw *regcache, int regnum)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   CORE_ADDR addr;
@@ -810,7 +810,7 @@
 
 static void
 inf_ptrace_store_registers (struct target_ops *ops,
-			    struct regcache *regcache, int regnum)
+			    regcache_raw *regcache, int regnum)
 {
   if (regnum == -1)
     for (regnum = 0;
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 77844bc..7ad0850 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1408,7 +1408,7 @@
 
 static void
 record_btrace_fetch_registers (struct target_ops *ops,
-			       struct regcache *regcache, int regno)
+			       regcache_raw *regcache, int regno)
 {
   struct btrace_insn_iterator *replay;
   struct thread_info *tp;
@@ -1449,7 +1449,7 @@
 
 static void
 record_btrace_store_registers (struct target_ops *ops,
-			       struct regcache *regcache, int regno)
+			       regcache_raw *regcache, int regno)
 {
   struct target_ops *t;
 
@@ -1467,7 +1467,7 @@
 
 static void
 record_btrace_prepare_to_store (struct target_ops *ops,
-				struct regcache *regcache)
+				regcache_raw *regcache)
 {
   struct target_ops *t;
 
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 7f8849b..57da46a 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -241,7 +241,7 @@
 /* Alloc a record_full_reg record entry.  */
 
 static inline struct record_full_entry *
-record_full_reg_alloc (struct regcache *regcache, int regnum)
+record_full_reg_alloc (regcache_raw *regcache, int regnum)
 {
   struct record_full_entry *rec;
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -465,7 +465,7 @@
 /* Record the value of a register NUM to record_full_arch_list.  */
 
 int
-record_full_arch_list_add_reg (struct regcache *regcache, int regnum)
+record_full_arch_list_add_reg (regcache_raw *regcache, int regnum)
 {
   struct record_full_entry *rec;
 
@@ -1393,7 +1393,7 @@
 /* Record registers change (by user or by GDB) to list as an instruction.  */
 
 static void
-record_full_registers_change (struct regcache *regcache, int regnum)
+record_full_registers_change (regcache_raw *regcache, int regnum)
 {
   /* Check record_full_insn_num.  */
   record_full_check_insn_num ();
@@ -1441,7 +1441,7 @@
 
 static void
 record_full_store_registers (struct target_ops *ops,
-			     struct regcache *regcache,
+			     regcache_raw *regcache,
 			     int regno)
 {
   if (!record_full_gdb_operation_disable)
@@ -2024,7 +2024,7 @@
 
 static void
 record_full_core_fetch_registers (struct target_ops *ops,
-				  struct regcache *regcache,
+				  regcache_raw *regcache,
 				  int regno)
 {
   if (regno < 0)
@@ -2045,7 +2045,7 @@
 
 static void
 record_full_core_prepare_to_store (struct target_ops *self,
-				   struct regcache *regcache)
+				   regcache_raw *regcache)
 {
 }
 
@@ -2053,8 +2053,8 @@
 
 static void
 record_full_core_store_registers (struct target_ops *ops,
-                             struct regcache *regcache,
-                             int regno)
+				  regcache_raw *regcache,
+				  int regno)
 {
   if (record_full_gdb_operation_disable)
     record_full_core_regbuf->raw_supply (regno,
diff --git a/gdb/record-full.h b/gdb/record-full.h
index 728bf59..6bd6e19 100644
--- a/gdb/record-full.h
+++ b/gdb/record-full.h
@@ -22,7 +22,7 @@
 
 extern int record_full_memory_query;
 
-extern int record_full_arch_list_add_reg (struct regcache *regcache, int num);
+extern int record_full_arch_list_add_reg (regcache_raw *regcache, int num);
 extern int record_full_arch_list_add_mem (CORE_ADDR addr, int len);
 extern int record_full_arch_list_add_end (void);
 
diff --git a/gdb/regcache.c b/gdb/regcache.c
index ebc9e69..197d1c2 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -232,17 +232,20 @@
   return register_size (get_regcache_arch (regcache), n);
 }
 
-regcache::regcache (gdbarch *gdbarch, address_space *aspace_,
-		    bool readonly_p_)
+regcache_raw::regcache_raw (gdbarch *gdbarch, bool readonly_p_)
   /* 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_),
-    m_aspace (aspace_), m_readonly_p (readonly_p_)
+  : reg_buffer (gdbarch, readonly_p_), m_readonly_p (readonly_p_)
 {
   m_ptid = minus_one_ptid;
 }
 
+regcache::regcache (gdbarch *gdbarch, address_space *aspace_,
+		    bool readonly_p_)
+  : regcache_raw (gdbarch, readonly_p_), m_aspace (aspace_)
+{}
+
 static enum register_status
 do_cooked_read (void *src, int regnum, gdb_byte *buf)
 {
@@ -259,7 +262,7 @@
 }
 
 gdbarch *
-regcache::arch () const
+regcache_raw::arch () const
 {
   return m_descr->gdbarch;
 }
@@ -267,7 +270,7 @@
 /* See regcache.h.  */
 
 ptid_t
-regcache_get_ptid (const struct regcache *regcache)
+regcache_get_ptid (const regcache_raw *regcache)
 {
   gdb_assert (!ptid_equal (regcache->ptid (), minus_one_ptid));
 
@@ -280,7 +283,7 @@
 {
 public:
 
-  regcache_invalidator (struct regcache *regcache, int regnum)
+  regcache_invalidator (regcache_raw *regcache, int regnum)
     : m_regcache (regcache),
       m_regnum (regnum)
   {
@@ -289,7 +292,7 @@
   ~regcache_invalidator ()
   {
     if (m_regcache != nullptr)
-      regcache_invalidate (m_regcache, m_regnum);
+      m_regcache->invalidate (m_regnum);
   }
 
   DISABLE_COPY_AND_ASSIGN (regcache_invalidator);
@@ -301,14 +304,14 @@
 
 private:
 
-  struct regcache *m_regcache;
+  regcache_raw *m_regcache;
   int m_regnum;
 };
 
 /* Return REGCACHE's architecture.  */
 
 struct gdbarch *
-get_regcache_arch (const struct regcache *regcache)
+get_regcache_arch (const regcache_raw *regcache)
 {
   return regcache->arch ();
 }
@@ -411,7 +414,7 @@
 }
 
 enum register_status
-regcache_register_status (const struct regcache *regcache, int regnum)
+regcache_register_status (const reg_buffer *regcache, int regnum)
 {
   gdb_assert (regcache != NULL);
   return regcache->get_register_status (regnum);
@@ -432,14 +435,14 @@
 }
 
 void
-regcache_invalidate (struct regcache *regcache, int regnum)
+regcache_invalidate (regcache_raw *regcache, int regnum)
 {
   gdb_assert (regcache != NULL);
   regcache->invalidate (regnum);
 }
 
 void
-regcache::invalidate (int regnum)
+regcache_raw::invalidate (int regnum)
 {
   gdb_assert (regnum >= 0);
   gdb_assert (!m_readonly_p);
@@ -584,7 +587,7 @@
 }
 
 void
-regcache_raw_update (struct regcache *regcache, int regnum)
+regcache_raw_update (regcache_raw *regcache, int regnum)
 {
   gdb_assert (regcache != NULL);
 
@@ -592,7 +595,7 @@
 }
 
 void
-regcache::raw_update (int regnum)
+regcache_raw::raw_update (int regnum)
 {
   gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
 
@@ -614,13 +617,13 @@
 }
 
 enum register_status
-regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
+regcache_raw_read (regcache_raw *regcache, int regnum, gdb_byte *buf)
 {
   return regcache->raw_read (regnum, buf);
 }
 
 enum register_status
-regcache::raw_read (int regnum, gdb_byte *buf)
+regcache_raw::raw_read (int regnum, gdb_byte *buf)
 {
   gdb_assert (buf != NULL);
   raw_update (regnum);
@@ -643,7 +646,7 @@
 
 template<typename T, typename>
 enum register_status
-regcache::raw_read (int regnum, T *val)
+regcache_raw::raw_read (int regnum, T *val)
 {
   gdb_byte *buf;
   enum register_status status;
@@ -677,7 +680,7 @@
 
 template<typename T, typename>
 void
-regcache::raw_write (int regnum, T val)
+regcache_raw::raw_write (int regnum, T val)
 {
   gdb_byte *buf;
 
@@ -890,7 +893,7 @@
 }
 
 void
-regcache::raw_write (int regnum, const gdb_byte *buf)
+regcache_raw::raw_write (int regnum, const gdb_byte *buf)
 {
 
   gdb_assert (buf != NULL);
@@ -1056,7 +1059,7 @@
 /* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE.  */
 
 void
-regcache_raw_supply (struct regcache *regcache, int regnum, const void *buf)
+regcache_raw_supply (regcache_raw *regcache, int regnum, const void *buf)
 {
   gdb_assert (regcache != NULL);
   regcache->raw_supply (regnum, buf);
@@ -1134,7 +1137,7 @@
 /* Collect register REGNUM from REGCACHE and store its contents in BUF.  */
 
 void
-regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
+regcache_raw_collect (const regcache_raw *regcache, int regnum, void *buf)
 {
   gdb_assert (regcache != NULL && buf != NULL);
   regcache->raw_collect (regnum, buf);
@@ -1242,7 +1245,7 @@
 
 void
 regcache_supply_regset (const struct regset *regset,
-			struct regcache *regcache,
+			regcache_raw *regcache,
 			int regnum, const void *buf, size_t size)
 {
   regcache->supply_regset (regset, regnum, buf, size);
@@ -1261,7 +1264,7 @@
 
 void
 regcache_collect_regset (const struct regset *regset,
-			 const struct regcache *regcache,
+			 const regcache_raw *regcache,
 			 int regnum, void *buf, size_t size)
 {
   regcache->collect_regset (regset, regnum, buf, size);
@@ -1324,7 +1327,7 @@
 }
 
 void
-regcache::debug_print_register (const char *func,  int regno)
+regcache_raw::debug_print_register (const char *func,  int regno)
 {
   struct gdbarch *gdbarch = arch ();
 
diff --git a/gdb/regcache.h b/gdb/regcache.h
index a76552f..e7dbaad 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -27,6 +27,8 @@
 struct regset;
 struct gdbarch;
 struct address_space;
+class regcache_raw;
+class reg_buffer;
 
 extern struct regcache *get_current_regcache (void);
 extern struct regcache *get_thread_regcache (ptid_t ptid);
@@ -37,27 +39,27 @@
 
 /* Return REGCACHE's ptid.  */
 
-extern ptid_t regcache_get_ptid (const struct regcache *regcache);
+extern ptid_t regcache_get_ptid (const regcache_raw *regcache);
 
 /* Return REGCACHE's architecture.  */
 
-extern struct gdbarch *get_regcache_arch (const struct regcache *regcache);
+extern struct gdbarch *get_regcache_arch (const regcache_raw *regcache);
 
 /* Return REGCACHE's address space.  */
 
 extern struct address_space *get_regcache_aspace (const struct regcache *);
 
-enum register_status regcache_register_status (const struct regcache *regcache,
+enum register_status regcache_register_status (const reg_buffer *regcache,
 					       int regnum);
 
 /* Make certain that the register REGNUM in REGCACHE is up-to-date.  */
 
-void regcache_raw_update (struct regcache *regcache, int regnum);
+void regcache_raw_update (regcache_raw *regcache, int regnum);
 
 /* 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,
+enum register_status regcache_raw_read (regcache_raw *regcache,
 					int rawnum, gdb_byte *buf);
 void regcache_raw_write (struct regcache *regcache, int rawnum,
 			 const gdb_byte *buf);
@@ -94,7 +96,7 @@
 void regcache_raw_write_part (struct regcache *regcache, int regnum,
 			      int offset, int len, const gdb_byte *buf);
 
-void regcache_invalidate (struct regcache *regcache, int regnum);
+void regcache_invalidate (regcache_raw *regcache, int regnum);
 
 /* Transfer of pseudo-registers.  The read variants return a register
    status, as an indication of when a ``cooked'' register was
@@ -143,9 +145,9 @@
    target.  These functions are called by the target in response to a
    target_fetch_registers() or target_store_registers().  */
 
-extern void regcache_raw_supply (struct regcache *regcache,
+extern void regcache_raw_supply (regcache_raw *regcache,
 				 int regnum, const void *buf);
-extern void regcache_raw_collect (const struct regcache *regcache,
+extern void regcache_raw_collect (const regcache_raw *regcache,
 				  int regnum, void *buf);
 
 /* Mapping between register numbers and offsets in a buffer, for use
@@ -186,11 +188,11 @@
    'regset_collect' fields in a regset structure.  */
 
 extern void regcache_supply_regset (const struct regset *regset,
-				    struct regcache *regcache,
+				    regcache_raw *regcache,
 				    int regnum, const void *buf,
 				    size_t size);
 extern void regcache_collect_regset (const struct regset *regset,
-				     const struct regcache *regcache,
+				     const regcache_raw *regcache,
 				     int regnum, void *buf, size_t size);
 
 
@@ -297,9 +299,60 @@
   signed char *m_register_status;
 };
 
+class regcache_raw : public reg_buffer
+{
+public:
+  regcache_raw () = delete;
+
+  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);
+
+  void raw_update (int regnum);
+
+  void invalidate (int regnum);
+
+  ptid_t ptid () const
+  {
+    return m_ptid;
+  }
+
+  void set_ptid (const ptid_t ptid)
+  {
+    this->m_ptid = ptid;
+  }
+
+  gdbarch *arch () const;
+
+/* Dump the contents of a register from the register cache to the target
+   debug.  */
+  void debug_print_register (const char *func, int regno);
+
+protected:
+  regcache_raw (gdbarch *gdbarch, bool readonly_p_);
+
+  /* Is this a read-only cache?  A read-only cache is used for saving
+     the target's register state (e.g, across an inferior function
+     call or just before forcing a function return).  A read-only
+     cache can only be updated via the methods regcache_dup() and
+     regcache_cpy().  The actual contents are determined by the
+     reggroup_save and reggroup_restore methods.  */
+  bool m_readonly_p;
+
+private:
+  /* If this is a read-write cache, which thread's registers is
+     it connected to?  */
+  ptid_t m_ptid;
+};
+
 /* The register cache for storing raw register values.  */
 
-class regcache : public reg_buffer
+class regcache : public regcache_raw
 {
 public:
   regcache (gdbarch *gdbarch, address_space *aspace_)
@@ -314,8 +367,6 @@
 
   DISABLE_COPY_AND_ASSIGN (regcache);
 
-  gdbarch *arch () const;
-
   address_space *aspace () const
   {
     return m_aspace;
@@ -326,16 +377,6 @@
   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>>
@@ -344,10 +385,6 @@
   template<typename T, typename = RequireLongest<T>>
   void cooked_write (int regnum, T val);
 
-  void raw_update (int regnum);
-
-  void invalidate (int regnum);
-
   enum register_status raw_read_part (int regnum, int offset, int len,
 				      gdb_byte *buf);
 
@@ -361,20 +398,6 @@
 
   void dump (ui_file *file, enum regcache_dump_what what_to_dump);
 
-  ptid_t ptid () const
-  {
-    return m_ptid;
-  }
-
-  void set_ptid (const ptid_t ptid)
-  {
-    this->m_ptid = ptid;
-  }
-
-/* Dump the contents of a register from the register cache to the target
-   debug.  */
-  void debug_print_register (const char *func, int regno);
-
   static void regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid);
 protected:
   regcache (gdbarch *gdbarch, address_space *aspace_, bool readonly_p_);
@@ -391,17 +414,6 @@
      makes sense, like PC or SP).  */
   struct address_space *m_aspace;
 
-  /* Is this a read-only cache?  A read-only cache is used for saving
-     the target's register state (e.g, across an inferior function
-     call or just before forcing a function return).  A read-only
-     cache can only be updated via the methods regcache_dup() and
-     regcache_cpy().  The actual contents are determined by the
-     reggroup_save and reggroup_restore methods.  */
-  bool m_readonly_p;
-  /* If this is a read-write cache, which thread's registers is
-     it connected to?  */
-  ptid_t m_ptid;
-
   friend struct regcache *
   get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
 				   struct address_space *aspace);
diff --git a/gdb/regset.h b/gdb/regset.h
index 36592cb..ff058d5 100644
--- a/gdb/regset.h
+++ b/gdb/regset.h
@@ -25,10 +25,10 @@
 
 /* Data structure describing a register set.  */
 
-typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
+typedef void (supply_regset_ftype) (const struct regset *, regcache_raw *,
                                     int, const void *, size_t);
-typedef void (collect_regset_ftype) (const struct regset *, 
-                                     const struct regcache *,
+typedef void (collect_regset_ftype) (const struct regset *,
+                                     const regcache_raw *,
                                      int, void *, size_t);
 
 struct regset
diff --git a/gdb/remote.c b/gdb/remote.c
index 3ceabcf..50cf231 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -105,7 +105,7 @@
 static void remote_files_info (struct target_ops *ignore);
 
 static void remote_prepare_to_store (struct target_ops *self,
-				     struct regcache *regcache);
+				     regcache_raw *regcache);
 
 static void remote_open_1 (const char *, int, struct target_ops *,
 			   int extended_p);
@@ -7554,7 +7554,7 @@
 /* Fetch a single register using a 'p' packet.  */
 
 static int
-fetch_register_using_p (struct regcache *regcache, struct packet_reg *reg)
+fetch_register_using_p (regcache_raw *regcache, struct packet_reg *reg)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   struct remote_state *rs = get_remote_state ();
@@ -7647,7 +7647,7 @@
 }
 
 static void
-process_g_packet (struct regcache *regcache)
+process_g_packet (regcache_raw *regcache)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   struct remote_state *rs = get_remote_state ();
@@ -7752,7 +7752,7 @@
 }
 
 static void
-fetch_registers_using_g (struct regcache *regcache)
+fetch_registers_using_g (regcache_raw *regcache)
 {
   send_g_packet ();
   process_g_packet (regcache);
@@ -7783,7 +7783,7 @@
 
 static void
 remote_fetch_registers (struct target_ops *ops,
-			struct regcache *regcache, int regnum)
+			regcache_raw *regcache, int regnum)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   remote_arch_state *rsa = get_remote_arch_state (gdbarch);
@@ -7834,7 +7834,7 @@
    first.  */
 
 static void
-remote_prepare_to_store (struct target_ops *self, struct regcache *regcache)
+remote_prepare_to_store (struct target_ops *self, regcache_raw *regcache)
 {
   remote_arch_state *rsa = get_remote_arch_state (regcache->arch ());
   int i;
@@ -7858,7 +7858,7 @@
    packet was not recognized.  */
 
 static int
-store_register_using_P (const struct regcache *regcache, 
+store_register_using_P (const regcache_raw *regcache,
 			struct packet_reg *reg)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
@@ -7899,7 +7899,7 @@
    contents of the register cache buffer.  FIXME: ignores errors.  */
 
 static void
-store_registers_using_G (const struct regcache *regcache)
+store_registers_using_G (const regcache_raw *regcache)
 {
   struct remote_state *rs = get_remote_state ();
   remote_arch_state *rsa = get_remote_arch_state (regcache->arch ());
@@ -7939,7 +7939,7 @@
 
 static void
 remote_store_registers (struct target_ops *ops,
-			struct regcache *regcache, int regnum)
+			regcache_raw *regcache, int regnum)
 {
   struct gdbarch *gdbarch = regcache->arch ();
   remote_arch_state *rsa = get_remote_arch_state (gdbarch);
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index dfc7404..9a72bca 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -177,7 +177,7 @@
 
 static void
 s390_guess_tracepoint_registers (struct gdbarch *gdbarch,
-				 struct regcache *regcache,
+				 regcache_raw *regcache,
 				 CORE_ADDR addr)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index 7477ce6..0d4d534 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -98,7 +98,7 @@
   target_debug_do_print (core_addr_to_string (*(X)))
 #define target_debug_print_int_p(X)		\
   target_debug_do_print (plongest (*(X)))
-#define target_debug_print_struct_regcache_p(X) \
+#define target_debug_print_regcache_raw_p(X) \
   target_debug_do_print (host_address_to_string (X))
 #define target_debug_print_struct_thread_info_p(X)	\
   target_debug_do_print (host_address_to_string (X))
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index c981796..0e6fef7 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -159,80 +159,80 @@
 }
 
 static void
-delegate_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+delegate_fetch_registers (struct target_ops *self, regcache_raw *arg1, int arg2)
 {
   self = self->beneath;
   self->to_fetch_registers (self, arg1, arg2);
 }
 
 static void
-tdefault_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+tdefault_fetch_registers (struct target_ops *self, regcache_raw *arg1, int arg2)
 {
 }
 
 static void
-debug_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+debug_fetch_registers (struct target_ops *self, regcache_raw *arg1, int arg2)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_fetch_registers (...)\n", debug_target.to_shortname);
   debug_target.to_fetch_registers (&debug_target, arg1, arg2);
   fprintf_unfiltered (gdb_stdlog, "<- %s->to_fetch_registers (", debug_target.to_shortname);
   target_debug_print_struct_target_ops_p (&debug_target);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_struct_regcache_p (arg1);
+  target_debug_print_regcache_raw_p (arg1);
   fputs_unfiltered (", ", gdb_stdlog);
   target_debug_print_int (arg2);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
 static void
-delegate_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+delegate_store_registers (struct target_ops *self, regcache_raw *arg1, int arg2)
 {
   self = self->beneath;
   self->to_store_registers (self, arg1, arg2);
 }
 
 static void
-tdefault_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+tdefault_store_registers (struct target_ops *self, regcache_raw *arg1, int arg2)
 {
   noprocess ();
 }
 
 static void
-debug_store_registers (struct target_ops *self, struct regcache *arg1, int arg2)
+debug_store_registers (struct target_ops *self, regcache_raw *arg1, int arg2)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_store_registers (...)\n", debug_target.to_shortname);
   debug_target.to_store_registers (&debug_target, arg1, arg2);
   fprintf_unfiltered (gdb_stdlog, "<- %s->to_store_registers (", debug_target.to_shortname);
   target_debug_print_struct_target_ops_p (&debug_target);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_struct_regcache_p (arg1);
+  target_debug_print_regcache_raw_p (arg1);
   fputs_unfiltered (", ", gdb_stdlog);
   target_debug_print_int (arg2);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
 static void
-delegate_prepare_to_store (struct target_ops *self, struct regcache *arg1)
+delegate_prepare_to_store (struct target_ops *self, regcache_raw *arg1)
 {
   self = self->beneath;
   self->to_prepare_to_store (self, arg1);
 }
 
 static void
-tdefault_prepare_to_store (struct target_ops *self, struct regcache *arg1)
+tdefault_prepare_to_store (struct target_ops *self, regcache_raw *arg1)
 {
   noprocess ();
 }
 
 static void
-debug_prepare_to_store (struct target_ops *self, struct regcache *arg1)
+debug_prepare_to_store (struct target_ops *self, regcache_raw *arg1)
 {
   fprintf_unfiltered (gdb_stdlog, "-> %s->to_prepare_to_store (...)\n", debug_target.to_shortname);
   debug_target.to_prepare_to_store (&debug_target, arg1);
   fprintf_unfiltered (gdb_stdlog, "<- %s->to_prepare_to_store (", debug_target.to_shortname);
   target_debug_print_struct_target_ops_p (&debug_target);
   fputs_unfiltered (", ", gdb_stdlog);
-  target_debug_print_struct_regcache_p (arg1);
+  target_debug_print_regcache_raw_p (arg1);
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
diff --git a/gdb/target.c b/gdb/target.c
index f2dccd2..6f45bb2 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3443,7 +3443,7 @@
 }
 
 void
-target_fetch_registers (struct regcache *regcache, int regno)
+target_fetch_registers (regcache_raw *regcache, int regno)
 {
   current_target.to_fetch_registers (&current_target, regcache, regno);
   if (targetdebug)
@@ -3451,7 +3451,7 @@
 }
 
 void
-target_store_registers (struct regcache *regcache, int regno)
+target_store_registers (regcache_raw *regcache, int regno)
 {
   if (!may_write_registers)
     error (_("Writing to registers is not allowed (regno %d)"), regno);
diff --git a/gdb/target.h b/gdb/target.h
index f5ad1e5..c7cb63d 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -475,11 +475,11 @@
 		       ptid_t, struct target_waitstatus *,
 		       int TARGET_DEBUG_PRINTER (target_debug_print_options))
       TARGET_DEFAULT_FUNC (default_target_wait);
-    void (*to_fetch_registers) (struct target_ops *, struct regcache *, int)
+    void (*to_fetch_registers) (struct target_ops *, regcache_raw *, int)
       TARGET_DEFAULT_IGNORE ();
-    void (*to_store_registers) (struct target_ops *, struct regcache *, int)
+    void (*to_store_registers) (struct target_ops *, regcache_raw *, int)
       TARGET_DEFAULT_NORETURN (noprocess ());
-    void (*to_prepare_to_store) (struct target_ops *, struct regcache *)
+    void (*to_prepare_to_store) (struct target_ops *, regcache_raw *)
       TARGET_DEFAULT_NORETURN (noprocess ());
 
     void (*to_files_info) (struct target_ops *)
@@ -1401,13 +1401,13 @@
 
 /* Fetch at least register REGNO, or all regs if regno == -1.  No result.  */
 
-extern void target_fetch_registers (struct regcache *regcache, int regno);
+extern void target_fetch_registers (regcache_raw *regcache, int regno);
 
 /* Store at least register REGNO, or all regs if REGNO == -1.
    It can store as many registers as it wants to, so target_prepare_to_store
    must have been previously called.  Calls error() if there are problems.  */
 
-extern void target_store_registers (struct regcache *regcache, int regs);
+extern void target_store_registers (regcache_raw *regcache, int regs);
 
 /* Get ready to modify the registers array.  On machines which store
    individual registers, this doesn't need to do anything.  On machines
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 7288e7c..4ec655d 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -841,7 +841,7 @@
 
 static void
 tfile_fetch_registers (struct target_ops *ops,
-		       struct regcache *regcache, int regno)
+		       regcache_raw *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   int offset, regn, regsize, dummy;
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index b6a800c..e93bb04 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -385,7 +385,7 @@
    ctf.  */
 
 void
-tracefile_fetch_registers (struct regcache *regcache, int regno)
+tracefile_fetch_registers (regcache_raw *regcache, int regno)
 {
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
   struct tracepoint *tp = get_tracepoint (get_tracepoint_number ());
diff --git a/gdb/tracefile.h b/gdb/tracefile.h
index e6d4460..3fb9f3d 100644
--- a/gdb/tracefile.h
+++ b/gdb/tracefile.h
@@ -115,6 +115,6 @@
 
 extern void init_tracefile_ops (struct target_ops *ops);
 
-extern void tracefile_fetch_registers (struct regcache *regcache, int regno);
+extern void tracefile_fetch_registers (regcache_raw *regcache, int regno);
 
 #endif /* TRACEFILE_H */