summaryrefslogtreecommitdiffhomepage
path: root/dev/user/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-29 10:51:53 +0200
committerGitHub <noreply@github.com>2025-05-29 10:51:53 +0200
commit5c0bb7ee7b1b0fee02cc179fb21f4c57a61d6c2d (patch)
treecb17577bcdc9714c97a84ce417a075117097f146 /dev/user/src
parentd608230b1350b064ceb01e6572519b108f6139b0 (diff)
parent3167f59dbb401d6a79b1524537e04218baf49ee3 (diff)
Merge pull request #32 from nekernel-org/dev
0.0.2e3
Diffstat (limited to 'dev/user/src')
-rw-r--r--dev/user/src/GNUmakefile16
-rw-r--r--dev/user/src/SystemCalls+IO.asm52
-rw-r--r--dev/user/src/SystemCalls.cc96
3 files changed, 0 insertions, 164 deletions
diff --git a/dev/user/src/GNUmakefile b/dev/user/src/GNUmakefile
deleted file mode 100644
index 09993d16..00000000
--- a/dev/user/src/GNUmakefile
+++ /dev/null
@@ -1,16 +0,0 @@
-##################################################
-# (c) Amlal El Mahrouss, all rights reserved.
-# This file is for user.sys's syscall stubs.
-##################################################
-
-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) SystemCalls+IO.asm -o SystemCalls+IO.asm.o
diff --git a/dev/user/src/SystemCalls+IO.asm b/dev/user/src/SystemCalls+IO.asm
deleted file mode 100644
index 77e22b59..00000000
--- a/dev/user/src/SystemCalls+IO.asm
+++ /dev/null
@@ -1,52 +0,0 @@
-;; /*
-;; * ========================================================
-;; *
-;; * user/src/SystemCalls+IO.asm
-;; * 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
diff --git a/dev/user/src/SystemCalls.cc b/dev/user/src/SystemCalls.cc
deleted file mode 100644
index f8b6d597..00000000
--- a/dev/user/src/SystemCalls.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-#include <user/Opts.h>
-#include <user/SystemCalls.h>
-
-/// @file SystemCalls.cc
-/// @brief Source file for the memory functions/syscalls for user.sys
-
-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;
-}
-
-IMPORT_C SInt64 MmStrLen(const Char* in) {
- if (!in) return 0;
-
- SizeT len{0};
-
- do {
- ++len;
- } while (in[len] != '\0');
-
- return len;
-}
-
-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;
-}
-
-//-----------------------------------------------------------------------------------------------------------//
-/// @brief Systems Calls implementation.
-/// @internal
-//-----------------------------------------------------------------------------------------------------------//
-
-constexpr auto kInvalidSyscall = 0UL;
-
-IMPORT_C Ref IoOpenFile(_Input const Char* path, _Input const Char* drv_letter) {
- return sci_syscall_arg_3(1, reinterpret_cast<VoidPtr>(const_cast<Char*>(path)),
- reinterpret_cast<VoidPtr>(const_cast<Char*>(drv_letter)));
-}
-
-IMPORT_C Void IoCloseFile(_Input Ref desc) {
- sci_syscall_arg_2(2, desc);
-}
-
-IMPORT_C UInt64 IoSeekFile(_Input Ref desc, _Input UInt64 off) {
- auto ret = (UInt64*) sci_syscall_arg_3(3, reinterpret_cast<VoidPtr>(desc),
- reinterpret_cast<VoidPtr>(&off));
-
- MUST_PASS((*ret) != ~0UL);
- return *ret;
-}
-
-IMPORT_C UInt64 IoTellFile(_Input Ref desc) {
- auto ret = (UInt64*) sci_syscall_arg_2(4, reinterpret_cast<VoidPtr>(desc));
- return *ret;
-}
-
-IMPORT_C SInt32 PrintOut(_Input IORef desc, const char* fmt, ...) {
- va_list args;
-
- va_start(args, fmt);
-
- auto ret = (UInt64*) sci_syscall_arg_4(5, reinterpret_cast<VoidPtr>(desc),
- reinterpret_cast<VoidPtr>(const_cast<Char*>(fmt)), args);
-
- va_end(args);
-
- return *ret;
-}
-
-IMPORT_C Void _rtl_assert(Bool expr, const Char* origin) {
- if (!expr) {
- PrintOut(nullptr, "Assertion failed: %s\r", origin);
- PrintOut(nullptr, "Origin: %s\r", origin);
- }
-}