public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug sim/25211] m68hc11 sim fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
@ 2021-01-11  6:54 ` vapier at gentoo dot org
  2021-01-12  8:32 ` f4grx+bzsw at f4grx dot net
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: vapier at gentoo dot org @ 2021-01-11  6:54 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vapier at gentoo dot org
          Component|tdep                        |sim

--- Comment #1 from Mike Frysinger <vapier at gentoo dot org> ---
Thanks for the patch.
Please follow the contribution instructions to have it reviewed:
https://sourceware.org/gdb/wiki/ContributionChecklist

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] m68hc11 sim fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
  2021-01-11  6:54 ` [Bug sim/25211] m68hc11 sim fails to remap registers when writing INIT vapier at gentoo dot org
@ 2021-01-12  8:32 ` f4grx+bzsw at f4grx dot net
  2021-10-31 17:27 ` [Bug sim/25211] sim: m68hc11: " vapier at gentoo dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: f4grx+bzsw at f4grx dot net @ 2021-01-12  8:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

--- Comment #2 from Sebastien F4GRX <f4grx+bzsw at f4grx dot net> ---
I'm not doing ALL OF THIS for a trivial two-liner.

I release all my rights to this contributions if you want to include it on your
own name.

meanwhile

-I recoded a fully working hc11 simulator
-People needing this will find the issue and the fix via a web search.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] sim: m68hc11: fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
  2021-01-11  6:54 ` [Bug sim/25211] m68hc11 sim fails to remap registers when writing INIT vapier at gentoo dot org
  2021-01-12  8:32 ` f4grx+bzsw at f4grx dot net
@ 2021-10-31 17:27 ` vapier at gentoo dot org
  2022-11-08  8:50 ` vapier at gentoo dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: vapier at gentoo dot org @ 2021-10-31 17:27 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|m68hc11 sim fails to remap  |sim: m68hc11: fails to
                   |registers when writing INIT |remap registers when
                   |                            |writing INIT

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] sim: m68hc11: fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-10-31 17:27 ` [Bug sim/25211] sim: m68hc11: " vapier at gentoo dot org
@ 2022-11-08  8:50 ` vapier at gentoo dot org
  2022-11-09 14:50 ` vapier at gentoo dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: vapier at gentoo dot org @ 2022-11-08  8:50 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

--- Comment #3 from Mike Frysinger <vapier at gentoo dot org> ---
sorry, but that's not how any of this works.  sending an e-mail with a patch
attached is less effort than filing a bug report when using git.

that said, i don't think your patch is correct.  no other device model calls
hw_{attach,detach}_address like that.  i'm guessing the sim_hw setup logic in
interp.c needs fixing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] sim: m68hc11: fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-11-08  8:50 ` vapier at gentoo dot org
@ 2022-11-09 14:50 ` vapier at gentoo dot org
  2022-11-09 15:17 ` f4grx+bzsw at f4grx dot net
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: vapier at gentoo dot org @ 2022-11-09 14:50 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-11-09
             Target|                            |m68hc11-elf
     Ever confirmed|0                           |1

--- Comment #4 from Mike Frysinger <vapier at gentoo dot org> ---
i double checked gdb-7.1 (which was released over a decade ago) and it seems to
fail in the same way, so def not a regression.  i didn't look back further
since even that version required backporting/hacking things up to get it to
build with current toolchain versions.

to repro:
$ ./configure --target=m68hc11-elf
$ make all-sim
$ cat >test.s <<EOF
.equ INIT, 0x3D
ldaa #0
staa INIT+0x1000
EOF
$ ./gas/as-new test.s -o test.o
$ ./ld/ld-new test.o -o test
$ ./sim/m68hc11/run ./test
/m68hc11: hw_attach_address: no parent attach method
program stopped with signal 6 (Aborted).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] sim: m68hc11: fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-11-09 14:50 ` vapier at gentoo dot org
@ 2022-11-09 15:17 ` f4grx+bzsw at f4grx dot net
  2022-11-10 15:05 ` vapier at gentoo dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 9+ messages in thread
