diff options
author | Himbeer <himbeer@disroot.org> | 2024-06-04 11:48:05 +0200 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-06-04 11:48:05 +0200 |
commit | ebb035f0d8a25bfc6a89cfadd06b0d65ccc7e332 (patch) | |
tree | f1de44a74ac5ef016e104ac64455220ad9681b8b /src/lib | |
parent | 2e6f98a43d935b87cddab4566b228c312dead010 (diff) |
interrupts: Assume successful console output
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/interrupts.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/interrupts.zig b/src/lib/interrupts.zig index febe660..c715816 100644 --- a/src/lib/interrupts.zig +++ b/src/lib/interrupts.zig @@ -114,14 +114,14 @@ export fn handleTrap(epc: usize, tval: usize, cause_bits: usize, hart_id: usize, _ = &status; _ = &frame; - const console = Console.autoChoose() orelse while (true) asm volatile ("wfi"); + const console = Console.autoChoose().?; const w = console.writer(); const cause: Cause = @bitCast(cause_bits); if (cause.isAsync()) { switch (@as(AsyncCause, @enumFromInt(cause.num))) { - .supervisor_software => w.print("Hart {d}: Software interrupt\r\n", .{hart_id}) catch while (true) {}, + .supervisor_software => w.print("Hart {d}: Software interrupt\r\n", .{hart_id}) catch unreachable, .supervisor_timer => { if (status.previous_privilege == 0) { // Trapped from U-mode, update pc for next time slice. @@ -147,7 +147,7 @@ export fn handleTrap(epc: usize, tval: usize, cause_bits: usize, hart_id: usize, std.debug.panic("Hart {d}: Unable to claim external interrupt: {any}", .{ hart_id, err }); }; if (external_cause) |source| { - w.print("Hart {d}: External interrupt: 0x{x}\r\n", .{ hart_id, source }) catch while (true) {}; + w.print("Hart {d}: External interrupt: 0x{x}\r\n", .{ hart_id, source }) catch unreachable; handleExternal(source); plic.default.complete(context, source) catch |err| { std.debug.panic("Hart {d}: Unable to complete external interrupt: {any}", .{ hart_id, err }); @@ -176,7 +176,7 @@ export fn handleTrap(epc: usize, tval: usize, cause_bits: usize, hart_id: usize, syscall.handle(frame) catch |err| switch (err) { syscall.Error.UnknownSyscall => { const a0 = frame.general_purpose_registers[10]; - w.print("Hart {d}: Unknown syscall, a0 = 0x{x:0>16}\r\n", .{ hart_id, a0 }) catch while (true) {}; + w.print("Hart {d}: Unknown syscall, a0 = 0x{x:0>16}\r\n", .{ hart_id, a0 }) catch unreachable; }, }; |