summaryrefslogtreecommitdiff
path: root/src/user
diff options
context:
space:
mode:
Diffstat (limited to 'src/user')
-rw-r--r--src/user/app/main.c1
-rw-r--r--src/user/lib/syscall.s24
2 files changed, 5 insertions, 20 deletions
diff --git a/src/user/app/main.c b/src/user/app/main.c
index ff47d4e..92aa56c 100644
--- a/src/user/app/main.c
+++ b/src/user/app/main.c
@@ -16,6 +16,7 @@ void read_file(const char *path, size_t len);
__attribute__((section(".text.startup")))
int main(void) {
+ _syscall(1, 2, 3, 4, 5);
// allocate bss
_syscall_memflag(&_bss_start, &_bss_end - &_bss_start, MEMFLAG_PRESENT);
diff --git a/src/user/lib/syscall.s b/src/user/lib/syscall.s
index 0f9e444..07f5631 100644
--- a/src/user/lib/syscall.s
+++ b/src/user/lib/syscall.s
@@ -2,24 +2,8 @@
.global _syscall
.type _syscall, @function
_syscall:
- push %rbx // preserve registers
- push %rsi
- push %rdi
- push %rbp
-
- // NOT the calling convention TODO you lazy fuck
- mov 20(%rsp), %rax
- mov 24(%rsp), %rbx
- mov %rsp, %rcx
- mov $_syscall_ret, %rdx
- mov 28(%rsp), %rsi
- mov 32(%rsp), %rdi
- mov 36(%rsp), %rbp
- sysenter
-
-_syscall_ret:
- pop %rbp
- pop %rdi
- pop %rsi
- pop %rbx
+ push %r10
+ mov %rcx, %r10
+ syscall
+ pop %r10
ret