This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC/RFA] Mutliarch h8300 step 2


Hi

Attachment patched remote part of h8300-hms target.

Andrey


2002-08-06 Andrey Volkov <avolkov@transas.com>

	* remote-e7000.c: Change loops for(0 ...7) to
      for(SIM_H8300_R0_REGNUM ...SIM_H8300_R7_REGNUM), 
      change NUM_REAL_REGS to NUM_REGS
	* remote-hms.c: use h8300_register_name as montitor->regname
	* tm-h8300.h: Define CCR_REGNUM, and h8300_register_name.
	* h8300-tdep.c: Declare h8300_register_name as extern function.


Index: remote-e7000.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-e7000.c,v
retrieving revision 1.28
diff -u -r1.28 remote-e7000.c
--- remote-e7000.c	5 May 2002 01:15:13 -0000	1.28
+++ remote-e7000.c	6 Aug 2002 17:31:47 -0000
@@ -659,10 +659,6 @@
     }
   serial_raw (e7000_desc);
 
-#ifdef GDB_TARGET_IS_H8300
-  h8300hmode = 1;
-#endif
-
   /* Start the remote connection; if error (0), discard this target.
      In particular, if the user quits, be sure to discard it
      (we'd be in an inconsistent state otherwise).  */
@@ -911,20 +907,18 @@
 	  wanted = want_sh3;
 	}
     }
-#ifdef GDB_TARGET_IS_H8300
   if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
     {
-      if (h8300smode)
+      if (TARGET_ARCHITECTURE->mach == bfd_mach_h8300s)
 	wanted = want_h8300s;
       else
 	wanted = want_h8300h;
     }
-#endif
 
   fetch_regs_from_dump (gch, wanted);
 
   /* And supply the extra ones the simulator uses */
-  for (regno = NUM_REALREGS; regno < NUM_REGS; regno++)
+  for (regno = NUM_REGS; regno < NUM_REGS + NUM_PSEUDO_REGS; regno++)
     {
       int buf = 0;
 
@@ -948,7 +942,7 @@
 {
   int regno;
 
-  for (regno = 0; regno < NUM_REALREGS; regno++)
+  for (regno = 0; regno < NUM_REGS; regno++)
     e7000_store_register (regno);
 
   registers_changed ();
@@ -969,7 +963,7 @@
 
   if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
     {
-      if (regno <= 7)
+      if (regno >= SIM_H8300_R0_REGNUM && regno <= SIM_H8300_R7_REGNUM)
 	{
 	  sprintf (buf, ".ER%d %s\r", regno, phex_nz (read_register (regno),
0));
 	  puts_e7000debug (buf);
@@ -2048,19 +2042,18 @@
 	  wanted_nopc = want_nopc_sh3;
 	}
     }
-#ifdef GDB_TARGET_IS_H8300
   if (TARGET_ARCHITECTURE->arch == bfd_arch_h8300)
     {
-      if (h8300smode)
+      if (TARGET_ARCHITECTURE->mach == bfd_mach_h8300s)
 	wanted_nopc = want_nopc_h8300s;
       else
 	wanted_nopc = want_nopc_h8300h;
     }
-#endif
+
   fetch_regs_from_dump (gch, wanted_nopc);
 
   /* And supply the extra ones the simulator uses */
-  for (regno = NUM_REALREGS; regno < NUM_REGS; regno++)
+  for (regno = NUM_REGS; regno < NUM_REGS + NUM_PSEUDO_REGS; regno++)
     {
       int buf = 0;
       supply_register (regno, (char *) &buf);
Index: remote-hms.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-hms.c,v
retrieving revision 1.5
diff -u -r1.5 remote-hms.c
--- remote-hms.c	6 Mar 2001 08:21:12 -0000	1.5
+++ remote-hms.c	6 Aug 2002 17:31:48 -0000
@@ -58,18 +58,6 @@
 }
 
 /*
- * This array of registers needs to match the indexes used by GDB. The
- * whole reason this exists is because the various ROM monitors use
- * different names than GDB does, and don't support all the
- * registers either. So, typing "info reg sp" becomes a "r30".
- */
-
-static char *hms_regnames[NUM_REGS] =
-{
-  "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "CCR", "PC"
-};
-
-/*
  * Define the monitor command strings. Since these are passed directly
  * through to a printf style function, we need can include formatting
  * strings. We also need a CR or LF on the end.
@@ -128,7 +116,7 @@
   hms_cmds.cmd_end = NULL;	/* optional command terminator */
   hms_cmds.target = &hms_ops;	/* target operations */
   hms_cmds.stopbits = SERIAL_1_STOPBITS;	/* number of stop bits */
-  hms_cmds.regnames = hms_regnames;	/* registers names */
+  hms_cmds.regname = h8300_register_name;	/* registers names */
   hms_cmds.magic = MONITOR_OPS_MAGIC;	/* magic */
 }				/* init_hms-cmds */
 
--- tm-h8300.h	2002-08-06 21:34:36 +0400
+++ tm-h8300.h_	2002-08-06 21:17:44 +0400
@@ -320,8 +320,12 @@
 /*Only for monitor.c, remote-hms ...*/
 #include "gdb/sim-h8300.h"
 
-/* tell gdb that there is breakpoint/watchpoint hardware in some h8300's */
+#define CCR_REGNUM  SIM_H8300_CCR_REGNUM
+
+const char *
+h8300_register_name (int regnr);
 
+/* tell gdb that there is breakpoint/watchpoint hardware in some h8300's */
 #define TARGET_HAS_HARDWARE_WATCHPOINTS 1
 
 int h8300_can_use_hw_wp(int type, int cnt, int other_type);
--- h8300-tdep.c	2002-08-06 21:45:24 +0400
+++ h8300-tdep.c.new	2002-08-06 21:47:42 +0400
@@ -196,7 +196,7 @@
 
 /* <--- end local declaration */
 
-static const char *
+const char *
 h8300_register_name (int regnr)
 {
     struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]