summaryrefslogtreecommitdiffhomepage
path: root/dev/libSystem/src
diff options
context:
space:
mode:
Diffstat (limited to 'dev/libSystem/src')
-rw-r--r--dev/libSystem/src/JailCalls.cc17
-rw-r--r--dev/libSystem/src/Makefile6
-rw-r--r--dev/libSystem/src/SystemCalls.cc (renamed from dev/libSystem/src/System.cc)11
-rw-r--r--dev/libSystem/src/SystemCallsABI+AMD64.asm (renamed from dev/libSystem/src/SystemProc.asm)2
-rw-r--r--dev/libSystem/src/VerifyCalls.cc18
5 files changed, 41 insertions, 13 deletions
diff --git a/dev/libSystem/src/JailCalls.cc b/dev/libSystem/src/JailCalls.cc
new file mode 100644
index 00000000..5cb47bb5
--- /dev/null
+++ b/dev/libSystem/src/JailCalls.cc
@@ -0,0 +1,17 @@
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <libSystem/SystemKit/Err.h>
+#include <libSystem/SystemKit/Jail.h>
+#include <libSystem/SystemKit/Syscall.h>
+#include <libSystem/SystemKit/System.h>
+#include <libSystem/SystemKit/Verify.h>
+
+using namespace LibSystem;
+
+IMPORT_C struct JAIL* JailGetCurrent(Void) {
+ return (struct JAIL*) libsys_syscall_arg_1(SYSCALL_HASH("JailGetCurrent"));
+} \ No newline at end of file
diff --git a/dev/libSystem/src/Makefile b/dev/libSystem/src/Makefile
index 64ef02cc..ea8e9905 100644
--- a/dev/libSystem/src/Makefile
+++ b/dev/libSystem/src/Makefile
@@ -1,5 +1,5 @@
##################################################
-# (c) Amlal El Mahrouss, all rights reserved.
+# (c) Amlal El Mahrouss and NeKernel contributors, all rights reserved.
# This file is for libSystem.dll's syscall stubs.
##################################################
@@ -8,9 +8,9 @@ FLAGS=-f win64
.PHONY: error
error:
- @echo "==> Invalid rule."
+ @echo "==> Invalid recipe."
@echo "==> Use libsys_asm_io_<arch> instead."
.PHONY: libsys_asm_io_x64
libsys_asm_io_x64:
- $(ASM) $(FLAGS) SystemProc.asm -o SystemProc.stub.obj
+ $(ASM) $(FLAGS) SystemCallsABI+AMD64.asm -o SystemCallsABI+AMD64.stub.obj
diff --git a/dev/libSystem/src/System.cc b/dev/libSystem/src/SystemCalls.cc
index da9931fe..3db9368d 100644
--- a/dev/libSystem/src/System.cc
+++ b/dev/libSystem/src/SystemCalls.cc
@@ -11,13 +11,6 @@
using namespace LibSystem;
-IMPORT_C Void _rtl_assert(Bool expr, const Char* origin) {
- if (!expr) {
- PrintOut(nullptr, "Assertion failed: %s\r", origin);
- libsys_syscall_arg_1(SYSCALL_HASH("_rtl_debug_break"));
- }
-}
-
/// @note this uses the FNV 64-bit variant.
IMPORT_C UInt64 libsys_hash_64(const Char* path) {
if (!path || *path == 0) return 0;
@@ -147,7 +140,7 @@ IMPORT_C VoidPtr MmFillMemory(_Input VoidPtr dest, _Input SizeT len, _Input UInt
IMPORT_C Ref IoOpenFile(_Input const Char* path, _Input const Char* drv_letter) {
return static_cast<Ref>(libsys_syscall_arg_3(
- SYSCALL_HASH("IoOpenFile"), Detail::sys_safe_cast(path), Detail::sys_safe_cast(drv_letter)));
+ SYSCALL_HASH("IoOpenFile"), Verify::sys_safe_cast(path), Verify::sys_safe_cast(drv_letter)));
}
IMPORT_C Void IoCloseFile(_Input Ref desc) {
@@ -183,7 +176,7 @@ IMPORT_C SInt32 PrintOut(_Input IORef desc, const Char* fmt, ...) {
// if truncated, `needed` >= kBufferSz; we still send truncated buffer
auto ret_ptr = libsys_syscall_arg_3(SYSCALL_HASH("PrintOut"), static_cast<VoidPtr>(desc),
- Detail::sys_safe_cast(buf));
+ Verify::sys_safe_cast(buf));
if (!ret_ptr) return -kErrorInvalidData;
diff --git a/dev/libSystem/src/SystemProc.asm b/dev/libSystem/src/SystemCallsABI+AMD64.asm
index 991a371f..da19f41f 100644
--- a/dev/libSystem/src/SystemProc.asm
+++ b/dev/libSystem/src/SystemCallsABI+AMD64.asm
@@ -1,7 +1,7 @@
;; /*
;; * ========================================================
;; *
-;; * libSystem/src/SystemProc.asm
+;; * libSystem/src/SystemCallsABI+AMD64.asm
;; * Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
;; *
;; * ========================================================
diff --git a/dev/libSystem/src/VerifyCalls.cc b/dev/libSystem/src/VerifyCalls.cc
new file mode 100644
index 00000000..078f921b
--- /dev/null
+++ b/dev/libSystem/src/VerifyCalls.cc
@@ -0,0 +1,18 @@
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <libSystem/SystemKit/Err.h>
+#include <libSystem/SystemKit/Syscall.h>
+#include <libSystem/SystemKit/Verify.h>
+
+using namespace LibSystem;
+
+IMPORT_C Void _rtl_assert(Bool expr, const Char* origin) {
+ if (!expr) {
+ PrintOut(nullptr, "Assertion failed: %s\r", origin);
+ libsys_syscall_arg_1(SYSCALL_HASH("_rtl_debug_break"));
+ }
+} \ No newline at end of file