summaryrefslogtreecommitdiff
path: root/kernel/src/arch/riscv64/riscv64.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/arch/riscv64/riscv64.cpp')
-rw-r--r--kernel/src/arch/riscv64/riscv64.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/src/arch/riscv64/riscv64.cpp b/kernel/src/arch/riscv64/riscv64.cpp
index 784cc94..8e2fb37 100644
--- a/kernel/src/arch/riscv64/riscv64.cpp
+++ b/kernel/src/arch/riscv64/riscv64.cpp
@@ -20,6 +20,16 @@ namespace arch {
asm volatile("" ::: "memory");
}
+ [[gnu::weak]] bool test_interrupts() {
+ uint64_t status;
+ __asm__ __volatile__ (
+ "csrr %0, mstatus"
+ : "=r" (status)
+ );
+
+ return (status & (1 << 3)) != 0;
+ }
+
[[gnu::weak]] void hcf() {
disable_interrupts();
while(true) {