From 8154646d1dcc09c6e6a40f992e3ce03fd3cb0b2b Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 10 Jan 2026 23:55:23 +0100 Subject: chore: release prep for NeKernel+Nectar. Signed-off-by: Amlal El Mahrouss --- src/libSystem/src/SystemCalls.cc | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'src/libSystem') diff --git a/src/libSystem/src/SystemCalls.cc b/src/libSystem/src/SystemCalls.cc index 0574d7ba..2651fb28 100644 --- a/src/libSystem/src/SystemCalls.cc +++ b/src/libSystem/src/SystemCalls.cc @@ -6,6 +6,8 @@ #include #include #include +#include "hint/CompilerHint.h" +#include "libSystem/SystemKit/Macros.h" using namespace LibSystem; @@ -148,6 +150,58 @@ IMPORT_C UInt64 IoTellFile(_Input Ref desc) { return *ret; } +IMPORT_C SInt32 PrintRelease(_Input IORef buf) { + SInt32* ret = static_cast(libsys_syscall_arg_2(SYSCALL_HASH("PrintRelease"), static_cast(buf))); + if (!ret) return -kErrorInvalidData; + + return static_cast(*ret); +} + +IMPORT_C IORef PrintCreate(Void) { + return static_cast(libsys_syscall_arg_1(SYSCALL_HASH("PrintCreate"))); +} + + +IMPORT_C VoidPtr MmCreateHeap(UInt64 initial_size, UInt32 max_size) { + return static_cast(libsys_syscall_arg_3(SYSCALL_HASH("MmCreateHeap"), + reinterpret_cast(&initial_size), + reinterpret_cast(&max_size))); +} + +IMPORT_C SInt32 MmDestroyHeap(VoidPtr heap) +{ + auto ret = libsys_syscall_arg_2(SYSCALL_HASH("MmDestroyHeap"), static_cast(heap)); + return *static_cast(ret); +} + +IMPORT_C SInt32 PrintIn(_Input IORef desc, const Char* fmt, ...) { + va_list args; + va_start(args, fmt); + + auto buf = StrFmt(fmt, args); + + va_end(args); + + // if truncated, `needed` >= kBufferSz; we still send truncated buffer + auto ret_ptr = libsys_syscall_arg_3(SYSCALL_HASH("PrintIn"), static_cast(desc), + Verify::sys_safe_cast(buf)); + + if (!ret_ptr) return -kErrorInvalidData; + + auto ret = static_cast(ret_ptr); + + return *ret; +} + +IMPORT_C IORef PrintGet(const Char* path) { + return static_cast(libsys_syscall_arg_2(SYSCALL_HASH("PrintGet"), + Verify::sys_safe_cast(path))); +} + +IMPORT_C ErrRef ErrGetLastError(Void) { + return *static_cast(libsys_syscall_arg_1(SYSCALL_HASH("ErrGetLastError"))); +} + IMPORT_C SInt32 PrintOut(_Input IORef desc, const Char* fmt, ...) { va_list args; va_start(args, fmt); -- cgit v1.2.3