From 6517fe26a2a0c89c3112f4a383c601572c71d64a Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Thu, 12 Mar 2015 17:38:04 -0700 Subject: Update to new privileged spec --- pk/sbi_entry.S | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 pk/sbi_entry.S (limited to 'pk/sbi_entry.S') 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 -- cgit v1.1