diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-29 17:19:57 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-29 17:19:57 +0200 |
| commit | 81027667166d9624ee12f45f011426678d1bbbf4 (patch) | |
| tree | d12fd352d23ae9c9a167c2c1b8b98c2c9cac2df7 /dev/libSystem/src | |
| parent | 3167f59dbb401d6a79b1524537e04218baf49ee3 (diff) | |
feat: Improve libSystem's architecture and implementation.
fix: Fix NeKit's Ref, and ErrorOr classes.
fix: Fix userland tools.
next:
- Finish the latest tickets and then release nekernel 0.0.3
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/libSystem/src')
| -rw-r--r-- | dev/libSystem/src/Makefile (renamed from dev/libSystem/src/GNUmakefile) | 8 | ||||
| -rw-r--r-- | dev/libSystem/src/SystemAPI.cc (renamed from dev/libSystem/src/System.cc) | 25 | ||||
| -rw-r--r-- | dev/libSystem/src/SystemProc.asm (renamed from dev/libSystem/src/SystemCalls+IO.asm) | 16 |
3 files changed, 23 insertions, 26 deletions
diff --git a/dev/libSystem/src/GNUmakefile b/dev/libSystem/src/Makefile index 9b901f9f..41c99c4d 100644 --- a/dev/libSystem/src/GNUmakefile +++ b/dev/libSystem/src/Makefile @@ -9,8 +9,8 @@ FLAGS=-f win64 .PHONY: error error: @echo "==> Invalid rule." - @echo "==> Use sci_asm_io_<arch> instead." + @echo "==> Use libsys_asm_io_<arch> instead." -.PHONY: sci_asm_io_x64 -sci_asm_io_x64: - $(ASM) $(FLAGS) SystemCalls+IO.asm -o SystemCalls+IO.stub.obj +.PHONY: libsys_asm_io_x64 +libsys_asm_io_x64: + $(ASM) $(FLAGS) SystemProc.asm -o SystemProc.asm.obj diff --git a/dev/libSystem/src/System.cc b/dev/libSystem/src/SystemAPI.cc index 1c28303d..37e835c1 100644 --- a/dev/libSystem/src/System.cc +++ b/dev/libSystem/src/SystemAPI.cc @@ -4,11 +4,11 @@ ------------------------------------------- */
-#include <libSystem/AsmProc.h>
+#include <libSystem/Syscall.h>
#include <libSystem/System.h>
-/// @file SystemCalls.cc
-/// @brief Source file for the memory functions/syscalls for libSystem.sys
+/// @file SystemAPI.cc
+/// @brief System wide API for NeKernel.
IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input SizeT len) {
if (!len || !dest || !src) {
@@ -46,22 +46,17 @@ IMPORT_C VoidPtr MmFillMemory(_Input VoidPtr dest, _Input SizeT len, _Input UInt return dest;
}
-//-----------------------------------------------------------------------------------------------------------//
-/// @brief Systems Calls implementation.
-/// @internal
-//-----------------------------------------------------------------------------------------------------------//
-
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)),
+ return (Ref)libsys_syscall_arg_3(SYSCALL_HASH('IoOpenFile'), 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);
+ libsys_syscall_arg_2(2, desc);
}
IMPORT_C UInt64 IoSeekFile(_Input Ref desc, _Input UInt64 off) {
- auto ret = (volatile UInt64*) sci_syscall_arg_3(3, reinterpret_cast<VoidPtr>(desc),
+ auto ret = (volatile UInt64*) libsys_syscall_arg_3(SYSCALL_HASH('IoSeekFile'), reinterpret_cast<VoidPtr>(desc),
reinterpret_cast<VoidPtr>(&off));
MUST_PASS((*ret) != ~0UL);
@@ -69,7 +64,7 @@ IMPORT_C UInt64 IoSeekFile(_Input Ref desc, _Input UInt64 off) { }
IMPORT_C UInt64 IoTellFile(_Input Ref desc) {
- auto ret = (volatile UInt64*) sci_syscall_arg_2(4, reinterpret_cast<VoidPtr>(desc));
+ auto ret = (volatile UInt64*) libsys_syscall_arg_2(SYSCALL_HASH('IoTellFile'), reinterpret_cast<VoidPtr>(desc));
return *ret;
}
@@ -78,8 +73,8 @@ IMPORT_C SInt32 PrintOut(_Input IORef desc, const char* fmt, ...) { va_start(args, fmt);
- auto ret = (volatile UInt64*) sci_syscall_arg_4(
- 5, reinterpret_cast<VoidPtr>(desc), reinterpret_cast<VoidPtr>(const_cast<Char*>(fmt)), args);
+ auto ret = (volatile UInt64*) libsys_syscall_arg_4(
+ SYSCALL_HASH('PrintOut'), reinterpret_cast<VoidPtr>(desc), reinterpret_cast<VoidPtr>(const_cast<Char*>(fmt)), args);
va_end(args);
@@ -90,5 +85,7 @@ 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);
+
+ libsys_syscall_arg_1(SYSCALL_HASH('_rtl_debug_break'));
}
}
diff --git a/dev/libSystem/src/SystemCalls+IO.asm b/dev/libSystem/src/SystemProc.asm index 097046af..bc41059a 100644 --- a/dev/libSystem/src/SystemCalls+IO.asm +++ b/dev/libSystem/src/SystemProc.asm @@ -11,12 +11,12 @@ section .text -global sci_syscall_arg_1 -global sci_syscall_arg_2 -global sci_syscall_arg_3 -global sci_syscall_arg_4 +global libsys_syscall_arg_1 +global libsys_syscall_arg_2 +global libsys_syscall_arg_3 +global libsys_syscall_arg_4 -sci_syscall_arg_1: +libsys_syscall_arg_1: push rbp mov rbp, rsp @@ -27,7 +27,7 @@ sci_syscall_arg_1: ret -sci_syscall_arg_2: +libsys_syscall_arg_2: push rbp mov rbp, rsp @@ -38,7 +38,7 @@ sci_syscall_arg_2: ret -sci_syscall_arg_3: +libsys_syscall_arg_3: push rbp mov rbp, rsp @@ -51,7 +51,7 @@ sci_syscall_arg_3: ret -sci_syscall_arg_4: +libsys_syscall_arg_4: push rbp mov rbp, rsp |
