git: c1a2798faa3d - main - arm64: Don't include td_inhibitors when checking td_ast in do_ast
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 22 Dec 2022 10:23:49 UTC
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=c1a2798faa3d8a76a7b9023d859629b5c0532d9b
commit c1a2798faa3d8a76a7b9023d859629b5c0532d9b
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2022-12-22 10:23:10 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2022-12-22 10:23:10 +0000
arm64: Don't include td_inhibitors when checking td_ast in do_ast
The td_ast member is an int so only 4 bytes, yet we were using an 8 byte
load and thus also got td_inhibitors in the upper bits. The code prior
to the commit that introduced td_ast did also do a bogus 8 byte load of
td_flags but masked the flags so arguably was correct, if dodgy. Now
that we're using the right width for the load we can also fold the
immediate offset back into the load; because td_ast is at an odd
multiple of 4 bytes from the start of struct thread the normal scaled
load couldn't be used with such an immediate offset when doing an 8 byte
load due to its limited immediate range, but we can use a scaled load
once more now that the offset is a multiple of the load width.
Reviewed by: andrew, kib
Fixes: c6d31b8306eb ("AST: rework")
Differential Revision: https://reviews.freebsd.org/D37751
---
sys/arm64/arm64/exception.S | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S
index e875b75e41c4..4a74358afeb9 100644
--- a/sys/arm64/arm64/exception.S
+++ b/sys/arm64/arm64/exception.S
@@ -177,11 +177,10 @@ __FBSDID("$FreeBSD$");
/* Read the current thread AST mask */
ldr x1, [x18, #PC_CURTHREAD] /* Load curthread */
- add x1, x1, #(TD_AST)
- ldr x1, [x1]
+ ldr w1, [x1, #(TD_AST)]
/* Check if we have a non-zero AST mask */
- cbz x1, 2f
+ cbz w1, 2f
/* Restore interrupts */
msr daif, x19