aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2025-09-16 11:21:39 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2025-09-16 11:21:39 +0000
commit7314f78b240bdbf2bcec07e3d5a475e37941bb6b (patch)
tree8d1c11ec282fb4d1d39dbdaf0e1c4c770d21ded1
parentda20d88599d52667c9cd422632302cf5e2e19938 (diff)
aarch64: Clarify the initial adjustments to sp for kernel exception entry
The first store-pair instruction in save_registers_head decrements the stack pointer to create room for most of the trapframe (and the redzone area for nested exceptions). However, the expression was a bit non-intuitive as it was using an expression without a leading negative sign to adjust the stack pointer. Rewrite the expression so that it is more clearly a negative adjustment to the stack pointer. Suggested by: andrew Reviewed by: andrew Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D52514
-rw-r--r--sys/arm64/arm64/exception.S4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S
index 13095def8b00..6e673fbe5a43 100644
--- a/sys/arm64/arm64/exception.S
+++ b/sys/arm64/arm64/exception.S
@@ -43,9 +43,9 @@
.macro save_registers_head el
.if \el == 1
mov x18, sp
- stp x0, x1, [sp, #(TF_X - TF_SIZE - 128)]!
+ stp x0, x1, [sp, #-(TF_SIZE - TF_X + 128)]!
.else
- stp x0, x1, [sp, #(TF_X - TF_SIZE)]!
+ stp x0, x1, [sp, #-(TF_SIZE - TF_X)]!
.endif
stp x2, x3, [sp, #(2 * 8)]
stp x4, x5, [sp, #(4 * 8)]