* MAINTAINERS: Add myself as dcache.c maintainer.
authorJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 18 Aug 2000 22:52:23 +0000 (22:52 +0000)
committerJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 18 Aug 2000 22:52:23 +0000 (22:52 +0000)
* remote-nindy.c (nindy_load): Invalidate dcache.

* dcache.c (dcache_invd): Renamed from dcache_flush.  The term
flush with respect to caches usually implies that data will be
written to memory.
(dcache_init, dcache_xfer_memory): Updated.
* monitor.c (flush_monitor_dcache, monitor_resume, monitor_load):
Updated.
* ocd.c (ocd_open, ocd_resume, bdm_reset_command): Updated.
* remote-bug.c (bug_load, bug_resume): Updated.
* remote-nindy.c (nindy_open, nindy_resume): Updated.
* remote-sds.c (sds_open, sds_resume): Updated.
* remote-utils.c (gr_open): Updated.
* remote.c (remote_open_1, remote_resume, remote_async_resume,
remote_cisco_open): Updated.
* wince.c (child_create_inferior, child_resume): Updated.

* monitor.c (monitor_open): Free dcache before creating a new one.
* dcache.c (dcache_free): New function.
* dcache.h (dcache_free): New prototype.
-------------------------------------------------------------------

12 files changed:
gdb/ChangeLog
gdb/MAINTAINERS
gdb/dcache.c
gdb/dcache.h
gdb/monitor.c
gdb/ocd.c
gdb/remote-bug.c
gdb/remote-nindy.c
gdb/remote-sds.c
gdb/remote-utils.c
gdb/remote.c
gdb/wince.c

index 5635e51..fd92979 100644 (file)
@@ -1,3 +1,28 @@
+2000-08-18  J.T. Conklin  <jtc@redback.com>
+
+       * MAINTAINERS: Add myself as dcache.c maintainer.
+
+       * remote-nindy.c (nindy_load): Invalidate dcache.
+
+       * dcache.c (dcache_invd): Renamed from dcache_flush.  The term
+       flush with respect to caches usually implies that data will be 
+       written to memory.
+       (dcache_init, dcache_xfer_memory): Updated.
+       * monitor.c (flush_monitor_dcache, monitor_resume, monitor_load): 
+       Updated.
+       * ocd.c (ocd_open, ocd_resume, bdm_reset_command): Updated.
+       * remote-bug.c (bug_load, bug_resume): Updated.
+       * remote-nindy.c (nindy_open, nindy_resume): Updated.
+       * remote-sds.c (sds_open, sds_resume): Updated.
+       * remote-utils.c (gr_open): Updated.
+       * remote.c (remote_open_1, remote_resume, remote_async_resume,
+       remote_cisco_open): Updated.
+       * wince.c (child_create_inferior, child_resume): Updated.
+
+       * monitor.c (monitor_open): Free dcache before creating a new one.
+       * dcache.c (dcache_free): New function.
+       * dcache.h (dcache_free): New prototype.
+
 2000-08-18  Andrew Cagney  <cagney@ops1.cygnus.com>
 
        * remote-array.c (array_fetch_register): Pass dummy parameter to
index 8082b17..6768a27 100644 (file)
@@ -125,7 +125,7 @@ FreeBSD native & host       Mark Kettenis           kettenis@gnu.org
 hurd native            Mark Kettenis           kettenis@gnu.org
 macos host & native    Stan Shebs              shebs@apple.com
 hpux, hp pa native     Jeff Law                law@cygnus.com
-NetBSD                 J.T. Conklin            jtc@redback.com
+NetBSD native & host   J.T. Conklin            jtc@redback.com
 SCO/Unixware           Nick Duffek             nsd@cygnus.com
                        Robert Lipe             rjl@sco.com
 GNU/Linux ARM native   Scott Bambrough         scottb@netwinder.org
@@ -188,6 +188,7 @@ testsuite           Stan Shebs              shebs@apple.com
   hp tests (gdb.hp)    Jimmy Guo               guo@cup.hp.com
   Java tests (gdb.java)        Anthony Green           green@cygnus.com
 Kernel Object Display  Fernando Nasser         fnasser@cygnus.com
+dcache.c               J.T. Conklin            jtc@redback.com
 
 
 UI: External (user) interfaces.
index a890979..a563d8b 100644 (file)
@@ -173,7 +173,7 @@ DCACHE *last_cache;         /* Used by info dcache */
 /* Free all the data cache blocks, thus discarding all cached data.  */
 
 void
