From d6021300d5886cb3598cc51a2c76714e88e30a33 Mon Sep 17 00:00:00 2001 From: Marcin Undak Date: Fri, 8 Oct 2021 10:01:57 -0400 Subject: [PATCH] Kernel: Move wait_cycles() function to Aarch_asm_utils.S Just a bit of housekeeping. --- Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S | 12 ++++++++++++ Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h | 1 + Kernel/Prekernel/Arch/aarch64/boot.S | 10 ---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S index 334848f9e7..b5eba4784d 100644 --- a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S +++ b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.S @@ -1,12 +1,24 @@ /* + * Copyright (c) 2021, Nico Weber * Copyright (c) 2021, Marcin Undak * * 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 diff --git a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h index e3d4b54ce6..55d115e2ac 100644 --- a/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h +++ b/Kernel/Prekernel/Arch/aarch64/Aarch64_asm_utils.h @@ -7,3 +7,4 @@ #pragma once extern "C" uint8_t get_current_exception_level(); +extern "C" void wait_cycles(int n); diff --git a/Kernel/Prekernel/Arch/aarch64/boot.S b/Kernel/Prekernel/Arch/aarch64/boot.S index 7eaa7fa557..2b4b1cc2c9 100644 --- a/Kernel/Prekernel/Arch/aarch64/boot.S +++ b/Kernel/Prekernel/Arch/aarch64/boot.S @@ -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