aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-09 22:12:27 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-09 22:12:27 +0300
commite8a1df103cc28419dd7d4439c0b1d1739d110f78 (patch)
tree2b4646f262a9008d80ca58fb2ecab2b5bf897873 /arch/riscv64/kernel
parent89d7cf197b2cae130565467bdfad5d5ef5fed2dd (diff)
downloadkmi-e8a1df103cc28419dd7d4439c0b1d1739d110f78.tar.gz
kmi-e8a1df103cc28419dd7d4439c0b1d1739d110f78.zip
start working on tests
+ Current setup will likely not last long, just a stopgap until I figure out how I want to build each testcase etc. Probably dir based, but I'll probably add some scripts that generate the build rules for each test case (or binary?). Also, should probably put ouput files in a build directory and keep the source clean, but again, good enough for now. Will have to start implementing more extensive tests, and probably come up with some way to compare textual output etc.
Diffstat (limited to 'arch/riscv64/kernel')
-rw-r--r--arch/riscv64/kernel/main.c1
-rw-r--r--arch/riscv64/kernel/pmem.c1
-rw-r--r--arch/riscv64/kernel/power.c6
-rw-r--r--arch/riscv64/kernel/proc.c10
4 files changed, 10 insertions, 8 deletions
diff --git a/arch/riscv64/kernel/main.c b/arch/riscv64/kernel/main.c
index 01b8957..c6b5e4a 100644
--- a/arch/riscv64/kernel/main.c
+++ b/arch/riscv64/kernel/main.c
@@ -6,6 +6,7 @@
* riscv64 main
*/
+#include <kmi/syscalls.h>
#include <kmi/utils.h>
#include <arch/arch.h>
#include "csr.h"
diff --git a/arch/riscv64/kernel/pmem.c b/arch/riscv64/kernel/pmem.c
index 56769c6..36f0284 100644
--- a/arch/riscv64/kernel/pmem.c
+++ b/arch/riscv64/kernel/pmem.c
@@ -6,6 +6,7 @@
* riscv64 implementation of arch-specific physical memory handling
*/
+#include <kmi/syscalls.h>
#include <arch/pmem.h>
stat_t stat_pmem_conf(void *fdt, size_t *max_order, size_t *base_bits,
diff --git a/arch/riscv64/kernel/power.c b/arch/riscv64/kernel/power.c
index 21e4957..2238eb1 100644
--- a/arch/riscv64/kernel/power.c
+++ b/arch/riscv64/kernel/power.c
@@ -34,15 +34,15 @@ stat_t poweroff(enum poweroff_type type)
/** \todo this only shuts down the cpu itself, but may leave the SOC
* active. Should read from fdt poweroff and syscon-poweroff etc */
switch (type) {
- case SHUTDOWN:
+ case SYS_SHUTDOWN:
sbi_system_reset(SBI_SHUTDOWN, SBI_NO_REASON);
return ERR_MISC;
- case COLD_REBOOT:
+ case SYS_COLD_REBOOT:
sbi_system_reset(SBI_COLD_REBOOT, SBI_NO_REASON);
return ERR_MISC;
- case WARM_REBOOT:
+ case SYS_WARM_REBOOT:
sbi_system_reset(SBI_WARM_REBOOT, SBI_NO_REASON);
return ERR_MISC;
};
diff --git a/arch/riscv64/kernel/proc.c b/arch/riscv64/kernel/proc.c
index 19bd52f..aa33ec7 100644
--- a/arch/riscv64/kernel/proc.c
+++ b/arch/riscv64/kernel/proc.c
@@ -62,11 +62,11 @@ void set_args(struct tcb *t, size_t n, struct sys_ret a)
{
struct riscv_regs *r = (struct riscv_regs *)(t->regs) - 1;
if (n >= 1) r->a0 = a.s;
- if (n >= 2) r->a1 = a.ar0;
- if (n >= 3) r->a2 = a.ar1;
- if (n >= 4) r->a3 = a.ar2;
- if (n >= 5) r->a4 = a.ar3;
- if (n >= 6) r->a5 = a.ar4;
+ if (n >= 2) r->a1 = a.a0;
+ if (n >= 3) r->a2 = a.a1;
+ if (n >= 4) r->a3 = a.a2;
+ if (n >= 5) r->a4 = a.a3;
+ if (n >= 6) r->a5 = a.a4;
}
struct sys_ret get_args(struct tcb *t)