]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
arm64: fix hardware single-stepping from EL1
authorMitchell Horne <mhorne@FreeBSD.org>
Mon, 1 Mar 2021 13:59:25 +0000 (09:59 -0400)
committerMitchell Horne <mhorne@FreeBSD.org>
Mon, 1 Mar 2021 14:04:22 +0000 (10:04 -0400)
commit874635e381731e1fbd5e2d0459ca87814f1e455c
tree6a47112a918b1984d76599764ff1fafc2e807a2f
parent79fbd483787a1b2d91d3bed231e6912270aa04c6
arm64: fix hardware single-stepping from EL1

The main issue is that debug exceptions must to be disabled for the
entire duration that SS bit in MDSCR_EL1 is set. Otherwise, a
single-step exception will be generated immediately. This can occur
before returning from the debugger (when MDSCR is written to) or before
re-entering it after the single-step (when debug exceptions are unmasked
in the exception handler).

Solve this by delaying the unmask to C code for EL1, and avoid unmasking
at all while handling debug exceptions, thus avoiding any recursive
debug traps.

Reviewed by: markj, jhb
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28944
sys/arm64/arm64/debug_monitor.c
sys/arm64/arm64/exception.S
sys/arm64/arm64/trap.c