HomeFreeBSD

arm64: Improve DDB backtrace support

Description

arm64: Improve DDB backtrace support

The existing implementation relies on each trap handler saving a normal
stack frame record, which is a waste of time and space when we're
already saving a trapframe to the stack. It's also wrong as it currently
saves LR not ELR.

Instead of patching it up, rewrite it based on the RISC-V implementation
with inspiration from the amd64 implementation for how to handle
vectored traps to provide an improved implementation. This includes
compressing the information down to one line like other architectures
rather than the highly-verbose old form that repeats itself by printing
LR and FP in one frame only to print them as PC and SP in the next. It
also includes printing out actually useful information about the traps
that occurred, though FAR is not saved in the trapframe so we cannot
print it (in general it can be clobbered between when the trap happened
and now), only ESR.

The AAPCS also allows the stack frame record to be located anywhere in
the frame, not just the top, so the caller's SP is not at a fixed offset
from the callee's FP like on almost all other architectures in
existence. This means there is no way to derive the caller's SP in the
unwinder, and so we have to drop that bit of (unused) state everywhere.

Reviewed by: jhb, markj
Differential Revision: https://reviews.freebsd.org/D28026

Details

Provenance
jrtc27Authored on Feb 1 2021, 2:15 PM
Reviewer
jhb
Differential Revision
D28026: arm64: Improve DDB backtrace support
Parents
rGdb46c0d0cb3d: Fix LINT kernel builds after 1a714ff20419 .
Branches
Unknown
Tags
Unknown