From: f4grx+bzsw at f4grx dot net @ 2022-11-09 15:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

--- Comment #5 from Sebastien F4GRX <f4grx+bzsw at f4grx dot net> ---
Hello,

I really appreciate that you managed to produce a minimal test case to
reproduce the bug. I should have done that.

TBH it's quite hard for me to contribute here because there are so many rules
in places that I feel overwhelmed and dont know how to start. There is also a
LOT of legacy in these complex code bases and even if I could hack something
that worked, I have absolutely no idea how to fix this properly. Meanwhile, I
have coded my own simulator where this function works.

Setting init to zero is quite important in the 68hc11, because in extended
mode, when you intend to use the hc11 as an almost generic microprocessor (not
just with a small embedded task), then the default value of INIT means that the
IO range lies in the middle of any large external ram you install on the bus.

I am very grateful that you have identified the issue. I dont know how to fix
it but I DEFINITELY volunteer to test it.

Sebastien

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] sim: m68hc11: fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-11-09 15:17 ` f4grx+bzsw at f4grx dot net
@ 2022-11-10 15:05 ` vapier at gentoo dot org
  2022-12-20  1:32 ` vapier at gentoo dot org
  2023-01-12 15:41 ` f4grx+bzsw at f4grx dot net
  8 siblings, 0 replies; 9+ messages in thread
From: vapier at gentoo dot org @ 2022-11-10 15:05 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

--- Comment #6 from Mike Frysinger <vapier at gentoo dot org> ---
hmm, i poked it more today, and now i wonder if this is a bug in dv-core. 
looking through the codebase, m68hc11 seems to have the only device models that
ever actually call hw_detach_address which might be why no one noticed before.

practically speaking, it does the samething as your proposed patch because the
dv-m68hc11 detach method calls sim_core_detach.  but i think the right fix is
to change dv-core so it has mirror attach/detach logic.

i'll probably send this out after GDB 13 branches.

--- 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);
 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] sim: m68hc11: fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-11-10 15:05 ` vapier at gentoo dot org
@ 2022-12-20  1:32 ` vapier at gentoo dot org
  2023-01-12 15:41 ` f4grx+bzsw at f4grx dot net
  8 siblings, 0 replies; 9+ messages in thread
From: vapier at gentoo dot org @ 2022-12-20  1:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |vapier at gentoo dot org
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from Mike Frysinger <vapier at gentoo dot org> ---
pushed post gdb-13 branch

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug sim/25211] sim: m68hc11: fails to remap registers when writing INIT
       [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-12-20  1:32 ` vapier at gentoo dot org
@ 2023-01-12 15:41 ` f4grx+bzsw at f4grx dot net
  8 siblings, 0 replies; 9+ messages in thread
From: f4grx+bzsw at f4grx dot net @ 2023-01-12 15:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25211

--- Comment #8 from Sebastien F4GRX <f4grx+bzsw at f4grx dot net> ---
Hi,

I have tested binutils main branch, which includes your fix, and I can confirm
that the hc11 simulator now remaps the IO registers when INIT is modified.

Thank you very much for this fix.

Sebastien

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-12 15:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-25211-4717@http.sourceware.org/bugzilla/>
2021-01-11  6:54 ` [Bug sim/25211] m68hc11 sim fails to remap registers when writing INIT vapier at gentoo dot org
2021-01-12  8:32 ` f4grx+bzsw at f4grx dot net
2021-10-31 17:27 ` [Bug sim/25211] sim: m68hc11: " vapier at gentoo dot org
2022-11-08  8:50 ` vapier at gentoo dot org
2022-11-09 14:50 ` vapier at gentoo dot org
2022-11-09 15:17 ` f4grx+bzsw at f4grx dot net
2022-11-10 15:05 ` vapier at gentoo dot org
2022-12-20  1:32 ` vapier at gentoo dot org
2023-01-12 15:41 ` f4grx+bzsw at f4grx dot net

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).