1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00

Added timer reset in async 7

This commit is contained in:
Stephen Marz 2019-11-03 21:17:29 -05:00
parent 4211090d17
commit 175c4fc7eb

View File

@ -35,8 +35,13 @@ extern "C" fn m_trap(epc: usize,
// Machine software
epc
},
7 => {
7 => unsafe {
// Machine timer
let mtimecmp = 0x0200_4000 as *mut u64;
let mtime = 0x0200_bff8 as *const u64;
// The frequency given by QEMU is 10_000_000 Hz, so this sets
// the next interrupt to fire one second from now.
mtimecmp.write_volatile(mtime.read_volatile() + 10_000_000);
epc
},
11 => {
@ -55,6 +60,18 @@ extern "C" fn m_trap(epc: usize,
// Illegal instruction
panic!("Illegal instruction CPU#{} -> 0x{:08x}: 0x{:08x}\n", hart, epc, tval);
},
8 => {
// Environment (system) call from User mode
epc + 4
},
9 => {
// Environment (system) call from Supervisor mode
epc + 4
},
11 => {
// Environment (system) call from Machine mode
panic!("E-call from Machine mode! CPU#{} -> 0x{:08x}\n", hart, epc);
},
// Page faults
12 => {
// Instruction page fault