Diff below has two dt(4) improvements. It fixes the construction of the call frame that accompanies the stack frame. Currently it sticks the saved copy of the LR register in there. But instead it should stick the value of the ELR in there to record the location where the trap happened. This fixes stack traces through traps.
Then it adds the magic defines to strip off the frames that are't interesting. ok? Index: dev/dt/dt_dev.c =================================================================== RCS file: /cvs/src/sys/dev/dt/dt_dev.c,v retrieving revision 1.10 diff -u -p -r1.10 dt_dev.c --- dev/dt/dt_dev.c 28 Sep 2020 13:16:58 -0000 1.10 +++ dev/dt/dt_dev.c 3 Oct 2020 17:54:20 -0000 @@ -56,6 +56,9 @@ #if defined(__amd64__) #define DT_FA_PROFILE 5 #define DT_FA_STATIC 2 +#elif defined(__arm64__) +#define DT_FA_PROFILE 7 +#define DT_FA_STATIC 2 #elif defined(__powerpc64__) #define DT_FA_PROFILE 6 #define DT_FA_STATIC 2 Index: arch/arm64/arm64/exception.S =================================================================== RCS file: /cvs/src/sys/arch/arm64/arm64/exception.S,v retrieving revision 1.11 diff -u -p -r1.11 exception.S --- arch/arm64/arm64/exception.S 17 Mar 2020 17:27:12 -0000 1.11 +++ arch/arm64/arm64/exception.S 3 Oct 2020 17:54:21 -0000 @@ -38,7 +38,6 @@ sub sp, sp, #128 .endif sub sp, sp, #(TF_SIZE + 16) - stp x29, x30, [sp, #(TF_SIZE)] stp x28, x29, [sp, #(TF_X + 28 * 8)] stp x26, x27, [sp, #(TF_X + 26 * 8)] stp x24, x25, [sp, #(TF_X + 24 * 8)] @@ -60,6 +59,7 @@ mrs x18, sp_el0 .endif mov fp, x18 + stp x29, x10, [sp, #(TF_SIZE)] stp x10, x11, [sp, #(TF_ELR)] stp x18, lr, [sp, #(TF_SP)] mrs x18, tpidr_el1