summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-03-27 20:35:24 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-03-27 20:35:24 +0100
commita3da0eaaf7569948f83c65ff7997c4d1fc868603 (patch)
tree735b9feba07568c802365169761efe0bc730f16b /dev
parente263653c2c1d1858827ac45061ecaefd9047fbb2 (diff)
BootZ: Introduce NetBoot module & consolidate STANDALONE macro
- Renamed __BOOTLDR_STANDALONE__ → __BOOTZ_STANDALONE__ across all modules. - Introduced NetBoot module to support fallback booting via packets. - Updated amd64-desktop build to bundle netboot.sys as part of system image. - NetBoot now properly zeroes out its header and performs sanity check on PatchLength. - Boot flow now attempts to fallback to NetBoot if neoskrnl.exe fails to start. - Reorganized disk formatting logic for clarity and better failure recovery. - HeFS & NeFS minimum disk size lowered (64GiB → 256MiB and 4GiB → 8MiB). - Renamed `IndexProperty` to `Index` in FSKit::Indexer. - Moved HintKit → hint/, updated includes and guards. - Removed deprecated LPC.{cc,h}, replaced by ProcessCodes.h. - Modernized SystemCalls.h typedefs: SCIObject → Ref, ThreadObject → ThreadRef, etc. - Updated userland tools `make_app` and `open` with copyright and behavior fixes. This prepares the BootZ infrastructure for headless/network environments. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev')
-rw-r--r--dev/boot/amd64-desktop.make7
-rw-r--r--dev/boot/arm64-desktop.make4
-rw-r--r--dev/boot/arm64-mobile.make4
-rw-r--r--dev/boot/modules/NetBoot/Boot.S10
-rw-r--r--dev/boot/modules/NetBoot/NetBoot.cc8
-rw-r--r--dev/boot/modules/NetBoot/amd64.json4
-rw-r--r--dev/boot/modules/SysChk/amd64.json4
-rw-r--r--dev/boot/modules/SysChk/arm64.json2
-rw-r--r--dev/boot/src/BootSupport.cc2
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc63
-rw-r--r--dev/boot/src/HEL/AMD64/BootPlatform.cc4
-rw-r--r--dev/boot/src/HEL/ARM64/BootPlatform.cc4
-rw-r--r--dev/boot/src/New+Delete.cc4
-rw-r--r--dev/hint/CompilerHint.h (renamed from dev/HintKit/CompilerHint.h)6
-rw-r--r--dev/kernel/FSKit/HeFS.h2
-rw-r--r--dev/kernel/FSKit/IndexableProperty.h8
-rw-r--r--dev/kernel/FSKit/NeFS.h4
-rw-r--r--dev/kernel/KernelKit/FileMgr.h2
-rw-r--r--dev/kernel/KernelKit/LoaderInterface.h2
-rw-r--r--dev/kernel/KernelKit/MemoryMgr.h2
-rw-r--r--dev/kernel/NetworkKit/IPC.h2
-rw-r--r--dev/kernel/src/IndexableProperty.cc2
-rw-r--r--dev/user/LPC.h56
-rw-r--r--dev/user/Macros.h2
-rw-r--r--dev/user/ProcessCodes.h56
-rw-r--r--dev/user/SystemCalls.h73
-rw-r--r--dev/user/src/LPC.cc10
27 files changed, 176 insertions, 171 deletions
diff --git a/dev/boot/amd64-desktop.make b/dev/boot/amd64-desktop.make
index 5a827643..9e47788c 100644
--- a/dev/boot/amd64-desktop.make
+++ b/dev/boot/amd64-desktop.make
@@ -60,7 +60,7 @@ endif
LD_FLAGS=-e Main --subsystem=10
-STANDALONE_MACRO=-D__BOOTLDR_STANDALONE__
+STANDALONE_MACRO=-D__BOOTZ_STANDALONE__
OBJ=*.o
REM=rm
@@ -74,7 +74,7 @@ FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -mno-red-zone -D__NEOSKRNL__ -D__BOOTZ__
BOOTLOADER=bootz.exe
KERNEL=neoskrnl.exe
SYSCHK=syschk.sys
-STARTUP=startup.sys
+NETBOOT=netboot.sys
SCIKIT=libuser.dylib
.PHONY: invalid-recipe
@@ -90,13 +90,14 @@ all: compile-amd64
$(COPY) src/$(BOOTLOADER) src/Root/EFI/BOOT/BOOTZ.EFI
$(COPY) ../kernel/$(KERNEL) src/Root/$(KERNEL)
$(COPY) ./modules/SysChk/$(SYSCHK) src/Root/$(SYSCHK)
+ $(COPY) ./modules/NetBoot/$(NETBOOT) src/Root/$(NETBOOT)
$(COPY) ../user/$(SCIKIT) src/Root/$(SCIKIT)
$(COPY) src/$(BOOTLOADER) src/Root/$(BOOTLOADER)
.PHONY: disk
disk:
dd if=/dev/zero of=$(BOOT) bs=30M count=100
- mformat -i $(BOOT) -F -v "NEOS_ESP"
+ mformat -i $(BOOT) -F -v "NeKernel"
ifneq ($(DEBUG_SUPPORT), )
diff --git a/dev/boot/arm64-desktop.make b/dev/boot/arm64-desktop.make
index 5b38d46c..72708c3f 100644
--- a/dev/boot/arm64-desktop.make
+++ b/dev/boot/arm64-desktop.make
@@ -36,7 +36,7 @@ EMU_FLAGS=-net none -smp 4 -m 8G -cpu max -M virt \
LD_FLAGS=-subsystem:efi_application -entry:Main /nodefaultlib
-STANDALONE_MACRO=-D__BOOTLDR_STANDALONE__
+STANDALONE_MACRO=-D__BOOTZ_STANDALONE__
OBJ=*.o
REM=rm
@@ -45,7 +45,7 @@ REM_FLAG=-f
FLAG_ASM=-f win64
FLAG_GNU=-fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__NE_ARM64__ -fno-rtti -fno-exceptions -I./ \
-target aarch64-unknown-windows \
- -std=c++20 -DBOOTZ_EPM_SUPPORT -DZBA_USE_FB -D__FSKIT_USE_NEFS__ -D__BOOTLDR_STANDALONE__ -D__NEOSKRNL__ -D__BOOTZ__ -D__HAVE_NE_APIS__ -D__NE__ -I../ -I../kernel
+ -std=c++20 -DBOOTZ_EPM_SUPPORT -DZBA_USE_FB -D__FSKIT_USE_NEFS__ -D__BOOTZ_STANDALONE__ -D__NEOSKRNL__ -D__BOOTZ__ -D__HAVE_NE_APIS__ -D__NE__ -I../ -I../kernel
BOOT_LOADER=bootz.exe
KERNEL=neoskrnl.exe
diff --git a/dev/boot/arm64-mobile.make b/dev/boot/arm64-mobile.make
index 485bfed0..274a29cb 100644
--- a/dev/boot/arm64-mobile.make
+++ b/dev/boot/arm64-mobile.make
@@ -37,7 +37,7 @@ EMU_FLAGS=-net none -smp 4 -m 8G -cpu max -M virt-9.1 \
LD_FLAGS=-subsystem:efi_application -entry:Main /nodefaultlib
-STANDALONE_MACRO=-D__BOOTLDR_STANDALONE__
+STANDALONE_MACRO=-D__BOOTZ_STANDALONE__
OBJ=*.o
REM=rm
@@ -46,7 +46,7 @@ REM_FLAG=-f
FLAG_ASM=-f win64
FLAG_GNU=-fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__NE_ARM64__ -fno-rtti -fno-exceptions -I./ \
-target aarch64-unknown-windows \
- -std=c++20 -DBOOTZ_EPM_SUPPORT -DkExpectedWidth=320 -DkExpectedHeight=480 -D__FSKIT_USE_NEFS__ -D__BOOTLDR_STANDALONE__ -D__NEOSKRNL__ -D__BOOTZ__ -D__HAVE_NE_APIS__ -D__NE__ -I../ -I../kernel
+ -std=c++20 -DBOOTZ_EPM_SUPPORT -DkExpectedWidth=320 -DkExpectedHeight=480 -D__FSKIT_USE_NEFS__ -D__BOOTZ_STANDALONE__ -D__NEOSKRNL__ -D__BOOTZ__ -D__HAVE_NE_APIS__ -D__NE__ -I../ -I../kernel
BOOT_LOADER=bootz.exe
KERNEL=neoskrnl.exe
diff --git a/dev/boot/modules/NetBoot/Boot.S b/dev/boot/modules/NetBoot/Boot.S
index 2095b91d..8ebfb352 100644
--- a/dev/boot/modules/NetBoot/Boot.S
+++ b/dev/boot/modules/NetBoot/Boot.S
@@ -7,8 +7,10 @@
;; * ========================================================
;; */
+#ifdef __NE_AMD64__
.code64
.intel_syntax noprefix
+#endif
#define kTypeDriver 101
#define kArchAmd64 122
@@ -18,11 +20,3 @@
.quad kHandoverMagic
.word kTypeDriver
-
-.text
-
-.extern main
-.global __main
-
-__main:
- ret
diff --git a/dev/boot/modules/NetBoot/NetBoot.cc b/dev/boot/modules/NetBoot/NetBoot.cc
index 1787045e..4a169d33 100644
--- a/dev/boot/modules/NetBoot/NetBoot.cc
+++ b/dev/boot/modules/NetBoot/NetBoot.cc
@@ -15,12 +15,14 @@ EXTERN_C Int32 ModuleMain(NeOS::HEL::BootInfoHeader* handover)
{
NETBOOT_INTERNET_HEADER inet{};
+ memset(&inet, 0, sizeof(NETBOOT_INTERNET_HEADER));
+
/// TODO: Read packet from JSON file 'netboot.json'
- if (inet.PatchLength < 0)
+ if (inet.PatchLength < 1)
{
Boot::BootTextWriter writer;
- writer.Write("NetBootLauncher: No Patch attached to packet.\r");
+ writer.Write("NetBootLauncher: No executable attached to the packet, aborting.\r");
return kEfiFail;
}
@@ -31,6 +33,8 @@ EXTERN_C Int32 ModuleMain(NeOS::HEL::BootInfoHeader* handover)
if (thread.IsValid())
return thread.Start(handover, YES);
+
+ return kEfiFail;
}
else
{
diff --git a/dev/boot/modules/NetBoot/amd64.json b/dev/boot/modules/NetBoot/amd64.json
index db035094..db39cced 100644
--- a/dev/boot/modules/NetBoot/amd64.json
+++ b/dev/boot/modules/NetBoot/amd64.json
@@ -10,12 +10,12 @@
"-fPIC",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,ModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x1000000,-e,ModuleMain"
],
"cpp_macros": [
"__NEOSKRNL__",
"__BOOTZ__",
- "__BOOTLDR_STANDALONE__",
+ "__BOOTZ_STANDALONE__",
"__NE_AMD64__",
"kNetBootVersionHighest=0x0100",
"kNetBootVersionLowest=0x0100",
diff --git a/dev/boot/modules/SysChk/amd64.json b/dev/boot/modules/SysChk/amd64.json
index 97b6c418..7f013b39 100644
--- a/dev/boot/modules/SysChk/amd64.json
+++ b/dev/boot/modules/SysChk/amd64.json
@@ -10,12 +10,12 @@
"-fPIC",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,ModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x1000000,-e,ModuleMain"
],
"cpp_macros": [
"__NEOSKRNL__",
"__BOOTZ__",
- "__BOOTLDR_STANDALONE__",
+ "__BOOTZ_STANDALONE__",
"__NE_AMD64__",
"kChkVersionHighest=0x0100",
"kChkVersionLowest=0x0100",
diff --git a/dev/boot/modules/SysChk/arm64.json b/dev/boot/modules/SysChk/arm64.json
index 6d9161ea..502c75cd 100644
--- a/dev/boot/modules/SysChk/arm64.json
+++ b/dev/boot/modules/SysChk/arm64.json
@@ -17,7 +17,7 @@
"cpp_macros": [
"__NEOSKRNL__",
"__BOOTZ__",
- "__BOOTLDR_STANDALONE__",
+ "__BOOTZ_STANDALONE__",
"__NE_ARM64__",
"kChkVersionHighest=0x0100",
"kChkVersionLowest=0x0100",
diff --git a/dev/boot/src/BootSupport.cc b/dev/boot/src/BootSupport.cc
index 4d808ddc..efe6602a 100644
--- a/dev/boot/src/BootSupport.cc
+++ b/dev/boot/src/BootSupport.cc
@@ -12,7 +12,7 @@
#include <KernelKit/MSDOS.h>
#include <KernelKit/PE.h>
-#ifdef __BOOTLDR_STANDALONE__
+#ifdef __BOOTZ_STANDALONE__
/// @brief memset definition in C++.
/// @param dst destination pointer.
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index 0840bc31..4744892f 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -202,47 +202,46 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
handover_hdr->f_FirmwareCustomTables[0] = (VoidPtr)BS;
handover_hdr->f_FirmwareCustomTables[1] = (VoidPtr)ST;
+ // ------------------------------------------ //
+ // If we succeed in reading the blob, then execute it.
+ // ------------------------------------------ //
+
+#if defined(__ATA_PIO__)
Boot::BootFileReader reader_syschk(L"syschk.sys", image_handle);
reader_syschk.ReadAll(0);
Boot::BootThread* syschk_thread = nullptr;
- // ------------------------------------------ //
- // If we succeed in reading the blob, then execute it.
- // ------------------------------------------ //
-
if (reader_syschk.Blob())
{
syschk_thread = new Boot::BootThread(reader_syschk.Blob());
- syschk_thread->SetName("BootZ: System Recovery Check");
- syschk_thread->Start(handover_hdr, NO);
- }
+ syschk_thread->SetName("BootZ: System Check");
-#if defined(__ATA_PIO__)
- Boot::BDiskFormatFactory<BootDeviceATA> partition_factory;
+ Boot::BDiskFormatFactory<BootDeviceATA> partition_factory;
- if (syschk_thread->Start(handover_hdr, NO) != kEfiOk)
- {
- if (partition_factory.IsPartitionValid() == NO)
+ if (syschk_thread->Start(handover_hdr, NO) != kEfiOk)
{
- Boot::BDiskFormatFactory<BootDeviceATA>::BFileDescriptor root{};
+ if (partition_factory.IsPartitionValid() == NO)
+ {
+ Boot::BDiskFormatFactory<BootDeviceATA>::BFileDescriptor root{};
- root.fFileName[0] = kNeFSRoot[0];
- root.fFileName[1] = 0;
+ root.fFileName[0] = kNeFSRoot[0];
+ root.fFileName[1] = 0;
- root.fKind = kNeFSCatalogKindDir;
+ root.fKind = kNeFSCatalogKindDir;
- const auto kFSName = "SSD";
+ const auto kFSName = "SSD";
- partition_factory.Format(kFSName, &root, 1);
+ partition_factory.Format(kFSName, &root, 1);
- fb_init();
+ fb_init();
- FB::fb_clear_video();
+ FB::fb_clear_video();
- FBDrawBitMapInRegion(zka_has_disk, NE_HAS_DISK_WIDTH, NE_HAS_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_HAS_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_HAS_DISK_HEIGHT) / 2);
+ FBDrawBitMapInRegion(zka_has_disk, NE_HAS_DISK_WIDTH, NE_HAS_DISK_HEIGHT, (kHandoverHeader->f_GOP.f_Width - NE_HAS_DISK_WIDTH) / 2, (kHandoverHeader->f_GOP.f_Height - NE_HAS_DISK_HEIGHT) / 2);
- fb_clear();
+ fb_clear();
+ }
}
}
#endif
@@ -265,7 +264,6 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
handover_hdr->f_FirmwareVendorLen);
handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
-
// Assign to global 'kHandoverHeader'.
WideChar kernel_path[256U] = L"neoskrnl.exe";
@@ -318,7 +316,24 @@ EFI_EXTERN_C EFI_API Int32 Main(EfiHandlePtr image_handle,
// Finally load the OS kernel.
// ---------------------------------------------------- //
- kernel_thread->Start(handover_hdr, YES);
+ if (kernel_thread->Start(handover_hdr, YES) != kEfiOk)
+ {
+ Boot::BootFileReader reader_netboot(L"netboot.sys", image_handle);
+ reader_netboot.ReadAll(0);
+
+ Boot::BootThread* netboot_thread = nullptr;
+ // ------------------------------------------ //
+ // If we succeed in reading the blob, then execute it. (That is NetBoot)
+ // ------------------------------------------ //
+
+ if (reader_netboot.Blob())
+ {
+ netboot_thread = new Boot::BootThread(reader_netboot.Blob());
+ netboot_thread->SetName("BootZ: NetBoot");
+ netboot_thread->Start(handover_hdr, YES);
+ }
+ }
+
CANT_REACH();
}
diff --git a/dev/boot/src/HEL/AMD64/BootPlatform.cc b/dev/boot/src/HEL/AMD64/BootPlatform.cc
index c7ae4085..aab1c6b4 100644
--- a/dev/boot/src/HEL/AMD64/BootPlatform.cc
+++ b/dev/boot/src/HEL/AMD64/BootPlatform.cc
@@ -9,7 +9,7 @@
#include <BootKit/Protocol.h>
#include <BootKit/BootKit.h>
-#ifdef __BOOTLDR_STANDALONE__
+#ifdef __BOOTZ_STANDALONE__
using namespace Boot;
@@ -103,4 +103,4 @@ void rt_hlt()
NeOS::HAL::rt_halt();
}
-#endif // __BOOTLDR_STANDALONE__
+#endif // __BOOTZ_STANDALONE__
diff --git a/dev/boot/src/HEL/ARM64/BootPlatform.cc b/dev/boot/src/HEL/ARM64/BootPlatform.cc
index 9713b80d..ebb9f9b0 100644
--- a/dev/boot/src/HEL/ARM64/BootPlatform.cc
+++ b/dev/boot/src/HEL/ARM64/BootPlatform.cc
@@ -8,7 +8,7 @@
#include <BootKit/Protocol.h>
#include <BootKit/BootKit.h>
-#ifdef __BOOTLDR_STANDALONE__
+#ifdef __BOOTZ_STANDALONE__
using namespace Boot;
@@ -34,4 +34,4 @@ EXTERN_C void rt_std()
{
}
-#endif // __BOOTLDR_STANDALONE__
+#endif // __BOOTZ_STANDALONE__
diff --git a/dev/boot/src/New+Delete.cc b/dev/boot/src/New+Delete.cc
index 03a1bb68..fa6bc146 100644
--- a/dev/boot/src/New+Delete.cc
+++ b/dev/boot/src/New+Delete.cc
@@ -8,7 +8,7 @@
#include <BootKit/Protocol.h>
#include <BootKit/BootKit.h>
-#ifdef __BOOTLDR_STANDALONE__
+#ifdef __BOOTZ_STANDALONE__
EXTERN EfiBootServices* BS;
/// @brief Allocates a new object.
@@ -57,4 +57,4 @@ void operator delete(void* buf, size_t size)
BS->FreePool(buf);
}
-#endif // __BOOTLDR_STANDALONE__
+#endif // __BOOTZ_STANDALONE__
diff --git a/dev/HintKit/CompilerHint.h b/dev/hint/CompilerHint.h
index 9a1be9f6..f765b00c 100644
--- a/dev/HintKit/CompilerHint.h
+++ b/dev/hint/CompilerHint.h
@@ -4,8 +4,8 @@
------------------------------------------- */
-#ifndef HINTKIT_HINT_H
-#define HINTKIT_HINT_H
+#ifndef _NE_COMPILERHINT_H_
+#define _NE_COMPILERHINT_H_
#ifdef __LIBCOMPILER__
#pragma compiler(hint_manifest)
@@ -22,4 +22,4 @@
#define _InOut
#define _StrictInOut
-#endif // ifndef HINTKIT_HINT_H
+#endif // ifndef _NE_COMPILERHINT_H_
diff --git a/dev/kernel/FSKit/HeFS.h b/dev/kernel/FSKit/HeFS.h
index 6911ddef..5643c94e 100644
--- a/dev/kernel/FSKit/HeFS.h
+++ b/dev/kernel/FSKit/HeFS.h
@@ -18,7 +18,7 @@
#define kHeFSFileNameLen (256U)
#define kHeFSPartNameLen (256U)
-#define kHeFSMinimumDiskSize (gib_cast(64))
+#define kHeFSMinimumDiskSize (mib_cast(256))
enum
{
diff --git a/dev/kernel/FSKit/IndexableProperty.h b/dev/kernel/FSKit/IndexableProperty.h
index 6a79bc1b..054b2433 100644
--- a/dev/kernel/FSKit/IndexableProperty.h
+++ b/dev/kernel/FSKit/IndexableProperty.h
@@ -17,7 +17,7 @@ namespace NeOS
{
namespace Indexer
{
- struct IndexProperty final
+ struct Index final
{
public:
Char Drive[kDriveNameLen];
@@ -41,7 +41,7 @@ namespace NeOS
NE_COPY_DEFAULT(IndexableProperty);
public:
- IndexProperty& Leak() noexcept;
+ Index& Leak() noexcept;
public:
void AddFlag(Int16 flag);
@@ -49,8 +49,8 @@ namespace NeOS
Int16 HasFlag(Int16 flag);
private:
- IndexProperty fIndex;
- UInt32 fFlags;
+ Index fIndex;
+ UInt32 fFlags;
};
/// @brief Index a file into the indexer instance.
diff --git a/dev/kernel/FSKit/NeFS.h b/dev/kernel/FSKit/NeFS.h
index 8ff9d9d2..29a294db 100644
--- a/dev/kernel/FSKit/NeFS.h
+++ b/dev/kernel/FSKit/NeFS.h
@@ -17,7 +17,7 @@ default.
#pragma once
#include <CompilerKit/CompilerKit.h>
-#include <HintKit/CompilerHint.h>
+#include <hint/CompilerHint.h>
#include <KernelKit/DriveMgr.h>
#include <NewKit/Defines.h>
#include <NewKit/KString.h>
@@ -31,7 +31,7 @@ default.
#define kNeFSInvalidCatalog (-1)
#define kNeFSCatalogNameLen (256)
-#define kNeFSMinimumDiskSize (gib_cast(4))
+#define kNeFSMinimumDiskSize (mib_cast(8))
#define kNeFSSectorSz (512)
diff --git a/dev/kernel/KernelKit/FileMgr.h b/dev/kernel/KernelKit/FileMgr.h
index fec83d17..61bb6440 100644
--- a/dev/kernel/KernelKit/FileMgr.h
+++ b/dev/kernel/KernelKit/FileMgr.h
@@ -30,7 +30,7 @@
#endif // __FSKIT_INCLUDES_HeFS__
#include <CompilerKit/CompilerKit.h>
-#include <HintKit/CompilerHint.h>
+#include <hint/CompilerHint.h>
#include <KernelKit/KPC.h>
#include <KernelKit/DebugOutput.h>
#include <NewKit/Stream.h>
diff --git a/dev/kernel/KernelKit/LoaderInterface.h b/dev/kernel/KernelKit/LoaderInterface.h
index 19c21ddb..99291c04 100644
--- a/dev/kernel/KernelKit/LoaderInterface.h
+++ b/dev/kernel/KernelKit/LoaderInterface.h
@@ -7,7 +7,7 @@
#pragma once
#include <CompilerKit/CompilerKit.h>
-#include <HintKit/CompilerHint.h>
+#include <hint/CompilerHint.h>
#include <NewKit/Defines.h>
#include <NewKit/ErrorOr.h>
diff --git a/dev/kernel/KernelKit/MemoryMgr.h b/dev/kernel/KernelKit/MemoryMgr.h
index 03bd4a2d..e2b8aa2f 100644
--- a/dev/kernel/KernelKit/MemoryMgr.h
+++ b/dev/kernel/KernelKit/MemoryMgr.h
@@ -13,7 +13,7 @@
#include <NewKit/KernelPanic.h>
#include <KernelKit/KPC.h>
-#include <HintKit/CompilerHint.h>
+#include <hint/CompilerHint.h>
namespace NeOS
{
diff --git a/dev/kernel/NetworkKit/IPC.h b/dev/kernel/NetworkKit/IPC.h
index 0d28c080..cbb9ddd4 100644
--- a/dev/kernel/NetworkKit/IPC.h
+++ b/dev/kernel/NetworkKit/IPC.h
@@ -12,7 +12,7 @@
#include <NewKit/Defines.h>
#include <NewKit/KString.h>
-#include <HintKit/CompilerHint.h>
+#include <hint/CompilerHint.h>
/// @file IPC.h
/// @brief IPC comm. protocol.
diff --git a/dev/kernel/src/IndexableProperty.cc b/dev/kernel/src/IndexableProperty.cc
index 404cddc3..8d3637f4 100644
--- a/dev/kernel/src/IndexableProperty.cc
+++ b/dev/kernel/src/IndexableProperty.cc
@@ -18,7 +18,7 @@ namespace NeOS
{
namespace Indexer
{
- IndexProperty& IndexableProperty::Leak() noexcept
+ Index& IndexableProperty::Leak() noexcept
{
return fIndex;
}
diff --git a/dev/user/LPC.h b/dev/user/LPC.h
deleted file mode 100644
index 87e5e500..00000000
--- a/dev/user/LPC.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-#pragma once
-
-#include <user/Macros.h>
-
-/// @file LPC.h
-/// @brief Local Procedure Code type and values.
-
-#define err_local_ok() (kLastError == kErrorSuccess)
-#define err_local_fail() (kLastError != kErrorSuccess)
-#define err_local_get() (kLastError)
-
-typedef SInt32 ErrObject;
-
-inline constexpr ErrObject kErrorSuccess = 0;
-inline constexpr ErrObject kErrorExecutable = 33;
-inline constexpr ErrObject kErrorExecutableLib = 34;
-inline constexpr ErrObject kErrorFileNotFound = 35;
-inline constexpr ErrObject kErrorDirectoryNotFound = 36;
-inline constexpr ErrObject kErrorDiskReadOnly = 37;
-inline constexpr ErrObject kErrorDiskIsFull = 38;
-inline constexpr ErrObject kErrorProcessFault = 39;
-inline constexpr ErrObject kErrorSocketHangUp = 40;
-inline constexpr ErrObject kErrorThreadLocalStorage = 41;
-inline constexpr ErrObject kErrorMath = 42;
-inline constexpr ErrObject kErrorNoNetwork = 43;
-inline constexpr ErrObject kErrorHeapOutOfMemory = 44;
-inline constexpr ErrObject kErrorNoSuchDisk = 45;
-inline constexpr ErrObject kErrorFileExists = 46;
-inline constexpr ErrObject kErrorFormatFailed = 47;
-inline constexpr ErrObject kErrorNetworkTimeout = 48;
-inline constexpr ErrObject kErrorInternal = 49;
-inline constexpr ErrObject kErrorForkAlreadyExists = 50;
-inline constexpr ErrObject kErrorOutOfTeamSlot = 51;
-inline constexpr ErrObject kErrorHeapNotPresent = 52;
-inline constexpr ErrObject kErrorNoEntrypoint = 53;
-inline constexpr ErrObject kErrorDiskIsCorrupted = 54;
-inline constexpr ErrObject kErrorDisk = 55;
-inline constexpr ErrObject kErrorInvalidData = 56;
-inline constexpr ErrObject kErrorAsync = 57;
-inline constexpr ErrObject kErrorNonBlocking = 58;
-inline constexpr ErrObject kErrorIPC = 59;
-inline constexpr ErrObject kErrorSign = 60;
-inline constexpr ErrObject kErrorInvalidCreds = 61;
-inline constexpr ErrObject kErrorCDTrayBroken = 62;
-inline constexpr ErrObject kErrorUnrecoverableDisk = 63;
-inline constexpr ErrObject kErrorFileLocked = 64;
-inline constexpr ErrObject kErrorUnimplemented = -1;
-
-/// @brief The last error reported by the system to the process.
-IMPORT_C ErrObject kLastError;
diff --git a/dev/user/Macros.h b/dev/user/Macros.h
index e2759258..c8ac2c97 100644
--- a/dev/user/Macros.h
+++ b/dev/user/Macros.h
@@ -14,7 +14,7 @@ Purpose: libsci Macros header.
/// @brief Macros and Core types of the SCI (System Call Interface).
/***********************************************************************************/
-#include <HintKit/CompilerHint.h>
+#include <hint/CompilerHint.h>
#define ATTRIBUTE(X) __attribute__((X))
diff --git a/dev/user/ProcessCodes.h b/dev/user/ProcessCodes.h
new file mode 100644
index 00000000..2b740784
--- /dev/null
+++ b/dev/user/ProcessCodes.h
@@ -0,0 +1,56 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <user/Macros.h>
+
+/// @file ProcessCodes.h
+/// @brief Process Codes type and values.
+
+#define err_local_ok() (kLastError == kErrorSuccess)
+#define err_local_fail() (kLastError != kErrorSuccess)
+#define err_local_get() (kLastError)
+
+typedef SInt32 ErrKind;
+
+inline constexpr ErrKind kErrorSuccess = 0;
+inline constexpr ErrKind kErrorExecutable = 33;
+inline constexpr ErrKind kErrorExecutableLib = 34;
+inline constexpr ErrKind kErrorFileNotFound = 35;
+inline constexpr ErrKind kErrorDirectoryNotFound = 36;
+inline constexpr ErrKind kErrorDiskReadOnly = 37;
+inline constexpr ErrKind kErrorDiskIsFull = 38;
+inline constexpr ErrKind kErrorProcessFault = 39;
+inline constexpr ErrKind kErrorSocketHangUp = 40;
+inline constexpr ErrKind kErrorThreadLocalStorage = 41;
+inline constexpr ErrKind kErrorMath = 42;
+inline constexpr ErrKind kErrorNoNetwork = 43;
+inline constexpr ErrKind kErrorHeapOutOfMemory = 44;
+inline constexpr ErrKind kErrorNoSuchDisk = 45;
+inline constexpr ErrKind kErrorFileExists = 46;
+inline constexpr ErrKind kErrorFormatFailed = 47;
+inline constexpr ErrKind kErrorNetworkTimeout = 48;
+inline constexpr ErrKind kErrorInternal = 49;
+inline constexpr ErrKind kErrorForkAlreadyExists = 50;
+inline constexpr ErrKind kErrorOutOfTeamSlot = 51;
+inline constexpr ErrKind kErrorHeapNotPresent = 52;
+inline constexpr ErrKind kErrorNoEntrypoint = 53;
+inline constexpr ErrKind kErrorDiskIsCorrupted = 54;
+inline constexpr ErrKind kErrorDisk = 55;
+inline constexpr ErrKind kErrorInvalidData = 56;
+inline constexpr ErrKind kErrorAsync = 57;
+inline constexpr ErrKind kErrorNonBlocking = 58;
+inline constexpr ErrKind kErrorIPC = 59;
+inline constexpr ErrKind kErrorSign = 60;
+inline constexpr ErrKind kErrorInvalidCreds = 61;
+inline constexpr ErrKind kErrorCDTrayBroken = 62;
+inline constexpr ErrKind kErrorUnrecoverableDisk = 63;
+inline constexpr ErrKind kErrorFileLocked = 64;
+inline constexpr ErrKind kErrorUnimplemented = -1;
+
+/// @brief The last error reported by the system to the process.
+IMPORT_C ErrKind kLastError;
diff --git a/dev/user/SystemCalls.h b/dev/user/SystemCalls.h
index 6a0c2845..2d14fa3c 100644
--- a/dev/user/SystemCalls.h
+++ b/dev/user/SystemCalls.h
@@ -16,13 +16,13 @@ Purpose: System Call Interface.
/// @brief Types API.
// ------------------------------------------------------------------------------------------ //
-typedef VoidPtr SCIObject;
+typedef VoidPtr Ref;
-typedef SCIObject IOObject;
-typedef IOObject FSObject;
-typedef SCIObject DLLObject;
-typedef SCIObject ThreadObject;
-typedef SCIObject SocketObject;
+typedef Ref IORef;
+typedef Ref FSRef;
+typedef Ref DLLRef;
+typedef Ref ThreadRef;
+typedef Ref SocketRef;
// ------------------------------------------------------------------------------------------ //
/// @brief Dynamic Loader API.
@@ -32,18 +32,18 @@ typedef SCIObject SocketObject;
/// @param symbol the symbol to look for
/// @param dll_handle the DLL handle.
/// @return the proc pointer.
-IMPORT_C SCIObject LdrGetDLLSymbolFromHandle(_Input const Char* symbol, _Input SCIObject dll_handle);
+IMPORT_C Ref LdrGetDLLSymbolFromHandle(_Input const Char* symbol, _Input Ref dll_handle);
/// @brief Open DLL handle.
/// @param path
/// @param drv
/// @return
-IMPORT_C SCIObject LdrOpenDLLHandle(_Input const Char* path, _Input const Char* drive_letter);
+IMPORT_C Ref LdrOpenDLLHandle(_Input const Char* path, _Input const Char* drive_letter);
/// @brief Close DLL handle
/// @param dll_handle
/// @return
-IMPORT_C Void LdrCloseDLLHandle(_Input SCIObject* dll_handle);
+IMPORT_C UInt32 LdrCloseDLLHandle(_Input Ref* dll_handle);
// ------------------------------------------------------------------------------------------ //
// File API.
@@ -53,38 +53,38 @@ IMPORT_C Void LdrCloseDLLHandle(_Input SCIObject* dll_handle);
/// @param fs_path the filesystem path.
/// @param drive_letter drive name, use NULL to use default drive location.
/// @return the file descriptor of the file.
-IMPORT_C SCIObject IoOpenFile(const Char* fs_path, const Char* drive_letter);
+IMPORT_C Ref IoOpenFile(const Char* fs_path, const Char* drive_letter);
/// @brief Closes a file and flushes its content.
/// @param file_desc the file descriptor.
/// @return Function doesn't return a type.
-IMPORT_C Void IoCloseFile(_Input SCIObject file_desc);
+IMPORT_C Void IoCloseFile(_Input Ref file_desc);
/// @brief Write data to a file.
/// @param file_desc the file descriptor.
/// @param out_data the data to write.
/// @param sz_data the size of the data to write.
/// @return the number of bytes written.
-IMPORT_C UInt32 IoWriteFile(_Input SCIObject file_desc, _Output VoidPtr out_data, SizeT sz_data);
+IMPORT_C UInt32 IoWriteFile(_Input Ref file_desc, _Output VoidPtr out_data, SizeT sz_data);
/// @brief Read data from a file.
/// @param file_desc the file descriptor.
/// @param out_data the data to read.
/// @param sz_data the size of the data to read.
-IMPORT_C UInt32 IoReadFile(_Input SCIObject file_desc, _Output VoidPtr* out_data, SizeT sz_data);
+IMPORT_C UInt32 IoReadFile(_Input Ref file_desc, _Output VoidPtr* out_data, SizeT sz_data);
/// @brief Rewind the file pointer to the beginning of the file.
/// @param file_desc the file descriptor.
/// @return the number of bytes read.
-IMPORT_C UInt64 IoRewindFile(_Input SCIObject file_desc);
+IMPORT_C UInt64 IoRewindFile(_Input Ref file_desc);
/// @brief Tell the current position of the file pointer.
/// @param file_desc the file descriptor.
/// @return the current position of the file pointer.
-IMPORT_C UInt64 IoTellFile(_Input SCIObject file_desc);
+IMPORT_C UInt64 IoTellFile(_Input Ref file_desc);
/// @brief Seek file offset from file descriptor.
-IMPORT_C UInt64 IoSeekFile(_Input SCIObject file_desc, UInt64 file_offset);
+IMPORT_C UInt64 IoSeekFile(_Input Ref file_desc, UInt64 file_offset);
// ------------------------------------------------------------------------
// Process API.
@@ -121,10 +121,10 @@ IMPORT_C VoidPtr MmCreateHeap(_Input SizeT len, _Input UInt32 flags);
/// @brief Destroys the pointer
/// @param heap the heap itself.
/// @return void.
-IMPORT_C Void MmDestroyHeap(_Input VoidPtr heap);
+IMPORT_C SInt32 MmDestroyHeap(_Input VoidPtr heap);
/// @brief Change protection flags of a memory region.
-IMPORT_C Void MmSetHeapFlags(_Input VoidPtr heap, _Input UInt32 flags);
+IMPORT_C SInt32 MmSetHeapFlags(_Input VoidPtr heap, _Input UInt32 flags);
/// @brief Change protection flags of a memory region.
IMPORT_C UInt32 MmGetHeapFlags(_Input VoidPtr heap);
@@ -159,38 +159,38 @@ IMPORT_C SInt32 ErrGetLastError(Void);
/// @brief Exit the current thread.
/// @param exit_code the exit code.
-IMPORT_C Void ThrExitCurrentThread(_Input SInt32 exit_code);
+IMPORT_C SInt32 ThrExitCurrentThread(_Input SInt32 exit_code);
/// @brief Exit the main thread.
/// @param exit_code the exit code.
-IMPORT_C Void ThrExitMainThread(_Input SInt32 exit_code);
+IMPORT_C SInt32 ThrExitMainThread(_Input SInt32 exit_code);
/// @brief Exit a thread.
/// @param thread the thread to exit.
/// @param exit_code the exit code.
-IMPORT_C Void ThrExitThread(_Input ThreadObject thread, _Input SInt32 exit_code);
+IMPORT_C SInt32 ThrExitThread(_Input ThreadRef thread, _Input SInt32 exit_code);
/// @brief Thread procedure function type.
-typedef Void (*thread_proc_kind)(int argc, char** argv);
+typedef SInt32 (*thread_proc_kind)(SInt32 argc, Char** argv);
/// @brief Creates a thread.
/// @param procedure the thread procedure.
/// @param argument_count number of arguments inside that thread.
/// @param flags Thread flags.
/// @return the thread object.
-IMPORT_C ThreadObject ThrCreateThread(thread_proc_kind procedure, SInt32 argument_count, SInt32 flags);
+IMPORT_C ThreadRef ThrCreateThread(thread_proc_kind procedure, SInt32 argument_count, SInt32 flags);
/// @brief Yields the current thread.
/// @param thread the thread to yield.
-IMPORT_C Void ThrYieldThread(ThreadObject thrd);
+IMPORT_C SInt32 ThrYieldThread(ThreadRef thrd);
/// @brief Joins a thread.
/// @param thread the thread to join.
-IMPORT_C Void ThrJoinThread(ThreadObject thrd);
+IMPORT_C SInt32 ThrJoinThread(ThreadRef thrd);
/// @brief Detach a thread.
/// @param thread the thread to detach.
-IMPORT_C Void ThrDetachThread(ThreadObject thrd);
+IMPORT_C SInt32 ThrDetachThread(ThreadRef thrd);
// ------------------------------------------------------------------------
// @brief Drive Management API.
@@ -215,7 +215,7 @@ IMPORT_C Char* DrvGetDriveLetterFromPath(_Input const Char* path);
/// @param letter the letter (A..Z).
/// @return the drive object.
// ------------------------------------------------------------------------------------------ //
-IMPORT_C SCIObject DrvGetMountedDrive(_Input const Char letter);
+IMPORT_C Ref DrvGetMountedDrive(_Input const Char letter);
// ------------------------------------------------------------------------------------------ //
/// @brief Mount a drive.
@@ -241,7 +241,7 @@ IMPORT_C Void DrvUnmountDrive(_Input const Char letter);
/// @return the event listener.
// ------------------------------------------------------------------------------------------ //
-IMPORT_C Void EvtAddListener(_Input const Char* event_name, _Input SCIObject listener);
+IMPORT_C Void EvtAddListener(_Input const Char* event_name, _Input Ref listener);
// ------------------------------------------------------------------------------------------ //
/// @brief Remove an event listener.
@@ -250,7 +250,7 @@ IMPORT_C Void EvtAddListener(_Input const Char* event_name, _Input SCIObject lis
/// @return the event listener.
// ------------------------------------------------------------------------------------------ //
-IMPORT_C Void EvtRemoveListener(_Input const Char* event_name, _Input SCIObject listener);
+IMPORT_C Void EvtRemoveListener(_Input const Char* event_name, _Input Ref listener);
// ------------------------------------------------------------------------------------------ //
/// @brief Dispatch an event.
@@ -267,6 +267,7 @@ IMPORT_C VoidPtr EvtDispatchEvent(_Input const Char* event_name, _Input VoidPtr
enum
{
+ kPowerCodeInvalid,
kPowerCodeShutdown,
kPowerCodeReboot,
kPowerCodeSleep,
@@ -292,24 +293,24 @@ IMPORT_C SInt32 CdCloseTray(Void);
// Printer API.
// ------------------------------------------------------------------------------------------ //
-IMPORT_C SInt32 PrintOut(IOObject file /* nullptr to direct to stdout */, const Char* fmt, ...);
+IMPORT_C SInt32 PrintOut(IORef file /* nullptr to direct to stdout */, const Char* fmt, ...);
-IMPORT_C SInt32 PrintIn(IOObject file /* nullptr to direct to stdout */, const Char* fmt, ...);
+IMPORT_C SInt32 PrintIn(IORef file /* nullptr to direct to stdout */, const Char* fmt, ...);
-IMPORT_C IOObject PrintCreate(Void);
+IMPORT_C IORef PrintCreate(Void);
-IMPORT_C SInt32 PrintRelease(IOObject);
+IMPORT_C SInt32 PrintRelease(IORef);
-IMPORT_C IOObject PrintGet(const Char* path);
+IMPORT_C IORef PrintGet(const Char* path);
// ------------------------------------------------------------------------------------------ //
// @brief Scheduler/Debug API.
// ------------------------------------------------------------------------------------------ //
-typedef SInt32 AffinityKind;
+typedef SInt32 AffinityRef;
typedef UInt64 PID;
-IMPORT_C SInt32 SchedAffinity(PID, SInt32 req, AffinityKind* local);
+IMPORT_C SInt32 SchedAffinity(PID, SInt32 req, AffinityRef* local);
IMPORT_C SInt32 SchedTrace(PID, SInt32 req, VoidPtr address, VoidPtr data);
diff --git a/dev/user/src/LPC.cc b/dev/user/src/LPC.cc
deleted file mode 100644
index f3f320b7..00000000
--- a/dev/user/src/LPC.cc
+++ /dev/null
@@ -1,10 +0,0 @@
-/* -------------------------------------------
-
-Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-File: LPC.cc
-Purpose: Local Procedure Codes.
-
-------------------------------------------- */
-
-#include <user/LPC.h>