/* * Copyright 2012-2020, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Ithamar R. Adema */ #include #include #include #include #include #include #include #include #include #include #define TRACE_CPU #ifdef TRACE_CPU # define TRACE(x) dprintf x #else # define TRACE(x) ; #endif /*! Detect RISCV core extensions. */ static status_t check_cpu_features() { // only seems possible from bootloader openfirmware or FDT? return B_OK; } extern "C" status_t boot_arch_cpu_init(void) { status_t err = check_cpu_features(); if (err != B_OK) { panic("It's RISCY business trying to boot Haiku on the wrong CPU!\n"); return err; } return B_OK; } extern "C" void arch_ucode_load(BootVolume& volume) { // NOP on riscv currently } extern "C" bigtime_t system_time() { // TODO: units conversion return CpuTime(); } extern "C" void spin(bigtime_t microseconds) { bigtime_t time = system_time(); while ((system_time() - time) < microseconds) asm volatile ("nop;"); }