Page MenuHomeFreeBSD

arm64: handle watchpoint exceptions from EL0

Authored by mhorne on Tue, Feb 9, 8:44 PM.


Test Plan

Triggering an EL0 watchpoint generates SIGTRAP after this patch.

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mhorne requested review of this revision.Tue, Feb 9, 8:44 PM
This revision is now accepted and ready to land.Tue, Feb 9, 9:06 PM

I'm not sure here and I can't figure out the abstractions in Linux code but on Linux I'm getting a SIGTRAP with si_addr pointing to the watched memory rather than the instruction, and LLDB uses that to identify which watchpoint was hit. Do you have any suggestion if I can determine that any other way?


Hmm. Returning the watched address in si_addr does seem more useful. I don't think there is any other simple way to determine which watchpoint triggered the exception, so we can probably switch over to this.

My only reservation is that FreeBSD/amd64 does not appear to behave this way, and it returns the trapping instruction address in si_addr.


Indeed it doesn't. We are working around that by checking DR7 directly.

Pass the value of the Fault Address Register to si_addr. This contains the address that triggered the watchpoint.

This revision now requires review to proceed.Fri, Feb 12, 11:50 PM

Thanks, I was able to get working hardware watchpoints with this patch.

Update siginfo(3) man page to note the differing behaviour of si_addr.

jhb added inline comments.

I'm not sure I would keep the arm64 sentence as we don't document the MD behaviors for other signals here but instead just use "may" to indicate it can vary.

This revision is now accepted and ready to land.Tue, Feb 16, 8:33 PM