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 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>:
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);
/* 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;
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;
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 =
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;
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 ();
}
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)
{
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. */
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)
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);
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)
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)