diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-09-09 21:28:04 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-09-09 21:28:04 +0200 |
| commit | b1e3dac861c0d6c28bdb7768d7f96f19456e9ad0 (patch) | |
| tree | 7868c5e081e86f72ec0203f3c8b1ed4bcb9b1598 /dev/libSystem/src/System.cc | |
| parent | 42832ec1b72baf244a1290ccf747b79db0caa69f (diff) | |
feat:! ddk/dki, ne_launch, ifs: Big architectural changes and
improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/libSystem/src/System.cc')
| -rw-r--r-- | dev/libSystem/src/System.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/dev/libSystem/src/System.cc b/dev/libSystem/src/System.cc index ba848a18..2215c4d8 100644 --- a/dev/libSystem/src/System.cc +++ b/dev/libSystem/src/System.cc @@ -40,6 +40,12 @@ IMPORT_C UInt64 libsys_hash_64(const Char* path) { return hash;
}
+IMPORT_C Char* StrFmt(const Char* fmt, ...) {
+ if (!fmt || *fmt == 0) return const_cast<Char*>("(null)");
+
+ return const_cast<Char*>("");
+}
+
// memmove-style copy
IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input SizeT len) {
// handles overlap, prefers 64-bit word copies when aligned
@@ -58,8 +64,9 @@ IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input Si // try 64-bit aligned backward copy
if (len >= sizeof(UInt64) && (reinterpret_cast<UIntPtr>(rs) % sizeof(UInt64) == 0) &&
(reinterpret_cast<UIntPtr>(rd) % sizeof(UInt64) == 0)) {
- auto rsw = reinterpret_cast<const UInt64*>(rs);
- auto rdw = reinterpret_cast<UInt64*>(rd);
+ auto rsw = reinterpret_cast<const UInt64*>(rs);
+ auto rdw = reinterpret_cast<UInt64*>(rd);
+
SizeT words = len / sizeof(UInt64);
for (SizeT i = 0; i < words; ++i) {
@@ -105,9 +112,11 @@ IMPORT_C VoidPtr MmCopyMemory(_Input VoidPtr dest, _Input VoidPtr src, _Input Si IMPORT_C SInt64 MmStrLen(const Char* in) {
// strlen via pointer walk
- if (!in) return 0;
+ if (!in) return -kErrorInvalidData;
+
const Char* p = in;
while (*p) ++p;
+
return static_cast<SInt64>(p - in);
}
|
