From 9655f71758003f93294e82926783024a7e4bcdde Mon Sep 17 00:00:00 2001 From: Jonathan Behrens Date: Mon, 30 Aug 2021 16:27:52 -0400 Subject: Configure PMP at boot --- kernel/riscv.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'kernel/riscv.h') diff --git a/kernel/riscv.h b/kernel/riscv.h index 0aec003..33b4335 100644 --- a/kernel/riscv.h +++ b/kernel/riscv.h @@ -181,6 +181,18 @@ w_mtvec(uint64 x) asm volatile("csrw mtvec, %0" : : "r" (x)); } +static inline void +w_pmpcfg0(uint64 x) +{ + asm volatile("csrw pmpcfg0, %0" : : "r" (x)); +} + +static inline void +w_pmpaddr0(uint64 x) +{ + asm volatile("csrw pmpaddr0, %0" : : "r" (x)); +} + // use riscv's sv39 page table scheme. #define SATP_SV39 (8L << 60) -- cgit v1.2.3