-dcache_flush (DCACHE *dcache)
+dcache_invd (DCACHE *dcache)
 {
   int i;
   dcache->valid_head = 0;
@@ -402,12 +402,23 @@ dcache_init (memxferfunc reading, memxferfunc writing)
   dcache->the_cache = (struct dcache_block *) xmalloc (csize);
   memset (dcache->the_cache, 0, csize);
 
-  dcache_flush (dcache);
+  dcache_invd (dcache);
 
   last_cache = dcache;
   return dcache;
 }
 
+/* Free a data cache */
+void
+dcache_free (DCACHE *dcache)
+{
+  if (last_cache == dcache)
+    last_cache = NULL;
+
+  free (dcache->the_cache);
+  free (dcache);
+}
+
 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
    to or from debugger address MYADDR.  Write to inferior if SHOULD_WRITE is
    nonzero. 
@@ -441,7 +452,7 @@ dcache_xfer_memory (DCACHE *dcache, CORE_ADDR memaddr, char *myaddr, int len,
       xfunc = should_write ? dcache->write_memory : dcache->read_memory;
 
       if (dcache->cache_has_stuff)
-       dcache_flush (dcache);
+       dcache_invd (dcache);
 
       len = xfunc (memaddr, myaddr, len);
     }
index 928173d..1615fce 100644 (file)
@@ -27,12 +27,15 @@ typedef int (*memxferfunc) (CORE_ADDR memaddr, char *myaddr, int len);
 
 typedef struct dcache_struct DCACHE;
 
-/* Flush DCACHE. */
-void dcache_flush (DCACHE * dcache);
+/* Invalidate DCACHE. */
+void dcache_invd (DCACHE * dcache);
 
 /* Initialize DCACHE. */
 DCACHE *dcache_init (memxferfunc reading, memxferfunc writing);
 
+/* Free a DCACHE */
+void dcache_free (DCACHE *);
+
 /* Simple to call from <remote>_xfer_memory */
 
 int dcache_xfer_memory (DCACHE * cache, CORE_ADDR mem, char *my, int len,
index b57365e..ca7dd30 100644 (file)
@@ -838,16 +838,14 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
 
   monitor_printf (current_monitor->line_term);
 
-  if (!remote_dcache)
-    {
-      if (current_monitor->flags & MO_HAS_BLOCKWRITES)
-       remote_dcache = dcache_init (monitor_read_memory, 
-                                    monitor_write_memory_block);
-      else
-       remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory);
-    }
+  if (remote_dcache)
+    dcache_free (remote_dcache);
+
+  if (current_monitor->flags & MO_HAS_BLOCKWRITES)
+    remote_dcache = dcache_init (monitor_read_memory, 
+                                monitor_write_memory_block);
   else
-    dcache_flush (remote_dcache);
+    remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory);
 
   start_remote ();
 }
@@ -934,7 +932,7 @@ monitor_supply_register (int regno, char *valstr)
 void
 flush_monitor_dcache (void)
 {
-  dcache_flush (remote_dcache);
+  dcache_invd (remote_dcache);
 }
 
 static void
@@ -950,7 +948,7 @@ monitor_resume (int pid, int step, enum target_signal sig)
        dump_reg_flag = 1;
       return;
     }
-  dcache_flush (remote_dcache);
+  dcache_invd (remote_dcache);
   if (step)
     monitor_printf (current_monitor->step);
   else
