From ce70afbf50a203be04bc326326cfa75831fe7f5d Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Fri, 26 Aug 2016 20:25:54 -0700 Subject: Disable interrupts during VM tests The code doesn't support interrupts, and it was relying on the reset value of the mie register (which is undefined) to disable them. --- v/vm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/v/vm.c b/v/vm.c index 7659cee..2530785 100644 --- a/v/vm.c +++ b/v/vm.c @@ -217,10 +217,11 @@ void vm_boot(uintptr_t test_addr) (1 << CAUSE_FAULT_FETCH) | (1 << CAUSE_FAULT_LOAD) | (1 << CAUSE_FAULT_STORE)); - // on ERET, user mode w/interrupts on; FPU on; accelerator on; VM on + // on ERET, user mode; FPU on; accelerator on; VM on int vm_choice = sizeof(long) == 8 ? VM_SV39 : VM_SV32; - write_csr(mstatus, MSTATUS_UIE | MSTATUS_FS | MSTATUS_XS | + write_csr(mstatus, MSTATUS_FS | MSTATUS_XS | (vm_choice * (MSTATUS_VM & ~(MSTATUS_VM<<1)))); + write_csr(mie, 0); random = 1 + (random % MAX_TEST_PAGES); freelist_head = pa2kva((void*)&freelist_nodes[0]); -- cgit v1.1