Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa:m68hc11] Switch m68hc11 to cooked registers
@ 2002-08-02  9:04 Andrew Cagney
  2002-08-02 11:44 ` Stephane Carrez
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-08-02  9:04 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 183 bytes --]

Hello,

The attached patch tries to switch the m68hc11 to the new cooked 
register framework.

It certainly compiles and looks ok (....) but I've not tested it.

ok to commit?
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2557 bytes --]

Index: ChangeLog
2002-08-02  Andrew Cagney  <cagney@redhat.com>

	* m68hc11-tdep.c (m68hc11_pseudo_register_read): Replace
	m68hc11_fetch_pseudo_register.
	(m68hc11_pseudo_register_write): Replace
	m68hc11_store_pseudo_register.
	(m68hc11_gdbarch_init): Update.

Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.22
diff -u -r1.22 m68hc11-tdep.c
--- m68hc11-tdep.c	29 Jul 2002 16:34:06 -0000	1.22
+++ m68hc11-tdep.c	2 Aug 2002 15:58:37 -0000
@@ -218,11 +218,11 @@
 /* Fetch a pseudo register.  The 68hc11 soft registers are treated like
    pseudo registers.  They are located in memory.  Translate the register
    fetch into a memory read.  */
-void
-m68hc11_fetch_pseudo_register (int regno)
+static void
+m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
+			      struct regcache *regcache,
+			      int regno, void *buf)
 {
-  char buf[MAX_REGISTER_RAW_SIZE];
-
   m68hc11_initialize_register_info ();
   
   /* Fetch a soft register: translate into a memory read.  */
@@ -234,23 +234,24 @@
     {
       memset (buf, 0, 2);
     }
-  supply_register (regno, buf);
 }
 
 /* Store a pseudo register.  Translate the register store
    into a memory write.  */
 static void
-m68hc11_store_pseudo_register (int regno)
+m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
+			       struct regcache *regcache,
+			       int regno, const void *buf)
 {
   m68hc11_initialize_register_info ();
 
   /* Store a soft register: translate into a memory write.  */
   if (soft_regs[regno].name)
     {
-      char buf[MAX_REGISTER_RAW_SIZE];
-
-      read_register_gen (regno, buf);
-      target_write_memory (soft_regs[regno].addr, buf, 2);
+      const int regsize = 2;
+      char *tmp = alloca (regsize);
+      memcpy (tmp, buf, regsize);
+      target_write_memory (soft_regs[regno].addr, tmp, regsize);
     }
 }
 
@@ -1098,8 +1099,8 @@
   set_gdbarch_register_size (gdbarch, 2);
   set_gdbarch_register_bytes (gdbarch, M68HC11_ALL_REGS * 2);
   set_gdbarch_register_virtual_type (gdbarch, m68hc11_register_virtual_type);
-  set_gdbarch_fetch_pseudo_register (gdbarch, m68hc11_fetch_pseudo_register);
-  set_gdbarch_store_pseudo_register (gdbarch, m68hc11_store_pseudo_register);
+  set_gdbarch_pseudo_register_read (gdbarch, m68hc11_pseudo_register_read);
+  set_gdbarch_pseudo_register_write (gdbarch, m68hc11_pseudo_register_write);
 
   set_gdbarch_use_generic_dummy_frames (gdbarch, 1);
   set_gdbarch_call_dummy_length (gdbarch, 0);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-03 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-02  9:04 [rfa:m68hc11] Switch m68hc11 to cooked registers Andrew Cagney
2002-08-02 11:44 ` Stephane Carrez
2002-08-03  9:09   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox