* monitor.c (monitor_open): If a dcache has already been created,
authorJ.T. Conklin <jtc@acorntoolworks.com>
Thu, 10 Aug 2000 18:54:27 +0000 (18:54 +0000)
committerJ.T. Conklin <jtc@acorntoolworks.com>
Thu, 10 Aug 2000 18:54:27 +0000 (18:54 +0000)
invalidate it rather than creating another.
* ocd.c (ocd_open): Likewise.
* remote-nindy.c (nindy_open): Likewise.
* remote-sds.c (sds_open): Likewise.
* remote-utils.c (gr_open): Likewise.
* remote.c (remote_open_1, remote_cisco_open): Likewise.

* dcache.c (dcache_alloc): Changed to take address of line as an
argument, and to invalidate cache line before returning.
(dcache_peek_byte): Updated.
(dcache_poke_byte): Updated.
-------------------------------------------------------------------

gdb/ChangeLog
gdb/dcache.c
gdb/monitor.c
gdb/ocd.c
gdb/remote-nindy.c
gdb/remote-sds.c
gdb/remote-utils.c
gdb/remote.c

index 47148e90140663c3f4725d26b6f3492f8d284967..157684afbbad8b2f6efbd6ea9b5d648f137dbce2 100644 (file)
@@ -1,3 +1,18 @@
+2000-08-10  J.T. Conklin  <jtc@redback.com>
+
+       * monitor.c (monitor_open): If a dcache has already been created,
+       invalidate it rather than creating another.
+       * ocd.c (ocd_open): Likewise.
+       * remote-nindy.c (nindy_open): Likewise.
+       * remote-sds.c (sds_open): Likewise.
+       * remote-utils.c (gr_open): Likewise.
+       * remote.c (remote_open_1, remote_cisco_open): Likewise.
+
+       * dcache.c (dcache_alloc): Changed to take address of line as an
+       argument, and to invalidate cache line before returning.
+       (dcache_peek_byte): Updated.
+       (dcache_poke_byte): Updated.
+
 2000-08-10  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
 
        From Greg McGary <greg@mcgary.org>:
index 7e5a755fce03c678bdd119e01bd756de6a38c70e..4081c920ceb2b39e3c46587e1fa589a21b66d9c9 100644 (file)
@@ -157,7 +157,7 @@ static struct dcache_block *dcache_hit (DCACHE * dcache, CORE_ADDR addr);
 
 static int dcache_write_line (DCACHE * dcache, struct dcache_block *db);
 
-static struct dcache_block *dcache_alloc (DCACHE * dcache);
+static struct dcache_block *dcache_alloc (DCACHE * dcache, CORE_ADDR addr);
 
 static int dcache_writeback (DCACHE * dcache);
 
@@ -267,15 +267,10 @@ dcache_write_line (DCACHE *dcache, register struct dcache_block *db)
 
 
 /* Get a free cache block, put or keep it on the valid list,
-   and return its address.  The caller should store into the block
-   the address and data that it describes, then remque it from the
-   free list and insert it into the valid list.  This procedure
-   prevents errors from creeping in if a memory retrieval is
-   interrupted (which used to put garbage blocks in the valid
-   list...).  */
+   and return its address.  */
 
 static struct dcache_block *
-dcache_alloc (DCACHE *dcache)
+dcache_alloc (DCACHE *dcache, CORE_ADDR addr)
 {
   register struct dcache_block *db;
 
@@ -297,6 +292,11 @@ dcache_alloc (DCACHE *dcache)
       dcache_write_line (dcache, db);
     }
 
+  db->addr = MASK(addr);
+  db->refs = 0;
+  db->anydirty = 0;
+  memset (db->state, ENTRY_BAD, sizeof (db->data));
+
   /* append this line to end of valid list */
   if (!dcache->valid_head)
     dcache->valid_head = db;
@@ -327,9 +327,9 @@ dcache_peek_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
          dcache_write_line (dcache, db);
        }
       else
-       db = dcache_alloc (dcache);
+       db = dcache_alloc (dcache, addr);
+
       immediate_quit++;
-      db->addr = MASK (addr);
       while (done < LINE_SIZE)
        {
          int try =
@@ -379,9 +379,7 @@ dcache_poke_byte (DCACHE *dcache, CORE_ADDR addr, char *ptr)
 
   if (!db)
     {
-      db = dcache_alloc (dcache);
-      db->addr = MASK (addr);
-      memset (db->state, ENTRY_BAD, sizeof (db->data));
+      db = dcache_alloc (dcache, addr);
     }
 
   db->data[XFORM (addr)] = *ptr;
index e3fa1c81fad3f2ec1f84729a134ba1cf3baa4693..b57365e53343e55831b56cc7cfb68e5e60bae58b 100644 (file)
@@ -838,10 +838,17 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty)
 
   monitor_printf (current_monitor->line_term);
 
-  if (current_monitor->flags & MO_HAS_BLOCKWRITES)
-    remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory_block);
+  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);
+    }
   else
-    remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory);
+    dcache_flush (remote_dcache);
+
   start_remote ();
 }
 
index 1a50978db826a350a9c5f1dda5fd45d032c9c192..5c29919387297cc5861063c8f81717ff7f970cb1 100644 (file)
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -292,7 +292,10 @@ device the OCD device is attached to (e.g. /dev/ttya).");
 
   unpush_target (current_ops);
 
-  ocd_dcache = dcache_init (ocd_read_bytes, ocd_write_bytes);
+  if (!ocd_dcache)
+    ocd_dcache = dcache_init (ocd_read_bytes, ocd_write_bytes);
+  else
+    dcache_flush (ocd_dcache);
 
   if (strncmp (name, "wiggler", 7) == 0)
     {
index ed89be38bf23bb14ee87d0bfbb66a120b24c572d..adf148473d12a2108f3a40f0857eb2f2d42e6482 100644 (file)
@@ -187,7 +187,11 @@ nindy_open (char *name,            /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */
   nindy_close (0);
 
   have_regs = regs_changed = 0;
-  nindy_dcache = dcache_init (ninMemGet, ninMemPut);
+
+  if (!nindy_dcache)
+    nindy_dcache = dcache_init (ninMemGet, ninMemPut);
+  else
+    dcache_flush (nindy_dcache);
 
   /* Allow user to interrupt the following -- we could hang if there's
      no NINDY at the other end of the remote tty.  */
index 5d49152d4cda5af18b32af3aa47bb730b4d2a357..ce6f5f6d2d19b5ac0bb16eaa0527c1dfc52373dd 100644 (file)
@@ -203,7 +203,10 @@ device is attached to the remote system (e.g. /dev/ttya).");
 
   unpush_target (&sds_ops);
 
-  sds_dcache = dcache_init (sds_read_bytes, sds_write_bytes);
+  if (!sds_dcache)
+    sds_dcache = dcache_init (sds_read_bytes, sds_write_bytes);
+  else
+    dcache_flush (sds_dcache);
 
   sds_desc = SERIAL_OPEN (name);
   if (!sds_desc)
index 795ae39c03851cfd1fa2eb09e00a08b73bff91d4..a31da1c623ef2aebea8541df70a8bf9279e5b2c9 100644 (file)
@@ -154,13 +154,18 @@ gr_generic_checkin (void)
 void
 gr_open (char *args, int from_tty, struct gr_settings *gr)
 {
+  DCACHE *dcache;
+
   target_preopen (from_tty);
   sr_scan_args (gr->ops->to_shortname, args);
   unpush_target (gr->ops);
 
   gr_settings = gr;
 
-  gr_set_dcache (dcache_init (gr->readfunc, gr->writefunc));
+  if ((dcache = gr_get_dcache()) == NULL)
+    gr_set_dcache (dcache_init (gr->readfunc, gr->writefunc));
+  else
+    dcache_flush (dcache);
 
   if (sr_get_desc () != NULL)
     gr_close (0);
index 9fe2a29ed107c5606eb314b5512a3604dbb15e41..557ab462289bbb9f93af249a22040463c8c54ac5 100644 (file)
@@ -2057,7 +2057,10 @@ serial device is attached to the remote system\n\
 
   unpush_target (target);
 
-  remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
+  if (!remote_dcache)
+    remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
+  else
+    dcache_flush (remote_dcache);
 
   remote_desc = SERIAL_OPEN (name);
   if (!remote_desc)
@@ -5034,7 +5037,10 @@ device is attached to the remote system (e.g. host:port).");
 
   unpush_target (&remote_cisco_ops);
 
-  remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
+  if (!remote_dcache)
+    remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
+  else
+    dcache_flush (remote_dcache);
 
   remote_desc = SERIAL_OPEN (name);
   if (!remote_desc)
This page took 0.035814 seconds and 4 git commands to generate.