Kernel: Move wait_cycles() function to Aarch_asm_utils.S

Just a bit of housekeeping.
This commit is contained in:
Marcin Undak 2021-10-08 10:01:57 -04:00 committed by Linus Groh
parent 18eb4a59d6
commit d6021300d5
Notes: sideshowbarker 2024-07-18 02:21:01 +09:00
3 changed files with 13 additions and 10 deletions

View File

@ -1,12 +1,24 @@
/*
* Copyright (c) 2021, Nico Weber <thakis@chromium.org>
* Copyright (c) 2021, Marcin Undak <mcinek@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
.global get_current_exception_level
.type get_current_exception_level, @function
get_current_exception_level:
mrs x0, CurrentEL
lsr x0, x0, #2
and x0, x0, #0x3
ret
.global wait_cycles
.type wait_cycles, @function
wait_cycles:
Lstart:
// This is probably too fast when caching and branch prediction is turned on.
// FIXME: Make timer-based.
subs x0, x0, #1
bne Lstart
ret

View File

@ -7,3 +7,4 @@
#pragma once
extern "C" uint8_t get_current_exception_level();
extern "C" void wait_cycles(int n);

View File

@ -30,13 +30,3 @@ Lbss_clear_loop:
bne Lbss_clear_loop
b init
.globl wait_cycles
.type wait_cycles, @function
wait_cycles:
Lstart:
// This is probably too fast when caching and branch prediction is turned on.
// FIXME: Make timer-based.
subs x0, x0, #1
bne Lstart
ret