From 05df78232efa58035cc7ec4434cb78786913f5ca Mon Sep 17 00:00:00 2001 From: jtc Date: Fri, 18 Aug 2000 22:52:22 +0000 Subject: [PATCH] * 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/ChangeLog | 25 +++++++++++++++++++++++++ gdb/MAINTAINERS | 3 ++- gdb/dcache.c | 17 ++++++++++++++--- gdb/dcache.h | 7 +++++-- gdb/monitor.c | 22 ++++++++++------------ gdb/ocd.c | 6 +++--- gdb/remote-bug.c | 4 ++-- gdb/remote-nindy.c | 6 ++++-- gdb/remote-sds.c | 4 ++-- gdb/remote-utils.c | 2 +- gdb/remote.c | 8 ++++---- gdb/wince.c | 4 ++-- 12 files changed, 74 insertions(+), 34 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5635e515c3..fd929792a6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,28 @@ +2000-08-18 J.T. Conklin + + * 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. + 2000-08-18 Andrew Cagney * remote-array.c (array_fetch_register): Pass dummy parameter to diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index 8082b17118..6768a2788f 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -125,7 +125,7 @@ FreeBSD native & host Mark Kettenis kettenis@gnu.org hurd native Mark Kettenis kettenis@gnu.org macos host & native Stan Shebs shebs@apple.com hpux, hp pa native Jeff Law law@cygnus.com -NetBSD J.T. Conklin jtc@redback.com +NetBSD native & host J.T. Conklin jtc@redback.com SCO/Unixware Nick Duffek nsd@cygnus.com Robert Lipe rjl@sco.com GNU/Linux ARM native Scott Bambrough scottb@netwinder.org @@ -188,6 +188,7 @@ testsuite Stan Shebs shebs@apple.com hp tests (gdb.hp) Jimmy Guo guo@cup.hp.com Java tests (gdb.java) Anthony Green green@cygnus.com Kernel Object Display Fernando Nasser fnasser@cygnus.com +dcache.c J.T. Conklin jtc@redback.com UI: External (user) interfaces. diff --git a/gdb/dcache.c b/gdb/dcache.c index a890979728..a563d8bff9 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); } diff --git a/gdb/dcache.h b/gdb/dcache.h index 928173d63b..1615fcebbc 100644 --- a/gdb/dcache.h +++ b/gdb/dcache.h @@ -27,12 +27,15 @@ typedef int (*memxferfunc) (CORE_ADDR memaddr, char *myaddr, int len); typedef struct dcache_struct DCACHE; -/* Flush DCACHE. */ -void dcache_flush (DCACHE * dcache); +/* Invalidate DCACHE. */ +void dcache_invd (DCACHE * dcache); /* Initialize DCACHE. */ DCACHE *dcache_init (memxferfunc reading, memxferfunc writing); +/* Free a DCACHE */ +void dcache_free (DCACHE *); + /* Simple to call from _xfer_memory */ int dcache_xfer_memory (DCACHE * cache, CORE_ADDR mem, char *my, int len, diff --git a/gdb/monitor.c b/gdb/monitor.c index b57365e533..ca7dd30152 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -838,16 +838,14 @@ monitor_open (char *args, struct monitor_ops *mon_ops, int from_tty) monitor_printf (current_monitor->line_term); - 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); - } + if (remote_dcache) + dcache_free (remote_dcache); + + if (current_monitor->flags & MO_HAS_BLOCKWRITES) + remote_dcache = dcache_init (monitor_read_memory, + monitor_write_memory_block); else - dcache_flush (remote_dcache); + remote_dcache = dcache_init (monitor_read_memory, monitor_write_memory); start_remote (); } @@ -934,7 +932,7 @@ monitor_supply_register (int regno, char *valstr) void flush_monitor_dcache (void) { - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); } static void @@ -950,7 +948,7 @@ monitor_resume (int pid, int step, enum target_signal sig) dump_reg_flag = 1; return; } - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); if (step) monitor_printf (current_monitor->step); else @@ -2147,7 +2145,7 @@ monitor_wait_srec_ack (void) static void monitor_load (char *file, int from_tty) { - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); monitor_debug ("MON load\n"); if (current_monitor->load_routine) diff --git a/gdb/ocd.c b/gdb/ocd.c index 5c29919387..6dd601e5da 100644 --- a/gdb/ocd.c +++ b/gdb/ocd.c @@ -295,7 +295,7 @@ device the OCD device is attached to (e.g. /dev/ttya)."); if (!ocd_dcache) ocd_dcache = dcache_init (ocd_read_bytes, ocd_write_bytes); else - dcache_flush (ocd_dcache); + dcache_invd (ocd_dcache); if (strncmp (name, "wiggler", 7) == 0) { @@ -387,7 +387,7 @@ ocd_resume (int pid, int step, enum target_signal siggnal) { int pktlen; - dcache_flush (ocd_dcache); + dcache_invd (ocd_dcache); if (step) ocd_do_command (OCD_STEP, &last_run_status, &pktlen); @@ -1318,7 +1318,7 @@ bdm_reset_command (char *args, int from_tty) error ("Not connected to OCD device."); ocd_do_command (OCD_RESET, &status, &pktlen); - dcache_flush (ocd_dcache); + dcache_invd (ocd_dcache); registers_changed (); } diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c index 7d3461536b..aac148eb5f 100644 --- a/gdb/remote-bug.c +++ b/gdb/remote-bug.c @@ -119,7 +119,7 @@ bug_load (char *args, int fromtty) sr_check_open (); - dcache_flush (gr_get_dcache ()); + dcache_invd (gr_get_dcache ()); inferior_pid = 0; abfd = bfd_openr (args, 0); if (!abfd) @@ -242,7 +242,7 @@ bug_open (char *args, int from_tty) void bug_resume (int pid, int step, enum target_signal sig) { - dcache_flush (gr_get_dcache ()); + dcache_invd (gr_get_dcache ()); if (step) { diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c index adf148473d..807000db73 100644 --- a/gdb/remote-nindy.c +++ b/gdb/remote-nindy.c @@ -191,7 +191,7 @@ nindy_open (char *name, /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */ if (!nindy_dcache) nindy_dcache = dcache_init (ninMemGet, ninMemPut); else - dcache_flush (nindy_dcache); + dcache_invd (nindy_dcache); /* Allow user to interrupt the following -- we could hang if there's no NINDY at the other end of the remote tty. */ @@ -269,7 +269,7 @@ nindy_resume (int pid, int step, enum target_signal siggnal) if (siggnal != TARGET_SIGNAL_0 && siggnal != stop_signal) warning ("Can't send signals to remote NINDY targets."); - dcache_flush (nindy_dcache); + dcache_invd (nindy_dcache); if (regs_changed) { nindy_store_registers (-1); @@ -614,6 +614,8 @@ nindy_load (char *filename, int from_tty) } } bfd_close (file); + + dcache_invd(nindy_dcache); } static int diff --git a/gdb/remote-sds.c b/gdb/remote-sds.c index ce6f5f6d2d..582d46b31c 100644 --- a/gdb/remote-sds.c +++ b/gdb/remote-sds.c @@ -206,7 +206,7 @@ device is attached to the remote system (e.g. /dev/ttya)."); if (!sds_dcache) sds_dcache = dcache_init (sds_read_bytes, sds_write_bytes); else - dcache_flush (sds_dcache); + dcache_invd (sds_dcache); sds_desc = SERIAL_OPEN (name); if (!sds_desc) @@ -358,7 +358,7 @@ sds_resume (int pid, int step, enum target_signal siggnal) { unsigned char buf[PBUFSIZ]; - dcache_flush (sds_dcache); + dcache_invd (sds_dcache); last_sent_signal = siggnal; last_sent_step = step; diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c index a31da1c623..236a0ec142 100644 --- a/gdb/remote-utils.c +++ b/gdb/remote-utils.c @@ -165,7 +165,7 @@ gr_open (char *args, int from_tty, struct gr_settings *gr) if ((dcache = gr_get_dcache()) == NULL) gr_set_dcache (dcache_init (gr->readfunc, gr->writefunc)); else - dcache_flush (dcache); + dcache_invd (dcache); if (sr_get_desc () != NULL) gr_close (0); diff --git a/gdb/remote.c b/gdb/remote.c index 557ab46228..66a14fa3de 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2060,7 +2060,7 @@ serial device is attached to the remote system\n\ if (!remote_dcache) remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes); else - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); remote_desc = SERIAL_OPEN (name); if (!remote_desc) @@ -2309,7 +2309,7 @@ remote_resume (int pid, int step, enum target_signal siggnal) else set_thread (pid, 0); /* run this thread */ - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); last_sent_signal = siggnal; last_sent_step = step; @@ -2343,7 +2343,7 @@ remote_async_resume (int pid, int step, enum target_signal siggnal) else set_thread (pid, 0); /* run this thread */ - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); last_sent_signal = siggnal; last_sent_step = step; @@ -5040,7 +5040,7 @@ device is attached to the remote system (e.g. host:port)."); if (!remote_dcache) remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes); else - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); remote_desc = SERIAL_OPEN (name); if (!remote_desc) diff --git a/gdb/wince.c b/gdb/wince.c index c07ada0b02..7081dd2fd5 100644 --- a/gdb/wince.c +++ b/gdb/wince.c @@ -1732,7 +1732,7 @@ child_create_inferior (char *exec_file, char *args, char **env) if (!remote_dcache) remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes); else - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); exec_file = upload_to_device (exec_file, exec_file); @@ -1842,7 +1842,7 @@ child_resume (int pid, int step, enum target_signal sig) th->context.ContextFlags = 0; } - dcache_flush (remote_dcache); + dcache_invd (remote_dcache); /* Allow continuing with the same signal that interrupted us. Otherwise complain. */ -- 2.11.0