aboutsummaryrefslogtreecommitdiff
path: root/pk/sbi_entry.S
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2015-03-12 17:38:04 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2015-03-12 17:38:04 -0700
commit6517fe26a2a0c89c3112f4a383c601572c71d64a (patch)
treed37eea7ae6f3e15eee94afb5c9c749a4cd800577 /pk/sbi_entry.S
parenta4ae7da6ef0c09c2616a0b82f7f569e4e134f75c (diff)
downloadpk-6517fe26a2a0c89c3112f4a383c601572c71d64a.zip
pk-6517fe26a2a0c89c3112f4a383c601572c71d64a.tar.gz
pk-6517fe26a2a0c89c3112f4a383c601572c71d64a.tar.bz2
Update to new privileged spec
Diffstat (limited to 'pk/sbi_entry.S')
-rw-r--r--pk/sbi_entry.S61
1 files changed, 61 insertions, 0 deletions
diff --git a/pk/sbi_entry.S b/pk/sbi_entry.S
new file mode 100644
index 0000000..33e998a
--- /dev/null
+++ b/pk/sbi_entry.S
@@ -0,0 +1,61 @@
+#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 a0, MCALL_HART_ID
+ mcall
+ ret
+
+ # num_harts
+ .align 4
+ lw a0, num_harts
+ ret
+
+ # query_memory
+ .align 4
+ j __sbi_query_memory
+
+ # console_putchar
+ .align 4
+ mv a1, a0
+ li a0, MCALL_CONSOLE_PUTCHAR
+ mcall
+ ret
+
+ # send_device_request
+ .align 4
+ mv a1, a0
+ li a0, MCALL_SEND_DEVICE_REQUEST
+ mcall
+ ret
+
+ # receive_device_response
+ .align 4
+ mv a1, a0
+ li a0, MCALL_RECEIVE_DEVICE_RESPONSE
+ mcall
+ ret
+
+ # send ipi
+ .align 4
+ csrw send_ipi, a0
+ ret
+
+ # end of SBI trampolines
+
+ .globl do_mcall
+do_mcall:
+ mcall
+ ret
+
+ .align RISCV_PGSHIFT