diff options
Diffstat (limited to 'machine/minit.c')
-rw-r--r-- | machine/minit.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/machine/minit.c b/machine/minit.c index c519926..59df32b 100644 --- a/machine/minit.c +++ b/machine/minit.c @@ -66,8 +66,14 @@ static void delegate_traps() write_csr(mideleg, interrupts); write_csr(medeleg, exceptions); - assert(read_csr(mideleg) == interrupts); + assert((~read_csr(mideleg) & interrupts) == 0); assert(read_csr(medeleg) == exceptions); + + uintptr_t hypervisor_exceptions = + (1U << CAUSE_FETCH_GUEST_PAGE_FAULT) | + (1U << CAUSE_LOAD_GUEST_PAGE_FAULT) | + (1U << CAUSE_STORE_GUEST_PAGE_FAULT); + set_csr(medeleg, hypervisor_exceptions); } static void fp_init() |