hw_riscv: strictly separate machine and syscall ids

Fix #3230
This commit is contained in:
Stefan Kalkowski 2019-03-14 15:33:32 +01:00 committed by Christian Helmuth
parent 91197804ac
commit 822a6e7c5f
5 changed files with 30 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -1 +1 @@
30243a733d49c8545adbb230df7e01f8a8fc12a0
b9358ccd68ac9fbb0ea49b22aa4dd08fdaae1978

View File

@ -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

View File

@ -16,41 +16,33 @@
#ifndef _SRC__LIB__HW__SPEC__RISCV__MACHINE_CALL_H_
#define _SRC__LIB__HW__SPEC__RISCV__MACHINE_CALL_H_
#include <kernel/interface.h>
using uintptr_t = unsigned long;
#include <bbl/mcall.h>
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_ */