aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorHimbeer <himbeer@disroot.org>2024-06-04 12:10:13 +0200
committerHimbeer <himbeer@disroot.org>2024-06-04 12:10:13 +0200
commit88ab08bfff60c7ef15ae81e2ab0bd802607f95be (patch)
tree58d55a3beb4dbd1d8d3e257d02af8d496449f553 /src/lib
parent4a633fe9613349d0ad6138b3a1c3d7745b1cafa0 (diff)
panic: Disable and clear all interrupts before using wfi
Fixes #16.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/instructions.zig1
-rw-r--r--src/lib/interrupts.zig8
2 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/instructions.zig b/src/lib/instructions.zig
index d072113..94c0059 100644
--- a/src/lib/instructions.zig
+++ b/src/lib/instructions.zig
@@ -86,6 +86,7 @@ pub fn stackPointer() usize {
pub const satp = Csr(paging.Satp, "satp");
pub const sstatus = Csr(Sstatus, "sstatus");
pub const sie = Csr(interrupts.Enable, "sie");
+pub const sip = Csr(interrupts.Enable, "sip");
pub const sscratch = Csr(usize, "sscratch");
pub const sepc = Csr(usize, "sepc");
diff --git a/src/lib/interrupts.zig b/src/lib/interrupts.zig
index c715816..8c6b930 100644
--- a/src/lib/interrupts.zig
+++ b/src/lib/interrupts.zig
@@ -43,17 +43,15 @@ pub const Enable = packed struct(usize) {
s_external: u1,
reserved2: u54,
- pub const all = .{
+ pub const none = std.mem.zeroInit(Enable, .{});
+ pub const all = std.mem.zeroInit(Enable, .{
.u_software = 1,
.s_software = 1,
- .reserved0 = 0,
.u_timer = 1,
.s_timer = 1,
- .reserved1 = 0,
.u_external = 1,
.s_external = 1,
- .reserved2 = 0,
- };
+ });
};
pub const Cause = packed struct(usize) {