summaryrefslogtreecommitdiff
path: root/Kernel/Arch/aarch64/Processor.h
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-12-30 13:38:42 +0100
committerAndrew Kaster <andrewdkaster@gmail.com>2022-12-30 08:32:46 -0700
commit984348ed0d8a7861a046804a6a884cc60957217a (patch)
tree0c6735bf67716821e1b0f38345bf0a3eccc29b19 /Kernel/Arch/aarch64/Processor.h
parent4d475588bbaf02b1ab972107925bb3c2c7eca44b (diff)
downloadserenity-984348ed0d8a7861a046804a6a884cc60957217a.zip
Kernel/aarch64: Implement Processor::pause and Processor::wait_check
For pause we use isb sy which will put the processor to sleep while the pipeline is being flushed. This instruction is also used by Rust in spin loops and found to be more efficient, as well as being a rough equivalent to the x86 pause instruction which we also use here. For wait_check we use yield, which is a hinted nop that is faster to execute, and I leave a FIXME for processing SMP messages once we support SMP. These two changes probably make spin loops work on aarch64 :^)
Diffstat (limited to 'Kernel/Arch/aarch64/Processor.h')
-rw-r--r--Kernel/Arch/aarch64/Processor.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Arch/aarch64/Processor.h b/Kernel/Arch/aarch64/Processor.h
index f6b76e726d..8374c61ac0 100644
--- a/Kernel/Arch/aarch64/Processor.h
+++ b/Kernel/Arch/aarch64/Processor.h
@@ -73,11 +73,12 @@ public:
ALWAYS_INLINE static void pause()
{
- TODO_AARCH64();
+ asm volatile("isb sy");
}
ALWAYS_INLINE static void wait_check()
{
- TODO_AARCH64();
+ asm volatile("yield");
+ // FIXME: Process SMP messages once we support SMP on aarch64; cf. x86_64
}
ALWAYS_INLINE u8 physical_address_bit_width() const