aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2022-03-08 11:38:51 +0000
committerAndrew Turner <andrew@FreeBSD.org>2022-03-14 15:00:27 +0000
commit1169099f8fd981f2e085f451f0b4a62e18bfe507 (patch)
tree2981c0ffdb32e5df3074d7ab337510967ba76ad0
parent831049dc34d404f6cb1e3bc20472b6854ce04283 (diff)
downloadsrc-1169099f8fd981f2e085f451f0b4a62e18bfe507.tar.gz
src-1169099f8fd981f2e085f451f0b4a62e18bfe507.zip
Make the arm64 get_pcpu a function again
We assume the pointer returned from get_pcpu will be consistent even if the thread is moved to a new CPU. Fix this by partially reverting 63c858a04d565 to make get_pcpu a function again. Sponsored by: The FreeBSD Foundation (cherry picked from commit ed306634266002a05c88c3a4cd036c99d4cd139a)
-rw-r--r--sys/arm64/include/pcpu.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arm64/include/pcpu.h b/sys/arm64/include/pcpu.h
index ce4dc46e1609..d83c9a656634 100644
--- a/sys/arm64/include/pcpu.h
+++ b/sys/arm64/include/pcpu.h
@@ -58,7 +58,14 @@ struct pcpu;
register struct pcpu *pcpup __asm ("x18");
-#define get_pcpu() pcpup
+static inline struct pcpu *
+get_pcpu(void)
+{
+ struct pcpu *pcpu;
+
+ __asm __volatile("mov %0, x18" : "=&r"(pcpu));
+ return (pcpu);
+}
static inline struct thread *
get_curthread(void)