@@ -2147,7 +2145,7 @@ monitor_wait_srec_ack (void)
 static void
 monitor_load (char *file, int from_tty)
 {
-  dcache_flush (remote_dcache);
+  dcache_invd (remote_dcache);
   monitor_debug ("MON load\n");
 
   if (current_monitor->load_routine)
index 5c29919..6dd601e 100644 (file)
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -295,7 +295,7 @@ device the OCD device is attached to (e.g. /dev/ttya).");
   if (!ocd_dcache)
     ocd_dcache = dcache_init (ocd_read_bytes, ocd_write_bytes);
   else
-    dcache_flush (ocd_dcache);
+    dcache_invd (ocd_dcache);
 
   if (strncmp (name, "wiggler", 7) == 0)
     {
@@ -387,7 +387,7 @@ ocd_resume (int pid, int step, enum target_signal siggnal)
 {
   int pktlen;
 
-  dcache_flush (ocd_dcache);
+  dcache_invd (ocd_dcache);
 
   if (step)
     ocd_do_command (OCD_STEP, &last_run_status, &pktlen);
@@ -1318,7 +1318,7 @@ bdm_reset_command (char *args, int from_tty)
     error ("Not connected to OCD device.");
 
   ocd_do_command (OCD_RESET, &status, &pktlen);
-  dcache_flush (ocd_dcache);
+  dcache_invd (ocd_dcache);
   registers_changed ();
 }
 
index 7d34615..aac148e 100644 (file)
@@ -119,7 +119,7 @@ bug_load (char *args, int fromtty)
 
   sr_check_open ();
 
-  dcache_flush (gr_get_dcache ());
+  dcache_invd (gr_get_dcache ());
   inferior_pid = 0;
   abfd = bfd_openr (args, 0);
   if (!abfd)
@@ -242,7 +242,7 @@ bug_open (char *args, int from_tty)
 void
 bug_resume (int pid, int step, enum target_signal sig)
 {
-  dcache_flush (gr_get_dcache ());
+  dcache_invd (gr_get_dcache ());
 
   if (step)
     {
index adf1484..807000d 100644 (file)
@@ -191,7 +191,7 @@ nindy_open (char *name,             /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */
   if (!nindy_dcache)
     nindy_dcache = dcache_init (ninMemGet, ninMemPut);
   else
-    dcache_flush (nindy_dcache);
+    dcache_invd (nindy_dcache);
 
   /* Allow user to interrupt the following -- we could hang if there's
      no NINDY at the other end of the remote tty.  */
@@ -269,7 +269,7 @@ nindy_resume (int pid, int step, enum target_signal siggnal)
   if (siggnal != TARGET_SIGNAL_0 && siggnal != stop_signal)
     warning ("Can't send signals to remote NINDY targets.");
 
-  dcache_flush (nindy_dcache);
+  dcache_invd (nindy_dcache);
   if (regs_changed)
     {
       nindy_store_registers (-1);
@@ -614,6 +614,8 @@ nindy_load (char *filename, int from_tty)
        }
     }
   bfd_close (file);
+
+  dcache_invd(nindy_dcache);
 }
 
 static int
index ce6f5f6..582d46b 100644 (file)
@@ -206,7 +206,7 @@ device is attached to the remote system (e.g. /dev/ttya).");
   if (!sds_dcache)
     sds_dcache = dcache_init (sds_read_bytes, sds_write_bytes);
   else
-    dcache_flush (sds_dcache);
+    dcache_invd (sds_dcache);
 
   sds_desc = SERIAL_OPEN (name);
   if (!sds_desc)
@@ -358,7 +358,7 @@ sds_resume (int pid, int step, enum target_signal siggnal)
 {
   unsigned char buf[PBUFSIZ];
 
-  dcache_flush (sds_dcache);
+  dcache_invd (sds_dcache);
 
   last_sent_signal = siggnal;
   last_sent_step = step;
index a31da1c..236a0ec 100644 (file)
@@ -165,7 +165,7 @@ gr_open (char *args, int from_tty, struct gr_settings *gr)
   if ((dcache = gr_get_dcache()) == NULL)
     gr_set_dcache (dcache_init (gr->readfunc, gr->writefunc));
   else
-    dcache_flush (dcache);
+    dcache_invd (dcache);
 
   if (sr_get_desc () != NULL)
     gr_close (0);
index 557ab46..66a14fa 100644 (file)
@@ -2060,7 +2060,7 @@ serial device is attached to the remote system\n\
   if (!remote_dcache)
     remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
   else
-    dcache_flush (remote_dcache);
+    dcache_invd (remote_dcache);
 
   remote_desc = SERIAL_OPEN (name);
   if (!remote_desc)
@@ -2309,7 +2309,7 @@ remote_resume (int pid, int step, enum target_signal siggnal)
   else
     set_thread (pid, 0);       /* run this thread */
 
-  dcache_flush (remote_dcache);
+  dcache_invd (remote_dcache);
 
   last_sent_signal = siggnal;
   last_sent_step = step;
@@ -2343,7 +2343,7 @@ remote_async_resume (int pid, int step, enum target_signal siggnal)
   else
     set_thread (pid, 0);       /* run this thread */
 
-  dcache_flush (remote_dcache);
+  dcache_invd (remote_dcache);
 
   last_sent_signal = siggnal;
   last_sent_step = step;
@@ -5040,7 +5040,7 @@ device is attached to the remote system (e.g. host:port).");
   if (!remote_dcache)
     remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
   else
-    dcache_flush (remote_dcache);
+    dcache_invd (remote_dcache);
 
   remote_desc = SERIAL_OPEN (name);
   if (!remote_desc)
index c07ada0..7081dd2 100644 (file)
@@ -1732,7 +1732,7 @@ child_create_inferior (char *exec_file, char *args, char **env)
   if (!remote_dcache)
     remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
   else
-    dcache_flush (remote_dcache);
+    dcache_invd (remote_dcache);
 
   exec_file = upload_to_device (exec_file, exec_file);
 
@@ -1842,7 +1842,7 @@ child_resume (int pid, int step, enum target_signal sig)
       th->context.ContextFlags = 0;
     }
 
-  dcache_flush (remote_dcache);
+  dcache_invd (remote_dcache);
 
   /* Allow continuing with the same signal that interrupted us.
      Otherwise complain. */