summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.clang-format2
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md38
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md20
-rw-r--r--.github/pull_request_template.md22
-rw-r--r--.github/workflows/libddk-build.yml26
-rw-r--r--.github/workflows/libsystem-build.yml26
-rw-r--r--.gitignore4
-rw-r--r--CITATION.cff10
-rw-r--r--README.md32
-rw-r--r--compile_flags.txt1
-rw-r--r--doc/requirements/AtomicType.md (renamed from doc/requirements/TypeAtomic.md)2
-rw-r--r--doc/requirements/BufferedStream.md2
-rw-r--r--doc/requirements/HAL.dll.md10
-rw-r--r--doc/requirements/UnbufferedStream.md2
-rw-r--r--doc/style/cpp_style.md2
-rwxr-xr-xformat.sh5
-rw-r--r--proofs/Makefile16
-rw-r--r--proofs/Memory/HeapMgr.v10
-rw-r--r--proofs/_CoqProject3
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Array.h4
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Atom.h4
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h4
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Foundation.h4
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Object.h4
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Property.h4
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/Ref.h4
-rw-r--r--public/frameworks/CoreFoundation.fwrk/headers/String.h4
-rw-r--r--public/frameworks/DiskImage.fwrk/headers/DiskImage.h4
-rw-r--r--public/frameworks/KernelTest.fwrk/headers/Foundation.h4
-rw-r--r--public/frameworks/KernelTest.fwrk/headers/SourceLocation.h4
-rw-r--r--public/frameworks/KernelTest.fwrk/headers/TestCase.h10
-rw-r--r--public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h4
-rw-r--r--public/tools/diutil/vendor/Dialogs.h41
-rwxr-xr-xscripts/modules_ahci_x64.sh5
-rw-r--r--src/boot/BootKit/BootKit.h16
-rw-r--r--src/boot/BootKit/Shared/BootImg.rsrc72
-rw-r--r--src/boot/amd64-ci.make6
-rw-r--r--src/boot/amd64-desktop.make20
-rw-r--r--src/boot/arm64-desktop.make11
-rw-r--r--src/boot/modules/BootNet/BootNet.cpp1
-rw-r--r--src/boot/modules/BootNet/README.md2
-rw-r--r--src/boot/modules/BootNet/amd64.json2
-rw-r--r--src/boot/modules/BootNet/arm64.json2
-rw-r--r--src/boot/modules/MemoryTest/MemoryTest.cpp30
-rw-r--r--src/boot/modules/MemoryTest/MemoryTestStartup.S24
-rw-r--r--src/boot/modules/MemoryTest/README.md3
-rw-r--r--src/boot/modules/MemoryTest/amd64.json35
-rw-r--r--src/boot/modules/MemoryTest/arm64.json35
-rw-r--r--src/boot/modules/SysChk/SysChk.cpp1
-rw-r--r--src/boot/modules/SysChk/amd64-ahci-epm.json3
-rw-r--r--src/boot/modules/SysChk/amd64-ahci-gpt.json4
-rw-r--r--src/boot/modules/SysChk/amd64-pio-epm.json2
-rw-r--r--src/boot/modules/SysChk/amd64-pio-gpt.json2
-rw-r--r--src/boot/src/BootFileReader.cpp1
-rw-r--r--src/boot/src/BootSupport.cpp4
-rw-r--r--src/boot/src/BootThread.cpp41
-rw-r--r--src/boot/src/HEL/AMD64/BootAPI.S7
-rw-r--r--src/boot/src/HEL/AMD64/BootEFI.cpp46
-rw-r--r--src/boot/src/HEL/AMD64/BootPlatform.cpp24
-rw-r--r--src/boot/src/HEL/ARM64/BootEFI.cpp5
-rw-r--r--src/boot/src/HEL/ARM64/BootPlatform.cpp5
-rw-r--r--src/boot/src/New+Delete.cpp13
-rw-r--r--src/boot/src/boot_rsrc.rsrc4
-rw-r--r--src/hal/HAL/HAL.h11
-rw-r--r--src/hal/hal.dll.arm64.json21
-rw-r--r--src/hal/hal.dll.x64.json21
-rw-r--r--src/hal/src/AMD64/HalCoreSystemCalls+DDK.cpp (renamed from src/kernel/HALKit/AMD64/HalCoreSystemCalls+DDK.cpp)2
-rw-r--r--src/hal/src/AMD64/HalCoreSystemCalls+LibSystem.cpp8
-rw-r--r--src/hal/src/AMD64/HalCoreSystemCalls+NeLaunch.cpp (renamed from src/kernel/HALKit/AMD64/HalCoreSystemCalls+NeLaunch.cpp)2
-rw-r--r--src/hal/src/ARM64/.keep (renamed from doc/requirements/.keep)0
-rw-r--r--src/hint/doc/.keep (renamed from src/launch/.keep)0
-rw-r--r--src/hint/obj/.keep (renamed from src/libMsg/.keep)0
-rw-r--r--src/kernel/CompilerKit/Version.h8
-rw-r--r--src/kernel/FSKit/Ext2+IFS.h2
-rw-r--r--src/kernel/FSKit/OpenHeFS.h8
-rw-r--r--src/kernel/FirmwareKit/EFI/EFI.h106
-rw-r--r--src/kernel/FirmwareKit/Handover.h5
-rw-r--r--src/kernel/HALKit/AMD64/CxxAbi.cpp2
-rw-r--r--src/kernel/HALKit/AMD64/HalCoreInterruptHandler.cpp2
-rw-r--r--src/kernel/HALKit/AMD64/HalDebugOutput.cpp8
-rw-r--r--src/kernel/HALKit/AMD64/HalKernelMain.cpp14
-rw-r--r--src/kernel/HALKit/AMD64/HalKernelPanic.cpp11
-rw-r--r--src/kernel/HALKit/AMD64/Network/Generic+Basic+BNID.cpp (renamed from src/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cpp)58
-rw-r--r--src/kernel/HALKit/AMD64/Paging.h4
-rw-r--r--src/kernel/HALKit/ARM64/CxxAbi.cpp1
-rw-r--r--src/kernel/HALKit/ARM64/HalCoreInterruptHandler.cpp2
-rw-r--r--src/kernel/HALKit/ARM64/HalHandoverStub.s2
-rw-r--r--src/kernel/HALKit/ARM64/HalSchedulerCorePrimitives.cpp2
-rw-r--r--src/kernel/HALKit/ARM64/Paging.h16
-rw-r--r--src/kernel/KernelKit/BinaryMutex.h5
-rw-r--r--src/kernel/KernelKit/CoreProcessScheduler.h52
-rw-r--r--src/kernel/KernelKit/DebugOutput.h4
-rw-r--r--src/kernel/KernelKit/DriveMgr.h8
-rw-r--r--src/kernel/KernelKit/FileMgr.h21
-rw-r--r--src/kernel/KernelKit/HardwareThreadScheduler.h7
-rw-r--r--src/kernel/KernelKit/ILoader.h6
-rw-r--r--src/kernel/KernelKit/PCI/DMA.h2
-rw-r--r--src/kernel/KernelKit/PCI/Device.h2
-rw-r--r--src/kernel/KernelKit/Semaphore.h7
-rw-r--r--src/kernel/KernelKit/User.h (renamed from src/kernel/KernelKit/UserMgr+User.h)13
-rw-r--r--src/kernel/KernelKit/UserMgr.h2
-rw-r--r--src/kernel/KernelKit/UserProcessScheduler.h19
-rw-r--r--src/kernel/NeKit/Atom.h22
-rw-r--r--src/kernel/NeKit/Config.h6
-rw-r--r--src/kernel/NeKit/Macros.h4
-rw-r--r--src/kernel/NeKit/New.h6
-rw-r--r--src/kernel/NeKit/Utils.h6
-rw-r--r--src/kernel/NeKit/Vettable.h8
-rw-r--r--src/kernel/amd64-ci.make4
-rw-r--r--src/kernel/amd64-desktop.make4
-rw-r--r--src/kernel/arm64-desktop.make6
-rw-r--r--src/kernel/kernel_rsrc.rsrc8
-rw-r--r--src/kernel/src/ACPIFactoryInterface.cpp1
-rw-r--r--src/kernel/src/AsciiUtils.cpp5
-rw-r--r--src/kernel/src/BinaryMutex.cpp37
-rw-r--r--src/kernel/src/CodeMgr.cpp1
-rw-r--r--src/kernel/src/FS/Ext2+FileMgr.cpp16
-rw-r--r--src/kernel/src/FS/Ext2+FileSystemParser.cpp (renamed from src/kernel/src/FS/Ext2+IFS.cpp)25
-rw-r--r--src/kernel/src/FS/NeFS+FileMgr.cpp10
-rw-r--r--src/kernel/src/FS/NeFS+FileSystemParser.cpp2
-rw-r--r--src/kernel/src/FS/OpenHeFS+FileMgr.cpp43
-rw-r--r--src/kernel/src/FS/OpenHeFS+FileSystemParser.cpp3
-rw-r--r--src/kernel/src/FileMgr.cpp1
-rw-r--r--src/kernel/src/GUIDWizard.cpp1
-rw-r--r--src/kernel/src/Gfx/FBDeviceInterface.cpp1
-rw-r--r--src/kernel/src/HeapMgr.cpp25
-rw-r--r--src/kernel/src/InitializerList.cpp1
-rw-r--r--src/kernel/src/Json.cpp2
-rw-r--r--src/kernel/src/KernelTask.cpp9
-rw-r--r--src/kernel/src/New+Delete.cpp8
-rw-r--r--src/kernel/src/PageMgr.cpp2
-rw-r--r--src/kernel/src/Property.cpp2
-rw-r--r--src/kernel/src/RT/.keep (renamed from src/libPOSIXWrapper/src/.keep)0
-rw-r--r--src/kernel/src/RT/README.txt4
-rw-r--r--src/kernel/src/Semaphore.cpp2
-rw-r--r--src/kernel/src/Storage/AHCIDeviceInterface.cpp1
-rw-r--r--src/kernel/src/Swap/DiskSwap.cpp1
-rw-r--r--src/kernel/src/User.cpp19
-rw-r--r--src/kernel/src/UserMgr.cpp23
-rw-r--r--src/kernel/src/UserProcessScheduler.cpp87
-rw-r--r--src/kernel/src/UserProcessTeam.cpp8
-rw-r--r--src/kernel/src/UtfUtils.cpp2
-rw-r--r--src/kernel/src/ZXDCodeMgr.cpp3
-rw-r--r--src/launch/src/RuntimeMain.cpp11
-rw-r--r--src/libDDK/DriverKit/ObjectKit/Base.hpp (renamed from src/libDDK/DriverKit/ObjectKit/Base.h)5
-rw-r--r--src/libDDK/DriverKit/ObjectKit/Checksum.hpp (renamed from src/libDDK/DriverKit/ObjectKit/Checksum.h)12
-rw-r--r--src/libDDK/DriverKit/ObjectKit/DriverKit.hpp (renamed from src/libDDK/DriverKit/ObjectKit/DriverKit.h)8
-rw-r--r--src/libDDK/src/CxxABI.cpp9
-rw-r--r--src/libDDK/src/KernelAllocator.cpp4
-rw-r--r--src/libDDK/src/KernelDevice.cpp4
-rw-r--r--src/libDDK/src/KernelDriverBase.cpp4
-rw-r--r--src/libMsg/src/Server.cpp18
-rw-r--r--src/libPOSIXWrapper/POSIXKit/POSIX.h24
-rw-r--r--src/libPOSIXWrapper/POSIXKit/unistd.h17
-rw-r--r--src/libPOSIXWrapper/doc/.keep (renamed from src/libPThread/src/.keep)0
-rw-r--r--src/libPOSIXWrapper/obj/.keep0
-rw-r--r--src/libPOSIXWrapper/src/POSIX.cpp6
-rw-r--r--src/libPThread/PThreadKit/Thread.h17
-rw-r--r--src/libPThread/PThreadKit/pthread.h11
-rw-r--r--src/libPThread/src/Thread.cpp23
-rw-r--r--src/libSoundSystem/SoundSystemKit/VirtualMixer.h2
-rw-r--r--src/libSoundSystem/src/VirtualMixer.cpp1
-rw-r--r--src/libSystem/SystemKit/Macros.h5
-rw-r--r--src/libSystem/SystemKit/System.h12
-rw-r--r--src/libSystem/src/JailCalls.cpp5
-rw-r--r--src/libSystem/src/SystemCalls.cpp12
-rw-r--r--src/libThread/ThreadKit/Thread.h11
-rw-r--r--src/libThread/doc/.keep0
-rw-r--r--src/libThread/libThread.json21
-rw-r--r--src/libThread/obj/.keep0
-rw-r--r--src/libThread/src/Thread.cpp82
-rw-r--r--src/modules/CoreGfx/CoreGfx.h2
-rw-r--r--test/kernel_tests/libddk_tests/Makefile7
-rw-r--r--test/kernel_tests/libsystem_tests/thread.test.cc2
-rw-r--r--test/module_tests/libpthread_tests/Makefile19
-rw-r--r--tools/chk.hefs.cpp17
-rwxr-xr-xtools/kapp.py (renamed from tools/mkapp.py)4
-rwxr-xr-xtools/kconf.py13
-rwxr-xr-xtools/kernel13
-rwxr-xr-xtools/kfwrk.py2
-rw-r--r--tools/mkfs.hefs.cpp5
181 files changed, 1309 insertions, 740 deletions
diff --git a/.clang-format b/.clang-format
index 3943f553..f9c1b5af 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,4 +1,6 @@
+---
BasedOnStyle: Google
+Language: Cpp
IndentWidth: 2
TabWidth: 2
UseTab: Never
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000..dd84ea78
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Smartphone (please complete the following information):**
+ - Device: [e.g. iPhone6]
+ - OS: [e.g. iOS8.1]
+ - Browser [e.g. stock browser, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000..bbcbbe7d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 00000000..8920bf5e
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,22 @@
+# [PR]: <Title of PR>
+
+## Description:
+
+<Describe briefly your PR here.>
+
+## PR Rationale:
+
+<Describe the rationale here>
+
+### PR Process:
+
+<Describe your process here>
+
+## Results:
+
+<Describe the results here>
+
+## Additional Information:
+
+<Describe additional information (Optional)>
+
diff --git a/.github/workflows/libddk-build.yml b/.github/workflows/libddk-build.yml
new file mode 100644
index 00000000..3ddcef1b
--- /dev/null
+++ b/.github/workflows/libddk-build.yml
@@ -0,0 +1,26 @@
+name: NeKernel libDDK [BUILD]
+
+on:
+ push:
+ branches: [ "develop" ]
+ pull_request:
+ branches: [ "develop" ]
+
+env:
+ BUILD_TYPE: KERNEL_BUILD
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Attempt NeBuild
+ run: sudo curl https://git.src.nekernel.org/nebuild/releases/download/v0.0.6-apple-m1/nebuild-debian -o /usr/bin/nebuild && sudo chmod +x /usr/bin/nebuild
+ - name: Check NeBuild
+ run: nebuild -v
+ - name: Install QEMU-IMG
+ run: sudo apt update && sudo apt install qemu-utils
+ - name: Attempt Kernel Build
+ run: mkdir tmp && sudo apt install g++-mingw-w64-x86-64 gcc-mingw-w64 nasm && git clone https://github.com/ne-foss-org/ne_kernel.git tmp/kernel && cd tmp/kernel/src/libDDK && nebuild libDDK.json
+
diff --git a/.github/workflows/libsystem-build.yml b/.github/workflows/libsystem-build.yml
new file mode 100644
index 00000000..8a9e9af3
--- /dev/null
+++ b/.github/workflows/libsystem-build.yml
@@ -0,0 +1,26 @@
+name: NeKernel libSystem [BUILD]
+
+on:
+ push:
+ branches: [ "develop" ]
+ pull_request:
+ branches: [ "develop" ]
+
+env:
+ BUILD_TYPE: KERNEL_BUILD
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Attempt NeBuild
+ run: sudo curl https://git.src.nekernel.org/nebuild/releases/download/v0.0.6-apple-m1/nebuild-debian -o /usr/bin/nebuild && sudo chmod +x /usr/bin/nebuild
+ - name: Check NeBuild
+ run: nebuild -v
+ - name: Install QEMU-IMG
+ run: sudo apt update && sudo apt install qemu-utils
+ - name: Attempt Kernel Build
+ run: mkdir tmp && sudo apt install g++-mingw-w64-x86-64 gcc-mingw-w64 nasm && git clone https://github.com/ne-foss-org/ne_kernel.git tmp/kernel && cd tmp/kernel/src/libSystem && nebuild libSystem.json
+
diff --git a/.gitignore b/.gitignore
index fc911573..3988bf16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,8 +26,8 @@ build/
*.pdf
*.aux
-ne_kernel
-ne_bootz
+neoskrnl.exe
+bootzldr.exe
neoskrnl/neoskrnl.xcodeproj/project.xcworkspace/xcshareddata/
diff --git a/CITATION.cff b/CITATION.cff
index 9fa4185b..6882ce91 100644
--- a/CITATION.cff
+++ b/CITATION.cff
@@ -1,6 +1,6 @@
cff-version: 1.2.0
-title: Ne.org Operating System Kernel in C++
-message: The Operating System Kernel of Ne.org
+title: Ne.app Operating System Kernel in C++
+message: The Operating System Kernel of Ne.app
type: software
authors:
- given-names: Amlal
@@ -9,11 +9,11 @@ authors:
identifiers:
- type: url
value: 'https://nekernel.org'
- description: Ne.org's Operating System Kernel
-repository-code: 'https://github.com/ne-foss-org/kernel'
+ description: Ne.app's Operating System Kernel
+repository-code: 'https://github.com/ne-foss-org/ne-kernel'
url: 'https://nekernel.org'
abstract: >-
- This is Ne.org's Modular Operating System Kernel.
+ This is Ne.app's Modular Operating System Kernel.
keywords:
- kernel
- operating-system
diff --git a/README.md b/README.md
index b88c514b..3f6c3d9b 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,16 @@
-
<!-- Read Me of NeKernel -->
-![Logotype](meta/media/ne_logotype.png)
+# 🍯 The NeKernel
-<div align="center">
- <h1>
- <b>The NeKernel System.</b>
- </h1>
- <p>
- <a href="https://github.com/ne-foss-org/nekernel/actions/workflows/boot-ahci-dev.yml/badge.svg"><img src="https://github.com/ne-foss-org/nekernel/actions/workflows/boot-ahci-dev.yml/badge.svg" alt="CI"></a>
- <a href="https://github.com/ne-foss-org/nekernel/actions/workflows/kernel-ahci-dev.yml/badge.svg"><img src="https://github.com/ne-foss-org/nekernel/actions/workflows/kernel-ahci-dev.yml/badge.svg" alt="CI"></a>
- <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License"></a>
- </p>
-</div>
+![License](https://img.shields.io/badge/LICENSE-Apache--2.0-blue.svg?style=for-the-badge)
+![GitHub Repo stars](https://img.shields.io/github/stars/ne-foss-org/ne-kernel?style=for-the-badge)
+
+<a href="https://github.com/ne-foss-org/nekernel/actions/workflows/boot-ahci-dev.yml/badge.svg"><img src="https://github.com/ne-foss-org/nekernel/actions/workflows/boot-ahci-dev.yml/badge.svg" alt="CI 1"></a>
+<a href="https://github.com/ne-foss-org/nekernel/actions/workflows/kernel-ahci-dev.yml/badge.svg"><img src="https://github.com/ne-foss-org/nekernel/actions/workflows/kernel-ahci-dev.yml/badge.svg?style=for-the-badge" alt="CI 2"></a>
+
+## About:
+
+The base system designed for scalability and portability, hybrid and written in modern C++ for backend systems.
## Getting Started:
@@ -35,17 +33,11 @@ git clone -j8 https://github.com/ne-foss-org/nekernel.git
cd nekernel
./scripts/setup_x64_project.sh
./scripts/modules_ahci_x64.sh
-./scripts/debug_ahci_x64.sh # For debug generic AHCI target (QEMU, USB)
+./scripts/debug_ahci_x64.sh # For debug generic AHCI target (QEMU, UDF)
```
---
-## Love our work?
-
-Give us a star on GitHub!
-
-![GitHub Repo stars](https://img.shields.io/github/stars/ne-foss-org/kernel)
-
## Community:
Join our [Discord](https://discord.gg/uD76Qweght), we're quite active and open for contributors!
@@ -121,6 +113,6 @@ NeKernel is licensed under the [Apache-2.0 License](LICENSE).
<div align="center">
<sub>
- &copy; 2022-2026 Amlal El Mahrouss & Ne.org Authors. Licensed under the Apache 2.0 license.
+ &copy; 2022-2026 Amlal El Mahrouss & Ne.app Authors. Licensed under the Apache 2.0 license.
</sub>
</div>
diff --git a/compile_flags.txt b/compile_flags.txt
index 362ffe20..51003cd9 100644
--- a/compile_flags.txt
+++ b/compile_flags.txt
@@ -16,6 +16,7 @@
-Ipublic/frameworks
-Isrc/boot/BootKit
-Itools/
+-D__BOOTZ_STANDALONE__
-I./
-std=c++20
-D__NE_AMD64__
diff --git a/doc/requirements/TypeAtomic.md b/doc/requirements/AtomicType.md
index 20ada8d1..5c4fcffb 100644
--- a/doc/requirements/TypeAtomic.md
+++ b/doc/requirements/AtomicType.md
@@ -1,4 +1,4 @@
-# TypeAtomic Type
+# AtomicType Type Requirements:
## Abstract:
diff --git a/doc/requirements/BufferedStream.md b/doc/requirements/BufferedStream.md
index 1ac01a0f..94a87bcb 100644
--- a/doc/requirements/BufferedStream.md
+++ b/doc/requirements/BufferedStream.md
@@ -1,4 +1,4 @@
-# BufferedStream
+# BufferedStream Requirements:
## Abstract:
diff --git a/doc/requirements/HAL.dll.md b/doc/requirements/HAL.dll.md
new file mode 100644
index 00000000..2e211e51
--- /dev/null
+++ b/doc/requirements/HAL.dll.md
@@ -0,0 +1,10 @@
+# HAL.DLL Requirements:
+
+## Abstract:
+
+The `HAL.DLL` is the dynamic library providing hardware abstracted system calls and kernel calls for the operating system.
+It is a critical component that allows applications to interact with hardware without needing to manage hardware-specific details.
+
+## Notes:
+
+`HAL.dll` is a ring-0/privileged image. \ No newline at end of file
diff --git a/doc/requirements/UnbufferedStream.md b/doc/requirements/UnbufferedStream.md
index d3bfd8eb..6afb76b7 100644
--- a/doc/requirements/UnbufferedStream.md
+++ b/doc/requirements/UnbufferedStream.md
@@ -1,4 +1,4 @@
-# UnbufferedStream
+# UnbufferedStream Requirements:
## Abstract:
diff --git a/doc/style/cpp_style.md b/doc/style/cpp_style.md
index 3069285e..85764082 100644
--- a/doc/style/cpp_style.md
+++ b/doc/style/cpp_style.md
@@ -6,7 +6,7 @@ NeKernel uses the Google C++ Style. But applied to low-level systems. We use C++
## No Exceptions, Never.
-NeKernel bans the usage of exceptions in ne_kernel, ne_bootz, etc.
+NeKernel bans the usage of exceptions in neoskrnl, bootzldr, etc.
Unless it is a program space and not to be deemed performance dependent.
## Templates, Containers, and ZOA over C with Classes.
diff --git a/format.sh b/format.sh
index f36943cd..9cb50804 100755
--- a/format.sh
+++ b/format.sh
@@ -2,9 +2,6 @@
THIS_PATH="$(realpath "$0")"
THIS_DIR="$(dirname "$THIS_PATH")"
-
-FILE_LIST="$(find "$THIS_DIR" | grep -E ".*(\.cc|\.c|\.h|\.inl)$")"
-
-echo -e "Files found to format = \n\"\"\"\n$FILE_LIST\n\"\"\""
+FILE_LIST="$(find "$THIS_DIR" | grep -E ".*(\.cpp|\.cc|\.c|\.h|\.inl)$")"
clang-format --verbose -i --style=file $FILE_LIST
diff --git a/proofs/Makefile b/proofs/Makefile
deleted file mode 100644
index efbda2d8..00000000
--- a/proofs/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-COQMAKEFILE ?= Makefile.coq
-
-all: $(COQMAKEFILE)
- $(MAKE) -f $(COQMAKEFILE)
-
-$(COQMAKEFILE): _CoqProject
- coq_makefile -f _CoqProject -o $(COQMAKEFILE)
-
-clean: $(COQMAKEFILE)
- $(MAKE) -f $(COQMAKEFILE) clean
- rm -f $(COQMAKEFILE) $(COQMAKEFILE).conf
-
-.PHONY: all clean
-
-
-
diff --git a/proofs/Memory/HeapMgr.v b/proofs/Memory/HeapMgr.v
deleted file mode 100644
index a709888e..00000000
--- a/proofs/Memory/HeapMgr.v
+++ /dev/null
@@ -1,10 +0,0 @@
-(*
- The HeapMgr, formally proven.
-
- Author: Amlal El Mahrouss
- Formalization: March 2026
-*)
-
-From Coq Require Import Logic.Classical_Prop.
-
-
diff --git a/proofs/_CoqProject b/proofs/_CoqProject
deleted file mode 100644
index ea90d761..00000000
--- a/proofs/_CoqProject
+++ /dev/null
@@ -1,3 +0,0 @@
--R Kernel Kernel
-
-Kernel/HeapMgr.v
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Array.h b/public/frameworks/CoreFoundation.fwrk/headers/Array.h
index afc5ea77..e5df695d 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Array.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Array.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_ARRAY_H
-#define HEADERS_ARRAY_H
+#ifndef FW_HEADERS_ARRAY_H
+#define FW_HEADERS_ARRAY_H
#include <libSystem/SystemKit/System.h>
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Atom.h b/public/frameworks/CoreFoundation.fwrk/headers/Atom.h
index 5abf9824..4ec12f57 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Atom.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Atom.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_ATOM_H
-#define HEADERS_ATOM_H
+#ifndef FW_HEADERS_ATOM_H
+#define FW_HEADERS_ATOM_H
#include <CoreFoundation.fwrk/headers/Foundation.h>
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h b/public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h
index f10dc2de..41e6d289 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Dictionary.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_DICTIONARY_H
-#define HEADERS_DICTIONARY_H
+#ifndef FW_HEADERS_DICTIONARY_H
+#define FW_HEADERS_DICTIONARY_H
#include <libSystem/SystemKit/System.h>
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h
index 82f3dca2..8f959543 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_FOUNDATION_H
-#define HEADERS_FOUNDATION_H
+#ifndef FW_HEADERS_FOUNDATION_H
+#define FW_HEADERS_FOUNDATION_H
#include <libSystem/SystemKit/System.h>
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Object.h b/public/frameworks/CoreFoundation.fwrk/headers/Object.h
index 54ee6268..771a2a6a 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Object.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Object.h
@@ -4,8 +4,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_OBJECT_H
-#define HEADERS_OBJECT_H
+#ifndef FW_HEADERS_OBJECT_H
+#define FW_HEADERS_OBJECT_H
#include <CoreFoundation.fwrk/headers/Foundation.h>
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Property.h b/public/frameworks/CoreFoundation.fwrk/headers/Property.h
index f3176827..33773d36 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Property.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Property.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_PROPERTY_H
-#define HEADERS_PROPERTY_H
+#ifndef FW_HEADERS_PROPERTY_H
+#define FW_HEADERS_PROPERTY_H
#include <CoreFoundation.fwrk/headers/Foundation.h>
#include <CoreFoundation.fwrk/headers/Ref.h>
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Ref.h b/public/frameworks/CoreFoundation.fwrk/headers/Ref.h
index 59928e4e..31b12fc6 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/Ref.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/Ref.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_REF_H
-#define HEADERS_REF_H
+#ifndef FW_HEADERS_REF_H
+#define FW_HEADERS_REF_H
#include <CoreFoundation.fwrk/headers/Object.h>
#include <libSystem/SystemKit/System.h>
diff --git a/public/frameworks/CoreFoundation.fwrk/headers/String.h b/public/frameworks/CoreFoundation.fwrk/headers/String.h
index d82646ee..baf9803f 100644
--- a/public/frameworks/CoreFoundation.fwrk/headers/String.h
+++ b/public/frameworks/CoreFoundation.fwrk/headers/String.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_STRING_H
-#define HEADERS_STRING_H
+#ifndef FW_HEADERS_STRING_H
+#define FW_HEADERS_STRING_H
#include <CoreFoundation.fwrk/headers/Object.h>
#include <CoreFoundation.fwrk/headers/Ref.h>
diff --git a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h
index 5ac8bd4b..346864a6 100644
--- a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h
+++ b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_DISKIMAGE_H
-#define HEADERS_DISKIMAGE_H
+#ifndef FW_HEADERS_DISKIMAGE_H
+#define FW_HEADERS_DISKIMAGE_H
#include <libSystem/SystemKit/System.h>
diff --git a/public/frameworks/KernelTest.fwrk/headers/Foundation.h b/public/frameworks/KernelTest.fwrk/headers/Foundation.h
index 2b9e848b..82066bdd 100644
--- a/public/frameworks/KernelTest.fwrk/headers/Foundation.h
+++ b/public/frameworks/KernelTest.fwrk/headers/Foundation.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_FOUNDATION_H
-#define HEADERS_FOUNDATION_H
+#ifndef FW_HEADERS_FOUNDATION_H
+#define FW_HEADERS_FOUNDATION_H
#include <libSystem/SystemKit/Err.h>
#include <libSystem/SystemKit/System.h>
diff --git a/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h b/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h
index b8f5abd0..80361dc1 100644
--- a/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h
+++ b/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_SOURCELOCATION_H
-#define HEADERS_SOURCELOCATION_H
+#ifndef FW_HEADERS_SOURCELOCATION_H
+#define FW_HEADERS_SOURCELOCATION_H
#include <KernelTest.fwrk/headers/Foundation.h>
diff --git a/public/frameworks/KernelTest.fwrk/headers/TestCase.h b/public/frameworks/KernelTest.fwrk/headers/TestCase.h
index 0a6208a8..81cecc75 100644
--- a/public/frameworks/KernelTest.fwrk/headers/TestCase.h
+++ b/public/frameworks/KernelTest.fwrk/headers/TestCase.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_TESTCASE_H
-#define HEADERS_TESTCASE_H
+#ifndef FW_HEADERS_TESTCASE_H
+#define FW_HEADERS_TESTCASE_H
#include <KernelTest.fwrk/headers/SourceLocation.h>
@@ -36,11 +36,13 @@
inline Void KTTestCase##NAME::Run() { \
auto ret = FN() == YES; \
if (!ret) { \
- PrintOut(nullptr, "[KERNEL-TEST] TEST FAILED!"); \
+ PrintOut(nullptr, "[KERNEL_IMG-TEST] TEST FAILED!"); \
KT_MUST_PASS(ret, ret, true); \
} \
} \
- inline const Char* KTTestCase##NAME::ToString() { return #FN; }
+ inline const Char* KTTestCase##NAME::ToString() { \
+ return #FN; \
+ }
KT_DECL_TEST(AlwaysBreak, []() -> bool {
KT_MUST_PASS("AlwaysBreak", YES, NO);
diff --git a/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h b/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h
index fba7f492..85cdbdb9 100644
--- a/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h
+++ b/public/frameworks/LaunchHelpers.fwrk/headers/Foundation.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef HEADERS_FOUNDATION_H
-#define HEADERS_FOUNDATION_H
+#ifndef FW_HEADERS_LAUNCH_FOUNDATION_H
+#define FW_HEADERS_LAUNCH_FOUNDATION_H
#include <CoreFoundation.fwrk/headers/Foundation.h>
#include <CoreFoundation.fwrk/headers/String.h>
diff --git a/public/tools/diutil/vendor/Dialogs.h b/public/tools/diutil/vendor/Dialogs.h
index 28cd8fa9..d1bbd7a2 100644
--- a/public/tools/diutil/vendor/Dialogs.h
+++ b/public/tools/diutil/vendor/Dialogs.h
@@ -176,7 +176,7 @@ namespace internal {
#elif __EMSCRIPTEN__
void start(int exit_code);
#else
- void start_process(std::vector<std::string> const& command);
+ void start_process(std::vector<std::string> const& command);
#endif
~executor();
@@ -491,10 +491,10 @@ inline settings::settings(bool resync) {
#if _WIN32
flags(flag::is_vista) = internal::is_vista();
#elif !__APPLE__
- flags(flag::has_zenity) = check_program("zenity");
+ flags(flag::has_zenity) = check_program("zenity");
flags(flag::has_matedialog) = check_program("matedialog");
- flags(flag::has_qarma) = check_program("qarma");
- flags(flag::has_kdialog) = check_program("kdialog");
+ flags(flag::has_qarma) = check_program("qarma");
+ flags(flag::has_kdialog) = check_program("kdialog");
// If multiple helpers are available, try to default to the best one
if (flags(flag::has_zenity) && flags(flag::has_kdialog)) {
@@ -541,7 +541,7 @@ inline bool settings::check_program(std::string const& program) {
(void) program;
return false;
#else
- int exit_code = -1;
+ int exit_code = -1;
internal::executor async;
async.start_process({"/bin/sh", "-c", "which " + program});
async.result(&exit_code);
@@ -605,7 +605,7 @@ inline std::string path::home() {
if (size_max != -1) len = size_t(size_max);
#endif
std::vector<char> buf(len);
- struct passwd pwd, *result;
+ struct passwd pwd, *result;
if (getpwuid_r(getuid(), &pwd, buf.data(), buf.size(), &result) == 0) return result->pw_dir;
#endif
return "/";
@@ -718,7 +718,7 @@ inline void internal::executor::start_process(std::vector<std::string> const& co
}
close(in[1]);
- m_fd = out[0];
+ m_fd = out[0];
auto flags = fcntl(m_fd, F_GETFL);
fcntl(m_fd, F_SETFL, flags | O_NONBLOCK);
@@ -754,7 +754,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */)
// FIXME: do something
(void) timeout;
#else
- char buf[BUFSIZ];
+ char buf[BUFSIZ];
ssize_t received = read(m_fd, buf, BUFSIZ); // Flawfinder: ignore
if (received > 0) {
m_stdout += std::string(buf, received);
@@ -765,7 +765,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */)
// (this happens when the calling application handles or ignores SIG_CHLD) and results in
// waitpid() failing with ECHILD. Otherwise we assume the child is running and we sleep for
// a little while.
- int status;
+ int status;
pid_t child = waitpid(m_pid, &status, WNOHANG);
if (child != m_pid && (child >= 0 || errno != ECHILD)) {
// FIXME: this happens almost always at first iteration
@@ -783,8 +783,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */)
inline void internal::executor::stop() {
// Loop until the user closes the dialog
- while (!ready())
- ;
+ while (!ready());
}
// dll implementation
@@ -880,11 +879,11 @@ inline std::vector<std::string> internal::dialog::desktop_helper() const {
#if __APPLE__
return {"osascript"};
#else
- return {flags(flag::has_zenity) ? "zenity"
+ return {flags(flag::has_zenity) ? "zenity"
: flags(flag::has_matedialog) ? "matedialog"
- : flags(flag::has_qarma) ? "qarma"
- : flags(flag::has_kdialog) ? "kdialog"
- : "echo"};
+ : flags(flag::has_qarma) ? "qarma"
+ : flags(flag::has_kdialog) ? "kdialog"
+ : "echo"};
#endif
}
@@ -1126,9 +1125,9 @@ inline internal::file_dialog::file_dialog(type in_type, std::string const& title
// Split the pattern list to check whether "*" is in there; if it
// is, we have to disable filters because there is no mechanism in
// OS X for the user to override the filter.
- std::regex sep("\\s+");
- std::string filter_list;
- bool has_filter = true;
+ std::regex sep("\\s+");
+ std::string filter_list;
+ bool has_filter = true;
std::sregex_token_iterator iter(patterns.begin(), patterns.end(), sep, -1);
std::sregex_token_iterator end;
for (; iter != end; ++iter) {
@@ -1237,7 +1236,7 @@ inline std::vector<std::string> internal::file_dialog::vector_result() {
return m_vector_result;
#else
std::vector<std::string> ret;
- auto result = m_async->result();
+ auto result = m_async->result();
for (;;) {
// Split result along newline characters
auto i = result.find('\n');
@@ -1570,7 +1569,7 @@ inline message::message(std::string const& title, std::string const& text,
if_cancel = button::ok;
break;
}
- m_mappings[1] = if_cancel;
+ m_mappings[1] = if_cancel;
m_mappings[256] = if_cancel; // XXX: I think this was never correct
script += " with icon ";
switch (_icon) {
@@ -1657,7 +1656,7 @@ inline message::message(std::string const& title, std::string const& text,
if (_choice == choice::yes_no_cancel) flag += "cancel";
command.push_back(flag);
if (_choice == choice::yes_no || _choice == choice::yes_no_cancel) {
- m_mappings[0] = button::yes;
+ m_mappings[0] = button::yes;
m_mappings[256] = button::no;
}
}
diff --git a/scripts/modules_ahci_x64.sh b/scripts/modules_ahci_x64.sh
index c9b8bd3e..ff58780d 100755
--- a/scripts/modules_ahci_x64.sh
+++ b/scripts/modules_ahci_x64.sh
@@ -5,7 +5,10 @@
# 04/05/25: Improve and fix script.
cd src/boot/modules/SysChk
-nebuild amd64-ahci-gpt.json
+nebuild amd64-ahci-epm.json
cd ../
cd BootNet
nebuild amd64.json
+cd ../
+cd MemoryTest
+nebuild amd64.json
diff --git a/src/boot/BootKit/BootKit.h b/src/boot/BootKit/BootKit.h
index 675049d8..1cdf2032 100644
--- a/src/boot/BootKit/BootKit.h
+++ b/src/boot/BootKit/BootKit.h
@@ -291,16 +291,16 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const Char* part_name) {
CopyMem(gpt_part->Signature, reinterpret_cast<VoidPtr>(const_cast<Char*>(kMagicGPT)),
StrLen(kMagicGPT));
- gpt_part->Revision = 0x00010000;
+ gpt_part->Revision = 0x00010000;
gpt_part->HeaderSize = sizeof(GPT_PARTITION_TABLE);
gpt_part->CRC32 = 0x00000000;
- gpt_part->Reserved1 = 0x00000000;
- gpt_part->LBAHeader = 0x00000000;
- gpt_part->LBAAltHeader = 0x00000000;
+ gpt_part->Reserved1 = 0x00000000;
+ gpt_part->LBAHeader = 0x00000000;
+ gpt_part->LBAAltHeader = 0x00000000;
gpt_part->FirstGPTEntry = 0x00000000;
- gpt_part->LastGPTEntry = 0x00000000;
+ gpt_part->LastGPTEntry = 0x00000000;
gpt_part->Guid.Data1 = 0x00000000;
gpt_part->Guid.Data2 = 0x0000;
@@ -310,10 +310,10 @@ inline Boolean BDiskFormatFactory<BootDev>::Format(const Char* part_name) {
gpt_part->Revision = 0x00010000;
- gpt_part->StartingLBA = 0x00000000;
+ gpt_part->StartingLBA = 0x00000000;
gpt_part->NumPartitionEntries = 0x00000000;
- gpt_part->SizeOfEntries = 0x00000000;
- gpt_part->CRC32PartEntry = 0x00000000;
+ gpt_part->SizeOfEntries = 0x00000000;
+ gpt_part->CRC32PartEntry = 0x00000000;
SetMem(gpt_part->Reserved2, 0, kSectorAlignGPT_PartTbl);
diff --git a/src/boot/BootKit/Shared/BootImg.rsrc b/src/boot/BootKit/Shared/BootImg.rsrc
new file mode 100644
index 00000000..514fdf85
--- /dev/null
+++ b/src/boot/BootKit/Shared/BootImg.rsrc
@@ -0,0 +1,72 @@
+#pragma once
+
+#define BOOT_LOGO_HEIGHT 64
+#define BOOT_LOGO_WIDTH 64
+
+// array size is 12288
+inline const Kernel::UInt32 kBootLogo[] = {
+ 0x1e3c5a, 0x22415f, 0x294967, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2c4c6a, 0x2b4c69, 0x2b4a68, 0x274865, 0x244562, 0x21415e, 0x1d3d5a, 0x1f3e57, 0x2a5555, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x1f3f5c, 0x335270, 0x416281, 0x436383, 0x436383, 0x426383, 0x426383, 0x426383, 0x426383, 0x436383, 0x426383, 0x436383, 0x426383, 0x426383, 0x426383, 0x436383, 0x426383, 0x426383, 0x436383, 0x426383, 0x436383, 0x426383, 0x426383, 0x426383, 0x426383, 0x426383, 0x426383, 0x436383, 0x426383, 0x436383, 0x426383, 0x426383, 0x426383, 0x426383, 0x436383, 0x426383, 0x426383, 0x436383, 0x436383, 0x426383, 0x426382, 0x426382, 0x406180, 0x3e5f7d, 0x395a79, 0x335472, 0x2b4d6a, 0x254462, 0x1e3f5d, 0x1e3d5b, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244361, 0x3d5e7d, 0x436484, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x446584, 0x446584, 0x426382, 0x3d5e7c, 0x335472, 0x284865, 0x203f5d, 0x1d3a58, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3e5f7e, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436483, 0x436484, 0x406180, 0x355574, 0x274765, 0x1e405c, 0x24486d, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3e5e7e, 0x436483, 0x426383, 0x426383, 0x426383, 0x436383, 0x426383, 0x426383, 0x436383, 0x436383, 0x436383, 0x436383, 0x426383, 0x426383, 0x436383, 0x426383, 0x426383, 0x436383, 0x436383, 0x436383, 0x436383, 0x426383, 0x426383, 0x436383, 0x426383, 0x426383, 0x436383, 0x426383, 0x436383, 0x436383, 0x426383, 0x426383, 0x436383, 0x426383, 0x426383, 0x436383, 0x436383, 0x426383, 0x436383, 0x426383, 0x426383, 0x436383, 0x426383, 0x426383, 0x426383, 0x436383, 0x436383, 0x436383, 0x436383, 0x436483, 0x3e5f7e, 0x30506f, 0x22425f, 0x20415a, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3d5e7d, 0x426383, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426383, 0x426382, 0x375876, 0x264663, 0x1f3f5b, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3d5e7d, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426382, 0x426383, 0x3b5c7b, 0x284965, 0x1d3d5b, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3d5e7d, 0x426382, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426282, 0x426383, 0x3d5d7d, 0x294967, 0x1e3f5a, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3d5d7d, 0x426282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x416282, 0x426282, 0x3c5d7c, 0x284866, 0x1e3d5b, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3c5d7c, 0x416282, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416281, 0x416282, 0x3a5a79, 0x254562, 0x1f3f5f, 0x000000, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3c5d7c, 0x416281, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416282, 0x355574, 0x20415e, 0x555555, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3c5c7c, 0x416181, 0x416181, 0x406181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x406181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x406181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x406181, 0x416181, 0x406181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x406181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x406181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x416181, 0x406080, 0x2d4d6b, 0x203d59, 0x000000, 0x000000, 0x000000,
+ 0x244461, 0x3c5c7c, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x406181, 0x3a5b7a, 0x254462, 0x24485b, 0x000000, 0x000000,
+ 0x244361, 0x3c5c7b, 0x406181, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x406180, 0x30506e, 0x1f3f5c, 0x000000, 0x000000,
+ 0x244361, 0x3b5c7b, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x406080, 0x3b5b7a, 0x244461, 0x194c66, 0x000000,
+ 0x244361, 0x3b5c7b, 0x406080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x2d4d6c, 0x1d3b59, 0x000000,
+ 0x244361, 0x3b5b7b, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x3f6080, 0x406081, 0x365676, 0x20415e, 0x000000,
+ 0x244361, 0x3b5b7b, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3e5f80, 0x3e5f80, 0x3e5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3c5c7d, 0x274563, 0x224455,
+ 0x244360, 0x3a5b7b, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3e5f80, 0x3e5f7f, 0x426182, 0x416181, 0x3e5f7f, 0x3c5d7e, 0x3d5e7f, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3e5f7f, 0x416181, 0x456484, 0x466585, 0x466584, 0x446383, 0x406080, 0x3e5e7f, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3e5f80, 0x3f5f80, 0x3f5f80, 0x3f5f80, 0x3e5f7f, 0x2b4b6a, 0x1e3c5a,
+ 0x234360, 0x3a5a7a, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3f5f80, 0x8c9fb2, 0xc6d0d9, 0xc1cbd6, 0xb2bfcc, 0x8b9eb2, 0x53708d, 0x3c5d7e, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3c5d7e, 0x68819a, 0xc1ccd6, 0xced6df, 0xd0d8e0, 0xcfd7df, 0xcad3dc, 0xbbc7d2, 0x6a839c, 0x3c5d7e, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3e5f7f, 0x3f5f80, 0x305170, 0x1d3d5a,
+ 0x234360, 0x3a5a7a, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7e, 0x8295a9, 0xf1f3f4, 0xffffff, 0xffffff, 0xffffff, 0xdae0e6, 0x7189a1, 0x3c5d7e, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3c5d7e, 0x5d7792, 0xdadfe4, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xe9ecef, 0x698199, 0x3c5c7d, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5e7f, 0x3e5f7f, 0x345574, 0x1f3f5d,
+ 0x234360, 0x3a5a7a, 0x3e5e7f, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3c5c7c, 0x7b8fa3, 0xf2f3f5, 0xffffff, 0xffffff, 0xffffff, 0xe6eaee, 0x69829b, 0x3b5c7d, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3c5c7d, 0x5a748e, 0xd9dee4, 0xffffff, 0xffffff, 0xe6e9ed, 0x6c8399, 0x3c5c7d, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7e, 0x3e5e7f, 0x375777, 0x21425f,
+ 0x234360, 0x395a79, 0x3e5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3e5e7e, 0xb7c2cd, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xd5dce3, 0x55718e, 0x3b5c7d, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x395a7b, 0x94a5b6, 0xffffff, 0xffffff, 0x99a9b9, 0x3a5b7b, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3d5e7e, 0x3e5e7e, 0x385979, 0x23425f,
+ 0x234360, 0x395979, 0x3d5e7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3a5a7c, 0x8c9eb1, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xb9c4d0, 0x456483, 0x3c5d7d, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3a5b7c, 0x7a90a6, 0xfdfdfd, 0xf8f9fa, 0x6e859d, 0x3a5b7c, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x395979, 0x234360,
+ 0x234360, 0x395979, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3a5a7c, 0x7a90a5, 0xfefefe, 0xe7eaee, 0xb3bdc8, 0xfafbfb, 0xffffff, 0xfcfdfd, 0x97a8ba, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3a5b7c, 0x71889f, 0xfafbfc, 0xf0f2f4, 0x5e7893, 0x3b5b7c, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x3d5d7e, 0x395979, 0x234360,
+ 0x234360, 0x395979, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3a5a7b, 0x7289a0, 0xfdfdfd, 0xd2d9e0, 0x4b6784, 0xacb8c5, 0xffffff, 0xffffff, 0xf1f3f6, 0x758ca3, 0x3a5b7c, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3a5a7b, 0x6d849d, 0xf9fafb, 0xe8ecef, 0x54708c, 0x3b5c7c, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3c5c7d, 0x3a5b7b, 0x395a7b, 0x3a5a7b, 0x395a7b, 0x395a7b, 0x3b5c7c, 0x3c5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x3d5d7d, 0x395979, 0x234360,
+ 0x234360, 0x385879, 0x3c5d7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x395a7b, 0x6d859d, 0xfbfcfc, 0xcbd3dc, 0x406080, 0x4b6785, 0xc9d1d9, 0xffffff, 0xffffff, 0xdce1e7, 0x587490, 0x3a5b7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x395a7b, 0x6b839b, 0xf9fafb, 0xe2e7eb, 0x4f6b89, 0x3b5b7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3b5c7c, 0x3a5a7c, 0x496785, 0x6c849d, 0x8da0b3, 0x99aabb, 0x95a7b8, 0x7e93a9, 0x55718e, 0x3c5c7d, 0x3b5c7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5d7d, 0x385879, 0x234360,
+ 0x234360, 0x385879, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x395a7b, 0x69829a, 0xfafafb, 0xc7d0d9, 0x405f7f, 0x395a7b, 0x607992, 0xe4e8ec, 0xffffff, 0xffffff, 0xbcc7d3, 0x456483, 0x3b5b7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x395a7b, 0x6a829b, 0xf9fafb, 0xdee3e9, 0x4c6987, 0x3b5b7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3a5b7c, 0x466483, 0x8a9db1, 0xd5dce3, 0xf7f8fa, 0xf6f7f8, 0xf5f6f7, 0xfefefe, 0xffffff, 0xe4e9ed, 0x96a8b9, 0x456483, 0x3b5b7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x385879, 0x234360,
+ 0x234360, 0x385878, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x395a7b, 0x678099, 0xf9f9fa, 0xc5ced8, 0x3f5f7f, 0x3c5c7d, 0x395a7b, 0x8194a7, 0xf7f8f9, 0xffffff, 0xfdfdfe, 0x97a8ba, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x395a7b, 0x69819a, 0xf9fafb, 0xdbe1e7, 0x496785, 0x3b5b7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3a5b7c, 0x4f6c8a, 0xbbc6d2, 0xfeffff, 0xf0f1f3, 0x9caab8, 0x667d94, 0x5f7790, 0x8193a6, 0xdadfe4, 0xffffff, 0xfefefe, 0xacbac8, 0x426181, 0x3b5b7c, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x3c5c7d, 0x385878, 0x234360,
+ 0x234360, 0x375878, 0x3c5c7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x39597b, 0x657e98, 0xf8f9fa, 0xc5ced7, 0x3f5e7e, 0x3b5b7c, 0x3b5b7c, 0x3e5d7d, 0xaab6c3, 0xffffff, 0xffffff, 0xf1f3f5, 0x7289a1, 0x39597b, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x39597a, 0x69829a, 0xf9fafb, 0xd9dfe5, 0x486684, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3a5b7c, 0x456383, 0xbac6d1, 0xffffff, 0xeef0f3, 0x768a9f, 0x395979, 0x38597a, 0x39597b, 0x375779, 0x5f7891, 0xe3e7eb, 0xffffff, 0xfafbfc, 0x8095aa, 0x39597b, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3c5c7c, 0x375878, 0x234360,
+ 0x234360, 0x375778, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x38597a, 0x647d97, 0xf7f9fa, 0xc6cfd8, 0x3f5e7e, 0x3b5b7c, 0x3b5b7c, 0x3a5a7b, 0x4d6986, 0xd1d8de, 0xffffff, 0xffffff, 0xdae0e6, 0x55718e, 0x39597b, 0x3b5b7c, 0x3b5b7c, 0x38597a, 0x6b839c, 0xfafbfb, 0xd8dee4, 0x476584, 0x3a5a7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x39597b, 0x8c9eb2, 0xfdfdfe, 0xffffff, 0x9cabba, 0x39597a, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x38587a, 0x9dacbb, 0xffffff, 0xffffff, 0xc7d0d9, 0x426180, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x375778, 0x234360,
+ 0x234360, 0x375778, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x38597a, 0x647d97, 0xf7f8fa, 0xc7d0d9, 0x3f5e7f, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x38597a, 0x6c8299, 0xeff1f3, 0xffffff, 0xffffff, 0xbac5d1, 0x436281, 0x3a5a7b, 0x3b5b7c, 0x38597a, 0x6c849c, 0xfafbfc, 0xd8dee4, 0x476583, 0x3a5a7b, 0x3b5b7c, 0x3b5b7c, 0x3a5a7b, 0x4c6987, 0xdae0e6, 0xffffff, 0xf0f2f4, 0x5f7892, 0x39597a, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x37587a, 0x778ca3, 0xfcfcfd, 0xffffff, 0xeaedf1, 0x56718e, 0x39597b, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x375778, 0x234360,
+ 0x234360, 0x375777, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x38587a, 0x647d97, 0xf7f8fa, 0xc8d1da, 0x3f5e7f, 0x3a5a7b, 0x3b5b7c, 0x3b5b7c, 0x3a5a7c, 0x3a5a7a, 0x96a5b5, 0xfdfefe, 0xffffff, 0xfcfdfd, 0x94a6b8, 0x3a5a7b, 0x3a5a7b, 0x38587a, 0x6e859d, 0xfbfcfc, 0xd8dee4, 0x466483, 0x3a5a7b, 0x3b5b7c, 0x3b5b7c, 0x38587a, 0x7a90a6, 0xfbfcfc, 0xffffff, 0xe2e6eb, 0x4b6886, 0x365779, 0x375879, 0x375879, 0x38587a, 0x39597a, 0x39597a, 0x8296ab, 0xfdfdfd, 0xffffff, 0xf1f3f6, 0x5e7893, 0x38597a, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x3b5b7c, 0x375777, 0x234360,
+ 0x234360, 0x365677, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x385879, 0x657e97, 0xf8f9fa, 0xc9d2da, 0x3f5e7e, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x39597b, 0x446280, 0xc2cad3, 0xffffff, 0xffffff, 0xf0f3f5, 0x7188a0, 0x38587a, 0x375879, 0x71879f, 0xfcfdfd, 0xd8dee4, 0x466483, 0x39597b, 0x3a5a7b, 0x3a5a7b, 0x39597a, 0xa7b5c4, 0xffffff, 0xffffff, 0xf1f3f5, 0x93a4b6, 0x788ea5, 0x8196ab, 0x8da0b3, 0x9aabbc, 0xa9b7c6, 0xb9c5d0, 0xe9ecf0, 0xffffff, 0xffffff, 0xd4dae1, 0x4b6785, 0x39597b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x365677, 0x234360,
+ 0x234360, 0x365677, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x375879, 0x677f98, 0xf9fafb, 0xcad3db, 0x405e7e, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x385879, 0x5d7690, 0xe5e8ec, 0xffffff, 0xffffff, 0xdbe1e7, 0x56728e, 0x355577, 0x768ca3, 0xfefefe, 0xd8dee4, 0x466483, 0x39597b, 0x3a5a7b, 0x3a5a7b, 0x3c5c7c, 0xbfc9d4, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xf9f9fa, 0xf4f5f7, 0xeff1f3, 0xe9ecee, 0xe1e5e9, 0xd7dce1, 0xc9d0d7, 0xb6c0ca, 0x9ba9b8, 0x5d768f, 0x39597a, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x365677, 0x234360,
+ 0x234360, 0x365677, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x375779, 0x6a829b, 0xfafbfc, 0xcdd4dd, 0x405f7f, 0x39597b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x385879, 0x8396a9, 0xf9fafa, 0xffffff, 0xffffff, 0xbec8d3, 0x416080, 0x8094a9, 0xffffff, 0xd8dee4, 0x466382, 0x39597a, 0x3a5a7b, 0x3a597b, 0x3e5d7d, 0xc4cdd7, 0xffffff, 0xffffff, 0xf8f9fa, 0xa7b3c0, 0x73879c, 0x647a92, 0x58718b, 0x506a86, 0x496481, 0x435f7e, 0x3e5c7b, 0x395879, 0x375678, 0x385879, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x3a5a7b, 0x365677, 0x234360,
+ 0x234360, 0x365676, 0x3a597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x365779, 0x6f869e, 0xfcfdfd, 0xd1d8e0, 0x426080, 0x39597a, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597a, 0x3e5c7c, 0xafbbc7, 0xffffff, 0xffffff, 0xfefefe, 0x9dadbd, 0x9babbb, 0xffffff, 0xd7dee4, 0x456382, 0x39597a, 0x39597b, 0x39597a, 0x3c5b7c, 0xbfc9d3, 0xffffff, 0xffffff, 0xd6dce2, 0x436180, 0x355678, 0x375779, 0x375779, 0x38587a, 0x38587a, 0x39597a, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x39597b, 0x3a597b, 0x365677, 0x234360,
+ 0x23435f, 0x365576, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x365678, 0x768ba2, 0xfefefe, 0xd8dee4, 0x456382, 0x38587a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x375879, 0x506b87, 0xd6dce2, 0xffffff, 0xffffff, 0xf7f8f9, 0xeceff2, 0xffffff, 0xd7dee4, 0x456382, 0x38587a, 0x39597a, 0x39597a, 0x385879, 0xabb8c5, 0xffffff, 0xffffff, 0xd6dce3, 0x446281, 0x38587a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x365576, 0x23435f,
+ 0x23435f, 0x355576, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x365678, 0x8295aa, 0xffffff, 0xe1e6eb, 0x4c6886, 0x385879, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x365678, 0x6f859b, 0xf1f3f5, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xd9dfe5, 0x466382, 0x38587a, 0x39597a, 0x39597a, 0x365678, 0x8598ac, 0xffffff, 0xffffff, 0xedf0f3, 0x5a7590, 0x375778, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x39597a, 0x355576, 0x23435f,
+ 0x22435f, 0x355576, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x355578, 0x95a6b7, 0xffffff, 0xeff1f4, 0x5a7490, 0x365678, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x38587a, 0x395879, 0x98a7b7, 0xfefefe, 0xffffff, 0xffffff, 0xffffff, 0xdce1e7, 0x486584, 0x385779, 0x39587a, 0x39587a, 0x375779, 0x55708b, 0xe7ebee, 0xffffff, 0xffffff, 0x9fafbf, 0x38587a, 0x385879, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x385779, 0x365678, 0x375779, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x39587a, 0x355576, 0x22435f,
+ 0x21415f, 0x345475, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x375779, 0x3a5a7b, 0xbbc6d1, 0xffffff, 0xfcfdfd, 0x7c91a7, 0x355577, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x375779, 0x43607f, 0xbfc8d1, 0xffffff, 0xffffff, 0xffffff, 0xdfe4e9, 0x496685, 0x375779, 0x38587a, 0x38587a, 0x38587a, 0x385879, 0x9fadbc, 0xffffff, 0xffffff, 0xf2f4f6, 0x8699ae, 0x3c5b7c, 0x355577, 0x365678, 0x375779, 0x365678, 0x365678, 0x476484, 0x8094aa, 0x8195aa, 0x39597a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x38587a, 0x355576, 0x22435f,
+ 0x21415d, 0x335374, 0x38587a, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x375779, 0x3c5b7c, 0x879aae, 0xf4f6f8, 0xffffff, 0xffffff, 0xc9d1da, 0x466483, 0x375779, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x365678, 0x546e89, 0xd5dbe1, 0xffffff, 0xffffff, 0xdee3e8, 0x486584, 0x375778, 0x385879, 0x385879, 0x385879, 0x375778, 0x496583, 0xc7cfd7, 0xffffff, 0xffffff, 0xf7f8f9, 0xb7c3cf, 0x758ca3, 0x58728e, 0x516d8a, 0x617a95, 0x92a4b6, 0xd5dce3, 0xfefefe, 0xa6b3c1, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x385879, 0x355475, 0x22435f,
+ 0x1f3e5c, 0x315171, 0x385879, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x375779, 0x3e5d7d, 0xa8b5c4, 0xfcfcfd, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x94a4b6, 0x365678, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x365577, 0x5c748e, 0xd1d7de, 0xffffff, 0xc9d1da, 0x3f5d7d, 0x375779, 0x385779, 0x385779, 0x385779, 0x385779, 0x365678, 0x516b87, 0xbdc6cf, 0xfbfcfc, 0xffffff, 0xffffff, 0xfcfcfd, 0xeef1f4, 0xe9edf0, 0xf5f6f8, 0xffffff, 0xf5f6f7, 0xa8b4c1, 0x476381, 0x375678, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x385779, 0x345475, 0x22435f,
+ 0x1e3c58, 0x2e4e6e, 0x385779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x3e5d7d, 0x8899ab, 0xabb6c2, 0xafbac5, 0xb0bac5, 0xb0bac6, 0xa8b4c0, 0x677e96, 0x365678, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x355577, 0x4b6683, 0x7f91a4, 0x5f7790, 0x375678, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x365578, 0x405d7c, 0x7c8fa3, 0xbec7d0, 0xe1e4e8, 0xeef0f2, 0xf2f4f5, 0xeef0f2, 0xdbe0e4, 0xadb8c4, 0x677d94, 0x395878, 0x365678, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x345475, 0x22435f,
+ 0x1b3a56, 0x2b4a69, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375678, 0x345476, 0x355476, 0x365576, 0x365576, 0x365576, 0x355476, 0x355577, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x365678, 0x335476, 0x355577, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x365678, 0x345476, 0x3a5878, 0x496481, 0x576f89, 0x5b728c, 0x556e88, 0x45617f, 0x375677, 0x345477, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x375779, 0x345475, 0x22435f,
+ 0x17374f, 0x254563, 0x365577, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x365577, 0x355577, 0x355477, 0x355577, 0x365678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375778, 0x345374, 0x22435f,
+ 0x3f3f3f, 0x20405c, 0x325273, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x375678, 0x335374, 0x22435f,
+ 0x000000, 0x1d3a55, 0x2c4b6b, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x365678, 0x335374, 0x22435f,
+ 0x000000, 0x183952, 0x244562, 0x345476, 0x365678, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365678, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365678, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365578, 0x365678, 0x365578, 0x365578, 0x365578, 0x365578, 0x365678, 0x335274, 0x22415f,
+ 0x000000, 0x000000, 0x1f3d59, 0x2e4e6e, 0x365578, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x365577, 0x335273, 0x22415f,
+ 0x000000, 0x000000, 0x1c384f, 0x254462, 0x345475, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x365577, 0x325273, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x1d3c56, 0x2c4c6c, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x355577, 0x325273, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x1c2f4b, 0x22405f, 0x315172, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355476, 0x355476, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355476, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x355477, 0x325173, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x1b3651, 0x264564, 0x335375, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x355476, 0x325173, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x1d3955, 0x294868, 0x345376, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x345476, 0x315172, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x193333, 0x1d3c56, 0x2a4a6a, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x315072, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x1e2d3c, 0x1d3b57, 0x2a4969, 0x335375, 0x345376, 0x345376, 0x345376, 0x345375, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345375, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345375, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345376, 0x345375, 0x345375, 0x345376, 0x315072, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x1f2f3f, 0x1e3a55, 0x284766, 0x325173, 0x345375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x335375, 0x345375, 0x315072, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x1c1c38, 0x1b3750, 0x244361, 0x2f4e70, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x305072, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x17334a, 0x1f3d5a, 0x294868, 0x315072, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x304f72, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x19263f, 0x1b3750, 0x23405d, 0x2a4969, 0x304f71, 0x335274, 0x335275, 0x335275, 0x335275, 0x335274, 0x335275, 0x335275, 0x335275, 0x335274, 0x335274, 0x335275, 0x335275, 0x335275, 0x335274, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335274, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335274, 0x335275, 0x335275, 0x335274, 0x335275, 0x335275, 0x335275, 0x335275, 0x335274, 0x335275, 0x335275, 0x335275, 0x335274, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x304f71, 0x22415f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x172f3f, 0x1b364f, 0x203e5b, 0x264564, 0x2c4b6c, 0x2f4f71, 0x315173, 0x325174, 0x325275, 0x335275, 0x335275, 0x335275, 0x325275, 0x335275, 0x335275, 0x335275, 0x335275, 0x325275, 0x325275, 0x335275, 0x335275, 0x325275, 0x335275, 0x335275, 0x335275, 0x335275, 0x325275, 0x325275, 0x335275, 0x335275, 0x325275, 0x325275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x335275, 0x325275, 0x325274, 0x335275, 0x335275, 0x335275, 0x335275, 0x325275, 0x335275, 0x335275, 0x335275, 0x2d4c6d, 0x1f3f5a,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x0e2a38, 0x193049, 0x1c3952, 0x203e5a, 0x234260, 0x264665, 0x294868, 0x2b4a6a, 0x2b4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2c4b6c, 0x2a496a, 0x21405e, 0x19364f,
+ 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x112233, 0x172941, 0x173246, 0x1a344c, 0x1b374f, 0x1b3851, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1c3852, 0x1b374f, 0x193347, 0x000000
+}; \ No newline at end of file
diff --git a/src/boot/amd64-ci.make b/src/boot/amd64-ci.make
index 28017bf3..1d3fcce0 100644
--- a/src/boot/amd64-ci.make
+++ b/src/boot/amd64-ci.make
@@ -69,8 +69,8 @@ FLAG_GNU=-fshort-wchar -Wall -Wpedantic -Wextra -Werror -D__EFI_x86_64__ -mno-re
-DEFI_FUNCTION_WRAPPER -I./ -I../kernel $(DEBUG_MACRO) $(DISK_DRV) -I../ -c -nostdlib -fno-rtti -fno-exceptions \
-std=c++20 -DBOOTZ_GPT_SUPPORT -DBOOTZ_EPM_SUPPORT -D__HAVE_NE_API__ -DBOOTZ_USE_FB -D__NE_AMD64__ -D__NE__ -DNE_AUTO_FORMAT
-BOOTLOADER=ne_bootz
-KERNEL=ne_kernel
+BOOTLOADER=bootzldr.exe
+KERNEL_IMG=neoskrnl.exe
SYSCHK=chk.efi
BOOTNET=net.efi
SCIKIT=libSystem.dll
@@ -130,7 +130,7 @@ efi:
$(HTTP_GET) https://retrage.github.io/edk2-nightly/bin/DEBUGX64_OVMF.fd -O OVMF.fd
BINS=*.bin
-EXECUTABLES=ne_bootz ne_kernel OVMF.fd
+EXECUTABLES=bootzldr.exe neoskrnl.exe OVMF.fd
TARGETS=$(REM_FLAG) $(OBJ) $(BIN) $(IMG) $(IMG_2) $(EXECUTABLES)
diff --git a/src/boot/amd64-desktop.make b/src/boot/amd64-desktop.make
index 0854db60..228a8f49 100644
--- a/src/boot/amd64-desktop.make
+++ b/src/boot/amd64-desktop.make
@@ -49,12 +49,12 @@ DEBUG_MACRO = -D__DEBUG__
endif
ifeq ($(KVM_SUPPORT),)
-EMU_FLAGS=-M q35 -smp 4 -m 8G \
+EMU_FLAGS=-M q35 -smp 6 -m 8G \
-bios $(BIOS) -cdrom $(BOOT) -boot d
endif
ifneq ($(KVM_SUPPORT),)
-EMU_FLAGS=-M q35 -smp 4 -m 8G \
+EMU_FLAGS=-M q35 -smp 6 -m 8G \
-bios $(BIOS) -M q35 -cdrom $(BOOT) -boot d -accel kvm
endif
@@ -71,12 +71,16 @@ FLAG_GNU=-fshort-wchar -D__EFI_x86_64__ -D__nekernel_allow_non_nekernel_pe -Wall
-DEFI_FUNCTION_WRAPPER -I./ -I../kernel $(DISK_DRV) -I../ -c -nostdlib -fno-rtti -fno-exceptions \
-std=c++20 -DBOOTZ_GPT_SUPPORT -D__HAVE_NE_API__ -DBOOTZ_USE_FB -D__NE_AMD64__ -D__NE__ -DNE_AUTO_FORMAT -Wl,--disable-reloc-section
-BOOTLOADER=ne_bootz
-KERNEL=ne_kernel
+BOOTLOADER=bootzldr.exe
+KERNEL_IMG=neoskrnl.exe
SYSCHK=chk.efi
BOOTNET=net.efi
+MEMTEST=memtest.efi
SCIKIT=libSystem.dll
DDK=libDDK.dll
+POSIXWRAPPER=libPOSIXWrapper.dll
+PTHREAD=libPThread.dll
+HAL=hal.x64.dll
.PHONY: invalid-recipe
invalid-recipe:
@@ -89,10 +93,14 @@ all: compile-amd64
$(LD_GNU) $(OBJ) $(LD_FLAGS) -o src/$(BOOTLOADER)
$(COPY) src/$(BOOTLOADER) src/root/EFI/BOOT/BOOTX64.EFI
$(COPY) src/$(BOOTLOADER) src/root/EFI/BOOT/BOOTZ.EFI
- $(COPY) ../kernel/$(KERNEL) src/root/$(KERNEL)
+ $(COPY) ../kernel/$(KERNEL_IMG) src/root/$(KERNEL_IMG)
$(COPY) ./modules/SysChk/$(SYSCHK) src/root/$(SYSCHK)
$(COPY) ./modules/BootNet/$(BOOTNET) src/root/$(BOOTNET)
+ $(COPY) ./modules/MemoryTest/$(MEMTEST) src/root/$(MEMTEST)
$(COPY) ../libSystem/$(SCIKIT) src/root/$(SCIKIT)
+ $(COPY) ../libPOSIXWrapper/$(POSIXWRAPPER) src/root/$(POSIXWRAPPER)
+ # $(COPY) ../libPThread/$(PTHREAD) src/root/$(PTHREAD)
+ # $(COPY) ../hal/$(HAL) src/root/$(HAL)
$(COPY) src/$(BOOTLOADER) src/root/$(BOOTLOADER)
$(COPY) ../libDDK/$(DDK) src/root/$(DDK)
@@ -140,7 +148,7 @@ efi:
$(HTTP_GET) https://retrage.github.io/edk2-nightly/bin/DEBUGX64_OVMF.fd -O OVMF.fd
BINS=*.bin
-EXECUTABLES=ne_bootz ne_kernel OVMF.fd
+EXECUTABLES=bootzldr.exe neoskrnl.exe OVMF.fd
TARGETS=$(REM_FLAG) $(OBJ) $(BIN) $(IMG) $(IMG_2) $(EXECUTABLES)
diff --git a/src/boot/arm64-desktop.make b/src/boot/arm64-desktop.make
index 55004175..01282950 100644
--- a/src/boot/arm64-desktop.make
+++ b/src/boot/arm64-desktop.make
@@ -47,10 +47,11 @@ FLAG_GNU=-fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__NE_ARM64__ -fno-
-target aarch64-unknown-windows \
-std=c++20 -DBOOTZ_EPM_SUPPORT -D__nekernel_allow_non_nekernel_pe -DBOOTZ_USE_FB -D__FSKIT_USE_NEFS__ -D__BOOTZ_STANDALONE__ -D__NEKERNEL__ -D__BOOTZ__ -D__HAVE_NE_API__ -D__NE__ -I../ -I../kernel
-BOOT_LOADER=ne_bootz
-KERNEL=ne_kernel
+BOOT_LOADER=bootzldr.exe
+KERNEL_IMG=neoskrnl.exe
SYSCHK=chk.efi
STARTUP=startup.efi
+HAL=hal.arm64.dll
.PHONY: invalid-recipe
invalid-recipe:
@@ -62,9 +63,11 @@ all: compile
$(LD_GNU) $(OBJ) $(LD_FLAGS) /out:src/$(BOOT_LOADER)
$(COPY) src/$(BOOT_LOADER) src/root/EFI/BOOT/BOOTAA64.EFI
$(COPY) src/$(BOOT_LOADER) src/root/EFI/BOOT/BootZ.EFI
- $(COPY) ../kernel/$(KERNEL) src/root/$(KERNEL)
+ $(COPY) ../kernel/$(KERNEL_IMG) src/root/$(KERNEL_IMG)
$(COPY) ./modules/SysChk/$(SYSCHK) src/root/$(SYSCHK)
$(COPY) src/$(BOOT_LOADER) src/root/$(BOOT_LOADER)
+ # $(COPY) ../libPThread/$(PTHREAD) src/root/$(PTHREAD)
+ # $(COPY) ../hal/$(HAL) src/root/$(HAL)
ifneq ($(DEBUG_SUPPORT), )
DEBUG = -D__DEBUG__
@@ -94,7 +97,7 @@ efi:
$(HTTP_GET) https://retrage.github.io/edk2-nightly/bin/DEBUGAARCH64_QEMU_EFI.fd -O OVMF.fd
BINS=*.bin
-EXECUTABLES=ne_bootz ne_kernel OVMF.fd
+EXECUTABLES=bootzldr.exe neoskrnl.exe OVMF.fd
TARGETS=$(REM_FLAG) $(OBJ) $(BIN) $(IMG) $(IMG_2) $(EXECUTABLES)
diff --git a/src/boot/modules/BootNet/BootNet.cpp b/src/boot/modules/BootNet/BootNet.cpp
index e4cbd073..e31d9460 100644
--- a/src/boot/modules/BootNet/BootNet.cpp
+++ b/src/boot/modules/BootNet/BootNet.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
#include <FirmwareKit/EFI/API.h>
diff --git a/src/boot/modules/BootNet/README.md b/src/boot/modules/BootNet/README.md
index 9c013d6f..fb5e71aa 100644
--- a/src/boot/modules/BootNet/README.md
+++ b/src/boot/modules/BootNet/README.md
@@ -1,5 +1,5 @@
# BootNet
-This module network boots a copy of `ne_kernel` via its NetBoot protocol.
+This module network boots a copy of `neoskrnl.exe` via its NetBoot protocol.
This is for EFI modules only, as the NeBoot firmware already supports it.
diff --git a/src/boot/modules/BootNet/amd64.json b/src/boot/modules/BootNet/amd64.json
index 41ce26e1..e654b77c 100644
--- a/src/boot/modules/BootNet/amd64.json
+++ b/src/boot/modules/BootNet/amd64.json
@@ -21,7 +21,7 @@
"-std=c++20",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,BootNetModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,BootNetModuleMain"
],
"cpp_macros": [
"__BOOTZ__",
diff --git a/src/boot/modules/BootNet/arm64.json b/src/boot/modules/BootNet/arm64.json
index f939083e..bed477a4 100644
--- a/src/boot/modules/BootNet/arm64.json
+++ b/src/boot/modules/BootNet/arm64.json
@@ -21,7 +21,7 @@
"-std=c++20",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,BootNetModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,BootNetModuleMain"
],
"cpp_macros": [
"__BOOTZ__",
diff --git a/src/boot/modules/MemoryTest/MemoryTest.cpp b/src/boot/modules/MemoryTest/MemoryTest.cpp
new file mode 100644
index 00000000..49f28dcb
--- /dev/null
+++ b/src/boot/modules/MemoryTest/MemoryTest.cpp
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2024-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 <BootKit/BootKit.h>
+#include <BootKit/BootThread.h>
+#include <FirmwareKit/EFI/API.h>
+
+EXTERN_C Int32 MemoryTestModuleMain(Kernel::HEL::BootInfoHeader* handover) {
+ fw_init_efi((EfiSystemTable*) handover->f_FirmwareCustomTables[Kernel::HEL::kHandoverTableST]);
+
+ Boot::BootTextWriter writer;
+ writer.Write("MemoryTest: Testing Memory...\r");
+
+ constexpr auto kTestValue = 0x20000000L;
+
+ Int32* mem = (Int32*) kTestValue;
+ if (!mem) return kEfiFail;
+
+ auto prev = *mem;
+ *mem = 42;
+ if (*mem != 42) {
+ return kEfiFail;
+ }
+
+ *mem = prev;
+
+ return kEfiOk;
+}
diff --git a/src/boot/modules/MemoryTest/MemoryTestStartup.S b/src/boot/modules/MemoryTest/MemoryTestStartup.S
new file mode 100644
index 00000000..a5832ee6
--- /dev/null
+++ b/src/boot/modules/MemoryTest/MemoryTestStartup.S
@@ -0,0 +1,24 @@
+;; /*
+;; * ========================================================
+;; *
+;; * BootZ
+;; * Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
+;; *
+;; * ========================================================
+;; */
+
+#ifdef __NE_AMD64__
+.code64
+.intel_syntax noprefix
+#endif
+
+#define kTypeDriver 101
+#define kArchAmd64 122
+#define kHandoverMagic 0xBADCC
+
+.section .ldr
+
+.quad kHandoverMagic
+.word kTypeDriver
+.word 0
+.word kArchAmd64 \ No newline at end of file
diff --git a/src/boot/modules/MemoryTest/README.md b/src/boot/modules/MemoryTest/README.md
new file mode 100644
index 00000000..fac97400
--- /dev/null
+++ b/src/boot/modules/MemoryTest/README.md
@@ -0,0 +1,3 @@
+# MemoryTest:
+
+This module tests the memory of a x64 machine by allocating to it.
diff --git a/src/boot/modules/MemoryTest/amd64.json b/src/boot/modules/MemoryTest/amd64.json
new file mode 100644
index 00000000..8d1f8bd3
--- /dev/null
+++ b/src/boot/modules/MemoryTest/amd64.json
@@ -0,0 +1,35 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../",
+ "../../",
+ "../../../kernel",
+ "../../../",
+ "./"
+ ],
+ "sources_path": [
+ "*.cpp",
+ "*.S",
+ "../../src/HEL/AMD64/*.cpp",
+ "../../src/HEL/AMD64/*.S",
+ "../../src/*.cpp"
+ ],
+ "output_name": "memtest.efi",
+ "compiler_flags": [
+ "-nostdlib",
+ "-std=c++20",
+ "-fno-rtti",
+ "-fno-exceptions",
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,MemoryTestModuleMain"
+ ],
+ "cpp_macros": [
+ "__BOOTZ__",
+ "__BOOTZ_STANDALONE__",
+ "__NE_AMD64__",
+ "__nekernel_max_cores=8 ",
+ "kMemTestVersionHighest=0x0100",
+ "kMemTestVersionLowest=0x0100",
+ "kMemTestEFIVersion=0x0100"
+ ]
+}
diff --git a/src/boot/modules/MemoryTest/arm64.json b/src/boot/modules/MemoryTest/arm64.json
new file mode 100644
index 00000000..41590bb4
--- /dev/null
+++ b/src/boot/modules/MemoryTest/arm64.json
@@ -0,0 +1,35 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": [
+ "../",
+ "../../",
+ "../../../kernel",
+ "../../../",
+ "./"
+ ],
+ "sources_path": [
+ "*.cpp",
+ "*.S",
+ "../../src/HEL/ARM64/*.cpp",
+ "../../src/HEL/ARM64/*.S",
+ "../../src/*.cpp"
+ ],
+ "output_name": "memtest.efi",
+ "compiler_flags": [
+ "-nostdlib",
+ "-std=c++20",
+ "-fno-rtti",
+ "-fno-exceptions",
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,MemoryTestModuleMain"
+ ],
+ "cpp_macros": [
+ "__BOOTZ__",
+ "__BOOTZ_STANDALONE__",
+ "__NE_ARM64__",
+ "__nekernel_max_cores=8 ",
+ "kMemTestVersionHighest=0x0100",
+ "kMemTestVersionLowest=0x0100",
+ "kMemTestEFIVersion=0x0100"
+ ]
+}
diff --git a/src/boot/modules/SysChk/SysChk.cpp b/src/boot/modules/SysChk/SysChk.cpp
index 336f4814..1a93d748 100644
--- a/src/boot/modules/SysChk/SysChk.cpp
+++ b/src/boot/modules/SysChk/SysChk.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
#include <BootKit/HW/SATA.h>
diff --git a/src/boot/modules/SysChk/amd64-ahci-epm.json b/src/boot/modules/SysChk/amd64-ahci-epm.json
index 43b0bff7..99037618 100644
--- a/src/boot/modules/SysChk/amd64-ahci-epm.json
+++ b/src/boot/modules/SysChk/amd64-ahci-epm.json
@@ -13,6 +13,7 @@
"../../src/New+Delete.cpp",
"../../../kernel/HALKit/AMD64/PCI/*.cpp",
"../../../kernel/HALKit/AMD64/Storage/*.cpp",
+ "../../../kernel/HALKit/AMD64/Network/*.cpp",
"../../../kernel/src/Storage/*.cpp",
"../../../kernel/src/Network/*.cpp",
"../../../kernel/HALKit/AMD64/*.cpp",
@@ -25,7 +26,7 @@
"-std=c++20",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,SysChkModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,SysChkModuleMain"
],
"cpp_macros": [
"__NEOSKRNL__",
diff --git a/src/boot/modules/SysChk/amd64-ahci-gpt.json b/src/boot/modules/SysChk/amd64-ahci-gpt.json
index d36f66bf..d9160952 100644
--- a/src/boot/modules/SysChk/amd64-ahci-gpt.json
+++ b/src/boot/modules/SysChk/amd64-ahci-gpt.json
@@ -13,7 +13,9 @@
"../../src/New+Delete.cpp",
"../../../kernel/HALKit/AMD64/PCI/*.cpp",
"../../../kernel/HALKit/AMD64/Storage/*.cpp",
+ "../../../kernel/HALKit/AMD64/Network/*.cpp",
"../../../kernel/src/Storage/*.cpp",
+ "../../../kernel/src/Network/*.cpp",
"../../../kernel/HALKit/AMD64/*.cpp",
"../../../kernel/HALKit/AMD64/*.s",
"../../../kernel/src/*.cpp"
@@ -24,7 +26,7 @@
"-std=c++20",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,SysChkModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,SysChkModuleMain"
],
"cpp_macros": [
"__NEOSKRNL__",
diff --git a/src/boot/modules/SysChk/amd64-pio-epm.json b/src/boot/modules/SysChk/amd64-pio-epm.json
index 7e4b1d4e..ffcca945 100644
--- a/src/boot/modules/SysChk/amd64-pio-epm.json
+++ b/src/boot/modules/SysChk/amd64-pio-epm.json
@@ -31,7 +31,7 @@
"-std=c++20",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,SysChkModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,SysChkModuleMain"
],
"cpp_macros": [
"__NEOSKRNL__",
diff --git a/src/boot/modules/SysChk/amd64-pio-gpt.json b/src/boot/modules/SysChk/amd64-pio-gpt.json
index d954daed..5457f8a9 100644
--- a/src/boot/modules/SysChk/amd64-pio-gpt.json
+++ b/src/boot/modules/SysChk/amd64-pio-gpt.json
@@ -24,7 +24,7 @@
"-std=c++20",
"-fno-rtti",
"-fno-exceptions",
- "-Wl,--subsystem=17,--image-base,0x10000000,-e,SysChkModuleMain"
+ "-Wl,--subsystem=17,--image-base,0x20000000,-e,SysChkModuleMain"
],
"cpp_macros": [
"__NEOSKRNL__",
diff --git a/src/boot/src/BootFileReader.cpp b/src/boot/src/BootFileReader.cpp
index 7f6da47e..0ca48cd3 100644
--- a/src/boot/src/BootFileReader.cpp
+++ b/src/boot/src/BootFileReader.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/Platform.h>
#include <BootKit/Protocol.h>
diff --git a/src/boot/src/BootSupport.cpp b/src/boot/src/BootSupport.cpp
index 232ac965..2680e439 100644
--- a/src/boot/src/BootSupport.cpp
+++ b/src/boot/src/BootSupport.cpp
@@ -16,13 +16,13 @@
#define kAtExitMaxDestructors (128U)
typedef struct atexit_func_entry {
- void(*destructor_func)();
+ void (*destructor_func)();
} atexit_func_entry_t;
typedef long long uarch_t;
atexit_func_entry_t __atexit_funcs[kAtExitMaxDestructors];
-uarch_t __atexit_func_count;
+uarch_t __atexit_func_count;
/// @note This function is a stub, not implemented by the bootloader as of right now. (AMLALE)
EXTERN_C int atexit(void (*f)()) {
diff --git a/src/boot/src/BootThread.cpp b/src/boot/src/BootThread.cpp
index 19e87bae..19d7e8f8 100644
--- a/src/boot/src/BootThread.cpp
+++ b/src/boot/src/BootThread.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
#include <BootKit/Support.h>
@@ -14,9 +13,10 @@
#include <KernelKit/PE.h>
#include <KernelKit/PEF.h>
#include <modules/CoreGfx/TextGfx.h>
+#include "FirmwareKit/Handover.h"
// \brief This macro defines the maximum size of a image's stack.
-#define kBootThreadSz mib_cast(16)
+#define kBootThreadSz kib_cast(8)
/// @brief External boot services symbol.
EXTERN EfiBootServices* BS;
@@ -79,13 +79,6 @@ BootThread::BootThread(VoidPtr blob) : fStartAddress(nullptr), fBlob(blob) {
writer.Write("BootZ: Image-Base: ").Write(loadStartAddress).Write("\r");
- fStack = new UInt8[kBootThreadSz];
-
- if (!fStack) {
- writer.Write("BootZ: Unable to allocate the stack for the thread.\r");
- return;
- }
-
LDR_SECTION_HEADER_PTR sectPtr =
(LDR_SECTION_HEADER_PTR) (((Char*) opt_header_ptr) + header_ptr->SizeOfOptionalHeader);
@@ -180,36 +173,16 @@ Int32 BootThread::Start(HEL::BootInfoHeader* handover, Bool own_stack) {
return kEfiFail;
}
+ NE_UNUSED(own_stack);
+
fHandover = handover;
BootTextWriter writer;
+ writer.Write("BootThread: ").Write(fBlobName).Write("\r");
- writer.Write("BootZ: Starting: ").Write(fBlobName).Write("\r");
- writer.Write("BootZ: Handover address: ").Write((UIntPtr) fHandover).Write("\r");
-
- if (own_stack) {
- writer.Write("BootZ: Using it's own stack.\r");
- writer.Write("BootZ: Stack address: ").Write((UIntPtr) &fStack[kBootThreadSz - 1]).Write("\r");
- writer.Write("BootZ: Stack size: ").Write(kBootThreadSz).Write("\r");
-
- fHandover->f_StackTop = &fStack[kBootThreadSz - 1];
- fHandover->f_StackSz = kBootThreadSz;
-
- auto ret = rt_jump_to_address(fStartAddress, fHandover, &fStack[kBootThreadSz - 1]);
-
- // we don't need the stack anymore.
-
- delete[] fStack;
- fStack = nullptr;
-
- return ret;
- } else {
- writer.Write("BootZ: Using the bootloader's stack.\r");
-
- return reinterpret_cast<HEL::HandoverProc>(fStartAddress)(fHandover);
- }
+ auto ret = ((HEL::HandoverProc)fStartAddress)(fHandover);
- return kEfiFail;
+ return ret;
}
const Char* BootThread::GetName() {
diff --git a/src/boot/src/HEL/AMD64/BootAPI.S b/src/boot/src/HEL/AMD64/BootAPI.S
index 33c1f5d3..a3c37c78 100644
--- a/src/boot/src/HEL/AMD64/BootAPI.S
+++ b/src/boot/src/HEL/AMD64/BootAPI.S
@@ -28,16 +28,9 @@ sched_jump_to_task:
rt_jump_to_address:
mov rbx, rcx
mov rcx, rdx
- push rbx
- push rdx
mov rsp, r8
- push rax
jmp rbx
- pop rdx
- pop rbx
- pop rax
-
ret
rt_reset_hardware:
diff --git a/src/boot/src/HEL/AMD64/BootEFI.cpp b/src/boot/src/HEL/AMD64/BootEFI.cpp
index ffcf394c..d3492843 100644
--- a/src/boot/src/HEL/AMD64/BootEFI.cpp
+++ b/src/boot/src/HEL/AMD64/BootEFI.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
#include <FirmwareKit/EFI.h>
@@ -75,7 +74,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
Boot::Stop();
}
- writer.Write("BootZ: The NeKernel Bootloader. Copyright 2024-2026, Amlal El Mahrouss and al.\r");
+ writer.Write("BootZ: The NeKernel Loader. Copyright 2024-2026, Amlal El Mahrouss and al.\r");
for (SizeT index_vt = 0; index_vt < sys_table->NumberOfTableEntries; ++index_vt) {
Char* vendor_table =
@@ -121,8 +120,10 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
if (mp) {
mp->GetNumberOfProcessors(mp, &cnt_disabled, &cnt_enabled);
+ kHandoverHeader->f_NumberOfProcessors = cnt_enabled;
handover_hdr->f_HardwareTables.f_MultiProcessingEnabled = cnt_enabled > 1;
} else {
+ handover_hdr->f_NumberOfProcessors = 1;
handover_hdr->f_HardwareTables.f_MultiProcessingEnabled = NO;
}
@@ -179,6 +180,18 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
syschk_thread->Start(handover_hdr, NO);
}
+ Boot::BootFileReader reader_memtest(L"memtest.efi", image_handle);
+ reader_memtest.ReadAll(0);
+
+ if (reader_memtest.Blob()) {
+ auto memtest_thread = new Boot::BootThread(reader_memtest.Blob());
+
+ if (memtest_thread) {
+ memtest_thread->SetName("MemoryTest");
+ memtest_thread->Start(handover_hdr, NO);
+ }
+ }
+
handover_hdr->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
handover_hdr->f_Magic = kHandoverMagic;
@@ -204,6 +217,17 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
ST->RuntimeServices->GetVariable(L"/props/kern_ver", kEfiGlobalNamespaceVarGUID, nullptr, &sz_ver,
&ver);
+ UInt32 sz_smp_max = sizeof(UInt64);
+ UInt64 smp_max = 0;
+
+ ST->RuntimeServices->GetVariable(L"/props/smp_max", kEfiGlobalNamespaceVarGUID, nullptr,
+ &sz_smp_max, &smp_max);
+
+ /// This variable makes sure we enable the core we want to actually use.
+ if (smp_max > 0 && smp_max < kHandoverHeader->f_NumberOfProcessors) {
+ kHandoverHeader->f_NumberOfProcessors = smp_max;
+ }
+
if (ver < KERNEL_VERSION_BCD) {
ver = KERNEL_VERSION_BCD;
@@ -244,16 +268,20 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
handover_hdr->f_KernelImage = reader_kernel.Blob();
handover_hdr->f_KernelSz = reader_kernel.Size();
- kernel_thread.Start(handover_hdr, YES);
+ return kernel_thread.Start(handover_hdr, YES);
}
- Boot::BootFileReader reader_netboot(L"net.efi", image_handle);
- reader_netboot.ReadAll(0);
+ Boot::BootFileReader reader_net(L"memtest.efi", image_handle);
+ reader_net.ReadAll(0);
- if (!reader_netboot.Blob()) return kEfiFail;
+ if (reader_net.Blob()) {
+ auto net_thread = new Boot::BootThread(reader_net.Blob());
- auto netboot_thread = Boot::BootThread(reader_netboot.Blob());
- netboot_thread.SetName("BootNet");
+ if (net_thread) {
+ net_thread->SetName("BootNet");
+ net_thread->Start(handover_hdr, NO);
+ }
+ }
- return netboot_thread.Start(handover_hdr, NO);
+ return kEfiFail;
}
diff --git a/src/boot/src/HEL/AMD64/BootPlatform.cpp b/src/boot/src/HEL/AMD64/BootPlatform.cpp
index 85c8da57..dc52c5c1 100644
--- a/src/boot/src/HEL/AMD64/BootPlatform.cpp
+++ b/src/boot/src/HEL/AMD64/BootPlatform.cpp
@@ -3,25 +3,35 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/Platform.h>
#include <BootKit/Protocol.h>
#ifdef __BOOTZ_STANDALONE__
-/// @brief These functions are used for x64 backends only. Do not try to use the same name for other backends, use their ISA specific conventions.
+/// @brief These functions are used for x64 backends only. Do not try to use the same name for other
+/// backends, use their ISA specific conventions.
using namespace Boot;
-EXTERN_C void rt_halt() { asm volatile("hlt"); }
+EXTERN_C void rt_halt() {
+ asm volatile("hlt");
+}
-EXTERN_C void rt_cli() { asm volatile("cli"); }
+EXTERN_C void rt_cli() {
+ asm volatile("cli");
+}
-EXTERN_C void rt_sti() { asm volatile("sti"); }
+EXTERN_C void rt_sti() {
+ asm volatile("sti");
+}
-EXTERN_C void rt_cld() { asm volatile("cld"); }
+EXTERN_C void rt_cld() {
+ asm volatile("cld");
+}
-EXTERN_C void rt_std() { asm volatile("std"); }
+EXTERN_C void rt_std() {
+ asm volatile("std");
+}
#endif // __BOOTZ_STANDALONE__
diff --git a/src/boot/src/HEL/ARM64/BootEFI.cpp b/src/boot/src/HEL/ARM64/BootEFI.cpp
index 9c40c9c3..2cfacc22 100644
--- a/src/boot/src/HEL/ARM64/BootEFI.cpp
+++ b/src/boot/src/HEL/ARM64/BootEFI.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/BootThread.h>
#include <FirmwareKit/EFI.h>
@@ -95,8 +94,10 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
if (mp) {
mp->GetNumberOfProcessors(mp, &cnt_disabled, &cnt_enabled);
+ kHandoverHeader->f_NumberOfProcessors = cnt_enabled;
kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled = cnt_enabled > 1;
} else {
+ kHandoverHeader->f_NumberOfProcessors = 1;
kHandoverHeader->f_HardwareTables.f_MultiProcessingEnabled = NO;
}
@@ -123,7 +124,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
kHandoverHeader->f_FirmwareVendorLen = Boot::BStrLen(sys_table->FirmwareVendor);
- Boot::BootFileReader reader_kernel(L"ne_kernel", image_handle);
+ Boot::BootFileReader reader_kernel(L"neoskrnl.exe", image_handle);
reader_kernel.ReadAll(0);
diff --git a/src/boot/src/HEL/ARM64/BootPlatform.cpp b/src/boot/src/HEL/ARM64/BootPlatform.cpp
index 142ea621..238401fd 100644
--- a/src/boot/src/HEL/ARM64/BootPlatform.cpp
+++ b/src/boot/src/HEL/ARM64/BootPlatform.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/Platform.h>
#include <BootKit/Protocol.h>
@@ -12,7 +11,9 @@
using namespace Boot;
-EXTERN_C void rt_halt() { while (Yes); }
+EXTERN_C void rt_halt() {
+ while (Yes);
+}
EXTERN_C void rt_cli() {}
diff --git a/src/boot/src/New+Delete.cpp b/src/boot/src/New+Delete.cpp
index 4d7592be..f3f3d753 100644
--- a/src/boot/src/New+Delete.cpp
+++ b/src/boot/src/New+Delete.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <BootKit/BootKit.h>
#include <BootKit/Platform.h>
#include <BootKit/Protocol.h>
@@ -16,7 +15,7 @@
/// @return
void* operator new(size_t sz) {
if (sz == 0) ++sz;
-
+
void* buf = nullptr;
while (BS->AllocatePool(EfiMemoryType::EfiLoaderData, sz, &buf) != kEfiOk);
@@ -29,7 +28,7 @@ void* operator new(size_t sz) {
/// @return
void* operator new[](size_t sz) {
if (sz == 0) ++sz;
-
+
void* buf = nullptr;
BS->AllocatePool(EfiMemoryType::EfiLoaderData, sz, &buf);
@@ -38,7 +37,7 @@ void* operator new[](size_t sz) {
/// @brief Deletes the object.
/// @param buf the object.
-void operator delete(void* buf) {
+void operator delete(void* buf) noexcept {
if (!buf) return;
BS->FreePool(buf);
@@ -46,7 +45,7 @@ void operator delete(void* buf) {
/// @brief Deletes the object.
/// @param buf the object.
-void operator delete[](void* buf) {
+void operator delete[](void* buf) noexcept {
if (!buf) return;
BS->FreePool(buf);
@@ -55,7 +54,7 @@ void operator delete[](void* buf) {
/// @brief Deletes the object (array specific).
/// @param buf the object.
/// @param size it's size.
-void operator delete(void* buf, size_t size) {
+void operator delete(void* buf, size_t size) noexcept {
if (!buf) return;
SetMem(buf, 0, size);
@@ -65,7 +64,7 @@ void operator delete(void* buf, size_t size) {
/// @brief Deletes the object (array specific).
/// @param buf the object.
/// @param size it's size.
-void operator delete[](void* buf, size_t size) {
+void operator delete[](void* buf, size_t size) noexcept {
if (!buf) return;
SetMem(buf, 0, size);
diff --git a/src/boot/src/boot_rsrc.rsrc b/src/boot/src/boot_rsrc.rsrc
index e875fa24..2c4e469f 100644
--- a/src/boot/src/boot_rsrc.rsrc
+++ b/src/boot/src/boot_rsrc.rsrc
@@ -12,8 +12,8 @@ BEGIN
VALUE "FileDescription", "NeKernel OS Loader."
VALUE "FileVersion", BOOTLOADER_VERSION
VALUE "InternalName", "bootz"
- VALUE "LegalCopyright", "Copyright (C) 2024-2025, Amlal El Mahrouss licensed under the Apache 2.0 license."
- VALUE "OriginalFilename", "ne_bootz"
+ VALUE "LegalCopyright", "Copyright (C) 2024-2026, Amlal El Mahrouss licensed under the Apache 2.0 license."
+ VALUE "OriginalFilename", "bootzldr.exe"
VALUE "ProductName", "bootz"
VALUE "ProductVersion", BOOTLOADER_VERSION
END
diff --git a/src/hal/HAL/HAL.h b/src/hal/HAL/HAL.h
new file mode 100644
index 00000000..485eb5d6
--- /dev/null
+++ b/src/hal/HAL/HAL.h
@@ -0,0 +1,11 @@
+// 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/ne-kernel
+
+#ifndef HAL_HAL_H
+#define HAL_HAL_H
+
+#include <ArchKit/ArchKit.h>
+
+#endif \ No newline at end of file
diff --git a/src/hal/hal.dll.arm64.json b/src/hal/hal.dll.arm64.json
new file mode 100644
index 00000000..25565b3d
--- /dev/null
+++ b/src/hal/hal.dll.arm64.json
@@ -0,0 +1,21 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": [ "../", "./" ],
+ "sources_path": [ "ARM64/*.cpp" ],
+ "output_name": "hal.arm64.dll",
+ "compiler_flags": [
+ "-ffreestanding",
+ "-shared",
+ "-fPIC",
+ "-fno-rtti",
+ "-fno-exceptions",
+ "-Wl,--subsystem=17"
+ ],
+ "cpp_macros": [
+ "kHALVersion=0x0100",
+ "kHALVersionHighest=0x0100",
+ "kHALVersionLowest=0x0100"
+ ],
+ "description": "The NeSystem Hardware Abstraction Layer."
+}
diff --git a/src/hal/hal.dll.x64.json b/src/hal/hal.dll.x64.json
new file mode 100644
index 00000000..be49a29c
--- /dev/null
+++ b/src/hal/hal.dll.x64.json
@@ -0,0 +1,21 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": [ "../", "./" ],
+ "sources_path": [ "AMD64/*.cpp" ],
+ "output_name": "hal.x64.dll",
+ "compiler_flags": [
+ "-ffreestanding",
+ "-shared",
+ "-fPIC",
+ "-fno-rtti",
+ "-fno-exceptions",
+ "-Wl,--subsystem=17"
+ ],
+ "cpp_macros": [
+ "kHALVersion=0x0100",
+ "kHALVersionHighest=0x0100",
+ "kHALVersionLowest=0x0100"
+ ],
+ "description": "The NeSystem Hardware Abstraction Layer."
+}
diff --git a/src/kernel/HALKit/AMD64/HalCoreSystemCalls+DDK.cpp b/src/hal/src/AMD64/HalCoreSystemCalls+DDK.cpp
index a0632ff0..8942c4db 100644
--- a/src/kernel/HALKit/AMD64/HalCoreSystemCalls+DDK.cpp
+++ b/src/hal/src/AMD64/HalCoreSystemCalls+DDK.cpp
@@ -3,6 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#include <ArchKit/ArchKit.h>
+#include <hal/HAL/HAL.h>
namespace Kernel {} \ No newline at end of file
diff --git a/src/hal/src/AMD64/HalCoreSystemCalls+LibSystem.cpp b/src/hal/src/AMD64/HalCoreSystemCalls+LibSystem.cpp
new file mode 100644
index 00000000..61eebcc7
--- /dev/null
+++ b/src/hal/src/AMD64/HalCoreSystemCalls+LibSystem.cpp
@@ -0,0 +1,8 @@
+// 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 <hal/HAL/HAL.h>
+
+namespace Kernel {}
diff --git a/src/kernel/HALKit/AMD64/HalCoreSystemCalls+NeLaunch.cpp b/src/hal/src/AMD64/HalCoreSystemCalls+NeLaunch.cpp
index 2a770052..61eebcc7 100644
--- a/src/kernel/HALKit/AMD64/HalCoreSystemCalls+NeLaunch.cpp
+++ b/src/hal/src/AMD64/HalCoreSystemCalls+NeLaunch.cpp
@@ -3,6 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#include <ArchKit/ArchKit.h>
+#include <hal/HAL/HAL.h>
namespace Kernel {}
diff --git a/doc/requirements/.keep b/src/hal/src/ARM64/.keep
index e69de29b..e69de29b 100644
--- a/doc/requirements/.keep
+++ b/src/hal/src/ARM64/.keep
diff --git a/src/launch/.keep b/src/hint/doc/.keep
index e69de29b..e69de29b 100644
--- a/src/launch/.keep
+++ b/src/hint/doc/.keep
diff --git a/src/libMsg/.keep b/src/hint/obj/.keep
index e69de29b..e69de29b 100644
--- a/src/libMsg/.keep
+++ b/src/hint/obj/.keep
diff --git a/src/kernel/CompilerKit/Version.h b/src/kernel/CompilerKit/Version.h
index 090bec7c..8cce72b9 100644
--- a/src/kernel/CompilerKit/Version.h
+++ b/src/kernel/CompilerKit/Version.h
@@ -6,10 +6,10 @@
#ifndef COMPILERKIT_VERSION_H
#define COMPILERKIT_VERSION_H
-#define BOOTLOADER_VERSION "v0.1.3-bootz"
-#define KERNEL_VERSION "v0.1.3-krnl"
+#define BOOTLOADER_VERSION "v0.1.4-bootz"
+#define KERNEL_VERSION "v0.1.4-neoskrnl"
-#define BOOTLOADER_VERSION_BCD (0x0103)
-#define KERNEL_VERSION_BCD (0x0103)
+#define BOOTLOADER_VERSION_BCD (0x0104)
+#define KERNEL_VERSION_BCD (0x0104)
#endif
diff --git a/src/kernel/FSKit/Ext2+IFS.h b/src/kernel/FSKit/Ext2+IFS.h
index 51767677..8c904710 100644
--- a/src/kernel/FSKit/Ext2+IFS.h
+++ b/src/kernel/FSKit/Ext2+IFS.h
@@ -32,7 +32,7 @@ class Ext2Context final {
}
}
- Ext2Context(const Ext2Context&) = delete;
+ Ext2Context(const Ext2Context&) = delete;
Ext2Context& operator=(const Ext2Context&) = delete;
Ext2Context(Ext2Context&& other) : drive(other.drive), superblock(other.superblock) {
diff --git a/src/kernel/FSKit/OpenHeFS.h b/src/kernel/FSKit/OpenHeFS.h
index 9983f6ff..1e3c3921 100644
--- a/src/kernel/FSKit/OpenHeFS.h
+++ b/src/kernel/FSKit/OpenHeFS.h
@@ -8,7 +8,7 @@
#include <CompilerKit/CompilerKit.h>
#include <KernelKit/DriveMgr.h>
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#include <NeKit/Config.h>
#include <NeKit/Crc32.h>
#include <NeKit/KString.h>
@@ -267,7 +267,7 @@ inline UInt32 hefs_hour_get(ATime raw_atime) {
/// @return the minute value.
/// @note The minute is stored in the lower 8 bits of the ATime value.
inline UInt32 hefs_minute_get(ATime raw_atime) {
- return (raw_atime) &0xFF;
+ return (raw_atime) & 0xFF;
}
inline constexpr UInt32 kOpenHeFSBaseYear = 1970;
@@ -387,10 +387,10 @@ class HeFileSystemParser final {
~HeFileSystemParser() = default;
public:
- HeFileSystemParser(const HeFileSystemParser&) = delete;
+ HeFileSystemParser(const HeFileSystemParser&) = delete;
HeFileSystemParser& operator=(const HeFileSystemParser&) = delete;
- HeFileSystemParser(HeFileSystemParser&&) = delete;
+ HeFileSystemParser(HeFileSystemParser&&) = delete;
HeFileSystemParser& operator=(HeFileSystemParser&&) = delete;
public:
diff --git a/src/kernel/FirmwareKit/EFI/EFI.h b/src/kernel/FirmwareKit/EFI/EFI.h
index e472a0f5..4e256403 100644
--- a/src/kernel/FirmwareKit/EFI/EFI.h
+++ b/src/kernel/FirmwareKit/EFI/EFI.h
@@ -56,7 +56,7 @@ typedef Char16 EfiChar16Type;
/// @brief Core Handle Kind
/// Self is like NT's Win32 HANDLE type.
typedef struct EfiHandle {
-} * EfiHandlePtr;
+}* EfiHandlePtr;
/* UEFI uses wide characters by default. */
typedef WideChar EfiCharType;
@@ -238,64 +238,42 @@ typedef struct EfiTableHeader {
UInt32 Reserved;
} EfiTableHeader;
-#define EFI_ACPI_TABLE_PROTOCOL_GUID \
- { \
- 0xffe06bdd, 0x6107, 0x46a6, { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c } \
- }
+#define EFI_ACPI_TABLE_PROTOCOL_GUID \
+ {0xffe06bdd, 0x6107, 0x46a6, {0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c}}
-#define EFI_LOAD_FILE_PROTOCOL_GUID \
- { \
- 0x56EC3091, 0x954C, 0x11d2, { 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
+#define EFI_LOAD_FILE_PROTOCOL_GUID \
+ {0x56EC3091, 0x954C, 0x11d2, {0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
-#define EFI_LOAD_FILE2_PROTOCOL_GUID \
- { \
- 0x4006c0c1, 0xfcb3, 0x403e, { 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d } \
- }
+#define EFI_LOAD_FILE2_PROTOCOL_GUID \
+ {0x4006c0c1, 0xfcb3, 0x403e, {0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d}}
-#define EFI_LOADED_IMAGE_PROTOCOL_GUID \
- { \
- 0x5B1B31A1, 0x9562, 0x11d2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } \
- }
+#define EFI_LOADED_IMAGE_PROTOCOL_GUID \
+ {0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B}}
-#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
- { \
- 0x9042a9de, 0x23dc, 0x4a38, { 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
- }
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
+ {0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a}}
-#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
- { \
- 0xA19832B9, 0xAC25, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
- }
+#define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
+ {0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}
#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000
-#define EFI_IP4_PROTOCOL_GUID \
- { \
- 0x41d94cd2, 0x35b6, 0x455a, { 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } \
- }
+#define EFI_IP4_PROTOCOL_GUID \
+ {0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd}}
#define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000
-#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
- { \
- 0x0964e5b22, 0x6459, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
+#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
+ {0x0964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
-#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
- { \
- 0xbc62157e, 0x3e33, 0x4fec, { 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } \
- }
+#define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
+ {0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf}}
-#define EFI_DEVICE_PATH_PROTOCOL_GUID \
- { \
- 0x9576e91, 0x6d3f, 0x11d2, { 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \
+ {0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
-#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
- { \
- 0x0964e5b22, 0x6459, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
+#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
+ {0x0964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
typedef UInt64(EfiImageUnload)(EfiHandlePtr ImageHandle);
@@ -350,17 +328,17 @@ typedef struct {
typedef EFI_STATUS(EFIAPI* EFI_SIMPLE_NETWORK_TRANSMIT)(IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
IN UInt32 HeaderSize, IN UInt32 BufferSize,
- IN Void* Buffer,
- IN EfiMacAddress* SrcAddr OPTIONAL,
+ IN Void* Buffer,
+ IN EfiMacAddress* SrcAddr OPTIONAL,
IN EfiMacAddress* DestAddr OPTIONAL,
- IN UInt16* Protocol OPTIONAL);
+ IN UInt16* Protocol OPTIONAL);
typedef EFI_STATUS(EFIAPI* EFI_SIMPLE_NETWORK_RECEIVE)(IN EFI_SIMPLE_NETWORK_PROTOCOL* This,
- OUT UInt32* HeaderSize OPTIONAL,
+ OUT UInt32* HeaderSize OPTIONAL,
IN OUT UInt32* BufferSize, OUT Void* Buffer,
- OUT EfiMacAddress* SrcAddr OPTIONAL,
+ OUT EfiMacAddress* SrcAddr OPTIONAL,
OUT EfiMacAddress* DestAddr OPTIONAL,
- OUT UInt16* Protocol OPTIONAL);
+ OUT UInt16* Protocol OPTIONAL);
typedef struct EFI_SIMPLE_NETWORK_PROTOCOL {
UInt64 Revision;
@@ -505,10 +483,8 @@ typedef struct EFI_GUID EFI_FINAL {
* Protocol stuff...
*/
-#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
- { \
- 0x387477c1, 0x69c7, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
+#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
+ {0x387477c1, 0x69c7, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
/** some helpers */
#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
@@ -606,7 +582,7 @@ typedef struct {
} EfiInputKey;
typedef EfiStatusType(EFI_API* EfiInputReadKey)(IN EfiSimpleTextInputProtocol* This,
- OUT EfiInputKey* Key);
+ OUT EfiInputKey* Key);
typedef EfiStatusType(EFI_API* EfiInputReset)(IN EfiSimpleTextInputProtocol* This,
IN Boolean ExtendedChk);
@@ -664,7 +640,7 @@ typedef struct EfiSystemTable {
struct {
EFI_GUID VendorGUID;
VoidPtr VendorTable;
- } * ConfigurationTable;
+ }* ConfigurationTable;
} EfiSystemTable;
#define kEfiOk 0
@@ -725,10 +701,8 @@ enum {
#define EFI_EXTRA_DESCRIPTOR_SIZE 8
-#define EFI_MP_SERVICES_PROTOCOL_GUID \
- { \
- 0x3fdda605, 0xa76e, 0x4f46, { 0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08 } \
- }
+#define EFI_MP_SERVICES_PROTOCOL_GUID \
+ {0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08}}
#define PROCESSOR_AS_BSP_BIT 0x00000001
#define PROCESSOR_ENABLED_BIT 0x00000002
@@ -824,10 +798,8 @@ typedef struct EfiTime {
UInt8 Pad2;
} EfiTime;
-#define EFI_FILE_INFO_GUID \
- { \
- 0x09576e92, 0x6d3f, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
- }
+#define EFI_FILE_INFO_GUID \
+ {0x09576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
struct EfiFileInfo EFI_FINAL {
/// @brief Structure size.
@@ -895,8 +867,8 @@ typedef EfiStatusType EFI_API (*EfiMpServicesStartupThisAP)(
IN Void* ProcedureArgument OPTIONAL, OUT Boolean* Finished OPTIONAL);
typedef EfiStatusType EFI_API (*EfiMpServicesDisableThisAP)(IN struct _EfiMpServicesProtocol* Self,
- IN UInt32 ProcessorNumber,
- IN Boolean EnableAP,
+ IN UInt32 ProcessorNumber,
+ IN Boolean EnableAP,
IN UInt32* HealthFlag OPTIONAL);
typedef EfiStatusType EFI_API (*EfiMpServicesWhoAmI)(IN struct _EfiMpServicesProtocol* Self,
diff --git a/src/kernel/FirmwareKit/Handover.h b/src/kernel/FirmwareKit/Handover.h
index 8515cfa6..f3382f75 100644
--- a/src/kernel/FirmwareKit/Handover.h
+++ b/src/kernel/FirmwareKit/Handover.h
@@ -10,7 +10,7 @@
#include <NeKit/Config.h>
#define kHandoverMagic (0xBADCC)
-#define kHandoverVersion (0x0117)
+#define kHandoverVersion (0x0118)
/* Initial bitmap pointer location and size. */
#define kHandoverStructSz sizeof(HEL::BootInfoHeader)
@@ -79,7 +79,8 @@ struct BootInfoHeader final {
UInt32 f_PixelPerLine;
} f_GOP;
- UInt64 f_FirmwareSpecific[8];
+ UInt64 f_NumberOfProcessors;
+ UInt64 f_FirmwareSpecific[7];
};
enum {
diff --git a/src/kernel/HALKit/AMD64/CxxAbi.cpp b/src/kernel/HALKit/AMD64/CxxAbi.cpp
index 50b6ccf2..c2487f85 100644
--- a/src/kernel/HALKit/AMD64/CxxAbi.cpp
+++ b/src/kernel/HALKit/AMD64/CxxAbi.cpp
@@ -11,7 +11,7 @@
#define kAtExitMaxDestructors (128U)
atexit_func_entry_t __atexit_funcs[kAtExitMaxDestructors];
-uarch_t __atexit_func_count;
+uarch_t __atexit_func_count;
/// @brief dynamic shared object Handle.
Kernel::UIntPtr __dso_handle;
diff --git a/src/kernel/HALKit/AMD64/HalCoreInterruptHandler.cpp b/src/kernel/HALKit/AMD64/HalCoreInterruptHandler.cpp
index 92fb064c..118dd98c 100644
--- a/src/kernel/HALKit/AMD64/HalCoreInterruptHandler.cpp
+++ b/src/kernel/HALKit/AMD64/HalCoreInterruptHandler.cpp
@@ -5,7 +5,7 @@
#include <ArchKit/ArchKit.h>
#include <KernelKit/ProcessScheduler.h>
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#include <NeKit/Atom.h>
#include <NeKit/KString.h>
#include <SignalKit/Signals.h>
diff --git a/src/kernel/HALKit/AMD64/HalDebugOutput.cpp b/src/kernel/HALKit/AMD64/HalDebugOutput.cpp
index a63b3657..dc4b78e7 100644
--- a/src/kernel/HALKit/AMD64/HalDebugOutput.cpp
+++ b/src/kernel/HALKit/AMD64/HalDebugOutput.cpp
@@ -59,7 +59,7 @@ namespace Detail {
TerminalDevice::~TerminalDevice() = default;
#ifdef __DEBUG__
-STATIC SizeT kX = kFontSizeX, kY = kFontSizeY;
+STATIC SizeT kX = kFontSizeX, kY = kFontSizeY + 70;
#endif // __DEBUG__
EXTERN_C void ke_utf_io_write(IDevice<const Utf8Char*>* obj, const Utf8Char* bytes) {
@@ -91,7 +91,7 @@ EXTERN_C void ke_utf_io_write(IDevice<const Utf8Char*>* obj, const Utf8Char* byt
tmp_str[0] = (bytes[index] > 127) ? '?' : bytes[index];
tmp_str[1] = 0;
- cg_render_string(tmp_str, kY, kX, RGB(0x00, 0x00, 0x00));
+ cg_render_string(tmp_str, kY, kX, RGB(0xFF, 0xFF, 0xFF));
if (bytes[index] == '\r') {
kY += kFontSizeY;
@@ -147,7 +147,7 @@ EXTERN_C void ke_io_write(IDevice<const Char*>* obj, const Char* bytes) {
tmp_str[0] = bytes[index];
tmp_str[1] = 0;
- cg_render_string(tmp_str, kY, kX, RGB(0x00, 0x00, 0x00));
+ cg_render_string(tmp_str, kY, kX, RGB(0xFF, 0xFF, 0xFF));
if (bytes[index] == '\r') {
kY += kFontSizeY;
@@ -161,7 +161,7 @@ EXTERN_C void ke_io_write(IDevice<const Char*>* obj, const Char* bytes) {
}
if (kY > kHandoverHeader->f_GOP.f_Height) {
- kY = kFontSizeY;
+ kY = kFontSizeY + 70;
FBDrawInRegion(cg_get_clear_clr(), FB::CGAccessibilty::Height(), FB::CGAccessibilty::Width(),
0, 0);
diff --git a/src/kernel/HALKit/AMD64/HalKernelMain.cpp b/src/kernel/HALKit/AMD64/HalKernelMain.cpp
index 7468b76d..2c454e20 100644
--- a/src/kernel/HALKit/AMD64/HalKernelMain.cpp
+++ b/src/kernel/HALKit/AMD64/HalKernelMain.cpp
@@ -133,6 +133,8 @@ EXTERN_C Kernel::Int32 hal_init_platform(Kernel::HEL::BootInfoHeader* handover_h
return kEfiFail;
}
+EXTERN_C BOOL rtl_init_nic_rtl8139();
+
EXTERN_C Kernel::Void hal_real_init(Kernel::Void) {
HAL::mp_init_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr);
@@ -156,11 +158,17 @@ EXTERN_C Kernel::Void hal_real_init(Kernel::Void) {
PEFLoader ldr("/system/init.out");
- if (ldr.IsLoaded()) rtl_create_user_process(ldr, UserProcess::ExecutableKind::kExecutableKind);
- else ke_panic(RUNTIME_CHECK_PROCESS, "RuntimeCheck: Invalid Process Data!");
-
+ if (ldr.IsLoaded())
+ rtl_create_user_process(ldr, UserProcess::ExecutableKind::kExecutableKind);
+ else
+ ke_panic(RUNTIME_CHECK_BAD_BEHAVIOR, "Invalid Init Process.");
+
UserProcessScheduler::The().SwitchTeam(kMidUserTeam);
+#ifdef __HALKIT_INCLUDES_BNID__
+ rtl_init_nic_rtl8139();
+#endif
+
while (YES);
}
#endif // ifndef __NE_MODULAR_KERNEL_COMPONENTS__
diff --git a/src/kernel/HALKit/AMD64/HalKernelPanic.cpp b/src/kernel/HALKit/AMD64/HalKernelPanic.cpp
index d9afa204..a5f0b8bc 100644
--- a/src/kernel/HALKit/AMD64/HalKernelPanic.cpp
+++ b/src/kernel/HALKit/AMD64/HalKernelPanic.cpp
@@ -45,19 +45,18 @@ Void RecoveryFactory::Recover() {
HAL::rt_cli();
HAL::rt_halt();
}
-
+
alreadyDumped = YES;
-
- HeFileSystemMgr mgr;
- auto node = mgr.Open("/system/dump.dmp", "wb");
+ HeFileSystemMgr mgr;
+ auto node = mgr.Open("/system/dump.dmp", "wb");
if (node && hal_read_cr2()) mgr.Write(node, hal_read_cr2(), 0, 0x100);
if (node) mm_free_ptr(node);
-
+
node = nullptr;
#endif
-
+
while (YES) {
HAL::rt_cli();
HAL::rt_halt();
diff --git a/src/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cpp b/src/kernel/HALKit/AMD64/Network/Generic+Basic+BNID.cpp
index aacda36c..4c1d0f1f 100644
--- a/src/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cpp
+++ b/src/kernel/HALKit/AMD64/Network/Generic+Basic+BNID.cpp
@@ -5,66 +5,82 @@
#include <DmaKit/DmaPool.h>
#include <HALKit/AMD64/Processor.h>
+#include <KernelKit/PCI/Iterator.h>
#include <modules/ACPI/ACPIFactoryInterface.h>
+/// @note BNID (RTL8139' Basic Network Interface) driver
+
+#define kNetDevID (0x8139)
+#define kNetSubClass (0x10EC)
+
using namespace Kernel;
using namespace Kernel::HAL;
STATIC UInt16 kRTLIOBase = 0xFFFF;
-STATIC BOOL kTXRXEnabled = NO;
-
STATIC UInt32 kRXOffset = 0UL;
STATIC constexpr CONST UInt32 kRXBufferSize = 8192 + 16 + 1500;
STATIC UInt8* kRXUpperLayer = nullptr;
STATIC UInt8* kRXBuffer = nullptr;
+STATIC PCI::Device kNetDev;
+
/***********************************************************************************/
-///@brief RTL8139 Init routine.
+///@brief BNID Init routine.
/***********************************************************************************/
-EXTERN_C BOOL rtl_init_nic_rtl8139(UInt16 io_base) {
+EXTERN_C BOOL rtl_init_nic_rtl8139() {
+ STATIC BOOL kTXRXEnabled = NO;
if (kTXRXEnabled) return NO;
- kRTLIOBase = io_base;
+ PCI::Iterator iterator(Types::PciDeviceKind::NetworkController, 0x00);
- MUST_PASS(io_base != 0xFFFF);
+ for (SizeT device_index = 0; device_index < NE_BUS_COUNT; ++device_index) {
+ kNetDev = iterator[device_index].Leak(); // Leak device.
- kRXBuffer = reinterpret_cast<UInt8*>(rtl_dma_alloc(sizeof(UInt8) * kRXBufferSize, 0));
+ if (kNetDev.VendorId() == kNetSubClass && kNetDev.DeviceId() == kNetDevID) {
+ kNetDev.EnableMmio();
+ kNetDev.BecomeBusMaster();
+
+ break;
+ }
+ }
+
+ kRTLIOBase = kNetDev.Bar(0);
- MUST_PASS(kRXBuffer);
+ MUST_PASS(kRTLIOBase != 0xFFFF);
+
+ kRXBuffer = reinterpret_cast<UInt8*>(rtl_dma_alloc(sizeof(UInt8) * kRXBufferSize, 0));
/// Reset first.
- rt_out8(io_base + 0x37, 0x10);
+ rt_out8(kRTLIOBase + 0x37, 0x10);
UInt16 timeout = 0U;
- while (rt_in8(io_base + 0x37) & 0x10) {
+ while (rt_in8(kRTLIOBase + 0x37) & 0x10) {
++timeout;
if (timeout > 0x1000) break;
}
- if (timeout <= 0x1000) {
- return NO;
- }
-
- rt_out32(io_base + 0x30, (UInt32) (UIntPtr) kRXBuffer);
+ rt_out32(kRTLIOBase + 0x30, (UInt32) (UIntPtr) kRXBuffer);
- rt_out8(io_base + 0x37, 0x0C);
+ rt_out8(kRTLIOBase + 0x37, 0x0C);
- rt_out32(io_base + 0x44, 0xF | (1 << 7));
+ rt_out32(kRTLIOBase + 0x44, 0xF | (1 << 7));
- rt_out16(io_base + 0x3C, 0x0005);
+ rt_out16(kRTLIOBase + 0x3C, 0x0005);
kTXRXEnabled = YES;
+ kout << "The Basic Network Interface Driver (BNID) has been initialized.\r";
+
return YES;
}
/***********************************************************************************/
-/// @brief RTL8139 I/O interrupt handler.
+/// @brief BNID I/O interrupt handler.
/// @param rsp stack pointer.
/// @note This function is called when the device interrupts to retrieve network data.
/***********************************************************************************/
@@ -105,7 +121,7 @@ EXTERN_C Void rtl_rtl8139_interrupt_handler(UIntPtr rsp) {
}
/***********************************************************************************/
-/// @brief RTL8139 get upper layer function
+/// @brief BNID get upper layer function
/// @return the upper layer.
/// @retval nullptr if no upper layer is set.
/// @retval pointer to the upper layer if set.
@@ -116,7 +132,7 @@ EXTERN_C UInt8* rtl_rtl8139_get_upper_layer() {
}
/***********************************************************************************/
-/// @brief RTL8139 set upper layer function
+/// @brief BNID set upper layer function
/// @param layer the upper layer.
/***********************************************************************************/
diff --git a/src/kernel/HALKit/AMD64/Paging.h b/src/kernel/HALKit/AMD64/Paging.h
index f6ec0bf4..7b64835a 100644
--- a/src/kernel/HALKit/AMD64/Paging.h
+++ b/src/kernel/HALKit/AMD64/Paging.h
@@ -57,7 +57,9 @@ namespace Detail {
kPageEnable = 31,
};
- inline UInt8 control_register_cast(ControlRegisterBits reg) { return static_cast<UInt8>(reg); }
+ inline UInt8 control_register_cast(ControlRegisterBits reg) {
+ return static_cast<UInt8>(reg);
+ }
} // namespace Detail
auto mm_alloc_bitmap(Boolean wr, Boolean user, SizeT size, Bool is_page, SizeT pad = 0) -> VoidPtr;
diff --git a/src/kernel/HALKit/ARM64/CxxAbi.cpp b/src/kernel/HALKit/ARM64/CxxAbi.cpp
index 3c7c7952..7f8c8245 100644
--- a/src/kernel/HALKit/ARM64/CxxAbi.cpp
+++ b/src/kernel/HALKit/ARM64/CxxAbi.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <KernelKit/DebugOutput.h>
#include <KernelKit/KPC.h>
#include <NeKit/CxxAbi.h>
diff --git a/src/kernel/HALKit/ARM64/HalCoreInterruptHandler.cpp b/src/kernel/HALKit/ARM64/HalCoreInterruptHandler.cpp
index 39f12705..1e3adadf 100644
--- a/src/kernel/HALKit/ARM64/HalCoreInterruptHandler.cpp
+++ b/src/kernel/HALKit/ARM64/HalCoreInterruptHandler.cpp
@@ -5,7 +5,7 @@
#include <ArchKit/ArchKit.h>
#include <KernelKit/ProcessScheduler.h>
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#include <NeKit/KString.h>
#include <SignalKit/Signals.h>
diff --git a/src/kernel/HALKit/ARM64/HalHandoverStub.s b/src/kernel/HALKit/ARM64/HalHandoverStub.s
index 5fe7a24a..8699bb11 100644
--- a/src/kernel/HALKit/ARM64/HalHandoverStub.s
+++ b/src/kernel/HALKit/ARM64/HalHandoverStub.s
@@ -15,5 +15,5 @@
.word 100
;; // CPU (ARM64)
.word 0
- ;; // TYPE (KERNEL)
+ ;; // TYPE (KERNEL_IMG)
.word 122
diff --git a/src/kernel/HALKit/ARM64/HalSchedulerCorePrimitives.cpp b/src/kernel/HALKit/ARM64/HalSchedulerCorePrimitives.cpp
index 634fc9c4..4581deb0 100644
--- a/src/kernel/HALKit/ARM64/HalSchedulerCorePrimitives.cpp
+++ b/src/kernel/HALKit/ARM64/HalSchedulerCorePrimitives.cpp
@@ -7,6 +7,7 @@
#include <KernelKit/ProcessScheduler.h>
namespace Kernel {
+
/***********************************************************************************/
/// @brief Unimplemented function (crashes by default)
/// @param process The process handle.
@@ -26,4 +27,5 @@ EXTERN_C Bool hal_check_task(HAL::StackFramePtr stack_ptr) {
return stack_ptr->SP != 0 && stack_ptr->IP != 0;
}
+
} // namespace Kernel
diff --git a/src/kernel/HALKit/ARM64/Paging.h b/src/kernel/HALKit/ARM64/Paging.h
index 71e663ae..fd04c2da 100644
--- a/src/kernel/HALKit/ARM64/Paging.h
+++ b/src/kernel/HALKit/ARM64/Paging.h
@@ -41,14 +41,10 @@
/// Long format address range
-#define cPageMAll \
- { 0b000, 0b000 }
-#define cPageMToMax(M) \
- { M, 0b000 }
-#define cPageMaxToM(M) \
- { 0b000, M }
-#define cPageMToN(M, N) \
- { M, N }
+#define cPageMAll {0b000, 0b000}
+#define cPageMToMax(M) {M, 0b000}
+#define cPageMaxToM(M) {0b000, M}
+#define cPageMToN(M, N) {M, N}
namespace Kernel::HAL {
struct PACKED PTE_4KB final {
@@ -86,7 +82,9 @@ namespace Detail {
PageEnable = 31,
};
- inline UInt8 control_register_cast(ControlRegisterBits reg) { return static_cast<UInt8>(reg); }
+ inline UInt8 control_register_cast(ControlRegisterBits reg) {
+ return static_cast<UInt8>(reg);
+ }
} // namespace Detail
struct PDE_4KB final {
diff --git a/src/kernel/KernelKit/BinaryMutex.h b/src/kernel/KernelKit/BinaryMutex.h
index 2fb390d3..2388c50a 100644
--- a/src/kernel/KernelKit/BinaryMutex.h
+++ b/src/kernel/KernelKit/BinaryMutex.h
@@ -7,6 +7,7 @@
#define KERNELKIT_BINARYMUTEX_H
#include <CompilerKit/CompilerKit.h>
+#include <KernelKit/CoreProcessScheduler.h>
#include <KernelKit/Timer.h>
#include <NeKit/Config.h>
@@ -14,6 +15,7 @@ namespace Kernel {
class UserProcess;
/// @brief Access control class, which locks a task until one is done.
+/// Implements priority inheritance to prevent priority inversion.
class BinaryMutex final {
public:
using LockedPtr = UserProcess*;
@@ -36,7 +38,8 @@ class BinaryMutex final {
NE_COPY_DEFAULT(BinaryMutex)
private:
- LockedPtr fLockingProcess{nullptr};
+ LockedPtr fLockingProcess{nullptr};
+ AffinityKind fOwnerOriginalAffinity{AffinityKind::kInvalid}; // for priority inheritance
};
} // namespace Kernel
diff --git a/src/kernel/KernelKit/CoreProcessScheduler.h b/src/kernel/KernelKit/CoreProcessScheduler.h
index 7ed23a92..5d6dc9b3 100644
--- a/src/kernel/KernelKit/CoreProcessScheduler.h
+++ b/src/kernel/KernelKit/CoreProcessScheduler.h
@@ -59,19 +59,11 @@ struct ProcessHeapTree final {
TreeKind Color{TreeKind::kBlackTreeKind};
- struct ProcessHeapTree<T>* Parent {
- nullptr
- };
- struct ProcessHeapTree<T>* Child {
- nullptr
- };
-
- struct ProcessHeapTree<T>* Prev {
- nullptr
- };
- struct ProcessHeapTree<T>* Next {
- nullptr
- };
+ struct ProcessHeapTree<T>* Parent{nullptr};
+ struct ProcessHeapTree<T>* Child{nullptr};
+
+ struct ProcessHeapTree<T>* Prev{nullptr};
+ struct ProcessHeapTree<T>* Next{nullptr};
};
template <typename T>
@@ -86,21 +78,13 @@ struct ProcessFileTree final {
TreeKind Color{TreeKind::kBlackTreeKind};
- struct ProcessFileTree<T>* Parent {
- nullptr
- };
+ struct ProcessFileTree<T>* Parent{nullptr};
- struct ProcessFileTree<T>* Child {
- nullptr
- };
+ struct ProcessFileTree<T>* Child{nullptr};
- struct ProcessFileTree<T>* Prev {
- nullptr
- };
+ struct ProcessFileTree<T>* Prev{nullptr};
- struct ProcessFileTree<T>* Next {
- nullptr
- };
+ struct ProcessFileTree<T>* Next{nullptr};
};
template <typename T>
@@ -121,21 +105,13 @@ struct ProcessSpecialTree final {
TreeKind Color{TreeKind::kBlackTreeKind};
- struct ProcessSpecialTree<T>* Parent {
- nullptr
- };
+ struct ProcessSpecialTree<T>* Parent{nullptr};
- struct ProcessSpecialTree<T>* Child {
- nullptr
- };
+ struct ProcessSpecialTree<T>* Child{nullptr};
- struct ProcessSpecialTree<T>* Prev {
- nullptr
- };
+ struct ProcessSpecialTree<T>* Prev{nullptr};
- struct ProcessSpecialTree<T>* Next {
- nullptr
- };
+ struct ProcessSpecialTree<T>* Next{nullptr};
};
/***********************************************************************************/
@@ -170,7 +146,7 @@ enum struct ProcessStatusKind : Int32 {
/***********************************************************************************/
enum struct AffinityKind : Int32 {
kInvalid = 0,
- kRealTime = 100,
+ kUltraHigh = 100,
kVeryHigh = 150,
kHigh = 200,
kStandard = 1000,
diff --git a/src/kernel/KernelKit/DebugOutput.h b/src/kernel/KernelKit/DebugOutput.h
index 3695602e..4a705804 100644
--- a/src/kernel/KernelKit/DebugOutput.h
+++ b/src/kernel/KernelKit/DebugOutput.h
@@ -185,7 +185,7 @@ inline TerminalDevice& operator<<(TerminalDevice& src, const Long& num) {
#undef kout
#endif // ifdef kout
-#define kout TerminalDevice::The()
+#define kout TerminalDevice::The() << __FILE__ << ": "
#ifdef kendl
#undef kendl
@@ -197,7 +197,7 @@ inline TerminalDevice& operator<<(TerminalDevice& src, const Long& num) {
#undef kout8
#endif // ifdef kout8
-#define kout8 Utf8TerminalDevice::The()
+#define kout8 Utf8TerminalDevice::The() << __FILE__ << ": "
#ifdef kendl8
#undef kendl8
diff --git a/src/kernel/KernelKit/DriveMgr.h b/src/kernel/KernelKit/DriveMgr.h
index 082ffc95..8b095f05 100644
--- a/src/kernel/KernelKit/DriveMgr.h
+++ b/src/kernel/KernelKit/DriveMgr.h
@@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef INC_DRIVE_MANAGER_H
-#define INC_DRIVE_MANAGER_H
+#ifndef KERNELKIT_DRIVEMGR_H
+#define KERNELKIT_DRIVEMGR_H
/// @file DriveMgr.h
/// @brief NeKernel's drive manager.
@@ -73,7 +73,7 @@ struct DriveTrait final {
Void (*fOutput)(DrivePacket& packet){nullptr};
Void (*fVerify)(DrivePacket& packet){nullptr};
Void (*fInit)(DrivePacket& packet){nullptr};
- const Char* (*fProtocol)(Void){nullptr};
+ const Char* (*fProtocol)(Void) {nullptr};
};
namespace Probe {
@@ -166,4 +166,4 @@ Void io_drv_input(DriveTrait::DrivePacket pckt);
Void io_drv_output(DriveTrait::DrivePacket pckt);
} // namespace Kernel
-#endif /* ifndef INC_DRIVE_MANAGER_H */
+#endif /* ifndef KERNELKIT_DRIVEMGR_H */
diff --git a/src/kernel/KernelKit/FileMgr.h b/src/kernel/KernelKit/FileMgr.h
index 87644e68..06af3c2d 100644
--- a/src/kernel/KernelKit/FileMgr.h
+++ b/src/kernel/KernelKit/FileMgr.h
@@ -3,14 +3,14 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef INC_FILEMGR_H
-#define INC_FILEMGR_H
+#ifndef KERNELKIT_FILEMGR_H
+#define KERNELKIT_FILEMGR_H
/// @file FileMgr.h
/// @brief File Manager Subsystem.
/// @author Amlal El Mahrouss (amlal@nekernel.org)
-//! Include filesystems that NeKernel supports.
+//! Include filesystems that the hybrid kernel supports.
#include <FSKit/Ext2+IFS.h>
#include <FSKit/NeFS.h>
#include <FSKit/OpenHeFS.h>
@@ -352,7 +352,7 @@ class FileStream final {
/// @brief Leak MIME.
/// @return The MIME.
- Char* MIME() { return const_cast<Char*>(fMime); }
+ Char* MIME() { return fMime; }
enum {
kFileMgrRestrictRead = 100,
@@ -364,14 +364,15 @@ class FileStream final {
};
private:
- NodePtr fFile{nullptr};
- Int32 fFileRestrict{kFileMgrRestrictReadBinary};
- const Char* fMime{kFileMimeGeneric};
+ NodePtr fFile{nullptr};
+ Int32 fFileRestrict{kFileMgrRestrictReadBinary};
+ Char* fMime{const_cast<Char*>(kFileMimeGeneric)};
};
using FileStreamASCII = FileStream<Char>;
using FileStreamUTF8 = FileStream<Utf8Char>;
-using FileStreamUTF16 = FileStream<WideChar>;
+using FileStreamUTF16 = FileStream<Utf16Char>;
+using FileStreamWide = FileStream<WideChar>;
typedef UInt64 CursorType;
@@ -423,9 +424,9 @@ inline FileStream<Encoding, Class>::FileStream(const Encoding* path, const Encod
/// @brief destructor of the file stream.
template <typename Encoding, typename Class>
inline FileStream<Encoding, Class>::~FileStream() {
- mm_free_ptr(fFile);
+ if (fFile) mm_free_ptr(fFile);
fFile = nullptr;
}
} // namespace Kernel
-#endif // ifndef INC_FILEMGR_H
+#endif // ifndef KERNELKIT_FILEMGR_H
diff --git a/src/kernel/KernelKit/HardwareThreadScheduler.h b/src/kernel/KernelKit/HardwareThreadScheduler.h
index 53a971e5..43a906d6 100644
--- a/src/kernel/KernelKit/HardwareThreadScheduler.h
+++ b/src/kernel/KernelKit/HardwareThreadScheduler.h
@@ -12,6 +12,7 @@
/// @note Last Rev Sun 28 Jul CET 2024
/// @note Last Rev Thu, Aug 1, 2024 9:07:38 AM
+/// @note Last Rev Sun, March 22, 2026 5:16 PM
#if defined(__nekernel_max_cores)
/// \note This can be edited at compile-time to specify how many cores can be used by NeKernel.
@@ -64,10 +65,10 @@ class HardwareThread final {
BOOL IsWakeup();
public:
- HAL::StackFramePtr StackFrame();
+ HAL::StackFramePtr StackFrame();
_Output const ThreadKind& Kind();
BOOL IsBusy();
- _Output const ThreadID& ID();
+ _Output const ThreadID& ID();
private:
HAL::StackFramePtr fStack{};
@@ -102,7 +103,7 @@ class HardwareThreadScheduler final : public ISchedulable {
public:
Ref<HardwareThread*> operator[](SizeT idx);
bool operator!();
- operator bool();
+ operator bool();
Bool IsUser() override { return Yes; }
diff --git a/src/kernel/KernelKit/ILoader.h b/src/kernel/KernelKit/ILoader.h
index f6e13023..9291340f 100644
--- a/src/kernel/KernelKit/ILoader.h
+++ b/src/kernel/KernelKit/ILoader.h
@@ -26,9 +26,9 @@ class ILoader {
public:
virtual _Output ErrorOr<VoidPtr> GetBlob() { return ErrorOr<VoidPtr>{}; }
- virtual _Output const Char* AsString() { return "(null)"; }
- virtual _Output const Char* MIME() { return "*/*"; }
- virtual _Output const Char* Path() { return "(null)"; }
+ virtual _Output const Char* AsString() { return "(null)"; }
+ virtual _Output const Char* MIME() { return "*/*"; }
+ virtual _Output const Char* Path() { return "(null)"; }
virtual _Output ErrorOr<VoidPtr> FindStart() { return ErrorOr<VoidPtr>{}; }
virtual _Output ErrorOr<VoidPtr> FindSymbol(_Input const Char*, _Input Int32) {
return ErrorOr<VoidPtr>{};
diff --git a/src/kernel/KernelKit/PCI/DMA.h b/src/kernel/KernelKit/PCI/DMA.h
index 63b284cb..f27681de 100644
--- a/src/kernel/KernelKit/PCI/DMA.h
+++ b/src/kernel/KernelKit/PCI/DMA.h
@@ -47,7 +47,7 @@ class DMAWrapper final {
T* Get(UIntPtr off = 0);
public:
- operator bool();
+ operator bool();
bool operator!();
public:
diff --git a/src/kernel/KernelKit/PCI/Device.h b/src/kernel/KernelKit/PCI/Device.h
index b7737385..1adc9f24 100644
--- a/src/kernel/KernelKit/PCI/Device.h
+++ b/src/kernel/KernelKit/PCI/Device.h
@@ -51,7 +51,7 @@ class Device final {
}
public:
- UShort DeviceId();
+ UInt16 DeviceId();
UShort VendorId();
UShort InterfaceId();
UChar Class();
diff --git a/src/kernel/KernelKit/Semaphore.h b/src/kernel/KernelKit/Semaphore.h
index bb6b9ba9..13f3eadb 100644
--- a/src/kernel/KernelKit/Semaphore.h
+++ b/src/kernel/KernelKit/Semaphore.h
@@ -29,6 +29,7 @@ using SemaphoreArr = UInt64[kSemaphoreCount];
/// @brief Checks if the semaphore is valid.
inline bool rtl_sem_is_valid(const SemaphoreArr& sem, const UInt64& owner = 0) {
+ //if (!sem) return false;
return sem[kSemaphoreOwnerIndex] == owner && sem[kSemaphoreCountIndex] > 0;
}
@@ -36,6 +37,8 @@ inline bool rtl_sem_is_valid(const SemaphoreArr& sem, const UInt64& owner = 0) {
/// @param sem
/// @return
inline bool rtl_sem_release(SemaphoreArr& sem) {
+ //if (!sem) return false;
+
sem[kSemaphoreOwnerIndex] = 0;
sem[kSemaphoreCountIndex] = 0;
@@ -47,6 +50,8 @@ inline bool rtl_sem_release(SemaphoreArr& sem) {
/// @param owner the owner to set, could be anything identifitable.
/// @return
inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64& owner) {
+ //if (!sem) return false;
+
if (!owner) {
err_global_get() = kErrorInvalidData;
return false; // Invalid owner, return false and set KPC.
@@ -65,6 +70,8 @@ inline bool rtl_sem_acquire(SemaphoreArr& sem, const UInt64& owner) {
/// @return
inline bool rtl_sem_wait(SemaphoreArr& sem, const UInt64& owner, const UInt64& timeout,
bool& condition) {
+ //if (!sem) return false;
+
if (!rtl_sem_is_valid(sem, owner)) {
return false;
}
diff --git a/src/kernel/KernelKit/UserMgr+User.h b/src/kernel/KernelKit/User.h
index bae51180..cc64bd1c 100644
--- a/src/kernel/KernelKit/UserMgr+User.h
+++ b/src/kernel/KernelKit/User.h
@@ -42,16 +42,16 @@ enum struct UserRingKind : Int32 {
kRingCount = 3,
};
-using UserPublicKey = Char*;
-using UserPublicKeyType = Char;
+using UserPublicKey = Char8*;
+using UserPublicKeyType = Char8;
/// @brief System User class.
class User final {
public:
User() = delete;
- User(const Int32& sel, const Char* username);
- User(const UserRingKind& kind, const Char* username);
+ User(const Int32& sel, const UserPublicKeyType* username);
+ User(const UserRingKind& kind, const UserPublicKeyType* username);
~User();
@@ -82,10 +82,15 @@ class User final {
/// @param password the password to check.
Bool Login(const UserPublicKey password);
+ /// @brief Returns whether the user is an adult or not.
+ Bool IsAdult();
+
private:
UserRingKind mUserRing{UserRingKind::kRingStdUser};
Char mUserName[kMaxUserNameLen] = {0};
UInt64 mUserFNV{0UL};
+ Bool mUserIsAdult{NO};
+
};
/// \brief Alias for user ptr.
diff --git a/src/kernel/KernelKit/UserMgr.h b/src/kernel/KernelKit/UserMgr.h
index 16ca79b6..7fc2b635 100644
--- a/src/kernel/KernelKit/UserMgr.h
+++ b/src/kernel/KernelKit/UserMgr.h
@@ -6,6 +6,6 @@
#ifndef KERNELKIT_USERMGR_H
#define KERNELKIT_USERMGR_H
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#endif \ No newline at end of file
diff --git a/src/kernel/KernelKit/UserProcessScheduler.h b/src/kernel/KernelKit/UserProcessScheduler.h
index ab3c713e..1318c7f6 100644
--- a/src/kernel/KernelKit/UserProcessScheduler.h
+++ b/src/kernel/KernelKit/UserProcessScheduler.h
@@ -13,7 +13,7 @@
#include <ArchKit/ArchKit.h>
#include <KernelKit/CoreProcessScheduler.h>
#include <KernelKit/LockDelegate.h>
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#include <NeKit/MutableArray.h>
////////////////////////////////////////////////////
@@ -63,10 +63,10 @@ class UserProcess final {
IDylibObject* DylibDelegate{nullptr};
SizeT MemoryCursor{0UL};
SizeT MemoryLimit{kCPSMaxMemoryLimit};
- SizeT UsedMemory{0UL}; /// AMLALE: This should be thread-safe as well.
- SizeT UsedFiles{0UL}; /// AMLALE: This is a thread-safe counter to track file allocation count.
- UserProcessSignal Signal;
- ProcessImage Image;
+ SizeT UsedMemory{0UL}; /// AMLALE: This should be thread-safe as well.
+ SizeT UsedFiles{0UL}; /// AMLALE: This is a thread-safe counter to track file allocation count.
+ UserProcessSignal Signal;
+ ProcessImage Image;
private:
ProcessFileTree<Any>* FileTree{nullptr};
@@ -83,9 +83,10 @@ class UserProcess final {
kExecutableKindCount,
};
- ProcessTime PTime{0}; //! @brief Process allocated tine.
+ ProcessTime PTime{0}; //! @brief Process allocated time.
ProcessTime RTime{0}; //! @brief Process run time.
- ProcessTime UTime{0}; //! #brief Process used time.
+ ProcessTime UTime{0}; //! @brief Process used time.
+ ProcessTime STime{0}; //! @brief Process sleep time (for dynamic priority boost).
ProcessID ProcessId{kCPSInvalidPID};
ExecutableKind Kind{ExecutableKind::kExecutableKind};
@@ -207,8 +208,8 @@ class UserProcessTeam final {
NE_COPY_DEFAULT(UserProcessTeam)
Array<UserProcess, kCPSProcessLimitPerTeam>& AsArray();
- Ref<UserProcess>& AsRef();
- ProcessID& Id();
+ Ref<UserProcess>& AsRef();
+ ProcessID& Id();
public:
UserProcessArray mProcessList;
diff --git a/src/kernel/NeKit/Atom.h b/src/kernel/NeKit/Atom.h
index c23508f6..53ab661e 100644
--- a/src/kernel/NeKit/Atom.h
+++ b/src/kernel/NeKit/Atom.h
@@ -10,7 +10,7 @@
namespace Kernel {
-template <class TypeAtomic>
+template <class AtomicType>
class Atom final {
public:
explicit Atom() = default;
@@ -21,29 +21,29 @@ class Atom final {
Atom(const Atom&) = delete;
public:
- using Type = TypeAtomic;
- using Ref = TypeAtomic&;
- using ConstRef = const TypeAtomic&;
+ using Type = AtomicType;
+ using Ref = AtomicType&;
+ using ConstRef = const AtomicType&;
- const TypeAtomic& operator[](const TypeAtomic& bit) {
- return (fArrayOfAtoms & (TypeAtomic{} << bit));
+ const AtomicType& operator[](const AtomicType& bit) {
+ return (fArrayOfAtoms & (AtomicType{} << bit));
}
- void operator|(const TypeAtomic& bit) { fArrayOfAtoms |= (TypeAtomic{1} << bit); }
+ void operator|(const AtomicType& bit) { fArrayOfAtoms |= (AtomicType{1} << bit); }
- Atom& operator|=(const TypeAtomic& bit) {
+ Atom& operator|=(const AtomicType& bit) {
this->operator|(bit);
return *this;
}
- friend bool operator==(Atom<TypeAtomic>& atomic, const TypeAtomic& idx) {
+ friend bool operator==(Atom<AtomicType>& atomic, const AtomicType& idx) {
return atomic[idx] == idx;
}
- friend bool operator!=(Atom<TypeAtomic>& atomic, const TypeAtomic& idx) {
+ friend bool operator!=(Atom<AtomicType>& atomic, const AtomicType& idx) {
return atomic[idx] != idx;
}
private:
- TypeAtomic fArrayOfAtoms;
+ AtomicType fArrayOfAtoms;
};
} // namespace Kernel
diff --git a/src/kernel/NeKit/Config.h b/src/kernel/NeKit/Config.h
index caf17ebd..a855bf2a 100644
--- a/src/kernel/NeKit/Config.h
+++ b/src/kernel/NeKit/Config.h
@@ -17,7 +17,7 @@
#define NE_ICODEC \
final: \
- public \
+ public \
::Kernel::ICodec
/// @brief The **NeKernel** namespace.
@@ -113,12 +113,12 @@ inline Args&& move(Args&& arg) {
template <class Type>
concept IsSerializable = requires() {
- {Type::kValue};
+ { Type::kValue };
};
template <class Type>
concept IsNotSerializable = requires() {
- {!Type::kValue};
+ { !Type::kValue };
};
/// @brief Encoding interface, used as a proxy to convert T to Char*
diff --git a/src/kernel/NeKit/Macros.h b/src/kernel/NeKit/Macros.h
index 4fb3a736..361afbda 100644
--- a/src/kernel/NeKit/Macros.h
+++ b/src/kernel/NeKit/Macros.h
@@ -16,7 +16,7 @@
#endif
#ifndef kib_cast
-#define kib_cast(X) (Kernel::UInt64)((X) *1024)
+#define kib_cast(X) (Kernel::UInt64)((X) * 1024)
#endif
#ifndef MIB
@@ -117,7 +117,7 @@
#define NE_UNUSED(X) ((Kernel::Void) X)
#ifndef RGB
-#define RGB(R, G, B) ((Kernel::UInt32)((0xFF << 24) | ((R) << 16) | ((G) << 8) | (B)))
+#define RGB(R, G, B) ((Kernel::UInt32) ((0xFF << 24) | ((R) << 16) | ((G) << 8) | (B)))
#endif // !RGB
#ifdef __NE_AMD64__
diff --git a/src/kernel/NeKit/New.h b/src/kernel/NeKit/New.h
index 648f4a20..9b601534 100644
--- a/src/kernel/NeKit/New.h
+++ b/src/kernel/NeKit/New.h
@@ -14,8 +14,8 @@ typedef __SIZE_TYPE__ size_t;
void* operator new(size_t);
void* operator new[](size_t);
-void operator delete(void*);
-void operator delete(void*, unsigned long);
-void operator delete[](void*);
+void operator delete(void*) noexcept;
+void operator delete(void*, unsigned long) noexcept;
+void operator delete[](void*) noexcept;
#endif
diff --git a/src/kernel/NeKit/Utils.h b/src/kernel/NeKit/Utils.h
index 0ac5acc5..3f387c33 100644
--- a/src/kernel/NeKit/Utils.h
+++ b/src/kernel/NeKit/Utils.h
@@ -55,9 +55,9 @@ inline constexpr SizeT oe_string_len(const CharType* str) {
if (!str) return 0;
#if __cplusplus == 202302L
- if
- consteval { return ARRAY_SIZE(str); }
- else {
+ if consteval {
+ return ARRAY_SIZE(str);
+ } else {
SizeT len{0};
while (str[len] != 0) ++len;
return len;
diff --git a/src/kernel/NeKit/Vettable.h b/src/kernel/NeKit/Vettable.h
index 4cb1682d..a33a3ab3 100644
--- a/src/kernel/NeKit/Vettable.h
+++ b/src/kernel/NeKit/Vettable.h
@@ -16,14 +16,10 @@
namespace Kernel {
template <class Type>
-concept IsVettable = requires(Type) {
- (Type::kVettable);
-};
+concept IsVettable = requires(Type) { (Type::kVettable); };
template <class Type>
-concept IsUnVettable = requires(Type) {
- (Type::kUnvettable);
-};
+concept IsUnVettable = requires(Type) { (Type::kUnvettable); };
} // namespace Kernel
#endif // !__NE_KIT_VETTABLE_H__
diff --git a/src/kernel/amd64-ci.make b/src/kernel/amd64-ci.make
index dcb1c97e..e9d8548c 100644
--- a/src/kernel/amd64-ci.make
+++ b/src/kernel/amd64-ci.make
@@ -5,7 +5,7 @@
CXX = x86_64-w64-mingw32-g++
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -fshort-wchar -D__nekernel_dma_best_align=8 -D__nekernel_max_cores=8 -c -D__NE_AMD64__ -D__NEOSKRNL__ -D__NE_VEPM__ -Werror -Wall -Wpedantic -Wextra -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__NE_SUPPORT_NX__ -O0 -I../vendor -D__FSKIT_INCLUDES_NEFS__ -D__NEKERNEL__ -D__HAVE_NE_API__ -D__FREESTANDING__ -D__NE_VIRTUAL_MEMORY_SUPPORT__ -D__NE_AUTO_FORMAT__ -D__NE__ -I./ -I../ -I../boot
+CCFLAGS = -fshort-wchar -D__nekernel_dma_best_align=8 -D__HALKIT_INCLUDES_BNID__=1 -D__nekernel_max_cores=8 -c -D__NE_AMD64__ -D__NEOSKRNL__ -D__NE_VEPM__ -Werror -Wall -Wpedantic -Wextra -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__NE_SUPPORT_NX__ -O0 -I../vendor -D__FSKIT_INCLUDES_NEFS__ -D__NEKERNEL__ -D__HAVE_NE_API__ -D__FREESTANDING__ -D__NE_VIRTUAL_MEMORY_SUPPORT__ -D__NE_AUTO_FORMAT__ -D__NE__ -I./ -I../ -I../boot
ASM = nasm
@@ -35,7 +35,7 @@ LDFLAGS = -e hal_init_platform --subsystem=17 --image-base 0x4000000
LDOBJ = obj/*.obj
# This file is the Kernel, responsible of task, memory, driver, sci, disk and device management.
-KERNEL_IMG = ne_kernel
+KERNEL_IMG = neoskrnl.exe
.PHONY: error
error:
diff --git a/src/kernel/amd64-desktop.make b/src/kernel/amd64-desktop.make
index 4afcdfd2..44092379 100644
--- a/src/kernel/amd64-desktop.make
+++ b/src/kernel/amd64-desktop.make
@@ -5,7 +5,7 @@
CXX = x86_64-w64-mingw32-g++
LD = x86_64-w64-mingw32-ld
-CCFLAGS = -fshort-wchar -D__nekernel_dma_pool_start=0x1000000 -D__nekernel_dma_pool_size=0x1000000 \
+CCFLAGS = -fshort-wchar -D__nekernel_dma_pool_start=0x1000000 -D__HALKIT_INCLUDES_BNID__=1 -D__nekernel_dma_pool_size=0x1000000 \
-D__nekernel_halkit_include_processor="<HALKit/AMD64/Processor.h>" -D__nekernel_max_cores=8 -c -D__NE_AMD64__ -D__NEOSKRNL__ -D__NE_VEPM__ -Wall -Wpedantic -Wextra -mno-red-zone -fno-rtti -fno-exceptions -std=c++20 -D__nekernel_dma_best_align=8 -D__FSKIT_INCLUDES_OPENHEFS__ -D__FSKIT_INCLUDES_EXT2__ -D__NE_SUPPORT_NX__ -O0 -I../vendor -D__NEKERNEL__ -D__HAVE_NE_API__ -D__FREESTANDING__ -D__NE_VIRTUAL_MEMORY_SUPPORT__ -D__NE_AUTO_FORMAT__ -D__NE__ -I./ -I../ -I../boot
ASM = nasm
@@ -38,7 +38,7 @@ LDFLAGS = -e hal_init_platform --subsystem=17 --image-base 0x10000000
LDOBJ = obj/*.obj
# This file is the Kernel, responsible of task, memory, driver, sci, disk and device management.
-KERNEL_IMG = ne_kernel
+KERNEL_IMG = neoskrnl.exe
.PHONY: error
error:
diff --git a/src/kernel/arm64-desktop.make b/src/kernel/arm64-desktop.make
index 1ca80a9e..334ed81b 100644
--- a/src/kernel/arm64-desktop.make
+++ b/src/kernel/arm64-desktop.make
@@ -23,7 +23,7 @@ LDFLAGS = -subsystem:efi_application -entry:hal_init_platform /nodefaultlib
LDOBJ = obj/*.obj
# This file is the Kernel, responsible of task management and memory.
-KERNEL = ne_kernel
+KERNEL_IMG = neoskrnl.exe
.PHONY: error
error:
@@ -46,7 +46,7 @@ OBJCOPY=x86_64-w64-mingw32-objcopy
.PHONY: link-arm64-epm
link-arm64-epm:
- $(LD) $(LDFLAGS) $(LDOBJ) /out:$(KERNEL)
+ $(LD) $(LDFLAGS) $(LDOBJ) /out:$(KERNEL_IMG)
.PHONY: all
all: nekernel-arm64-epm link-arm64-epm
@@ -61,4 +61,4 @@ help:
.PHONY: clean
clean:
- rm -f $(LDOBJ) $(wildcard *.o) $(KERNEL)
+ rm -f $(LDOBJ) $(wildcard *.o) $(KERNEL_IMG)
diff --git a/src/kernel/kernel_rsrc.rsrc b/src/kernel/kernel_rsrc.rsrc
index 0a43086e..cc0c2eb3 100644
--- a/src/kernel/kernel_rsrc.rsrc
+++ b/src/kernel/kernel_rsrc.rsrc
@@ -8,12 +8,12 @@ BEGIN
BEGIN
BLOCK "080904E4"
BEGIN
- VALUE "CompanyName", "Amlal El Mahrouss"
- VALUE "FileDescription", "NeKernel"
+ VALUE "CompanyName", "Amlal El Mahrouss & Ne.app"
+ VALUE "FileDescription", "NeSystem OS Kernel"
VALUE "FileVersion", KERNEL_VERSION
VALUE "InternalName", "ne_kernel"
- VALUE "LegalCopyright", "(c) 2024-2025 Amlal El Mahrouss, licensed under the Apache 2.0 license."
- VALUE "OriginalFilename", "ne_kernel"
+ VALUE "LegalCopyright", "(c) 2024-2026 Amlal El Mahrouss and Ne.app, licensed under the Apache 2.0 license."
+ VALUE "OriginalFilename", "neoskrnl.exe"
VALUE "ProductName", "NeKernel"
VALUE "ProductVersion", KERNEL_VERSION
END
diff --git a/src/kernel/src/ACPIFactoryInterface.cpp b/src/kernel/src/ACPIFactoryInterface.cpp
index 53f7b9e0..9aa4e26e 100644
--- a/src/kernel/src/ACPIFactoryInterface.cpp
+++ b/src/kernel/src/ACPIFactoryInterface.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <ArchKit/ArchKit.h>
#include <KernelKit/HeapMgr.h>
#include <NeKit/KString.h>
diff --git a/src/kernel/src/AsciiUtils.cpp b/src/kernel/src/AsciiUtils.cpp
index 83caa058..10b4c756 100644
--- a/src/kernel/src/AsciiUtils.cpp
+++ b/src/kernel/src/AsciiUtils.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <NeKit/Utils.h>
namespace Kernel {
@@ -105,9 +104,7 @@ Int32 rt_to_lower(Int ch) {
}
Int32 rt_is_alnum(Int ch) {
- return (ch >= 'a' && ch <= 'z') ||
- (ch >= 'A' && ch <= 'Z') ||
- (ch >= '0' && ch <= '9');
+ return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9');
}
Boolean rt_is_space(Int ch) {
diff --git a/src/kernel/src/BinaryMutex.cpp b/src/kernel/src/BinaryMutex.cpp
index e321ba69..eb559f98 100644
--- a/src/kernel/src/BinaryMutex.cpp
+++ b/src/kernel/src/BinaryMutex.cpp
@@ -7,18 +7,18 @@
#include <KernelKit/ProcessScheduler.h>
namespace Kernel {
-/***********************************************************************************/
-/// @brief Unlocks the binary mutex.
-/***********************************************************************************/
Bool BinaryMutex::Unlock() {
- if (fLockingProcess->Status == ProcessStatusKind::kRunning) {
- fLockingProcess = nullptr;
+ if (!fLockingProcess) return No;
- return Yes;
+ // restore original priority if we boosted the owner
+ if (fOwnerOriginalAffinity != AffinityKind::kInvalid) {
+ fLockingProcess->Affinity = fOwnerOriginalAffinity;
+ fOwnerOriginalAffinity = AffinityKind::kInvalid;
}
- return No;
+ fLockingProcess = nullptr;
+ return Yes;
}
/***********************************************************************************/
@@ -26,9 +26,20 @@ Bool BinaryMutex::Unlock() {
/***********************************************************************************/
Bool BinaryMutex::Lock(BinaryMutex::LockedPtr process) {
- if (!process || this->IsLocked()) return No;
+ if (!process) return No;
+
+ // if already locked, implement priority inheritance
+ if (this->IsLocked() && fLockingProcess) {
+ // boost owner to waiter's priority if waiter is higher priority (lower value = higher priority)
+ if (process->Affinity < fLockingProcess->Affinity) {
+ fOwnerOriginalAffinity = fLockingProcess->Affinity;
+ fLockingProcess->Affinity = process->Affinity;
+ }
+ return No; // lock not acquired, but owner boosted
+ }
- this->fLockingProcess = process;
+ this->fLockingProcess = process;
+ fOwnerOriginalAffinity = AffinityKind::kInvalid;
return Yes;
}
@@ -42,12 +53,16 @@ Bool BinaryMutex::IsLocked() const {
}
/***********************************************************************************/
-/// @brief Try lock or wait.
+/// @brief Try lock, waiting until timeout if already locked.
/***********************************************************************************/
Bool BinaryMutex::LockAndWait(BinaryMutex::LockedPtr process, ITimer* timer) {
- if (timer == nullptr) return No;
+ if (timer == nullptr || !process) return No;
+
+ // try to acquire lock immediately
+ if (this->Lock(process)) return Yes;
+ // wait and retry
timer->Wait();
return this->Lock(process);
}
diff --git a/src/kernel/src/CodeMgr.cpp b/src/kernel/src/CodeMgr.cpp
index 8344fefc..e9eab8bd 100644
--- a/src/kernel/src/CodeMgr.cpp
+++ b/src/kernel/src/CodeMgr.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <KernelKit/CodeMgr.h>
#include <KernelKit/ProcessScheduler.h>
#include <NeKit/Utils.h>
diff --git a/src/kernel/src/FS/Ext2+FileMgr.cpp b/src/kernel/src/FS/Ext2+FileMgr.cpp
new file mode 100644
index 00000000..c034183d
--- /dev/null
+++ b/src/kernel/src/FS/Ext2+FileMgr.cpp
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: Apache-2.0
+// Copyright 2024-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
+
+#ifndef __NE_MINIMAL_OS__
+#ifdef __FSKIT_INCLUDES_EXT2__
+
+#include <KernelKit/FileMgr.h>
+#include <KernelKit/HeapMgr.h>
+
+/// @brief Ext2 File System Manager.
+/// BUGS: 0
+
+#endif
+#endif \ No newline at end of file
diff --git a/src/kernel/src/FS/Ext2+IFS.cpp b/src/kernel/src/FS/Ext2+FileSystemParser.cpp
index 30fb2f0d..4816119e 100644
--- a/src/kernel/src/FS/Ext2+IFS.cpp
+++ b/src/kernel/src/FS/Ext2+FileSystemParser.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#ifndef __NE_MINIMAL_OS__
#ifdef __FSKIT_INCLUDES_EXT2__
@@ -18,17 +17,18 @@
#include <NeKit/Utils.h>
/// @note There's no current maintainer of Ext2, the position is vacant.
-/// @note AMLALE: @0xf00sec has written this driver, and I @amlel-el-mahrouss is currently working on adding triple indirect indices.
+/// @note AMLALE: @0xf00sec has written this driver, and I @amlel-el-mahrouss is currently working
+/// on adding triple indirect indices.
/// @note AMLALE: This driver is too verbose, we need a complete overhaul of it.
-constexpr static UInt32 EXT2_DIRECT_BLOCKS = 12;
-constexpr static UInt32 EXT2_SINGLE_INDIRECT_INDEX = 12;
-constexpr static UInt32 EXT2_DOUBLE_INDIRECT_INDEX = 13;
-constexpr static UInt32 EXT2_TRIPLE_INDIRECT_INDEX = 14;
-constexpr static UInt32 EXT2_ROOT_INODE = 2;
-constexpr ATTRIBUTE(unused) static UInt32 EXT2_SUPERBLOCK_BLOCK = 1;
-constexpr static UInt32 EXT2_GROUP_DESC_BLOCK_SMALL = 2;
-constexpr static UInt32 EXT2_GROUP_DESC_BLOCK_LARGE = 1;
+constexpr static UInt32 EXT2_DIRECT_BLOCKS = 12;
+constexpr static UInt32 EXT2_SINGLE_INDIRECT_INDEX = 12;
+constexpr static UInt32 EXT2_DOUBLE_INDIRECT_INDEX = 13;
+constexpr static UInt32 EXT2_TRIPLE_INDIRECT_INDEX = 14;
+constexpr static UInt32 EXT2_ROOT_INODE = 2;
+constexpr ATTRIBUTE(unused) static UInt32 EXT2_SUPERBLOCK_BLOCK = 1;
+constexpr static UInt32 EXT2_GROUP_DESC_BLOCK_SMALL = 2;
+constexpr static UInt32 EXT2_GROUP_DESC_BLOCK_LARGE = 1;
namespace Detail {
static inline SizeT ext2_min(SizeT a, SizeT b) {
@@ -521,8 +521,8 @@ static ErrorOr<Void*> ext2_set_block_address(Ext2Context* ctx, Ext2Node* node,
mm_free_ptr(singlePtr);
return ErrorOr<Void*>(nullptr);
} else if (logicalBlockIndex < doubleStart + tripleSpan) {
- UInt32 tripleLba = ext2_block_to_lba(ctx, node->inode.fBlock[EXT2_TRIPLE_INDIRECT_INDEX]);
- auto triplePtrRef = ext2_read_block_ptr(ctx, node->inode.fBlock[EXT2_TRIPLE_INDIRECT_INDEX]);
+ UInt32 tripleLba = ext2_block_to_lba(ctx, node->inode.fBlock[EXT2_TRIPLE_INDIRECT_INDEX]);
+ auto triplePtrRef = ext2_read_block_ptr(ctx, node->inode.fBlock[EXT2_TRIPLE_INDIRECT_INDEX]);
if (triplePtrRef.HasError()) {
return ErrorOr<Void*>(kErrorDisk);
@@ -536,7 +536,6 @@ static ErrorOr<Void*> ext2_set_block_address(Ext2Context* ctx, Ext2Node* node,
mm_free_ptr(triplePtrRef.Leak().Leak());
}
-
return ErrorOr<Void*>(kErrorDisk);
}
diff --git a/src/kernel/src/FS/NeFS+FileMgr.cpp b/src/kernel/src/FS/NeFS+FileMgr.cpp
index e42bd519..a0cf4ad0 100644
--- a/src/kernel/src/FS/NeFS+FileMgr.cpp
+++ b/src/kernel/src/FS/NeFS+FileMgr.cpp
@@ -50,7 +50,7 @@ NodePtr NeFileSystemMgr::Create(_Input const Char* path) {
kout << "NeFS: Create called with null or empty path\n";
return nullptr;
}
-
+
return rtl_node_cast(mParser->CreateCatalog(path));
}
@@ -62,7 +62,7 @@ NodePtr NeFileSystemMgr::CreateDirectory(const Char* path) {
kout << "NeFS: CreateDirectory called with null or empty path\n";
return nullptr;
}
-
+
return rtl_node_cast(mParser->CreateCatalog(path, 0, kNeFSCatalogKindDir));
}
@@ -74,7 +74,7 @@ NodePtr NeFileSystemMgr::CreateAlias(const Char* path) {
kout << "NeFS: CreateAlias called with null or empty path\n";
return nullptr;
}
-
+
return rtl_node_cast(mParser->CreateCatalog(path, 0, kNeFSCatalogKindAlias));
}
@@ -119,12 +119,12 @@ _Output NodePtr NeFileSystemMgr::Open(_Input const Char* path, _Input const Char
kout << "NeFS: Open called with null or empty path\n";
return nullptr;
}
-
+
if (!r || *r == 0) {
kout << "NeFS: Open called with null or empty mode string\n";
return nullptr;
}
-
+
auto catalog = mParser->GetCatalog(path);
if (!catalog) {
kout << "NeFS: Open could not find catalog for path\n";
diff --git a/src/kernel/src/FS/NeFS+FileSystemParser.cpp b/src/kernel/src/FS/NeFS+FileSystemParser.cpp
index 42fb36a8..36b63ec7 100644
--- a/src/kernel/src/FS/NeFS+FileSystemParser.cpp
+++ b/src/kernel/src/FS/NeFS+FileSystemParser.cpp
@@ -12,7 +12,7 @@
#include <KernelKit/IFS.h>
#include <KernelKit/KPC.h>
#include <KernelKit/ProcessScheduler.h>
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#include <NeKit/Crc32.h>
#include <NeKit/KString.h>
#include <NeKit/KernelPanic.h>
diff --git a/src/kernel/src/FS/OpenHeFS+FileMgr.cpp b/src/kernel/src/FS/OpenHeFS+FileMgr.cpp
index 551d69d1..80c51061 100644
--- a/src/kernel/src/FS/OpenHeFS+FileMgr.cpp
+++ b/src/kernel/src/FS/OpenHeFS+FileMgr.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#ifndef __NE_MINIMAL_OS__
#ifdef __FSKIT_INCLUDES_OPENHEFS__
@@ -14,6 +13,7 @@
/// BUGS: 0
namespace Kernel {
+
/// @brief C++ constructor
HeFileSystemMgr::HeFileSystemMgr() {
mParser = new HeFileSystemParser();
@@ -74,9 +74,7 @@ NodePtr HeFileSystemMgr::Create(_Input const Char* path) {
err_local_get() = kErrorSuccess;
- if (auto node = mParser->CreateINode(&mDriveTrait, 0, nullptr, out, 0);
- node)
- return nullptr;
+ if (auto node = mParser->CreateINode(&mDriveTrait, 0, nullptr, out, 0); node) return nullptr;
kout << "OpenHeFS: ERROR: Check KPC.\r";
@@ -107,14 +105,12 @@ NodePtr HeFileSystemMgr::CreateDirectory(const Char* path) {
err_local_get() = kErrorSuccess;
- if (auto node = mParser->CreateINodeDirectory(&mDriveTrait, 0, out);
- node)
- return nullptr;
+ if (auto node = mParser->CreateINodeDirectory(&mDriveTrait, 0, out); node) return nullptr;
kout << "OpenHeFS: ERROR: Check KPC.\r";
- err_local_get() = kErrorDiskIsFull;
-
+ err_local_get() = kErrorDiskIsFull;
+
return nullptr;
}
@@ -126,7 +122,7 @@ NodePtr HeFileSystemMgr::CreateAlias(const Char* path) {
kout << "OpenHeFS: CreateAlias called with null or empty path\r";
return nullptr;
}
-
+
// TODO: It needs its own helper!
SizeT len = oe_string_len<Char>(path);
@@ -140,14 +136,15 @@ NodePtr HeFileSystemMgr::CreateAlias(const Char* path) {
err_local_get() = kErrorSuccess;
- if (auto node = mParser->CreateINode(&mDriveTrait, kOpenHeFSFileKindSymbolicLink, nullptr, out, 0);
- node)
+ if (auto node =
+ mParser->CreateINode(&mDriveTrait, kOpenHeFSFileKindSymbolicLink, nullptr, out, 0);
+ node)
return nullptr;
kout << "OpenHeFS: ERROR: Check KPC.\r";
- err_local_get() = kErrorDiskIsFull;
-
+ err_local_get() = kErrorDiskIsFull;
+
return nullptr;
}
@@ -221,14 +218,10 @@ _Output VoidPtr HeFileSystemMgr::Read(_Input NodePtr node, _Input Int32 flags, _
return nullptr;
}
- /// @note name is not used in OpenHeFS to mark data offsets. That's an NeFS-ism.
+/// @note name is not used in OpenHeFS to mark data offsets. That's an NeFS-ism.
Void HeFileSystemMgr::Write(_Input const Char* name, _Input NodePtr node, _Input VoidPtr data,
_Input Int32 flags, _Input SizeT size) {
NE_UNUSED(node);
- //NE_UNUSED(flags);
- //NE_UNUSED(size);
- //NE_UNUSED(name);
- //NE_UNUSED(data);
if (!flags) return;
if (!size) return;
@@ -237,8 +230,8 @@ Void HeFileSystemMgr::Write(_Input const Char* name, _Input NodePtr node, _Input
static IMountpoint mnt;
io_construct_main_drive(mnt.A());
-
- mParser->INodeManip(&mnt.A(), (VoidPtr)data, size, u8"/", (Char8*)name, 0, NO);
+
+ mParser->INodeManip(&mnt.A(), (VoidPtr) data, size, u8"/", (Char8*) name, 0, NO);
}
_Output VoidPtr HeFileSystemMgr::Read(_Input const Char* name, _Input NodePtr node,
@@ -257,13 +250,14 @@ _Output VoidPtr HeFileSystemMgr::Read(_Input const Char* name, _Input NodePtr no
static IMountpoint mnt;
io_construct_main_drive(mnt.A());
- mParser->INodeManip(&mnt.A(), (VoidPtr)retBlob, sz, u8"/", (Char8*)name, 0, YES);
-
+ mParser->INodeManip(&mnt.A(), (VoidPtr) retBlob, sz, u8"/", (Char8*) name, 0, YES);
+
return retBlob;
}
_Output Bool HeFileSystemMgr::Seek(NodePtr node, SizeT off) {
if (this->Tell(node) == kFileMgrNPos) return false;
+ kout << "The Method is not implemented in the Hybrid kernel.\r";
return off > 0;
}
@@ -273,7 +267,7 @@ _Output Bool HeFileSystemMgr::Seek(NodePtr node, SizeT off) {
_Output SizeT HeFileSystemMgr::Tell(NodePtr node) {
if (!node) return kFileMgrNPos;
SizeT pos = 0ULL;
-
+ kout << "The Method is not implemented in the Hybrid kernel.\r";
return pos;
}
@@ -289,6 +283,7 @@ _Output Bool HeFileSystemMgr::Rewind(NodePtr node) {
_Output HeFileSystemParser* HeFileSystemMgr::GetParser() {
return mParser;
}
+
} // namespace Kernel
#endif // ifdef __FSKIT_INCLUDES_OPENHEFS__
diff --git a/src/kernel/src/FS/OpenHeFS+FileSystemParser.cpp b/src/kernel/src/FS/OpenHeFS+FileSystemParser.cpp
index e03657f7..6f980730 100644
--- a/src/kernel/src/FS/OpenHeFS+FileSystemParser.cpp
+++ b/src/kernel/src/FS/OpenHeFS+FileSystemParser.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#ifdef __FSKIT_INCLUDES_OPENHEFS__
#include <FSKit/OpenHeFS.h>
@@ -11,7 +10,7 @@
#include <FirmwareKit/GPT.h>
#include <KernelKit/KPC.h>
#include <KernelKit/ProcessScheduler.h>
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#include <NeKit/Crc32.h>
#include <NeKit/KString.h>
#include <NeKit/KernelPanic.h>
diff --git a/src/kernel/src/FileMgr.cpp b/src/kernel/src/FileMgr.cpp
index 4d109bf3..4dadf288 100644
--- a/src/kernel/src/FileMgr.cpp
+++ b/src/kernel/src/FileMgr.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <KernelKit/FileMgr.h>
#include <NeKit/Utils.h>
diff --git a/src/kernel/src/GUIDWizard.cpp b/src/kernel/src/GUIDWizard.cpp
index ad54d4bd..fd43d861 100644
--- a/src/kernel/src/GUIDWizard.cpp
+++ b/src/kernel/src/GUIDWizard.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <CFKit/GUIDWizard.h>
#include <NeKit/Ref.h>
diff --git a/src/kernel/src/Gfx/FBDeviceInterface.cpp b/src/kernel/src/Gfx/FBDeviceInterface.cpp
index 35688966..48bc1abd 100644
--- a/src/kernel/src/Gfx/FBDeviceInterface.cpp
+++ b/src/kernel/src/Gfx/FBDeviceInterface.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <GfxKit/FB.h>
using namespace Kernel;
diff --git a/src/kernel/src/HeapMgr.cpp b/src/kernel/src/HeapMgr.cpp
index c22d6cdd..195c5ef2 100644
--- a/src/kernel/src/HeapMgr.cpp
+++ b/src/kernel/src/HeapMgr.cpp
@@ -3,15 +3,14 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <ArchKit/ArchKit.h>
#include <KernelKit/DebugOutput.h>
#include <KernelKit/HeapMgr.h>
#include <KernelKit/KPC.h>
+#include <KernelKit/LockDelegate.h>
#include <NeKit/Crc32.h>
#include <NeKit/PageMgr.h>
#include <NeKit/Utils.h>
-#include <KernelKit/LockDelegate.h>
/* ========================================
@@ -29,6 +28,8 @@
#define kHeapMgrMagic (0xD4D75)
#define kHeapMgrAlignSz (4U)
+#define kHeapMgrSpinMax (255'000)
+
namespace Kernel {
/// @brief Implementation details.
@@ -64,8 +65,8 @@ namespace Detail {
};
/// @brief Check for heap address validity.
- /// @param heap_ptr The address_ptr to check.
/// @return Bool if the pointer is valid or not.
+ /// @param heap_ptr The address_ptr to check.
_Output auto mm_check_ptr_address(VoidPtr heap_ptr) -> Bool {
if (!heap_ptr) return false;
@@ -85,28 +86,24 @@ STATIC PageMgr kPageMgr;
/// @param user User enable bit.
/// @return The newly allocated pointer.
_Output VoidPtr mm_alloc_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount) {
- static Bool locked = false;
- LockDelegate<255> lock{&locked};
+ static Bool kAllocationLocked = false;
+ LockDelegate<kHeapMgrSpinMax> lock{&kAllocationLocked};
auto sz_fix = sz;
if (sz_fix == 0) return nullptr;
- locked = true;
+ kAllocationLocked = true;
sz_fix += sizeof(Detail::MM_INFORMATION_BLOCK);
- auto wrapper = kPageMgr.Request(wr, user, No, sz_fix, pad_amount);
+ PTEWrapper wrapper = kPageMgr.Request(wr, user,
+ No, sz_fix, pad_amount);
Detail::MM_INFORMATION_BLOCK_PTR heap_info_ptr =
reinterpret_cast<Detail::MM_INFORMATION_BLOCK_PTR>(wrapper.VirtualAddress() +
sizeof(Detail::MM_INFORMATION_BLOCK));
- if (!heap_info_ptr) {
- locked = false;
- return nullptr;
- }
-
heap_info_ptr->fSize = sz_fix;
heap_info_ptr->fMagic = kHeapMgrMagic;
heap_info_ptr->fCRC32 = 0U; // dont fill it for now.
@@ -126,7 +123,7 @@ _Output VoidPtr mm_alloc_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount) {
(Void)(kout << "HeapMgr: Registered heap address: "
<< hex_number(reinterpret_cast<UIntPtr>(heap_info_ptr)) << kendl);
- locked = false;
+ kAllocationLocked = false;
return result;
}
@@ -134,7 +131,7 @@ _Output VoidPtr mm_alloc_ptr(SizeT sz, Bool wr, Bool user, SizeT pad_amount) {
/// @brief Controls the page's heap.
/// @param heap_ptr the pointer to make a page heap.
/// @return kErrorSuccess if successful, otherwise an error code.
- _Output Int32 mm_ctl_page(VoidPtr heap_ptr, const Bool enable) {
+_Output Int32 mm_ctl_page(VoidPtr heap_ptr, const Bool enable) {
if (Detail::mm_check_ptr_address(heap_ptr) == No) return kErrorHeapNotPresent;
Detail::MM_INFORMATION_BLOCK_PTR heap_info_ptr =
diff --git a/src/kernel/src/InitializerList.cpp b/src/kernel/src/InitializerList.cpp
index 42e3db6a..fada5851 100644
--- a/src/kernel/src/InitializerList.cpp
+++ b/src/kernel/src/InitializerList.cpp
@@ -3,5 +3,4 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <NeKit/InitializerList.h>
diff --git a/src/kernel/src/Json.cpp b/src/kernel/src/Json.cpp
index 06e428e9..5cfd7c06 100644
--- a/src/kernel/src/Json.cpp
+++ b/src/kernel/src/Json.cpp
@@ -5,4 +5,4 @@
#include <NeKit/Json.h>
-namespace Kernel {} \ No newline at end of file
+namespace Kernel {}
diff --git a/src/kernel/src/KernelTask.cpp b/src/kernel/src/KernelTask.cpp
index e733d64a..e73dce21 100644
--- a/src/kernel/src/KernelTask.cpp
+++ b/src/kernel/src/KernelTask.cpp
@@ -3,9 +3,8 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
-#include <KernelKit/KernelTask.h>
#include <KernelKit/CodeMgr.h>
+#include <KernelKit/KernelTask.h>
/***********************************************************************************/
/// @file KernelTaskScheduler.cc
@@ -14,15 +13,15 @@
/***********************************************************************************/
namespace Kernel {
-
+
/// @internal @brief Calls the DDK stub to initialize the stack_frame of the driver.
EXTERN_C Int32 kt_kernel_task_start(HAL::StackFramePtr stack_frame, VoidPtr code) {
MUST_PASS(stack_frame && code);
- ((rtl_kstart_kind)(code))(stack_frame);
+ ((rtl_kstart_kind) (code))(stack_frame);
return stack_frame->R8;
}
-
+
Bool KernelTaskHelper::Start(KernelTask& task_ptr, const KID& kid) {
if (!kid) return NO;
diff --git a/src/kernel/src/New+Delete.cpp b/src/kernel/src/New+Delete.cpp
index 9ec34c6f..6e4dd79a 100644
--- a/src/kernel/src/New+Delete.cpp
+++ b/src/kernel/src/New+Delete.cpp
@@ -18,19 +18,19 @@ void* operator new(size_t sz) {
return Kernel::mm_alloc_ptr(sz, true, false);
}
-void operator delete[](void* ptr) {
+void operator delete[](void* ptr) noexcept {
if (ptr == nullptr) return;
Kernel::mm_free_ptr(ptr);
}
-void operator delete(void* ptr) {
+void operator delete(void* ptr) noexcept {
if (ptr == nullptr) return;
Kernel::mm_free_ptr(ptr);
}
-void operator delete(void* ptr, size_t sz) {
+void operator delete(void* ptr, size_t sz) noexcept {
if (ptr == nullptr) return;
NE_UNUSED(sz);
@@ -38,7 +38,7 @@ void operator delete(void* ptr, size_t sz) {
Kernel::mm_free_ptr(ptr);
}
-void operator delete[](void* ptr, size_t sz) {
+void operator delete[](void* ptr, size_t sz) noexcept {
if (ptr == nullptr) return;
NE_UNUSED(sz);
diff --git a/src/kernel/src/PageMgr.cpp b/src/kernel/src/PageMgr.cpp
index 7aac7d42..0ed16767 100644
--- a/src/kernel/src/PageMgr.cpp
+++ b/src/kernel/src/PageMgr.cpp
@@ -13,6 +13,7 @@
#endif // ifdef __NE_AMD64__ || defined(__NE_ARM64__)
namespace Kernel {
+
PTEWrapper::PTEWrapper(Boolean Rw, Boolean User, Boolean ExecDisable, UIntPtr VirtAddr)
: fRw(Rw),
fUser(User),
@@ -91,4 +92,5 @@ Void PTEWrapper::NoExecute(const bool enable) {
Bool PTEWrapper::NoExecute() {
return fExecDisable;
}
+
} // namespace Kernel
diff --git a/src/kernel/src/Property.cpp b/src/kernel/src/Property.cpp
index 6db475e8..6da6ae70 100644
--- a/src/kernel/src/Property.cpp
+++ b/src/kernel/src/Property.cpp
@@ -6,6 +6,7 @@
#include <CFKit/Property.h>
namespace Kernel::CF {
+
/***********************************************************************************/
/// @brief Destructor.
/***********************************************************************************/
@@ -37,4 +38,5 @@ KBasicString<>& Property::GetKey() {
PropertyId& Property::GetValue() {
return fValue;
}
+
} // namespace Kernel::CF
diff --git a/src/libPOSIXWrapper/src/.keep b/src/kernel/src/RT/.keep
index e69de29b..e69de29b 100644
--- a/src/libPOSIXWrapper/src/.keep
+++ b/src/kernel/src/RT/.keep
diff --git a/src/kernel/src/RT/README.txt b/src/kernel/src/RT/README.txt
new file mode 100644
index 00000000..d85b9570
--- /dev/null
+++ b/src/kernel/src/RT/README.txt
@@ -0,0 +1,4 @@
+NeKernel Real-Time Patches
+==========================
+
+This patchset transforms NeKernel into a real-time OS, although designed for backend/server purposes. \ No newline at end of file
diff --git a/src/kernel/src/Semaphore.cpp b/src/kernel/src/Semaphore.cpp
index c353c223..8516e462 100644
--- a/src/kernel/src/Semaphore.cpp
+++ b/src/kernel/src/Semaphore.cpp
@@ -3,6 +3,4 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <KernelKit/Semaphore.h>
-
diff --git a/src/kernel/src/Storage/AHCIDeviceInterface.cpp b/src/kernel/src/Storage/AHCIDeviceInterface.cpp
index 3e47ef45..3a48cadc 100644
--- a/src/kernel/src/Storage/AHCIDeviceInterface.cpp
+++ b/src/kernel/src/Storage/AHCIDeviceInterface.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <StorageKit/AHCI.h>
namespace Kernel {
diff --git a/src/kernel/src/Swap/DiskSwap.cpp b/src/kernel/src/Swap/DiskSwap.cpp
index 94991d20..b7733870 100644
--- a/src/kernel/src/Swap/DiskSwap.cpp
+++ b/src/kernel/src/Swap/DiskSwap.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <KernelKit/FileMgr.h>
#include <SwapKit/DiskSwap.h>
diff --git a/src/kernel/src/User.cpp b/src/kernel/src/User.cpp
index 2e626b03..6fd2e7b3 100644
--- a/src/kernel/src/User.cpp
+++ b/src/kernel/src/User.cpp
@@ -7,12 +7,12 @@
#include <KernelKit/HeapMgr.h>
#include <KernelKit/KPC.h>
#include <KernelKit/ThreadLocalStorage.h>
-#include <KernelKit/UserMgr+User.h>
+#include <KernelKit/User.h>
#include <NeKit/KString.h>
#include <NeKit/KernelPanic.h>
#include <NeKit/Utils.h>
-/// @file UserMgr+User.cpp
+/// @file User.cpp
/// @brief Multi-user support.
namespace Kernel {
@@ -23,7 +23,7 @@ namespace Detail {
/// \param password password to hash.
/// \return the hashed password
////////////////////////////////////////////////////////////
- STATIC UInt64 user_fnv_generator(const Char* password, User* user) {
+ STATIC UInt64 user_fnv_generator(const UserPublicKeyType* password, User* user) {
kout << "user_fnv_generator: Try hashing user password...\r";
if (!password || !user) return 0;
@@ -48,18 +48,17 @@ namespace Detail {
////////////////////////////////////////////////////////////
/// @brief User ring constructor.
////////////////////////////////////////////////////////////
-User::User(const Int32& sel, const Char* user_name) : mUserRing((UserRingKind) sel) {
+User::User(const Int32& sel, const UserPublicKeyType* user_name) : mUserRing((UserRingKind) sel) {
MUST_PASS(sel >= 0);
- rt_copy_memory_safe((VoidPtr) user_name, this->mUserName, rt_string_len(user_name),
- kMaxUserNameLen);
+ urt_copy_memory((VoidPtr) user_name, this->mUserName, urt_string_len(user_name));
}
////////////////////////////////////////////////////////////
/// @brief User ring constructor.
////////////////////////////////////////////////////////////
-User::User(const UserRingKind& ring_kind, const Char* user_name) : mUserRing(ring_kind) {
- rt_copy_memory_safe((VoidPtr) user_name, this->mUserName, rt_string_len(user_name),
- kMaxUserNameLen);
+User::User(const UserRingKind& ring_kind, const UserPublicKeyType* user_name)
+ : mUserRing(ring_kind) {
+ urt_copy_memory((VoidPtr) user_name, this->mUserName, urt_string_len(user_name));
}
////////////////////////////////////////////////////////////
@@ -67,6 +66,8 @@ User::User(const UserRingKind& ring_kind, const Char* user_name) : mUserRing(rin
////////////////////////////////////////////////////////////
User::~User() = default;
+Bool User::IsAdult() { return mUserIsAdult; }
+
Bool User::Save(const UserPublicKey password) {
if (!password || *password == 0) return No;
diff --git a/src/kernel/src/UserMgr.cpp b/src/kernel/src/UserMgr.cpp
deleted file mode 100644
index cceda53d..00000000
--- a/src/kernel/src/UserMgr.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Copyright 2024-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/kernel
-
-#include <KernelKit/FileMgr.h>
-#include <KernelKit/HeapMgr.h>
-#include <KernelKit/KPC.h>
-#include <KernelKit/ThreadLocalStorage.h>
-#include <KernelKit/UserMgr+User.h>
-#include <NeKit/KString.h>
-#include <NeKit/KernelPanic.h>
-#include <NeKit/Utils.h>
-
-/// @file UserMgr+User.cpp
-/// @brief Multi-user support.
-
-namespace Kernel {
- namespace Detail {
- struct UserPermissionControl;
- struct UserPermissionElevator;
- }
-}
diff --git a/src/kernel/src/UserProcessScheduler.cpp b/src/kernel/src/UserProcessScheduler.cpp
index 4b8d788b..a8ef1799 100644
--- a/src/kernel/src/UserProcessScheduler.cpp
+++ b/src/kernel/src/UserProcessScheduler.cpp
@@ -12,6 +12,7 @@
#include <NeKit/KString.h>
#include <NeKit/Utils.h>
#include <SignalKit/Signals.h>
+#include "KernelKit/CoreProcessScheduler.h"
///! BUG COUNT: 0
@@ -405,6 +406,7 @@ ProcessID UserProcessScheduler::Spawn(const Char* name, VoidPtr code, VoidPtr im
process.PTime = 0;
process.UTime = 0;
process.RTime = 0;
+ process.STime = 0;
if (!process.FileTree) {
process.FileTree = new ProcessFileTree<VoidPtr>();
@@ -474,47 +476,66 @@ Bool UserProcessScheduler::HasMP() {
/***********************************************************************************/
SizeT UserProcessScheduler::Run() {
- if (mTeam.mProcessCur < 1) {
- return 0UL;
- }
+ STATIC SizeT process_index{}; //! we store this guy to tell the scheduler how many
+ //! things we have scheduled.
- SizeT process_index = 0UL; //! we store this guy to tell the scheduler how many
- //! things we have scheduled.
+ UserProcessTeam& team = mTeam;
+ SizeT limit = team.AsArray().Capacity();
- for (; process_index < mTeam.AsArray().Capacity(); ++process_index) {
- auto& process = mTeam.AsArray()[process_index];
+ if (team.mProcessCur < 1) {
+ return {};
+ }
- //! Check if the process needs to be run.
- if (UserProcessHelper::CanBeScheduled(process)) {
- kout << process.Name << " will be scheduled to run...\r";
+ if (process_index > limit)
+ process_index = 0UL;
+ else
+ ++process_index;
- //! Increase the usage time of the process.
- if (process.UTime < process.PTime) {
- ++process.UTime;
- }
+ auto& process = team.AsArray()[process_index];
- this->TheCurrentProcess() = process;
+ //! Check if the process needs to be run.
+ if (UserProcessHelper::CanBeScheduled(process)) {
+ kout << process.Name << " will be scheduled to run...\r";
- if (UserProcessHelper::Switch(process.StackFrame, process.ProcessId)) {
- process.PTime = static_cast<Int32>(process.Affinity);
+ //! Increase the usage time of the process.
+ if (process.UTime < process.PTime) {
+ ++process.UTime;
+ }
- // We add a bigger cooldown according to the RTime and affinity here.
- if (process.PTime < process.RTime && AffinityKind::kRealTime != process.Affinity) {
- if (process.RTime < (Int32) AffinityKind::kVeryHigh)
- process.RTime += (Int32) AffinityKind::kLowUsage;
- else if (process.RTime < (Int32) AffinityKind::kHigh)
- process.RTime += (Int32) AffinityKind::kStandard;
- else if (process.RTime < (Int32) AffinityKind::kStandard)
- process.RTime += (Int32) AffinityKind::kHigh;
+ //! boost priority for processes that slept (interactive boost)
+ if (process.STime > 0) {
+ // the longer it slept, the bigger the boost (capped at kVeryHigh level)
+ ProcessTime boost = process.STime / 10;
+ if (boost > (Int32) AffinityKind::kHigh) boost = (Int32) AffinityKind::kHigh;
+ process.PTime += boost;
+ process.STime = 0; // reset sleep counter after boost
+ }
- process.PTime -= process.RTime;
- process.RTime = 0UL;
- }
+ this->TheCurrentProcess() = process;
+
+ if (UserProcessHelper::Switch(process.StackFrame, process.ProcessId)) {
+ // We add a bigger cooldown according to the RTime and affinity here.
+ if (process.PTime < process.RTime && AffinityKind::kUltraHigh != process.Affinity) {
+ if (process.RTime < (Int32) AffinityKind::kVeryHigh)
+ process.RTime += (Int32) AffinityKind::kLowUsage;
+ else if (process.RTime < (Int32) AffinityKind::kHigh)
+ process.RTime += (Int32) AffinityKind::kStandard;
+ else if (process.RTime < (Int32) AffinityKind::kStandard)
+ process.RTime += (Int32) AffinityKind::kHigh;
+
+ process.PTime -= process.RTime;
+ process.RTime = 0UL;
+ } else if (AffinityKind::kUltraHigh != process.Affinity) {
+ process.PTime += (Int32) AffinityKind::kUltraHigh;
}
- } else {
- ++process.RTime;
- --process.PTime;
}
+ } else {
+ //! track sleep time for processes that are blocked/waiting
+ if (process.Status == ProcessStatusKind::kFrozen) {
+ ++process.STime;
+ }
+ ++process.RTime;
+ --process.PTime;
}
return process_index;
@@ -562,7 +583,7 @@ ErrorOr<ProcessID> UserProcessHelper::TheCurrentPID() {
/// @retval true can be schedulded.
/// @retval false cannot be schedulded.
Bool UserProcessHelper::CanBeScheduled(const UserProcess& process) {
- if (process.Affinity == AffinityKind::kRealTime) return Yes;
+ if (process.Affinity == AffinityKind::kUltraHigh) return Yes;
if (process.Status != ProcessStatusKind::kRunning) return No;
if (process.Affinity == AffinityKind::kInvalid) return No;
@@ -594,7 +615,7 @@ SizeT UserProcessHelper::StartScheduling() {
Bool UserProcessHelper::Switch(HAL::StackFramePtr frame_ptr, ProcessID new_pid) {
(Void)(kout << "IP: " << hex_number(frame_ptr->IP) << kendl);
- for (SizeT index = 0UL; index < HardwareThreadScheduler::The().Capacity(); ++index) {
+ for (SizeT index{}; index < HardwareThreadScheduler::The().Capacity(); ++index) {
if (!HardwareThreadScheduler::The()[index].Leak()) continue;
if (HardwareThreadScheduler::The()[index].Leak()->Kind() == ThreadKind::kAPInvalid ||
diff --git a/src/kernel/src/UserProcessTeam.cpp b/src/kernel/src/UserProcessTeam.cpp
index 293fd45a..a89aafa2 100644
--- a/src/kernel/src/UserProcessTeam.cpp
+++ b/src/kernel/src/UserProcessTeam.cpp
@@ -7,15 +7,19 @@
namespace Kernel {
UserProcessTeam::UserProcessTeam() {
- for (SizeT i = 0U; i < this->mProcessList.Count(); ++i) {
+ for (SizeT i{}; i < kCPSProcessLimitPerTeam; ++i) {
this->mProcessList[i] = UserProcess{};
this->mProcessList[i].PTime = 0;
this->mProcessList[i].RTime = 0;
this->mProcessList[i].UTime = 0;
+ this->mProcessList[i].STime = 0;
this->mProcessList[i].Status = ProcessStatusKind::kKilled;
}
- // se the cursor to zero.
+ // We dont know our team yet.
+ this->mTeamId = 0UL;
+
+ // We dont have any running processes.
this->mProcessCur = 0UL;
}
diff --git a/src/kernel/src/UtfUtils.cpp b/src/kernel/src/UtfUtils.cpp
index 0698010c..dbf52840 100644
--- a/src/kernel/src/UtfUtils.cpp
+++ b/src/kernel/src/UtfUtils.cpp
@@ -8,6 +8,7 @@
/// @author Amlal El Mahrouss (amlal@nekernel.org)
namespace Kernel {
+
Size urt_string_len(const Utf8Char* str) {
if (!str) return 0;
@@ -58,4 +59,5 @@ Int32 urt_copy_memory(const VoidPtr src, VoidPtr dst, Size len) {
return index;
}
+
} // namespace Kernel
diff --git a/src/kernel/src/ZXDCodeMgr.cpp b/src/kernel/src/ZXDCodeMgr.cpp
index 59abc3c3..29599b1e 100644
--- a/src/kernel/src/ZXDCodeMgr.cpp
+++ b/src/kernel/src/ZXDCodeMgr.cpp
@@ -3,8 +3,5 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <KernelKit/CodeMgr.h>
#include <KernelKit/ZXD.h>
-
-
diff --git a/src/launch/src/RuntimeMain.cpp b/src/launch/src/RuntimeMain.cpp
index 833a2f55..1a08ece6 100644
--- a/src/launch/src/RuntimeMain.cpp
+++ b/src/launch/src/RuntimeMain.cpp
@@ -3,22 +3,21 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <LaunchKit/Foundation.h>
#include <libSystem/SystemKit/Err.h>
#include <libSystem/SystemKit/Syscall.h>
/// @note This called by _NeMain from its own runtime.
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"))); // Register service based on program data.
+ /// start the LaunchHelpers.fwrk service, and make the launcher scheduable too (via mgmt.launch)
+ UInt32* ret = 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_attach_service"))); // Attach this program as the service process.
+ ret = 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/libDDK/DriverKit/ObjectKit/Base.h b/src/libDDK/DriverKit/ObjectKit/Base.hpp
index bf557352..869e6ec1 100644
--- a/src/libDDK/DriverKit/ObjectKit/Base.h
+++ b/src/libDDK/DriverKit/ObjectKit/Base.hpp
@@ -10,7 +10,7 @@
#define DDK_DRIVER_IMPL \
final: \
- public \
+ public \
::Kernel::DDK::IDriverBase
/// @author Amlal El Mahrouss
@@ -29,6 +29,7 @@ class IDriverBase {
IDriverBase& operator=(const IDriverBase&) = default;
IDriverBase(const IDriverBase&) = default;
+public:
using PtrType = void*;
virtual constexpr bool IsCastable() { return false; }
@@ -41,7 +42,7 @@ class IDriverBase {
/// @author @amlel-el-mahrouss
template <typename Driver>
concept IsValidDriver = requires(Driver drv) {
- {drv.IsActive() && drv.Type() > kInvalidType};
+ { drv.IsActive() && drv.Type() > kInvalidType };
};
} // namespace Kernel::DDK
diff --git a/src/libDDK/DriverKit/ObjectKit/Checksum.h b/src/libDDK/DriverKit/ObjectKit/Checksum.hpp
index 927bbb77..d1973161 100644
--- a/src/libDDK/DriverKit/ObjectKit/Checksum.h
+++ b/src/libDDK/DriverKit/ObjectKit/Checksum.hpp
@@ -6,11 +6,12 @@
#ifndef DRIVERKIT_CHECKSUM_H
#define DRIVERKIT_CHECKSUM_H
-#include <DriverKit/ObjectKit/Base.h>
+#include <DriverKit/ObjectKit/Base.hpp>
namespace Kernel::DDK {
-using IndexableBlob = char*;
+using Blob = char*;
+using IndexableBlob = Blob;
using Indexable = char;
/// @note This uses the FNV 64-bit variant.
@@ -22,19 +23,18 @@ inline uintptr_t rtl_checksum(const IndexableBlob path) {
const uintptr_t kFNVPrime = 0x100000001b3ULL;
uintptr_t hash = kFNVSeed;
-
IndexableBlob path_ = path;
while (*path_) {
- hash ^= (Indexable) (*path_++);
+ hash ^= (Indexable) (*path_);
+ ++path_;
+
hash *= kFNVPrime;
}
return hash;
}
-using Blob = void*;
-
} // namespace Kernel::DDK
#endif
diff --git a/src/libDDK/DriverKit/ObjectKit/DriverKit.h b/src/libDDK/DriverKit/ObjectKit/DriverKit.hpp
index 3fc883fa..a5604c77 100644
--- a/src/libDDK/DriverKit/ObjectKit/DriverKit.h
+++ b/src/libDDK/DriverKit/ObjectKit/DriverKit.hpp
@@ -3,10 +3,10 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef DRIVERKIT_DDK_H
-#define DRIVERKIT_DDK_H
+#ifndef DRIVERKIT_OBJECTKIT_DDK_H
+#define DRIVERKIT_OBJECTKIT_DDK_H
-#include <DriverKit/ObjectKit/Base.h>
-#include <DriverKit/ObjectKit/Checksum.h>
+#include <DriverKit/ObjectKit/Base.hpp>
+#include <DriverKit/ObjectKit/Checksum.hpp>
#endif
diff --git a/src/libDDK/src/CxxABI.cpp b/src/libDDK/src/CxxABI.cpp
index f1fc5034..4c5bda38 100644
--- a/src/libDDK/src/CxxABI.cpp
+++ b/src/libDDK/src/CxxABI.cpp
@@ -12,7 +12,9 @@ void* operator new(size_t sz) {
return ::kalloc(sz);
}
-void operator delete(void* ptr) { ::kfree(ptr); }
+void operator delete(void* ptr) {
+ ::kfree(ptr);
+}
void* operator new[](size_t sz) {
if (!sz) ++sz;
@@ -20,5 +22,6 @@ void* operator new[](size_t sz) {
return ::kalloc(sz);
}
-void operator delete[](void* ptr) { ::kfree(ptr); }
-
+void operator delete[](void* ptr) {
+ ::kfree(ptr);
+}
diff --git a/src/libDDK/src/KernelAllocator.cpp b/src/libDDK/src/KernelAllocator.cpp
index f2dd7b45..e81161a5 100644
--- a/src/libDDK/src/KernelAllocator.cpp
+++ b/src/libDDK/src/KernelAllocator.cpp
@@ -14,7 +14,7 @@
DDK_EXTERN void* kalloc(size_t sz) {
if (!sz) ++sz;
- void* ptr = ::ke_call_dispatch("mm_alloc_ptr", 1, &sz, sizeof(size_t));
+ void* ptr = ::ke_call_dispatch("mm_alloc_ptr", 1, &sz, sizeof(sz));
return ptr;
}
@@ -26,5 +26,5 @@ DDK_EXTERN void* kalloc(size_t sz) {
DDK_EXTERN void kfree(void* ptr) {
if (!ptr) return;
- ::ke_call_dispatch("mm_free_ptr", 1, ptr, 0);
+ ::ke_call_dispatch("mm_free_ptr", 1, ptr, sizeof(ptr));
}
diff --git a/src/libDDK/src/KernelDevice.cpp b/src/libDDK/src/KernelDevice.cpp
index c5fb785f..50a2c9a8 100644
--- a/src/libDDK/src/KernelDevice.cpp
+++ b/src/libDDK/src/KernelDevice.cpp
@@ -11,8 +11,8 @@
DDK_EXTERN DDK_DEVICE_PTR kopen_dev(const char* devicePath) {
if (nil == devicePath) return nil;
- return (DDK_DEVICE_PTR) ::ke_call_dispatch("dk_open_dev", 1, (void*) devicePath,
- kstrlen(devicePath));
+ return (DDK_DEVICE_PTR)::ke_call_dispatch("dk_open_dev", 1, (void*) devicePath,
+ kstrlen(devicePath));
}
/// @brief Close any device.
diff --git a/src/libDDK/src/KernelDriverBase.cpp b/src/libDDK/src/KernelDriverBase.cpp
index 37b138a0..67fd7466 100644
--- a/src/libDDK/src/KernelDriverBase.cpp
+++ b/src/libDDK/src/KernelDriverBase.cpp
@@ -3,6 +3,4 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#include <DriverKit/ObjectKit/Base.h>
-
-
+#include <DriverKit/ObjectKit/Base.hpp>
diff --git a/src/libMsg/src/Server.cpp b/src/libMsg/src/Server.cpp
index e4602047..ed043d0b 100644
--- a/src/libMsg/src/Server.cpp
+++ b/src/libMsg/src/Server.cpp
@@ -4,35 +4,37 @@
// Official repository: https://github.com/ne-foss-org/nekernel
#include <libMsg/MsgKit/Server.h>
+#include <libSystem/SystemKit/Err.h>
static libmsg_func_type* kFuncs{nullptr};
static SizeT kFuncCnt{0};
static SemaphoreRef kSemaphore{nullptr};
IMPORT_C UInt32 libmsg_close_library(Void) {
- if (kSemaphore) return 0;
+ if (kSemaphore) return kErrorInvalidData;
kFuncs = nullptr;
kFuncCnt = 0;
- return 0;
+ return kErrorSuccess;
}
IMPORT_C UInt32 libmsg_eval_expr(struct LIBMSG_EXPR* head, VoidPtr arg, SizeT arg_size) {
- if (kSemaphore) return 0;
+ if (kSemaphore) return kErrorInvalidData;
+ if (!head) return kErrorInvalidData;
- if (!head) return 0;
+ static auto kSemWaitTime = 1000;
- kSemaphore = SemCreate(1000, 1000, "libmsg_semaphore");
+ kSemaphore = ::SemCreate(kSemWaitTime, kSemWaitTime, "libmsg_semaphore");
- if (!kSemaphore) return 0;
+ if (!kSemaphore) return kErrorInvalidData;
kFuncs[head->l_index](head, arg, arg_size);
- SemClose(kSemaphore);
+ ::SemClose(kSemaphore);
kSemaphore = nullptr;
- return 0;
+ return kErrorSuccess;
}
IMPORT_C Void libmsg_init_library(libmsg_func_type* funcs, SizeT cnt) {
diff --git a/src/libPOSIXWrapper/POSIXKit/POSIX.h b/src/libPOSIXWrapper/POSIXKit/POSIX.h
new file mode 100644
index 00000000..ea2067b3
--- /dev/null
+++ b/src/libPOSIXWrapper/POSIXKit/POSIX.h
@@ -0,0 +1,24 @@
+// 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
+
+#ifndef LIBPOSIX_POSIXKIT_POSIX_H
+#define LIBPOSIX_POSIXKIT_POSIX_H
+
+#include <libSystem/SystemKit/System.h>
+
+/// @file POSIX.h
+/// @brief POSIX definitions header for the NeSystem.
+
+/// @brief Please use these macros to specify whether your function is thread safe or not.
+#define PTHREAD_UNSAFE __THREAD_UNSAFE
+#define PTHREAD_SAFE __THREAD_SAFE
+
+#define _POSIX_SOURCE __POSIX_SOURCE__
+#define _XOPEN_SOURCE __XOPEN_SOURCE__
+
+PTHREAD_UNSAFE IMPORT_C SInt64 write(SizeT count, SInt32 fd, Void* data, SizeT sz);
+PTHREAD_UNSAFE IMPORT_C SInt64 read(SizeT count, SInt32 fd, Void* data, SizeT sz);
+
+#endif // LIBPOSIX_POSIXKIT_POSIX_H
diff --git a/src/libPOSIXWrapper/POSIXKit/unistd.h b/src/libPOSIXWrapper/POSIXKit/unistd.h
index 0e133c89..96701f35 100644
--- a/src/libPOSIXWrapper/POSIXKit/unistd.h
+++ b/src/libPOSIXWrapper/POSIXKit/unistd.h
@@ -3,19 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-#ifndef LIBPOSIX_POSIXKIT_UNISTD_H
-#define LIBPOSIX_POSIXKIT_UNISTD_H
+#pragma once
-#include <libSystem/SystemKit/System.h>
-
-/// @file Unistd.h
-/// @brief POSIX Standard Header for NeKernel.
-
-#define _POSIX_SOURCE __POSIX_SOURCE__
-#define _XOPEN_SOURCE __XOPEN_SOURCE__
-
-IMPORT_C SInt64 write(SizeT count, SInt32 fd, Void* data, SizeT sz);
-
-IMPORT_C SInt64 read(SizeT count, SInt32 fd, Void* data, SizeT sz);
-
-#endif // LIBPOSIX_POSIXKIT_UNISTD_H
+#include <libPOSIXWrapper/POSIXKit/POSIX.h>
diff --git a/src/libPThread/src/.keep b/src/libPOSIXWrapper/doc/.keep
index e69de29b..e69de29b 100644
--- a/src/libPThread/src/.keep
+++ b/src/libPOSIXWrapper/doc/.keep
diff --git a/src/libPOSIXWrapper/obj/.keep b/src/libPOSIXWrapper/obj/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/libPOSIXWrapper/obj/.keep
diff --git a/src/libPOSIXWrapper/src/POSIX.cpp b/src/libPOSIXWrapper/src/POSIX.cpp
new file mode 100644
index 00000000..98db8e51
--- /dev/null
+++ b/src/libPOSIXWrapper/src/POSIX.cpp
@@ -0,0 +1,6 @@
+// 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 <libPOSIXWrapper/POSIXKit/POSIX.h>
diff --git a/src/libPThread/PThreadKit/Thread.h b/src/libPThread/PThreadKit/Thread.h
index 85f7a320..7e528ab2 100644
--- a/src/libPThread/PThreadKit/Thread.h
+++ b/src/libPThread/PThreadKit/Thread.h
@@ -8,14 +8,15 @@
#include <libPOSIXWrapper/POSIXKit/unistd.h>
-#define PTHREAD_UNSAFE /* hint */
-#define PTHREAD_SAFE /* hint */
+/// @internal Internal type, please do not rely on it for multi-platform builds.
+typedef ThreadRef pthread_ref_t;
-PTHREAD_SAFE SInt32 pthread_create(_Output ThreadRef* thread, VoidPtr attr, VoidPtr (*start_routine)(VoidPtr), VoidPtr arg);
-PTHREAD_SAFE SInt32 pthread_join(ThreadRef thread, VoidPtr* retval);
-PTHREAD_SAFE SInt32 pthread_exit(SInt32 retval);
-PTHREAD_SAFE SInt32 pthread_detach(ThreadRef thread);
-PTHREAD_SAFE ThreadRef pthread_self(Void);
-PTHREAD_SAFE SInt32 pthread_yield(void);
+PTHREAD_SAFE IMPORT_C SInt32 pthread_create(_Output pthread_ref_t* thread, VoidPtr attr,
+ VoidPtr (*start_routine)(VoidPtr), VoidPtr arg);
+PTHREAD_SAFE IMPORT_C SInt32 pthread_join(pthread_ref_t thread, VoidPtr* retval);
+PTHREAD_SAFE IMPORT_C SInt32 pthread_exit(SInt32 retval);
+PTHREAD_SAFE IMPORT_C SInt32 pthread_detach(pthread_ref_t thread);
+PTHREAD_SAFE IMPORT_C pthread_ref_t pthread_self(Void);
+PTHREAD_SAFE IMPORT_C SInt32 pthread_yield(void);
#endif // LIBPOSIX_POSIXKIT_THREAD_H
diff --git a/src/libPThread/PThreadKit/pthread.h b/src/libPThread/PThreadKit/pthread.h
new file mode 100644
index 00000000..2448c458
--- /dev/null
+++ b/src/libPThread/PThreadKit/pthread.h
@@ -0,0 +1,11 @@
+// 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
+
+#ifndef LIBPOSIX_POSIXKIT_PTHREAD_H
+#define LIBPOSIX_POSIXKIT_PTHREAD_H
+
+#include <libPThread/ThreadKit/Thread.h>
+
+#endif
diff --git a/src/libPThread/src/Thread.cpp b/src/libPThread/src/Thread.cpp
index 5a351be8..0d5052f2 100644
--- a/src/libPThread/src/Thread.cpp
+++ b/src/libPThread/src/Thread.cpp
@@ -4,6 +4,7 @@
// Official repository: https://github.com/ne-foss-org/nekernel
#include <libPThread/PThreadKit/Thread.h>
+#include <libSystem/SystemKit/Err.h>
PTHREAD_SAFE SInt32 pthread_detach(ThreadRef thread) {
return ThrDetachThread(thread);
@@ -22,21 +23,25 @@ PTHREAD_SAFE SInt32 pthread_exit(SInt32 retval) {
}
PTHREAD_SAFE SInt32 pthread_join(ThreadRef thread, VoidPtr* retval) {
- SInt32* ret = (SInt32*)retval;
- *ret = ThrJoinThread(thread);
+ SInt32* ret = (SInt32*) retval;
+
+ if (!ret) return kErrorInvalidData;
- return 0;
+ *ret = ThrJoinThread(thread);
+ return kErrorSuccess;
}
-PTHREAD_SAFE SInt32 pthread_create(_Output ThreadRef* thread, VoidPtr attr, VoidPtr (*start_routine)(VoidPtr), VoidPtr arg) {
+PTHREAD_SAFE SInt32 pthread_create(_Output ThreadRef* thread, VoidPtr attr,
+ VoidPtr (*start_routine)(VoidPtr), VoidPtr arg) {
LIBSYS_UNUSED(attr);
- /// @note passing zero means you'd have to read the argv until you hit a nullptr.
- ThreadRef thrd = ThrCreateThread("pthread_thread", (ThrProcKind)start_routine, 0, arg, 0);
+ if (!attr || !thread || !arg || !start_routine) return kErrorInvalidData;
- if (!thrd) return -1;
+ /// @note passing zero means you'd have to read the argv until you hit a nullptr.
+ ThreadRef thrd = ThrCreateThread("pthread_thread", (ThrProcKind) start_routine, 0, arg, 0);
+
+ if (!thrd) return kErrorInvalidData;
*thread = thrd;
- return 0;
+ return kErrorSuccess;
}
-
diff --git a/src/libSoundSystem/SoundSystemKit/VirtualMixer.h b/src/libSoundSystem/SoundSystemKit/VirtualMixer.h
index 69fa341a..c0883ae9 100644
--- a/src/libSoundSystem/SoundSystemKit/VirtualMixer.h
+++ b/src/libSoundSystem/SoundSystemKit/VirtualMixer.h
@@ -10,9 +10,11 @@
#include <libSystem/SystemKit/System.h>
namespace SoundSystem {
+
struct VirtualMixer;
struct VirtualSource;
struct VirtualVolume;
+
} // namespace SoundSystem
#endif
diff --git a/src/libSoundSystem/src/VirtualMixer.cpp b/src/libSoundSystem/src/VirtualMixer.cpp
index 792bb672..0316b27f 100644
--- a/src/libSoundSystem/src/VirtualMixer.cpp
+++ b/src/libSoundSystem/src/VirtualMixer.cpp
@@ -6,4 +6,3 @@
#include <SoundSystemKit/VirtualMixer.h>
namespace SoundSystem {}
-
diff --git a/src/libSystem/SystemKit/Macros.h b/src/libSystem/SystemKit/Macros.h
index 37150b01..1673d427 100644
--- a/src/libSystem/SystemKit/Macros.h
+++ b/src/libSystem/SystemKit/Macros.h
@@ -15,6 +15,9 @@
#define ATTRIBUTE(X) __attribute__((X))
+#define __THREAD_SAFE ATTRIBUTE(thread_safe)
+#define __THREAD_UNSAFE
+
#define IMPORT_CXX extern "C++"
#define IMPORT_C extern "C"
@@ -91,7 +94,7 @@ typedef nullPtr NullPtr;
#endif
#ifndef kib_cast
-#define kib_cast(X) (UInt64)((X) *1024)
+#define kib_cast(X) (UInt64)((X) * 1024)
#endif
#ifndef MIB
diff --git a/src/libSystem/SystemKit/System.h b/src/libSystem/SystemKit/System.h
index 69cce9a7..7e4a9ae6 100644
--- a/src/libSystem/SystemKit/System.h
+++ b/src/libSystem/SystemKit/System.h
@@ -21,7 +21,8 @@
/// @brief Types API.
// ------------------------------------------------------------------------------------------ //
-/// @brief Reference type, used for all references in the system, such as file descriptors, dylib handles, thread handles, etc.
+/// @brief Reference type, used for all references in the system, such as file descriptors, dylib
+/// handles, thread handles, etc.
struct REF_TYPE {
UInt64 __hash; /// @brief Hash of the syscall
VoidPtr __self; /// @brief Syscall self value.
@@ -398,7 +399,8 @@ IMPORT_C UInt64 StrMathToNumber(const Char* in, const Char** endp, const SInt16
// ------------------------------------------------------------------------------------------ //
/// @brief Create a semaphore.
-IMPORT_C _Output SemaphoreRef SemCreate(_Input UInt32 initial_count, _Input UInt32 max_count, _Input const Char* name);
+IMPORT_C _Output SemaphoreRef SemCreate(_Input UInt32 initial_count, _Input UInt32 max_count,
+ _Input const Char* name);
/// @brief Wait on a semaphore.
IMPORT_C SInt32 SemWait(_Input SemaphoreRef sem);
@@ -406,4 +408,10 @@ IMPORT_C SInt32 SemWait(_Input SemaphoreRef sem);
/// @brief Close a semaphore.
IMPORT_C SInt32 SemClose(_Input SemaphoreRef sem);
+// ------------------------------------------------------------------------------------------ //
+// @brief User AgeAuth API.
+// ------------------------------------------------------------------------------------------ //
+
+IMPORT_C SInt32 UserIsAdult(_Input SInt32 uid);
+
#endif // ifndef SYSTEMKIT_SYSTEM_H
diff --git a/src/libSystem/src/JailCalls.cpp b/src/libSystem/src/JailCalls.cpp
index 674e916a..e5e11a43 100644
--- a/src/libSystem/src/JailCalls.cpp
+++ b/src/libSystem/src/JailCalls.cpp
@@ -11,5 +11,6 @@
using namespace LibSystem;
-IMPORT_C struct JAIL* JailGetCurrent(Void) { return (struct JAIL*) libsys_syscall_arg_1(SYSCALL_HASH("JailGetCurrent")); }
-
+IMPORT_C struct JAIL* JailGetCurrent(Void) {
+ return (struct JAIL*) libsys_syscall_arg_1(SYSCALL_HASH("JailGetCurrent"));
+}
diff --git a/src/libSystem/src/SystemCalls.cpp b/src/libSystem/src/SystemCalls.cpp
index 470bc237..c5497f91 100644
--- a/src/libSystem/src/SystemCalls.cpp
+++ b/src/libSystem/src/SystemCalls.cpp
@@ -3,7 +3,6 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
#include <libSystem/SystemKit/Err.h>
#include <libSystem/SystemKit/Syscall.h>
#include <libSystem/SystemKit/System.h>
@@ -126,7 +125,9 @@ IMPORT_C Ref IoOpenFile(_Input const Char* path, _Input const Char* drv_letter)
Verify::sys_safe_cast<Char, Void>(drv_letter)));
}
-IMPORT_C Void IoCloseFile(_Input Ref desc) { libsys_syscall_arg_2(SYSCALL_HASH("IoCloseFile"), static_cast<VoidPtr>(desc)); }
+IMPORT_C Void IoCloseFile(_Input Ref desc) {
+ libsys_syscall_arg_2(SYSCALL_HASH("IoCloseFile"), static_cast<VoidPtr>(desc));
+}
IMPORT_C UInt64 IoSeekFile(_Input Ref desc, _Input UInt64 off) {
auto ret_ptr = libsys_syscall_arg_3(SYSCALL_HASH("IoSeekFile"), static_cast<VoidPtr>(desc),
@@ -134,7 +135,7 @@ IMPORT_C UInt64 IoSeekFile(_Input Ref desc, _Input UInt64 off) {
if (!ret_ptr) return ~0UL;
- auto ret = static_cast<volatile UInt64*>(ret_ptr);
+ auto ret = static_cast<volatile UInt64*>(ret_ptr);
UInt64 result = *ret;
MUST_PASS(result != ~0UL);
@@ -160,7 +161,9 @@ IMPORT_C SInt32 PrintRelease(_Input IORef buf) {
return static_cast<SInt32>(*ret);
}
-IMPORT_C IORef PrintCreate(Void) { return static_cast<IORef>(libsys_syscall_arg_1(SYSCALL_HASH("PrintCreate"))); }
+IMPORT_C IORef PrintCreate(Void) {
+ return static_cast<IORef>(libsys_syscall_arg_1(SYSCALL_HASH("PrintCreate")));
+}
IMPORT_C VoidPtr MmCreateHeap(UInt64 initial_size, UInt32 max_size) {
return static_cast<VoidPtr>(libsys_syscall_arg_3(SYSCALL_HASH("MmCreateHeap"),
@@ -223,4 +226,3 @@ IMPORT_C SInt32 PrintOut(_Input IORef desc, const Char* fmt, ...) {
IMPORT_C UInt64 PrintSize(IORef ref) {
return *static_cast<UInt64*>(libsys_syscall_arg_2(SYSCALL_HASH("PrintSize"), ref));
}
-
diff --git a/src/libThread/ThreadKit/Thread.h b/src/libThread/ThreadKit/Thread.h
new file mode 100644
index 00000000..e8fa7eb0
--- /dev/null
+++ b/src/libThread/ThreadKit/Thread.h
@@ -0,0 +1,11 @@
+// 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/ne-kernel
+
+#ifndef THREADKIT_THREADKIT_H
+#define THREADKIT_THREADKIT_H
+
+#include <libSystem/SystemKit/System.h>
+
+#endif // THREADKIT_THREADKIT_H
diff --git a/src/libThread/doc/.keep b/src/libThread/doc/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/libThread/doc/.keep
diff --git a/src/libThread/libThread.json b/src/libThread/libThread.json
new file mode 100644
index 00000000..dc1da098
--- /dev/null
+++ b/src/libThread/libThread.json
@@ -0,0 +1,21 @@
+{
+ "compiler_path": "x86_64-w64-mingw32-g++",
+ "compiler_std": "c++20",
+ "headers_path": ["../", "./"],
+ "sources_path": ["src/*.cpp"],
+ "output_name": "libThread.dll",
+ "compiler_flags": [
+ "-ffreestanding",
+ "-shared",
+ "-fPIC",
+ "-fno-rtti",
+ "-fno-exceptions",
+ "-Wl,--subsystem=17"
+ ],
+ "cpp_macros": [
+ "kLibThreadVersion=0x0100",
+ "kLibThreadVersionHighest=0x0100",
+ "kLibThreadVersionLowest=0x0100"
+ ],
+ "description": "The System Thread Kit for the NeSystem."
+}
diff --git a/src/libThread/obj/.keep b/src/libThread/obj/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/libThread/obj/.keep
diff --git a/src/libThread/src/Thread.cpp b/src/libThread/src/Thread.cpp
new file mode 100644
index 00000000..03e1322b
--- /dev/null
+++ b/src/libThread/src/Thread.cpp
@@ -0,0 +1,82 @@
+// 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/ne-kernel
+
+#include <libSystem/SystemKit/Err.h>
+#include <libThread/ThreadKit/Thread.h>
+
+#define kThreadMapMax (1024UL)
+#define kThreadBaseHash (0x5555ffff6ULL)
+
+/// @brief The registered thread for a specific process.
+static ThreadRef kThreadMap[kThreadMapMax];
+
+/// @brief Exit codes as we want to track them.
+static SInt32 kThreadExitCodes[kThreadMapMax];
+
+/// @brief This hash-list stores the thread to be run.
+static ThreadRef kThreadHeads[kThreadMapMax];
+
+/// @brief This hash-list stores the thread to be run.
+static SInt32 kThreadFlags[kThreadMapMax];
+
+/// @brief Current thread reference
+static ThreadRef kCurrentThread;
+
+static __THREAD_UNSAFE Void _ThrRunThread(SInt32 argument_count, VoidPtr args,
+ ThrProcKind procedure, ThreadRef ref) {
+ static SemaphoreRef sem_ref = SemCreate(0, 1000, "ThreadSem");
+
+ if (sem_ref) return;
+
+ auto ret = procedure(argument_count, (Char**) args);
+ kThreadExitCodes[kThreadMapMax % ref->__hash] = ret;
+
+ if (ref == kCurrentThread) kCurrentThread = nullptr;
+
+ SemClose(sem_ref);
+ sem_ref = nullptr;
+}
+
+IMPORT_C ThreadRef ThrCreateThread(const Char* thread_name, ThrProcKind procedure,
+ SInt32 argument_count, VoidPtr args, SInt32 flags) {
+ ThreadRef ref = new REF_TYPE;
+ if (!ref) return nullptr;
+
+ if (!thread_name || !procedure) {
+ delete ref;
+ ref = nullptr;
+ return nullptr;
+ }
+
+ ref->__hash = *(UInt32*) thread_name;
+ ref->__hash += kThreadBaseHash; // pad hash with a seed.
+
+ ref->__self = (VoidPtr) procedure;
+
+ kThreadMap[kThreadMapMax % ref->__hash] = ref;
+ kThreadHeads[kThreadMapMax % ref->__hash] = ref;
+ kThreadFlags[kThreadMapMax % ref->__hash] = flags;
+
+ kCurrentThread = ref;
+
+ _ThrRunThread(argument_count, args, procedure, ref);
+
+ return ref;
+}
+
+IMPORT_C SInt32 ThrExitThread(_Input ThreadRef ref, _Input SInt32 exit_code) {
+ if (!ref) return kErrorInvalidData;
+
+ kThreadMap[kThreadMapMax % ref->__hash] = nullptr;
+ kThreadHeads[kThreadMapMax % ref->__hash] = nullptr;
+
+ kThreadFlags[kThreadMapMax % ref->__hash] = 0;
+
+ if (kCurrentThread == ref) kCurrentThread = nullptr;
+
+ kThreadExitCodes[kThreadMapMax % ref->__hash] = exit_code;
+
+ return kErrorSuccess;
+} \ No newline at end of file
diff --git a/src/modules/CoreGfx/CoreGfx.h b/src/modules/CoreGfx/CoreGfx.h
index 88787e8e..1d6966f5 100644
--- a/src/modules/CoreGfx/CoreGfx.h
+++ b/src/modules/CoreGfx/CoreGfx.h
@@ -12,7 +12,7 @@
#define cg_color(R, G, B) RGB(R, G, B)
-#define cg_get_clear_clr() RGB(0xFF, 0xFF, 0xFF)
+#define cg_get_clear_clr() RGB(0, 0, 0)
#define cg_clear() kCGCursor = 0UL
diff --git a/test/kernel_tests/libddk_tests/Makefile b/test/kernel_tests/libddk_tests/Makefile
index a2bb9d4f..de3df855 100644
--- a/test/kernel_tests/libddk_tests/Makefile
+++ b/test/kernel_tests/libddk_tests/Makefile
@@ -4,14 +4,11 @@
##################################################
GCC=x86_64-w64-mingw32-g++ -Wl,-subsystem=17
-LIB=-L../../src/libSystem -lSystem
+LIB=-L../../src/libDDK -lDDK
STD=-std=c++20 -DKT_TESTING_ENABLED
INCLUDE=-I../../src -I../../public -I../../public/frameworks/ -I../../
-OBJ_FILES = \
- thread.test.exe \
- memory.test.exe \
- io.test.exe
+OBJ_FILES =
.PHONY: all
all: $(OBJ_FILES)
diff --git a/test/kernel_tests/libsystem_tests/thread.test.cc b/test/kernel_tests/libsystem_tests/thread.test.cc
index db248e26..28c9196c 100644
--- a/test/kernel_tests/libsystem_tests/thread.test.cc
+++ b/test/kernel_tests/libsystem_tests/thread.test.cc
@@ -1,6 +1,6 @@
/// \file thread.test.cc
/// \brief Threading API tests.
-/// \author Amlal El Mahrouss (amlal at nekernel dot org)
+/// \author Amlal El Mahrouss (amlal at nekernel dot org) (2025-2026)
#include <libSystem/SystemKit/System.h>
#include <public/frameworks/KernelTest.fwrk/headers/TestCase.h>
diff --git a/test/module_tests/libpthread_tests/Makefile b/test/module_tests/libpthread_tests/Makefile
new file mode 100644
index 00000000..cb3f818c
--- /dev/null
+++ b/test/module_tests/libpthread_tests/Makefile
@@ -0,0 +1,19 @@
+##################################################
+# (c) Amlal El Mahrouss and NeKernel Authors, licensed under the Apache 2.0 license.
+# This file is for libsystem testing.
+##################################################
+
+GCC=x86_64-w64-mingw32-g++ -Wl,-subsystem=17
+LIB=-L../../src/libPThread -lPThread
+STD=-std=c++20 -DKT_TESTING_ENABLED
+INCLUDE=-I../../src -I../../public -I../../public/frameworks/ -I../../
+
+OBJ_FILES =
+
+.PHONY: all
+all: $(OBJ_FILES)
+
+%.exe: %.cc
+ @echo "==> Building test: $@"
+ $(GCC) $(LIB) $< \
+ $(STD) $(INCLUDE) -o $(basename $<).exe \ No newline at end of file
diff --git a/tools/chk.hefs.cpp b/tools/chk.hefs.cpp
index 69a4312c..a0f56b77 100644
--- a/tools/chk.hefs.cpp
+++ b/tools/chk.hefs.cpp
@@ -3,15 +3,14 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
-#include <tools/libmkfs/mkfs.hpp>
-#include <tools/libmkfs/openhefs.hpp>
#include <cstdlib>
#include <fstream>
+#include <tools/libmkfs/mkfs.hpp>
+#include <tools/libmkfs/openhefs.hpp>
/// @note decimal base.
static uint16_t kNumericalBase = 10;
-static auto kMinArgs = 2;
+static auto kMinArgs = 2;
int main(int argc, char** argv) {
if (argc < kMinArgs) {
@@ -20,9 +19,9 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
- auto args = mkfs::detail::build_args(argc, argv);
+ auto args = mkfs::detail::build_args(argc, argv);
auto opt_disk = mkfs::get_option<char>(args, "in");
- auto origin = mkfs::get_option<char>(args, "b");
+ auto origin = mkfs::get_option<char>(args, "b");
if (opt_disk.empty()) {
mkfs::console_out() << "chk: hefs: error: OpenHeFS partition is empty! Exiting..."
@@ -58,8 +57,8 @@ int main(int argc, char** argv) {
if (strncmp(boot_node.magic, kOpenHeFSMagic, kOpenHeFSMagicLen) != 0 ||
boot_node.sectorCount < 1 || boot_node.sectorSize < kMkFsSectorSz) {
- mkfs::console_out() << "chk: hefs: error: Device does not contain an OpenHeFS disk: " << opt_disk
- << "\n";
+ mkfs::console_out() << "chk: hefs: error: Device does not contain an OpenHeFS disk: "
+ << opt_disk << "\n";
return EXIT_FAILURE;
}
@@ -69,7 +68,7 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
- mkfs::console_out() << "chk: hefs: OpenHeFS partition is healthy. Exiting...\n";
+ mkfs::console_out() << "chk: hefs: The OpenHeFS partition is healthy. Exiting...\n";
return EXIT_SUCCESS;
}
diff --git a/tools/mkapp.py b/tools/kapp.py
index e3128a52..c18e7b01 100755
--- a/tools/mkapp.py
+++ b/tools/kapp.py
@@ -12,7 +12,7 @@ def create_directory_structure(base_path, project_name):
},
"src": {
".keep": None,
- "CommandLine.cc": None,
+ "CommandLine.cpp": None,
},
"vendor": {
".keep": None
@@ -69,7 +69,7 @@ def create_directory_structure(base_path, project_name):
if __name__ == "__main__":
if len(sys.argv) != 2:
- print("HELP: mkapp.py <project_name>")
+ print("HELP: kapp.py <project_name>")
sys.exit(os.EX_CONFIG)
base_path = os.getcwd() # Use the current working directory as the base path
diff --git a/tools/kconf.py b/tools/kconf.py
deleted file mode 100755
index a54d6244..00000000
--- a/tools/kconf.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#! /usr/bin/env python3
-# -*- coding: utf-8 -*-
-
-import os, json, sys
-
-if __name__ == '__main__':
- print("kconf: running kernel as standalone...")
- os.system("../scripts/debug_ahci_x64.sh")
- sys.exit(0)
-
-
-
-
diff --git a/tools/kernel b/tools/kernel
new file mode 100755
index 00000000..d9a639e7
--- /dev/null
+++ b/tools/kernel
@@ -0,0 +1,13 @@
+#! /usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import os, sys
+
+KERNEL_SCRIPT="./scripts/debug_ahci_x64.sh"
+MODULES_SCRIPT="./scripts/modules_ahci_x64.sh"
+
+if __name__ == '__main__':
+ os.system(MODULES_SCRIPT)
+ os.system(KERNEL_SCRIPT)
+ sys.exit(0)
+
diff --git a/tools/kfwrk.py b/tools/kfwrk.py
index 3f104465..9d3833de 100755
--- a/tools/kfwrk.py
+++ b/tools/kfwrk.py
@@ -18,7 +18,7 @@ def create_directory_structure(base_path_fwrk, project_file_name, project_name):
},
"src": {
".keep": None,
- "DylibMain.cc": None,
+ "DylibMain.cpp": None,
},
"xml": {
".keep": None
diff --git a/tools/mkfs.hefs.cpp b/tools/mkfs.hefs.cpp
index ad60c675..c6e528ad 100644
--- a/tools/mkfs.hefs.cpp
+++ b/tools/mkfs.hefs.cpp
@@ -3,14 +3,13 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel
-
-#include <tools/libmkfs/mkfs.hpp>
-#include <tools/libmkfs/openhefs.hpp>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <limits>
+#include <tools/libmkfs/mkfs.hpp>
+#include <tools/libmkfs/openhefs.hpp>
static std::uint16_t kVersion = kOpenHeFSVersion;
static std::uint16_t kNumericalBase = 10;