summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2022-08-19 23:36:29 +0200
committerdzwdz2022-08-19 23:36:29 +0200
commit040bb34290c9a4305e13637e002060411e5a8385 (patch)
tree5bdd71a8925519d5f2e22d60a9fdd572abea2ed0 /src
parent390aec5ca22e62d128e71d1dee312a2f0a82ab68 (diff)
include: make camellia/syscalls.h compatible with assembly
Diffstat (limited to 'src')
-rw-r--r--src/shared/include/camellia/syscalls.h47
-rw-r--r--src/user/lib/elfload.S (renamed from src/user/lib/elfload.s)7
2 files changed, 29 insertions, 25 deletions
diff --git a/src/shared/include/camellia/syscalls.h b/src/shared/include/camellia/syscalls.h
index dfc964f..04dfba5 100644
--- a/src/shared/include/camellia/syscalls.h
+++ b/src/shared/include/camellia/syscalls.h
@@ -1,35 +1,34 @@
#pragma once
-#include <camellia/types.h>
-#include <stddef.h>
-enum {
- // idc about stable syscall numbers just yet
- _SYSCALL_EXIT,
- _SYSCALL_AWAIT,
- _SYSCALL_FORK,
+#define _SYSCALL_EXIT 0
+#define _SYSCALL_AWAIT 1
+#define _SYSCALL_FORK 2
+
+#define _SYSCALL_OPEN 3
+#define _SYSCALL_MOUNT 4
+#define _SYSCALL_DUP 5
- _SYSCALL_OPEN,
- _SYSCALL_MOUNT,
- _SYSCALL_DUP,
+#define _SYSCALL_READ 6
+#define _SYSCALL_WRITE 7
+#define _SYSCALL_GETSIZE 8
+#define _SYSCALL_REMOVE 9
+#define _SYSCALL_CLOSE 10
- _SYSCALL_READ,
- _SYSCALL_WRITE,
- _SYSCALL_GETSIZE,
- _SYSCALL_REMOVE,
- _SYSCALL_CLOSE,
+#define _SYSCALL_FS_WAIT 11
+#define _SYSCALL_FS_RESPOND 12
- _SYSCALL_FS_WAIT,
- _SYSCALL_FS_RESPOND,
+#define _SYSCALL_MEMFLAG 13
+#define _SYSCALL_PIPE 14
- _SYSCALL_MEMFLAG,
- _SYSCALL_PIPE,
+#define _SYSCALL_SLEEP 15
- _SYSCALL_SLEEP,
+#define _SYSCALL_EXECBUF 100
- _SYSCALL_EXECBUF = 100,
+#define _SYSCALL_DEBUG_KLOG 101
- _SYSCALL_DEBUG_KLOG,
-};
+#ifndef ASM_FILE
+#include <camellia/types.h>
+#include <stddef.h>
long _syscall(long, long, long, long, long, long);
@@ -83,3 +82,5 @@ void _syscall_sleep(long ms);
long _syscall_execbuf(void __user *buf, size_t len);
void _syscall_debug_klog(const void __user *buf, size_t len);
+
+#endif
diff --git a/src/user/lib/elfload.s b/src/user/lib/elfload.S
index faab85f..0f15c06 100644
--- a/src/user/lib/elfload.s
+++ b/src/user/lib/elfload.S
@@ -1,3 +1,6 @@
+#define ASM_FILE 1
+#include <camellia/syscalls.h>
+
.section .text
.global _freejmp_chstack
.type _freejmp_chstack, @function
@@ -12,6 +15,6 @@ _freejmp_chstack:
// _Noreturn void execbuf_chstack(void *stack, void __user *buf, size_t len);
execbuf_chstack:
mov %rdi, %rsp
- mov $100, %rdi
+ mov $_SYSCALL_EXECBUF, %rdi
syscall
- jmp 0 // if execbuf failed we might as well crash
+ hlt // if execbuf failed we might as well crash