aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/conf/init.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-09-15 19:21:14 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-09-15 19:46:07 +0300
commita717296a2036cede5fccfff544513043a984d614 (patch)
tree68f75a23adc298628fb9cab41fd47402a99dd19d /arch/riscv64/conf/init.c
parent619725a5f2f5272f9cbb547ed95c87312c2765a9 (diff)
downloadkmi-a717296a2036cede5fccfff544513043a984d614.tar.gz
kmi-a717296a2036cede5fccfff544513043a984d614.zip
change syscalls to take 5 params and return 6
+ In total, a syscall is built up of 6 values, with the first being the syscall number. Symmetrically, the first value is now a status and the following five values return "values". This allows us to cram in more info into the ipc_* functions. The performance difference is absolutely minimal, at least from my testing in qemu.
Diffstat (limited to 'arch/riscv64/conf/init.c')
-rw-r--r--arch/riscv64/conf/init.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/riscv64/conf/init.c b/arch/riscv64/conf/init.c
index 4bd6a4e..feb5177 100644
--- a/arch/riscv64/conf/init.c
+++ b/arch/riscv64/conf/init.c
@@ -9,30 +9,33 @@
#include <stdint.h>
#include "../../../include/apos/syscalls.h"
+#define ecall() do { asm ("ecall" : : : "a0", "a1", "a2", "a3", "a4", "a5"); \
+} while (0)
static void sys_noop()
{
long register a0 asm ("a0") = SYS_NOOP;
- asm ("ecall" : : : "a0", "a1");
+ ecall();
}
static void sys_putch(char c)
{
long register a0 asm ("a0") = SYS_PUTCH;
long register a1 asm ("a1") = c;
- asm ("ecall" : : : "a0", "a1");
+ ecall();
}
static uint64_t sys_timebase()
{
long register a0 asm ("a0") = SYS_TIMEBASE;
long register a1 asm ("a1") = 0;
- asm ("ecall" : : : "a0", "a1");
+ long register a2 asm ("a2") = 0;
+ ecall();
#if defined(_LP64)
return a1;
#else
- uint64_t t = a0;
+ uint64_t t = a1;
t <<= 32;
- return t + a1;
+ return t + a2;
#endif
}
@@ -40,13 +43,14 @@ static uint64_t sys_ticks()
{
long register a0 asm ("a0") = SYS_TICKS;
long register a1 asm ("a1") = 0;
- asm ("ecall" : : : "a0", "a1");
+ long register a2 asm ("a2") = 0;
+ ecall();
#if defined(_LP64)
return a1;
#else
- uint64_t t = a0;
+ uint64_t t = a1;
t <<= 32;
- return t + a1;
+ return t + a2;
#endif
}