mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +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
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…
Add table
Add a link
Reference in a new issue