summaryrefslogtreecommitdiffhomepage
path: root/dev/LibSCI/src
diff options
context:
space:
mode:
Diffstat (limited to 'dev/LibSCI/src')
-rw-r--r--dev/LibSCI/src/GPU.cc10
-rw-r--r--dev/LibSCI/src/LPC.cc10
-rw-r--r--dev/LibSCI/src/LibSCI+IO.asm50
-rw-r--r--dev/LibSCI/src/Makefile16
-rw-r--r--dev/LibSCI/src/SCI.cc45
5 files changed, 131 insertions, 0 deletions
diff --git a/dev/LibSCI/src/GPU.cc b/dev/LibSCI/src/GPU.cc
new file mode 100644
index 00000000..e5aae8d4
--- /dev/null
+++ b/dev/LibSCI/src/GPU.cc
@@ -0,0 +1,10 @@
+/* -------------------------------------------
+
+Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+
+File: GPU.cc
+Purpose: GPU Interface.
+
+------------------------------------------- */
+
+#include <LPC.h>
diff --git a/dev/LibSCI/src/LPC.cc b/dev/LibSCI/src/LPC.cc
new file mode 100644
index 00000000..7b6af907
--- /dev/null
+++ b/dev/LibSCI/src/LPC.cc
@@ -0,0 +1,10 @@
+/* -------------------------------------------
+
+Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+
+File: LPC.cc
+Purpose: Local Procedure Codes.
+
+------------------------------------------- */
+
+#include <LPC.h>
diff --git a/dev/LibSCI/src/LibSCI+IO.asm b/dev/LibSCI/src/LibSCI+IO.asm
new file mode 100644
index 00000000..0beb9e1c
--- /dev/null
+++ b/dev/LibSCI/src/LibSCI+IO.asm
@@ -0,0 +1,50 @@
+;; /*
+;; * ========================================================
+;; *
+;; * LibSCI
+;; * Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved., 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/LibSCI/src/Makefile b/dev/LibSCI/src/Makefile
new file mode 100644
index 00000000..eb655ed5
--- /dev/null
+++ b/dev/LibSCI/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/LibSCI/src/SCI.cc b/dev/LibSCI/src/SCI.cc
new file mode 100644
index 00000000..92cfc54b
--- /dev/null
+++ b/dev/LibSCI/src/SCI.cc
@@ -0,0 +1,45 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <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;
+}