diff options
author | J.T. Conklin <jtc@redback.com> | 2000-08-10 18:54:27 +0000 |
---|---|---|
committer | J.T. Conklin <jtc@redback.com> | 2000-08-10 18:54:27 +0000 |
commit | 9ce2259b42e1458ab7c9433bdfe1bb5e801b5705 (patch) | |
tree | fd7db91b7c1607b821a2b7579dd4b46c451a410b /gdb/dcache.c | |
parent | 4b4309fd7953ce46c0a4ed5271f8cc17dbdd77d8 (diff) | |
download | gdb-9ce2259b42e1458ab7c9433bdfe1bb5e801b5705.tar.gz |
* 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.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/gdb/dcache.c b/gdb/dcache.c index 7e5a755fce0..4081c920ceb 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; |