summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-15 13:04:33 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-03-15 13:04:33 +0100
commitfca7e2533bfd9ed5fd678aeec2600d1c13a2c5c8 (patch)
tree2d25d26c8dd5b65c3e39853fbcce46b80b38c20d /src
parent72c5d5fb1c06f91b7793c3af5c79cf10efc18c49 (diff)
[CHORE] Add PThread core features and NeLaunch ProgramData feature.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src')
-rw-r--r--src/launch/src/CRuntimeZero.S18
-rw-r--r--src/launch/src/RuntimeMain.cpp4
-rw-r--r--src/libPThread/PThreadKit/Thread.h (renamed from src/libPThread/PThreadKit/pthread.h)0
-rw-r--r--src/libPThread/src/PThreadHandle.cpp0
-rw-r--r--src/libPThread/src/Thread.cpp33
-rw-r--r--src/libSystem/SystemKit/System.h1
6 files changed, 52 insertions, 4 deletions
diff --git a/src/launch/src/CRuntimeZero.S b/src/launch/src/CRuntimeZero.S
index 7dd283c9..2a7b195d 100644
--- a/src/launch/src/CRuntimeZero.S
+++ b/src/launch/src/CRuntimeZero.S
@@ -20,7 +20,21 @@ _NeMain:
callq launch_startup_fn
movq %rcx, 0
-
callq ThrExitMainThread
-
popq %rbp
+
+.data
+.global _ProgramData
+_ProgramData:
+ //;; ident
+ .word 0xffeecc
+ //;; version
+ .word 0x0110
+ //;; kind: 0x0 = LaunchSystem
+ .word 0x0
+ //;; flags
+ .word 0x0
+ //;; Launcher name
+ .asciz "NeKernel Launcher"
+
+
diff --git a/src/launch/src/RuntimeMain.cpp b/src/launch/src/RuntimeMain.cpp
index 3216dad0..833a2f55 100644
--- a/src/launch/src/RuntimeMain.cpp
+++ b/src/launch/src/RuntimeMain.cpp
@@ -12,13 +12,13 @@
IMPORT_C SInt32 launch_startup_fn(Void) {
/// Start LaunchHelpers.fwrk services, and make the launcher manageable too (via mgmt.launch)
UInt32* ret =
- static_cast<UInt32*>(libsys_syscall_arg_1(libsys_hash_64("__launch_register_service")));
+ static_cast<UInt32*>(libsys_syscall_arg_1(libsys_hash_64("__launch_register_service"))); // Register service based on program data.
if (ret) {
switch (*ret) {
case kErrorSuccess: {
ret =
- static_cast<UInt32*>(libsys_syscall_arg_1(libsys_hash_64("__launch_listen_as_super")));
+ static_cast<UInt32*>(libsys_syscall_arg_1(libsys_hash_64("__launch_attach_service"))); // Attach this program as the service process.
return *ret;
}
default:
diff --git a/src/libPThread/PThreadKit/pthread.h b/src/libPThread/PThreadKit/Thread.h
index 053885e7..053885e7 100644
--- a/src/libPThread/PThreadKit/pthread.h
+++ b/src/libPThread/PThreadKit/Thread.h
diff --git a/src/libPThread/src/PThreadHandle.cpp b/src/libPThread/src/PThreadHandle.cpp
deleted file mode 100644
index e69de29b..00000000
--- a/src/libPThread/src/PThreadHandle.cpp
+++ /dev/null
diff --git a/src/libPThread/src/Thread.cpp b/src/libPThread/src/Thread.cpp
new file mode 100644
index 00000000..34a610cd
--- /dev/null
+++ b/src/libPThread/src/Thread.cpp
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (see LICENSE file)
+// Official repository: https://github.com/ne-foss-org/nekernel
+
+#include <libPThread/PThreadKit/Thread.h>
+
+namespace POSIXKit::Detail {
+
+ /// @brief Max path structure.
+ constexpr auto kMaxPathLen = 255;
+ static constexpr auto kCanaryValue = 0xf0f0488f;
+
+ /// @brief Thread Information Structure.
+ struct ThreadFrameParams final {
+ SInt64 fCanary;
+ VoidPtr fStackPtr;
+ VoidPtr fCodePtr;
+ SizeT fCodeSz;
+ SizeT fStackSz;
+ SInt64 fThrdID;
+ SInt64 fUsrID, fGrpID;
+ SInt64* fFD{};
+ SizeT fFDCnt;
+ Char fCWD[kMaxPathLen];
+ Char fRoot[kMaxPathLen];
+ ThreadRef fRef;
+ };
+
+} // namespace POSIX::Detail
+
+
+
diff --git a/src/libSystem/SystemKit/System.h b/src/libSystem/SystemKit/System.h
index 1a7298d8..4e766d9d 100644
--- a/src/libSystem/SystemKit/System.h
+++ b/src/libSystem/SystemKit/System.h
@@ -14,6 +14,7 @@
/// @brief Secure TTY device path.
#define kSecurePrintDevicePath "/devices/stty{}{}"
+/// @brief Laser-disc path (Blu-ray, DVD, CD, etc.)
#define kCDDevicePath "/devices/dvd{}{}"
// ------------------------------------------------------------------------------------------ //