riscv64: Fill in some missing CPU defines, advance build further

Change-Id: Id050fad59ede444f2eab7eca681c6ec44612aaf9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3160
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: François Revol <[email protected]>
This commit is contained in:
Alexander von Gluck IV
2020-08-19 16:11:32 +00:00
committed by Alex von Gluck IV
parent 425515d0ac
commit 21258e2674
5 changed files with 110 additions and 2 deletions
@@ -0,0 +1,25 @@
/*
* Copyright 2013-2020 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef BOOT_ARCH_CPU_H
#define BOOT_ARCH_CPU_H
#include <SupportDefs.h>
#include <boot/vfs.h>
#ifdef __cplusplus
extern "C" {
#endif
status_t boot_arch_cpu_init(void);
void arch_ucode_load(BootVolume& volume);
#ifdef __cplusplus
}
#endif
#endif /* BOOT_ARCH_CPU_H */
+2
View File
@@ -113,6 +113,8 @@ rule BuildEFILoader {
OUTPUT_TARGET on $(efiLoader) = binary ;
case arm64 :
OUTPUT_TARGET on $(efiLoader) = binary ;
case riscv64 :
OUTPUT_TARGET on $(efiLoader) = binary ;
case * :
Exit "Currently unsupported arch:" $(TARGET_ARCH) ;
}
+2
View File
@@ -22,6 +22,8 @@ local kernelDebugSources =
local kernelArchDriverSources =
arch_elf.cpp
arch_cpu.cpp
# Serial UART Drivers
#arch_uart_8250.cpp
#arch_uart_8250_omap.cpp
+73
View File
@@ -0,0 +1,73 @@
/*
* Copyright 2012-2020, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ithamar R. Adema <[email protected]>
*/
#include <OS.h>
#include <boot/platform.h>
#include <boot/stdio.h>
#include <boot/kernel_args.h>
#include <boot/stage2.h>
#include <arch/cpu.h>
#include <arch_kernel.h>
#include <arch_system_info.h>
#include <string.h>
#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()
{
#warning Implement system_time in RISCV bootloader!
return 0;
}
extern "C" void
spin(bigtime_t microseconds)
{
#warning Implment spin in RISCV bootloader!
//bigtime_t time = system_time();
//while ((system_time() - time) < microseconds)
// asm volatile ("nop;");
}
@@ -1,5 +1,5 @@
/*
* Copyright 2019, Haiku, Inc. All rights reserved.
* Copyright 2019-2020, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -92,6 +92,13 @@ arch_debug_get_interrupt_pc(bool* _isSyscall)
}
void
arch_debug_unset_current_thread(void)
{
// TODO: Implement!
}
status_t
arch_debug_init(kernel_args *args)
{
@@ -103,4 +110,3 @@ arch_debug_init(kernel_args *args)
return B_NO_ERROR;
}