public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: dv-core: add hw_detach_address method [PR sim/25211]
@ 2022-12-20 1:31 Michael Frysinger
0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2022-12-20 1:31 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=09d236daec8ff0b02516d3fa088fda3da8ba9cdc
commit 09d236daec8ff0b02516d3fa088fda3da8ba9cdc
Author: Mike Frysinger <vapier@gentoo.org>
Date: Thu Nov 10 22:20:15 2022 +0700
sim: dv-core: add hw_detach_address method [PR sim/25211]
The core device has an attach address method as the root of the tree
which calls out to the sim API. But it doesn't have a corresponding
detach method which means we just crash if anything tries to detach
itself from the core. In practice, the m68hc11 is the only model
that actually tries to detach itself on the fly, so no one noticed
earlier.
With this in place, we can delete the existing detach code from the
m68hc11 model since it defaults to "passthru" callback which will in
turn call the dv-core detach, and they have the same behavior -- call
the sim core API to detach from the address space.
Bug: https://sourceware.org/PR25211
Diff:
---
sim/common/dv-core.c | 18 ++++++++++++++++++
sim/m68hc11/dv-m68hc11.c | 13 -------------
2 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/sim/common/dv-core.c b/sim/common/dv-core.c
index 4a5f5a0eb57..4cff41bea8e 100644
--- a/sim/common/dv-core.c
+++ b/sim/common/dv-core.c
@@ -72,6 +72,23 @@ dv_core_attach_address_callback (struct hw *me,
}
+static void
+dv_core_detach_address_callback (struct hw *me,
+ int level,
+ int space,
+ address_word addr,
+ address_word nr_bytes,
+ struct hw *client)
+{
+ HW_TRACE ((me, "detach - level=%d, space=%d, addr=0x%lx, nr_bytes=%ld, client=%s",
+ level, space, (unsigned long) addr, (unsigned long) nr_bytes, hw_path (client)));
+ /* NOTE: At preset the space is assumed to be zero. Perhaphs the
+ space should be mapped onto something for instance: space0 -
+ unified memory; space1 - IO memory; ... */
+ sim_core_detach (hw_system (me), NULL, /*cpu*/ level, space, addr);
+}
+
+
static unsigned
dv_core_dma_read_buffer_callback (struct hw *me,
void *dest,
@@ -109,6 +126,7 @@ static void
dv_core_finish (struct hw *me)
{
set_hw_attach_address (me, dv_core_attach_address_callback);
+ set_hw_detach_address (me, dv_core_detach_address_callback);
set_hw_dma_write_buffer (me, dv_core_dma_write_buffer_callback);
set_hw_dma_read_buffer (me, dv_core_dma_read_buffer_callback);
}
diff --git a/sim/m68hc11/dv-m68hc11.c b/sim/m68hc11/dv-m68hc11.c
index cdcc9f8eb91..f255f100d70 100644
--- a/sim/m68hc11/dv-m68hc11.c
+++ b/sim/m68hc11/dv-m68hc11.c
@@ -253,18 +253,6 @@ dv_m6811_attach_address_callback (struct hw *me,
}
}
-static void
-dv_m6811_detach_address_callback (struct hw *me,
- int level,
- int space,
- address_word addr,
- address_word nr_bytes,
- struct hw *client)
-{
- sim_core_detach (hw_system (me), NULL, /*cpu*/
- level, space, addr);
-}
-
static void
m68hc11_delete (struct hw* me)
{
@@ -387,7 +375,6 @@ m68hc11cpu_finish (struct hw *me)
set_hw_ports (me, m68hc11cpu_ports);
set_hw_port_event (me, m68hc11cpu_port_event);
set_hw_attach_address (me, dv_m6811_attach_address_callback);
- set_hw_detach_address (me, dv_m6811_detach_address_callback);
#ifdef set_hw_ioctl
set_hw_ioctl (me, m68hc11_ioctl);
#else
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-20 1:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-20 1:31 [binutils-gdb] sim: dv-core: add hw_detach_address method [PR sim/25211] Michael Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).