summaryrefslogtreecommitdiffhomepage
path: root/dev/user/src/SystemCalls+IO.asm
diff options
context:
space:
mode:
Diffstat (limited to 'dev/user/src/SystemCalls+IO.asm')
-rw-r--r--dev/user/src/SystemCalls+IO.asm52
1 files changed, 52 insertions, 0 deletions
diff --git a/dev/user/src/SystemCalls+IO.asm b/dev/user/src/SystemCalls+IO.asm
new file mode 100644
index 00000000..58ea79e7
--- /dev/null
+++ b/dev/user/src/SystemCalls+IO.asm
@@ -0,0 +1,52 @@
+;; /*
+;; * ========================================================
+;; *
+;; * libsci
+;; * Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+;; *
+;; * ========================================================
+;; */
+
+[bits 64]
+
+;; @brief Syscall dispatch, also taking note the Microsoft's calling convention to translate it to NeKernel's ABI.
+
+section .text
+
+global sci_syscall_arg_1
+global sci_syscall_arg_2
+global sci_syscall_arg_3
+global sci_syscall_arg_4
+
+sci_syscall_arg_1:
+ mov r8, rcx
+ syscall
+ ret
+
+sci_syscall_arg_2:
+ mov r8, rcx
+ mov r9, rdx
+ syscall
+ ret
+
+sci_syscall_arg_3:
+ mov rbx, r8
+
+ mov r8, rcx
+ mov r9, rdx
+ mov r10, rbx
+
+ syscall
+ ret
+
+sci_syscall_arg_4:
+ mov rbx, r8
+ mov rax, r9
+
+ mov r8, rcx
+ mov r9, rdx
+ mov r10, rbx
+ mov r11, rax
+
+ syscall
+ ret