mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel/aarch64: Implement wait_cycles as a pause loop
The hand-written assembly does not compile under Clang due to register size mismatches. Using a loop is slower (~6 instructions on O2 as opposed to 2 with hand-written assembly), but using the pause instruction makes this more efficient even under TCG.
This commit is contained in:
parent
984348ed0d
commit
5d00e21852
Notes:
sideshowbarker
2024-07-17 02:26:00 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/5d00e21852 Pull-request: https://github.com/SerenityOS/serenity/pull/16722 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/FireFox317 ✅ Reviewed-by: https://github.com/Hendiadyoin1
1 changed files with 3 additions and 6 deletions
|
@ -62,13 +62,10 @@ inline ExceptionLevel get_current_exception_level()
|
|||
|
||||
inline void wait_cycles(int n)
|
||||
{
|
||||
// This is probably too fast when caching and branch prediction is turned on.
|
||||
// FIXME: Make timer-based.
|
||||
asm("mov x0, %[value]\n"
|
||||
"0:\n"
|
||||
" subs x0, x0, #1\n"
|
||||
" bne 0b" ::[value] "r"(n)
|
||||
: "x0");
|
||||
for (int volatile i = 0; i < n; i = i + 1) {
|
||||
Processor::pause();
|
||||
}
|
||||
}
|
||||
|
||||
inline void el1_vector_table_install(void* vector_table)
|
||||
|
|
Loading…
Reference in a new issue