aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-02 21:40:10 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-02 21:40:10 +0300
commit8a3452098267e1af127d6c4f1836a9d82cd23f38 (patch)
treec9fad842a8903f64a57027b66ef54bba0dee2928 /arch/riscv64
parent7ad9c01dad7b1b46eced8290b8b991383d648188 (diff)
downloadkmi-8a3452098267e1af127d6c4f1836a9d82cd23f38.tar.gz
kmi-8a3452098267e1af127d6c4f1836a9d82cd23f38.zip
more complete interrupt handling outline
+ Still largely untested, should really try to come up with a proper testsuite, at the moment it's mostly me trying things out in the (as of yet unreleased) kmx repo
Diffstat (limited to 'arch/riscv64')
-rw-r--r--arch/riscv64/conf/init.c8
-rw-r--r--arch/riscv64/kernel/csr.h2
-rw-r--r--arch/riscv64/kernel/irq.c8
3 files changed, 10 insertions, 8 deletions
diff --git a/arch/riscv64/conf/init.c b/arch/riscv64/conf/init.c
index 80bb68a..010267e 100644
--- a/arch/riscv64/conf/init.c
+++ b/arch/riscv64/conf/init.c
@@ -36,7 +36,8 @@ char *strcpy(char * restrict dst, const char * restrict src)
}
static inline struct sys_ret ecall(size_t n,
- sys_arg_t arg0, sys_arg_t arg1, sys_arg_t arg2, sys_arg_t arg3,
+ sys_arg_t arg0, sys_arg_t arg1,
+ sys_arg_t arg2, sys_arg_t arg3,
sys_arg_t arg4, sys_arg_t arg5)
{
/* here a static assert of n <= 6 && n >= 1 would be ideal */
@@ -186,8 +187,9 @@ static void sys_ipc_server(void *f)
}
static inline struct sys_ret sys_ipc_req(sys_arg_t pid,
- sys_arg_t d0, sys_arg_t d1, sys_arg_t d2,
- sys_arg_t d3)
+ sys_arg_t d0, sys_arg_t d1,
+ sys_arg_t d2,
+ sys_arg_t d3)
{
struct sys_ret r = ecall6(SYS_IPC_REQ, pid, d0, d1, d2, d3);
diff --git a/arch/riscv64/kernel/csr.h b/arch/riscv64/kernel/csr.h
index bc48464..9b7b78a 100644
--- a/arch/riscv64/kernel/csr.h
+++ b/arch/riscv64/kernel/csr.h
@@ -40,8 +40,6 @@
/** Address of \c sstatus CSR. */
#define CSR_SSTATUS 0x100
-#define SR_SPIE 0b10
-
/** Address of \c sie CSR. */
#define CSR_SIE 0x104
diff --git a/arch/riscv64/kernel/irq.c b/arch/riscv64/kernel/irq.c
index 2ef15cc..0c129b9 100644
--- a/arch/riscv64/kernel/irq.c
+++ b/arch/riscv64/kernel/irq.c
@@ -38,16 +38,18 @@ stat_t deactivate_irq(irq_t id)
return OK;
}
+/** Bit pattern representing supervisor external, timer and software irqs. */
+#define SR_IRQS (1 << 9) | (1 << 5) | (1 << 3)
+
/* very simple for now */
void enable_irqs()
{
- /* should be supervisor external interrupt */
- csr_set(CSR_SIE, 1 << 9);
+ csr_set(CSR_SIE, SR_IRQS);
}
void disable_irqs()
{
- csr_clear(CSR_SIE, 1 << 9);
+ csr_clear(CSR_SIE, SR_IRQS);
}
irq_t get_irq()