1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#include "encoding.h"
#include "mcall.h"
.section .sbi,"ax",@progbits
.align RISCV_PGSHIFT
.globl sbi_base
sbi_base:
# TODO: figure out something better to do with this space. It's not
# protected from the OS, so beware.
.skip RISCV_PGSIZE - 2048
# hart_id
.align 4
li a7, MCALL_HART_ID
ecall
ret
# num_harts
.align 4
lw a0, num_harts
ret
# query_memory
.align 4
j __sbi_query_memory
# console_putchar
.align 4
li a7, MCALL_CONSOLE_PUTCHAR
ecall
ret
# send_device_request
.align 4
li a7, MCALL_SEND_DEVICE_REQUEST
ecall
ret
# receive_device_response
.align 4
li a7, MCALL_RECEIVE_DEVICE_RESPONSE
ecall
ret
# send ipi
.align 4
li a7, MCALL_SEND_IPI
ecall
ret
# timebase
.align 4
li a0, 1000000000 # or, you know, we could provide the correct answer
ret
# shutdown
.align 4
li a7, MCALL_SHUTDOWN
ecall
# end of SBI trampolines
.globl do_mcall
do_mcall:
mv a7, a0
mv a0, a1
mv a1, a2
ecall
ret
.align RISCV_PGSHIFT
|