summaryrefslogtreecommitdiffhomepage
path: root/dev/user/src/SystemCalls+IO.asm
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-16 18:15:13 +0200
committerGitHub <noreply@github.com>2025-04-16 18:15:13 +0200
commit0033ef41f33ce3d39b4e7ed7e1353cec916bdd5d (patch)
treecf298a3b522fed5b829c4b250932ab13ef407838 /dev/user/src/SystemCalls+IO.asm
parentd3cf45311cf3f6de0bc25bb0ddb5c14a29a72cd6 (diff)
parent58b3d776ab5435de352217b2a3a525aeb9316e99 (diff)
Merge pull request #19 from amlel-el-mahrouss/dev
urgent patches.
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