summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/riscv64/syscall.S
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/riscv64/syscall.S')
-rw-r--r--usr/klibc/arch/riscv64/syscall.S13
1 files changed, 13 insertions, 0 deletions
diff --git a/usr/klibc/arch/riscv64/syscall.S b/usr/klibc/arch/riscv64/syscall.S
new file mode 100644
index 0000000..89d9bd2
--- /dev/null
+++ b/usr/klibc/arch/riscv64/syscall.S
@@ -0,0 +1,13 @@
+#include <machine/asm.h>
+#include <asm/unistd.h>
+
+ENTRY(__syscall_common)
+ scall
+ li t0, -4096
+ bleu a0, t0, 1f
+ neg a0, a0
+ lui t0, %hi(errno)
+ sw a0, %lo(errno)(t0)
+ li a0, -1
+1: jr ra
+END(__syscall_common)