Page MenuHomeFreeBSD

arm64: fix hardware single-stepping from EL1
ClosedPublic

Authored by mhorne on Feb 26 2021, 5:44 PM.
Tags
None
Referenced Files
F82082872: D28944.id.diff
Thu, Apr 25, 8:36 AM
F82082733: D28944.id84755.diff
Thu, Apr 25, 8:33 AM
F82050762: D28944.id84897.diff
Thu, Apr 25, 12:48 AM
Unknown Object (File)
Mon, Apr 22, 1:26 AM
Unknown Object (File)
Thu, Apr 11, 10:56 AM
Unknown Object (File)
Fri, Mar 29, 12:58 PM
Unknown Object (File)
Mar 7 2024, 5:09 PM
Unknown Object (File)
Feb 19 2024, 6:08 PM

Details

Summary

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.

Test Plan

step from ddb works without hanging or resetting the system. Stepping over a watchpoint works as well.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable