summaryrefslogtreecommitdiffhomepage
path: root/dev/SCIKit/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:13:48 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:15:17 +0100
commita13e1c0911c0627184bc38f18c7fdda64447b3ad (patch)
tree073a62c09bf216e85a3f310376640fa1805147f9 /dev/SCIKit/src
parent149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff)
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/SCIKit/src')
-rw-r--r--dev/SCIKit/src/LPC.cc10
-rw-r--r--dev/SCIKit/src/LibSCI+IO.asm50
-rw-r--r--dev/SCIKit/src/Makefile16
-rw-r--r--dev/SCIKit/src/SCI.cc45
4 files changed, 121 insertions, 0 deletions
diff --git a/dev/SCIKit/src/LPC.cc b/dev/SCIKit/src/LPC.cc
new file mode 100644
index 00000000..f4433161
--- /dev/null
+++ b/dev/SCIKit/src/LPC.cc
@@ -0,0 +1,10 @@
+/* -------------------------------------------
+
+Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+File: LPC.cc
+Purpose: Local Procedure Codes.
+
+------------------------------------------- */
+
+#include <SCIKit/LPC.h>
diff --git a/dev/SCIKit/src/LibSCI+IO.asm b/dev/SCIKit/src/LibSCI+IO.asm
new file mode 100644
index 00000000..769ae513
--- /dev/null
+++ b/dev/SCIKit/src/LibSCI+IO.asm
@@ -0,0 +1,50 @@
+;; /*
+;; * ========================================================
+;; *
+;; * libsci
+;; * Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+;; *
+;; * ========================================================
+;; */
+
+[bits 64]
+
+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
diff --git a/dev/SCIKit/src/Makefile b/dev/SCIKit/src/Makefile
new file mode 100644
index 00000000..f8f9fbe4
--- /dev/null
+++ b/dev/SCIKit/src/Makefile
@@ -0,0 +1,16 @@
+##################################################
+# (c) Amlal EL Mahrouss, all rights reserved.
+# This is the bootloader makefile.
+##################################################
+
+ASM=nasm
+FLAGS=-f win64
+
+.PHONY: error
+error:
+ @echo "==> Invalid rule."
+ @echo "==> Use sci_asm_io_<arch> instead."
+
+.PHONY: sci_asm_io_x64
+sci_asm_io_x64:
+ $(ASM) $(FLAGS) libsci+IO.asm -o libsci+IO.o
diff --git a/dev/SCIKit/src/SCI.cc b/dev/SCIKit/src/SCI.cc
new file mode 100644
index 00000000..3427ae4e
--- /dev/null
+++ b/dev/SCIKit/src/SCI.cc
@@ -0,0 +1,45 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <SCIKit/SCI.h>
+
+/// @file libsci.cc
+/// @brief Source file for the memory functions of the libsci.
+
+/// @brief Copy memory region.
+IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input SizeT len)
+{
+ if (!len ||
+ !dest ||
+ !src)
+ {
+ return nullptr;
+ }
+
+ for (SizeT i = 0; i < len; i++)
+ {
+ ((Char*)dest)[i] = ((Char*)src)[i];
+ }
+
+ return dest;
+}
+
+/// @brief Fill memory region with **value**.
+IMPORT_C VoidPtr MmFillMemory(_Input VoidPtr dest, _Input SizeT len, _Input UInt8 value)
+{
+ if (!len ||
+ !dest)
+ {
+ return nullptr;
+ }
+
+ for (SizeT i = 0; i < len; i++)
+ {
+ ((Char*)dest)[i] = value;
+ }
+
+ return dest;
+}