8 #define SBI_CALL(which, arg0, arg1, arg2) \
10 register uintptr_t a0 asm("a0") = (uintptr_t)(arg0); \
11 register uintptr_t a1 asm("a1") = (uintptr_t)(arg1); \
12 register uintptr_t a2 asm("a2") = (uintptr_t)(arg2); \
13 register uintptr_t a6 asm("a6") = (uintptr_t)(0); \
14 register uintptr_t a7 asm("a7") = (uintptr_t)(which); \
15 asm volatile("ecall" \
17 : "r"(a1), "r"(a2), "r"(a6), "r"(a7) \
25 #define SBI_CALL_0(which) SBI_CALL(which, 0, 0, 0)
26 #define SBI_CALL_1(which, arg0) SBI_CALL(which, arg0, 0, 0)
27 #define SBI_CALL_2(which, arg0, arg1) SBI_CALL(which, arg0, arg1, 0)
28 #define SBI_CALL_3(which, arg0, arg1, arg2) SBI_CALL(which, arg0, arg1, arg2)
30 static inline void sbi_console_putstr(
char *str) {
31 while (*str !=
'\0') {
36 static inline void sbi_console_putchar(
int ch) {
40 static inline int sbi_console_getchar(
void) {
44 static inline void sbi_set_timer(uint64_t stime_value) {
48 static inline void sbi_set_mode(uint64_t hart_id, uint64_t addr) {
52 static inline void sbi_shutdown(
void) {
56 static inline void sbi_clear_ipi(
void) {
60 static inline void sbi_send_ipi(
const unsigned long *hart_mask) {
64 static inline void sbi_remote_fence_i(
const unsigned long *hart_mask) {
68 static inline void sbi_remote_sfence_vma(
const unsigned long *hart_mask,
unsigned long start,
unsigned long size) {
72 static inline void sbi_remote_sfence_vma_asid(
const unsigned long *hart_mask,
unsigned long start,
unsigned long size,
unsigned long asid) {
#define SBI_CALL_1(which, arg0)
Definition: sbi.h:26
#define SBI_CALL_2(which, arg0, arg1)
Definition: sbi.h:27
#define SBI_CALL_0(which)
Definition: sbi.h:25
#define SBI_EXT_TIME
Definition: sbidef.h:14
#define SBI_EXT_0_1_SHUTDOWN
Definition: sbidef.h:12
#define SBI_EXT_0_1_CONSOLE_GETCHAR
Definition: sbidef.h:6
#define SBI_EXT_HSM
Definition: sbidef.h:17
#define SBI_EXT_0_1_CONSOLE_PUTCHAR
Definition: sbidef.h:5
#define SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID
Definition: sbidef.h:11
#define SBI_EXT_0_1_REMOTE_SFENCE_VMA
Definition: sbidef.h:10
#define SBI_EXT_0_1_SEND_IPI
Definition: sbidef.h:8
#define SBI_EXT_0_1_REMOTE_FENCE_I
Definition: sbidef.h:9
#define SBI_EXT_0_1_CLEAR_IPI
Definition: sbidef.h:7