From e99586d56aa63911e842a974bd8eb7ed20da7af0 Mon Sep 17 00:00:00 2001 From: "J.T. Conklin" Date: Fri, 18 Aug 2000 22:52:23 +0000 Subject: * 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. ------------------------------------------------------------------- --- gdb/dcache.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'gdb/dcache.c') diff --git a/gdb/dcache.c b/gdb/dcache.c index a890979..a563d8b 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -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); } -- cgit v1.1