aboutsummaryrefslogtreecommitdiff
path: root/src/interrupts.zig
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-05-04 10:42:18 +0200
committerHimbeer <himbeer@disroot.org>2024-05-04 10:42:18 +0200
commit535f38adc196a778d149dda0194882942243604b (patch)
treee4ba326f8a76af0d90522907e2e2724ca4246c9a /src/interrupts.zig
parent0faebc5453563f2fdd0dfe3f8f53ca6f6f4b77a8 (diff)
Handle access faults, not just page faults
Diffstat (limited to 'src/interrupts.zig')
-rw-r--r--src/interrupts.zig16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/interrupts.zig b/src/interrupts.zig
index 4cd6947..6823d8b 100644
--- a/src/interrupts.zig
+++ b/src/interrupts.zig
@@ -106,7 +106,7 @@ export fn supervisor_trap(epc: usize, tval: usize, cause_bits: usize, hart_id: u
.supervisor_timer => w.print("Hart {d}: Supervisor timer interrupt\r\n", .{hart_id}) catch while (true) {},
.supervisor_external => w.print("Hart {d}: Supervisor external interrupt\r\n", .{hart_id}) catch while (true) {},
else => {
- w.print("Hart {d}: Unhandled asynchronous interrupt\r\n", .{hart_id}) catch while (true) {};
+ w.print("Hart {d}: Unhandled asynchronous interrupt: {d}\r\n", .{ hart_id, cause.num }) catch while (true) {};
while (true) {}
},
}
@@ -116,6 +116,18 @@ export fn supervisor_trap(epc: usize, tval: usize, cause_bits: usize, hart_id: u
w.print("Hart {d}: Illegal instruction\r\n", .{hart_id}) catch while (true) {};
while (true) {}
},
+ .instruction_access_fault => {
+ w.print("Hart {d}: Instruction access fault, tval = 0x{x:0>16}\r\n", .{ hart_id, tval }) catch while (true) {};
+ return epc + 4;
+ },
+ .load_access_fault => {
+ w.print("Hart {d}: Load access fault, tval = 0x{x:0>16}\r\n", .{ hart_id, tval }) catch while (true) {};
+ return epc + 4;
+ },
+ .store_or_amo_access_fault => {
+ w.print("Hart {d}: Store/AMO access fault, tval = 0x{x:0>16}\r\n", .{ hart_id, tval }) catch while (true) {};
+ return epc + 4;
+ },
.ecall => {
w.print("Hart {d}: Environment call from U-mode\r\n", .{hart_id}) catch while (true) {};
return epc + 4;
@@ -133,7 +145,7 @@ export fn supervisor_trap(epc: usize, tval: usize, cause_bits: usize, hart_id: u
return epc + 4;
},
else => {
- w.print("Hart {d}: Unhandled synchronous interrupt\r\n", .{hart_id}) catch while (true) {};
+ w.print("Hart {d}: Unhandled synchronous interrupt: {d}\r\n", .{ hart_id, cause.num }) catch while (true) {};
while (true) {}
},
}