aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interrupts.zig8
-rw-r--r--src/process.zig1
2 files changed, 6 insertions, 3 deletions
diff --git a/src/interrupts.zig b/src/interrupts.zig
index ba5f440..9d47934 100644
--- a/src/interrupts.zig
+++ b/src/interrupts.zig
@@ -130,11 +130,13 @@ export fn handleTrap(epc: usize, tval: usize, cause_bits: usize, hart_id: usize,
// before returning into it.
process.list.last.?.data.pc = epc;
+
+ schedule() catch |err| {
+ std.debug.panic("Hart {d}: Unable to schedule next process: {any}", .{ hart_id, err });
+ };
}
- schedule() catch |err| {
- std.debug.panic("Hart {d}: Unable to schedule next process: {any}", .{ hart_id, err });
- };
+ // Don't interrupt kernel code, it may never run otherwise.
},
.supervisor_external => {
const context: u14 = @intCast(2 * hart_id + 1);
diff --git a/src/process.zig b/src/process.zig
index 5cec65f..690f4f3 100644
--- a/src/process.zig
+++ b/src/process.zig
@@ -167,6 +167,7 @@ pub fn demo(allocator: std.mem.Allocator) !void {
list.prepend(proc_node);
try time.interruptInMillis(null, schedule_interval_millis);
+ try switchTo(&proc_node.data);
while (true) asm volatile ("wfi");
}