Page MenuHomeFreeBSD

arm64: ddb(4) support
ClosedPublic

Authored by zbb on Apr 22 2015, 3:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 2 2025, 7:42 PM
Unknown Object (File)
Nov 23 2025, 3:31 AM
Unknown Object (File)
Nov 22 2025, 3:10 PM
Unknown Object (File)
Nov 22 2025, 9:13 AM
Unknown Object (File)
Nov 22 2025, 12:29 AM
Unknown Object (File)
Nov 21 2025, 6:23 PM
Unknown Object (File)
Nov 6 2025, 9:59 AM
Unknown Object (File)
Nov 6 2025, 6:12 AM
Subscribers

Details

Reviewers
emaste
andrew
imp
Summary

This was developed by Semihalf under the sponsorship of the FreeBSD Foundation.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emaste retitled this revision from to arm64: ddb(4) support.
emaste updated this object.
emaste edited the test plan for this revision. (Show Details)
emaste added reviewers: imp, andrew.

@zbb, let me know if you'd like to do the commit to HEAD, but I can take care of it otherwise - I'd just like to get this in as early as possible.

Looks generally good (copyright date 2015) and a couple of printf issues. This is incomplete, but good given state of the port, it is in decent shape.

sys/arm64/arm64/db_disasm.c
3

2015

sys/arm64/arm64/db_interface.c
3

2015

sys/arm64/arm64/db_trace.c
3

2015

114

8? Why not 16?

First pass though the full patch (and not as a collection of smaller patches).

The cache has been enabled and we have pmap_extract.

In general a call to WRITE_SPECIALREG should be followed by isb() if the code after it relies on the write.

sys/arm64/arm64/db_interface.c
110

pmap_extract is implemented.

164

We have the D-cache enabled now.

sys/arm64/arm64/debug_monitor.c
207

If the order of these writes is important there should be calls to isb() after them to ensure no later instructions are executed before the earlier instructions.

339

In what cases can this be called? i.e. is there any way we could be scheduled off this cpu (I assume not given it's part of ddb). If it could be called from a thread that could be scheduled out we would need to add a critical section.

475

braekpoints?

sys/arm64/arm64/db_trace.c
114

Good question - I actually prefer %08x for addresses that happen to be in userland, but it should probably be %0x16 so that everything lines up.

This is what we get today:

...
do_el0_sync() at handle_el0_sync+0x54
pc = 0xffffff80003d02c4 lr = 0xffffff80003c51b0
sp = 0xffffff8056fc1ab0 fp = 0x7ffffff610

handle_el0_sync() at 0x40466068
pc = 0xffffff80003c51b0 lr = 0x40466068
sp = 0x7ffffff620 fp = 0x7ffffff660

$d.6() at 0x403198
pc = 0x40466068 lr = 0x00403198
sp = 0x7ffffff670 fp = 0x7ffffffb00
...
emaste edited edge metadata.

update years
correct typos
update comment on pmap_extract

Arg, I generated the new diff without context and that confused Phabricator on files.amd64. There is no change in the 2nd upload there.

(I'd expect Phabricator's diff parser to use the line number in the diff to set the line numbers there, though.)

As discussed this morning @zbb will take care of committing to HEAD.

The updated version of this change (copyright dates, typos etc.) are in the GitHub FreeBSDFoundation/arm64-head-ddb branch now - this commit:
https://github.com/FreeBSDFoundation/freebsd/commit/53fb4e609e9f4f48504da9a2bd782ba22835f549

zbb updated this revision to Diff 4993.
zbb added a reviewer: emaste.
emaste edited edge metadata.

Looks good to me - two comments from @andrew that still need a response, but I would be happy to have this committed now.

If the order of these writes is important there should be calls to isb() after them to ensure no later instructions are executed before the earlier instructions.

In what cases can this be called? i.e. is there any way we could be scheduled off this cpu (I assume not given it's part of ddb). If it could be called from a thread that could be scheduled out we would need to add a critical section.

This revision is now accepted and ready to land.Apr 24 2015, 9:23 PM
sys/arm64/arm64/db_interface.c
116

This should be p != NULL || p->p_vmspace != NULL ||

134

u_int? It's too small.

153

u_int

sys/arm64/arm64/db_trace.c
82

What are these magic numbers?

sys/arm64/arm64/debug_monitor.c
87

Could this be READ_SPECIALREG?

187

Should there be an isb to ensure the above registers have been written (as per the ARMv8A ARM)?

206

Could we change this to read mdscr_el1 to a variable, modify it as needed, then write it back?

446

Do we need an instruction barrier between these? i.e. could the disable be reordered before the write, and if so would it be bad?