summaryrefslogtreecommitdiffhomepage
path: root/dev/user/src/SystemCalls.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-20 16:47:35 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-04-20 16:47:35 +0200
commitbc97b2b790eb06d8f9adb8ef8fa41874d7d19770 (patch)
treea6929db78467c2b07877abb9d9aad579d77139bb /dev/user/src/SystemCalls.cc
parent699e395505a602f4a731c481646233d87f87a85c (diff)
kernel, dev: python script to make an ESP from files.
- Started implementing the wrt_* APIs (Wide string functions) - Make user.sys link now, need to implement more syscalls. - Tiny HEFS refactors too. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/user/src/SystemCalls.cc')
-rw-r--r--dev/user/src/SystemCalls.cc34
1 files changed, 28 insertions, 6 deletions
diff --git a/dev/user/src/SystemCalls.cc b/dev/user/src/SystemCalls.cc
index 7ad0fe6f..20eaa0e0 100644
--- a/dev/user/src/SystemCalls.cc
+++ b/dev/user/src/SystemCalls.cc
@@ -5,14 +5,10 @@
------------------------------------------- */
#include <user/SystemCalls.h>
+#include <user/Opts.h>
/// @file SystemCalls.cc
-/// @brief Source file for the memory functions of the libsci.
-
-IMPORT_C VoidPtr sci_syscall_arg_1(SizeT id);
-IMPORT_C VoidPtr sci_syscall_arg_2(SizeT id, VoidPtr arg1);
-IMPORT_C VoidPtr sci_syscall_arg_3(SizeT id, VoidPtr arg1, VoidPtr arg3);
-IMPORT_C VoidPtr sci_syscall_arg_4(SizeT id, VoidPtr arg1, VoidPtr arg3, VoidPtr arg4);
+/// @brief Source file for the memory functions of the user.sys.
/// @brief Copy memory region.
IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input SizeT len)
@@ -32,6 +28,7 @@ IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input Si
return dest;
}
+/// @brief Get string length.
IMPORT_C SInt64 MmStrLen(const Char* in)
{
if (!in)
@@ -89,3 +86,28 @@ IMPORT_C UInt64 IoTellFile(_Input Ref desc)
auto ret = (UInt64*)sci_syscall_arg_2(4, reinterpret_cast<VoidPtr>(desc));
return *ret;
}
+
+/// @brief Print to the file descriptor.
+/// @param desc the file descriptor.
+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);
+ }
+} \ No newline at end of file