aboutsummaryrefslogtreecommitdiff
path: root/gdb/dcache.c
diff options
context:
space:
mode:
authorJ.T. Conklin <jtc@acorntoolworks.com>2000-08-10 18:54:27 +0000
committerJ.T. Conklin <jtc@acorntoolworks.com>2000-08-10 18:54:27 +0000
commitf1d7622b957e12c8130c24fe4c46882f70b59b1c (patch)
tree00b4defbb759d34bc6ef4db5dc670b7fc5702473 /gdb/dcache.c
parente84d946b3ae38920c124cba665158104049c8665 (diff)
downloadfsf-binutils-gdb-f1d7622b957e12c8130c24fe4c46882f70b59b1c.zip
fsf-binutils-gdb-f1d7622b957e12c8130c24fe4c46882f70b59b1c.tar.gz
fsf-binutils-gdb-f1d7622b957e12c8130c24fe4c46882f70b59b1c.tar.bz2
* 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. -------------------------------------------------------------------
Diffstat (limited to 'gdb/dcache.c')
-rw-r--r--gdb/dcache.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 7e5a755..4081c92 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -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;