Index: sys/arm64/arm64/exception.S =================================================================== --- sys/arm64/arm64/exception.S +++ sys/arm64/arm64/exception.S @@ -25,6 +25,9 @@ * */ +#include "opt_ddb.h" +#include "opt_stack.h" + #include #include __FBSDID("$FreeBSD$"); @@ -33,6 +36,13 @@ .text +#if defined(DDB) || defined(KDTRACE_HOOKS) || defined(STACK) +#define EXTRA_FRAME_SPACE (8 * 2) +#define SAVE_FP +#else +#define EXTRA_FRAME_SPACE 0 +#endif + /* * This is limited to 28 instructions as it's placed in the exception vector * slot that is 32 instructions long. We need one for the branch, and three @@ -43,7 +53,10 @@ mov x18, sp sub sp, sp, #128 .endif - sub sp, sp, #(TF_SIZE) + sub sp, sp, #(TF_SIZE + EXTRA_FRAME_SPACE) +#if defined(SAVE_FP) + stp x29, lr, [sp, #(TF_SIZE)] +#endif stp x28, x29, [sp, #(TF_X + 28 * 8)] stp x26, x27, [sp, #(TF_X + 26 * 8)] stp x24, x25, [sp, #(TF_X + 24 * 8)] @@ -69,7 +82,9 @@ stp w11, w12, [sp, #(TF_SPSR)] stp x18, lr, [sp, #(TF_SP)] mrs x18, tpidr_el1 +#if defined(SAVE_FP) add x29, sp, #(TF_SIZE) +#endif .endm .macro save_registers el @@ -158,7 +173,7 @@ ldr x29, [sp, #(TF_X + 29 * 8)] .endif .if \el == 0 - add sp, sp, #(TF_SIZE) + add sp, sp, #(TF_SIZE + EXTRA_FRAME_SPACE) .else mov sp, x18 mrs x18, tpidr_el1