summaryrefslogtreecommitdiffhomepage
path: root/dev/launch/src
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-10-26 16:01:12 +0100
committerGitHub <noreply@github.com>2025-10-26 16:01:12 +0100
commit36269e57831e560df6a0da9c9d02c00671b0163d (patch)
tree69f6a0c6f08ef5ef2f6fcbb7302537dbce222e6e /dev/launch/src
parent2117a9b0f4b84f5bd6c99566bcf5849a64104467 (diff)
parentb6ce6640afaf6c1cc6ad274f3053b2e218a49554 (diff)
Merge pull request #68 from nekernel-org/dev
NeKernel: v0.0.6e1
Diffstat (limited to 'dev/launch/src')
-rw-r--r--dev/launch/src/AppMain.cc31
-rw-r--r--dev/launch/src/CRuntimeZero.S (renamed from dev/launch/src/CRT0.S)11
-rw-r--r--dev/launch/src/LaunchSrv.cc17
3 files changed, 39 insertions, 20 deletions
diff --git a/dev/launch/src/AppMain.cc b/dev/launch/src/AppMain.cc
new file mode 100644
index 00000000..eef95fba
--- /dev/null
+++ b/dev/launch/src/AppMain.cc
@@ -0,0 +1,31 @@
+/* -------------------------------------------
+
+ Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
+
+ ------------------------------------------- */
+
+#include <LaunchKit/Foundation.h>
+#include <libSystem/SystemKit/Err.h>
+#include <libSystem/SystemKit/Syscall.h>
+
+/// @note This called by _NeMain from its own runtime.
+extern "C" SInt32 nelaunch_startup_fn(Void) {
+ /// @todo Start LaunchServices.fwrk services, make the launcher manageable too (via mgmt.launch)
+
+ NELAUNCH_INFO("Turning on launcher...");
+
+ UInt32* ret = (UInt32*) libsys_syscall_arg_1(libsys_hash_64("__launch_register_pid0"));
+
+ if (ret) {
+ switch (*ret) {
+ case kErrorSuccess: {
+ libsys_syscall_arg_1(libsys_hash_64("__launch_listen_as_root"));
+ return *ret;
+ }
+ default:
+ break;
+ }
+ }
+
+ return kErrorExecutable;
+}
diff --git a/dev/launch/src/CRT0.S b/dev/launch/src/CRuntimeZero.S
index 84a293e6..73fa5352 100644
--- a/dev/launch/src/CRT0.S
+++ b/dev/launch/src/CRuntimeZero.S
@@ -4,15 +4,20 @@
------------------------------------------- */
- .text
+.text
.extern nelaunch_startup_fn
+.extern ThrExitMainThread
.globl _NeMain
_NeMain:
push %rbp
movq %rsp, %rbp
+
callq nelaunch_startup_fn
- popq %rbp
- retq
+ movq %rcx, 0
+
+ callq ThrExitMainThread
+
+ popq %rbp
diff --git a/dev/launch/src/LaunchSrv.cc b/dev/launch/src/LaunchSrv.cc
deleted file mode 100644
index f5c9ee3c..00000000
--- a/dev/launch/src/LaunchSrv.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2025, Amlal El Mahrouss, all rights reserved.
-
- ------------------------------------------- */
-
-#include <LaunchKit/LaunchKit.h>
-#include <libSystem/SystemKit/Err.h>
-
-/// @note This called by _NeMain from its own runtime.
-extern "C" SInt32 nelaunch_startup_fn(Void) {
- /// @todo Start LaunchServices.fwrk services, make the launcher manageable too (via mgmt.launch)
-
- NELAUNCH_INFO("Starting NeKernel services...");
-
- return kErrorSuccess;
-}