diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-08-26 20:25:54 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-08-26 20:25:54 -0700 |
commit | ce70afbf50a203be04bc326326cfa75831fe7f5d (patch) | |
tree | 08481998f5370875b2d99f4dda4f94cc1a05ec99 | |
parent | 1386acb05aa78f54635d7074e2cb552278602dfd (diff) | |
download | env-ce70afbf50a203be04bc326326cfa75831fe7f5d.zip env-ce70afbf50a203be04bc326326cfa75831fe7f5d.tar.gz env-ce70afbf50a203be04bc326326cfa75831fe7f5d.tar.bz2 |
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.
-rw-r--r-- | v/vm.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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]); |