diff --git a/repos/base-hw/lib/mk/spec/riscv/bootstrap-hw.mk b/repos/base-hw/lib/mk/spec/riscv/bootstrap-hw.mk index a36ecd166..94d027d9b 100644 --- a/repos/base-hw/lib/mk/spec/riscv/bootstrap-hw.mk +++ b/repos/base-hw/lib/mk/spec/riscv/bootstrap-hw.mk @@ -1,4 +1,10 @@ -INC_DIR += $(BASE_DIR)/../base-hw/src/bootstrap/spec/riscv +# +# evaluate bbl_dir immediately, otherwise it won't recognize +# missing ports when checking library dependencies +# +BBL_DIR := $(call select_from_ports,bbl)/src/lib/bbl + +INC_DIR += $(BASE_DIR)/../base-hw/src/bootstrap/spec/riscv $(BBL_DIR) SRC_CC += bootstrap/spec/riscv/platform.cc SRC_CC += lib/base/riscv/kernel/interface.cc diff --git a/repos/base-hw/lib/mk/spec/riscv/core-hw.mk b/repos/base-hw/lib/mk/spec/riscv/core-hw.mk index fe940bcd7..97d7cc3ba 100644 --- a/repos/base-hw/lib/mk/spec/riscv/core-hw.mk +++ b/repos/base-hw/lib/mk/spec/riscv/core-hw.mk @@ -1,4 +1,10 @@ -INC_DIR += $(REP_DIR)/src/core/spec/riscv +# +# evaluate bbl_dir immediately, otherwise it won't recognize +# missing ports when checking library dependencies +# +BBL_DIR := $(call select_from_ports,bbl)/src/lib/bbl + +INC_DIR += $(REP_DIR)/src/core/spec/riscv $(BBL_DIR) CC_OPT += -fno-delete-null-pointer-checks diff --git a/repos/base-hw/ports/bbl.hash b/repos/base-hw/ports/bbl.hash index 010c8043b..2f836aba2 100644 --- a/repos/base-hw/ports/bbl.hash +++ b/repos/base-hw/ports/bbl.hash @@ -1 +1 @@ -30243a733d49c8545adbb230df7e01f8a8fc12a0 +b9358ccd68ac9fbb0ea49b22aa4dd08fdaae1978 diff --git a/repos/base-hw/ports/bbl.port b/repos/base-hw/ports/bbl.port index 1476e0984..c2bd6e2de 100644 --- a/repos/base-hw/ports/bbl.port +++ b/repos/base-hw/ports/bbl.port @@ -3,6 +3,6 @@ VERSION := git DOWNLOADS := bbl.git URL(bbl) = https://github.com/skalk/bbl-lite.git -REV(bbl) = 20e03dfa317747dd39175f9fc3c15c50b702ac04 +REV(bbl) = 22300f2f0ea72b7f9228ca6743d4ebb12cf5a79b DIR(bbl) = src/lib/bbl diff --git a/repos/base-hw/src/lib/hw/spec/riscv/machine_call.h b/repos/base-hw/src/lib/hw/spec/riscv/machine_call.h index d0b95be33..49523a73e 100644 --- a/repos/base-hw/src/lib/hw/spec/riscv/machine_call.h +++ b/repos/base-hw/src/lib/hw/spec/riscv/machine_call.h @@ -16,41 +16,33 @@ #ifndef _SRC__LIB__HW__SPEC__RISCV__MACHINE_CALL_H_ #define _SRC__LIB__HW__SPEC__RISCV__MACHINE_CALL_H_ -#include +using uintptr_t = unsigned long; +#include namespace Hw { - using Kernel::addr_t; - using Kernel::Call_arg; - using Genode::uint64_t; - /** - * SBI calls to machine mode. - * - * Keep in sync with exception_vector.s. - */ - constexpr Call_arg call_id_set_sys_timer() { return 200; } - constexpr Call_arg call_id_get_sys_timer() { return 201; } - - inline addr_t ecall(addr_t call, addr_t arg) + inline unsigned long ecall(unsigned long id, unsigned long a0, + unsigned long a1) { asm volatile ("mv a0, %0\n" "mv a1, %1\n" + "mv a2, %2\n" "ecall \n" "mv %0, a0\n" - : "+r"(call) : "r"(arg) - : "a0", "a1"); - return call; + : "+r"(id) : "r"(a0), "r"(a1) + : "a0", "a1", "a2"); + return id; } - inline void put_char(addr_t c) { - ecall(Kernel::call_id_print_char(), c); + inline void put_char(unsigned long c) { + ecall(MCALL_CONSOLE_PUTCHAR, c, /* unused arg */ 0); } - inline void set_sys_timer(addr_t t) { - Kernel::call(call_id_set_sys_timer(), (Call_arg)t); } + inline void set_sys_timer(unsigned long t) { + ecall(MCALL_SET_TIMER, t, /* unused arg */ 0); } - inline addr_t get_sys_timer() { - return Kernel::call(call_id_get_sys_timer()); } + inline unsigned long get_sys_timer() { + return ecall(MCALL_GET_TIMER, /* unused args */ 0, 0); } } #endif /* _SRC__LIB__HW__SPEC__RISCV__MACHINE_CALL_H_ */