From fd27d5f1e4176926d613005f30feb209375d97ea Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 15 Feb 2025 09:33:35 +0100 Subject: Impl and Patches: - Private tools directory. - SCI gets new API. - Window Manager library. - Steps version 2. - Patch 'open' command. - ATA.h fixes. Signed-off-by: Amlal --- ReadMe.md | 21 +++++++----------- compile_flags.txt | 5 ++++- dev/Kernel/src/DriveMgr.cc | 4 ++-- dev/LibSCI/GPU.h | 29 ++++++++++++++----------- dev/LibSCI/Macros.h | 25 ++++++++++++++------- dev/LibSCI/SCI.h | 42 +++++++++++++++++++++++++++--------- dev/LibSCI/src/GPU.cc | 2 +- dev/Mod/ATA/ATA.h | 5 +---- dev/Tools/.keepme | 0 dev/Usr/LibCF/Object.h | 24 +++++++++++++++++++++ dev/Usr/LibUI/Widget.h | 8 ------- dev/Usr/LibWM/Core.h | 19 ++++++++++++++++ public/tools/make_app/Steps.h | 11 +++++++++- public/tools/open/src/CommandLine.cc | 7 ++---- 14 files changed, 137 insertions(+), 65 deletions(-) create mode 100644 dev/Tools/.keepme create mode 100644 dev/Usr/LibCF/Object.h delete mode 100644 dev/Usr/LibUI/Widget.h create mode 100644 dev/Usr/LibWM/Core.h diff --git a/ReadMe.md b/ReadMe.md index 7e0cd72f..f5c016b4 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,23 +1,18 @@ -# New Kernel Architecture (NeKernel) +# New Kernel Architecture OS (NeOS) ## Brief: -A Microkernel written in C++ 20, with a System Call Interface Library, and custom bootloader. - -## Screenshots: - -![doc/apic.png](doc/apic.png) -![doc/filesystem.png](doc/filesystem.png) +An OS written in C++ 20, with a System Call Interface Library, and a custom bootloader. ## Requirements: -- MinGW/GCC -- LibCompiler -- Netwide Assembler -- Git -- BTB/OpenBTB +- MinGW/GCC. +- LibCompiler Runtime Headers and Toolchain. +- Netwide Assembler. +- Git. +- BTB. ## Installation: @@ -30,7 +25,7 @@ cd nekernel
-And then select the makefile (arm64 and amd64 are stable and EFI based) to execute: +And then select the makefile (ARM64 and AMD64 are stable and EFI based) to execute: ``` make -f amd64-efi.make all diff --git a/compile_flags.txt b/compile_flags.txt index 50fde27b..b93c0ea8 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -2,7 +2,10 @@ -Idev/ -Idev/LibSCI -Idev/Boot/ --Iprivate/tools +-Ipublic/tools +-Ipublic/tools/make_app +-Ipublic/tools/make_fs +-Ipublic/tools/open -Idev/Boot/BootKit -std=c++20 -D__NE_AMD64__ diff --git a/dev/Kernel/src/DriveMgr.cc b/dev/Kernel/src/DriveMgr.cc index 4240f158..7ed75934 100644 --- a/dev/Kernel/src/DriveMgr.cc +++ b/dev/Kernel/src/DriveMgr.cc @@ -14,7 +14,7 @@ /***********************************************************************************/ /// @file DriveMgr.cc -/// @brief Drive Manager of neoskrnl. +/// @brief Drive Manager of kernel. /***********************************************************************************/ namespace Kernel @@ -93,7 +93,7 @@ namespace Kernel { return; } - + pckt.fPacketGood = YES; #endif // if defined(__ATA_PIO__) || defined (__ATA_DMA__) } diff --git a/dev/LibSCI/GPU.h b/dev/LibSCI/GPU.h index fee621e6..52ae6b1d 100644 --- a/dev/LibSCI/GPU.h +++ b/dev/LibSCI/GPU.h @@ -7,45 +7,50 @@ Purpose: GFX System Calls. ------------------------------------------- */ -#ifndef SCIKIT_GPU_H -#define SCIKIT_GPU_H +#ifndef SCI_GPU_H +#define SCI_GPU_H #include -struct GPUCmdBuffer; - /// ------------------------------------------------------------------------------------------ // /// @brief GPU API. /// ------------------------------------------------------------------------------------------ // +struct GPUCmdBuffer; + +typedef VoidPtr GPUObject; + /// ------------------------------------------------------------------------------------------ // /// @brief Command buffer structure type. /// ------------------------------------------------------------------------------------------ // struct GPUCmdBuffer final { - VoidPtr Data; - SizeT DataSz; - SizeT BufferLayer; - Bool IsGPGPUData; - Bool BufferFirst; + VoidPtr Data{nullptr}; + SizeT DataSz{0}; + SizeT BufferLayer{0}; + Bool IsGPGPUData{false}; + Bool BufferFirst{false}; Bool isGPGPUData() { return this->isValid() && !this->BufferFirst && this->IsGPGPUData; } + Bool isBackBuffer() + { + return !this->BufferFirst; + } + Bool isValid() { return this->Data && (this->DataSz > 0) && (MmGetHeapFlags(this->Data) != -1); } }; -typedef VoidPtr GPUObject; - IMPORT_C GPUObject GPUNewFromDeviceName(_Input const Char* device_name); IMPORT_C SInt32 GPUDisposeDevice(GPUObject gpu_handle, Bool cancel_all, Bool flush_all); IMPORT_C SInt32 GPUSendCmdBufferListWithCnt(GPUCmdBuffer** cmd_list, SizeT cmd_list_cnt); -#endif // ifndef SCIKIT_GPU_H +#endif // ifndef SCI_GPU_H diff --git a/dev/LibSCI/Macros.h b/dev/LibSCI/Macros.h index e57df6ee..3236176c 100644 --- a/dev/LibSCI/Macros.h +++ b/dev/LibSCI/Macros.h @@ -49,17 +49,26 @@ typedef void* VoidPtr; typedef __UINTPTR_TYPE__ UIntPtr; typedef char Char; -typedef VoidPtr SCIObject; - -typedef SCIObject IOObject; -typedef IOObject FSObject; -typedef SCIObject DLLObject; -typedef SCIObject ThreadObject; -typedef SCIObject SocketObject; - #ifdef __cplusplus typedef decltype(nullptr) nullPtr; typedef nullPtr NullPtr; + +#define SCI_COPY_DELETE(KLASS) \ + KLASS& operator=(const KLASS&) = delete; \ + KLASS(const KLASS&) = delete; + +#define SCI_COPY_DEFAULT(KLASS) \ + KLASS& operator=(const KLASS&) = default; \ + KLASS(const KLASS&) = default; + +#define SCI_MOVE_DELETE(KLASS) \ + KLASS& operator=(KLASS&&) = delete; \ + KLASS(KLASS&&) = delete; + +#define SCI_MOVE_DEFAULT(KLASS) \ + KLASS& operator=(KLASS&&) = default; \ + KLASS(KLASS&&) = default; + #endif IMPORT_C void _rtl_assert(Bool expr, const Char* origin); diff --git a/dev/LibSCI/SCI.h b/dev/LibSCI/SCI.h index 865a2c21..1e17ebd3 100644 --- a/dev/LibSCI/SCI.h +++ b/dev/LibSCI/SCI.h @@ -3,15 +3,27 @@ Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. File: SCI.h -Purpose: System Calls. +Purpose: System Call Interface. ------------------------------------------- */ -#ifndef SCIKIT_FOUNDATION_H -#define SCIKIT_FOUNDATION_H +#ifndef SCI_SCI_H +#define SCI_SCI_H #include +// ------------------------------------------------------------------------------------------ // +/// @brief Types API. +// ------------------------------------------------------------------------------------------ // + +typedef VoidPtr SCIObject; + +typedef SCIObject IOObject; +typedef IOObject FSObject; +typedef SCIObject DLLObject; +typedef SCIObject ThreadObject; +typedef SCIObject SocketObject; + // ------------------------------------------------------------------------------------------ // /// @brief Dynamic Loader API. // ------------------------------------------------------------------------------------------ // @@ -79,9 +91,9 @@ IMPORT_C UInt64 IoSeekFile(_Input SCIObject file_desc, UInt64 file_offset); // ------------------------------------------------------------------------ /// @brief Spawns a Thread Information Block and Global Information Block inside the current process. -/// @param void. +/// @param process_id Target Process ID, must be valid. /// @return > 0 error ocurred or already present, = 0 success. -IMPORT_C UInt32 RtlSpawnIB(Void); +IMPORT_C UInt32 RtlSpawnIB(UIntPtr process_id); /// @brief Spawns a process with a unique pid (stored as UIntPtr). /// @param process_path process filesystem path. @@ -136,13 +148,13 @@ IMPORT_C SInt64 MmStrCmp(_Input const Char* dest, _Input const Char* src); IMPORT_C SInt64 MmStrLen(const Char* str); // ------------------------------------------------------------------------ -// Error API. +// @brief Error API. // ------------------------------------------------------------------------ IMPORT_C SInt32 ErrGetLastError(Void); // ------------------------------------------------------------------------ -// Threading API. +// @brief Threading API. // ------------------------------------------------------------------------ /// @brief Exit the current thread. @@ -181,7 +193,7 @@ IMPORT_C Void ThrJoinThread(ThreadObject thrd); IMPORT_C Void ThrDetachThread(ThreadObject thrd); // ------------------------------------------------------------------------ -// Drive Management API. +// @brief Drive Management API. // ------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------ // @@ -291,7 +303,7 @@ IMPORT_C SInt32 ConRelease(IOObject); IMPORT_C IOObject ConGet(const Char* path); // ------------------------------------------------------------------------------------------ // -// Scheduler Interrupts API. +// @brief Scheduler/Debug API. // ------------------------------------------------------------------------------------------ // typedef SInt32 AffinityKind; @@ -305,4 +317,14 @@ IMPORT_C SInt32 SchedKill(PID, SInt32 req); IMPORT_C SInt32 SchedBreakPoint(Void); -#endif // ifndef SCIKIT_FOUNDATION_H +// ------------------------------------------------------------------------------------------ // +// @brief Video API. +// ------------------------------------------------------------------------------------------ // + +IMPORT_C SInt32 VideoGetBuffer(VoidPtr* out); + +IMPORT_C Void VideoDisposeBuffer(VoidPtr* in); + +IMPORT_C SInt32 VideoGetProfile(VoidPtr* in); + +#endif // ifndef SCI_SCI_H diff --git a/dev/LibSCI/src/GPU.cc b/dev/LibSCI/src/GPU.cc index d9594191..b3442db8 100644 --- a/dev/LibSCI/src/GPU.cc +++ b/dev/LibSCI/src/GPU.cc @@ -7,4 +7,4 @@ Purpose: GPU Interface. ------------------------------------------- */ -#include +#include diff --git a/dev/Mod/ATA/ATA.h b/dev/Mod/ATA/ATA.h index a5189b31..8fdd3150 100644 --- a/dev/Mod/ATA/ATA.h +++ b/dev/Mod/ATA/ATA.h @@ -13,8 +13,6 @@ #pragma once -#ifndef __AHCI__ - #include #include @@ -154,5 +152,4 @@ Kernel::SizeT drv_get_sector_count(); /// @brief get device size. Kernel::SizeT drv_get_size(); -#endif // ifdef __NEOSKRNL__ -#endif // ifndef __ATA_PIO__ || __AHCI__ +#endif // ifdef __NEOSKRNL__ \ No newline at end of file diff --git a/dev/Tools/.keepme b/dev/Tools/.keepme new file mode 100644 index 00000000..e69de29b diff --git a/dev/Usr/LibCF/Object.h b/dev/Usr/LibCF/Object.h new file mode 100644 index 00000000..4181ea60 --- /dev/null +++ b/dev/Usr/LibCF/Object.h @@ -0,0 +1,24 @@ + +/* ------------------------------------------- + + Copyright (C) 2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include + +namespace LibCF +{ + class QObject; + + class QObject + { + public: + explicit QObject() = default; + ~QObject() = default; + + SCI_COPY_DEFAULT(QObject); + }; +} // namespace LibCF \ No newline at end of file diff --git a/dev/Usr/LibUI/Widget.h b/dev/Usr/LibUI/Widget.h deleted file mode 100644 index 52c1675b..00000000 --- a/dev/Usr/LibUI/Widget.h +++ /dev/null @@ -1,8 +0,0 @@ - -/* ------------------------------------------- - - Copyright (C) 2025, Amlal EL Mahrouss, all rights reserved. - -------------------------------------------- */ - -#pragma once \ No newline at end of file diff --git a/dev/Usr/LibWM/Core.h b/dev/Usr/LibWM/Core.h new file mode 100644 index 00000000..ce1409ad --- /dev/null +++ b/dev/Usr/LibWM/Core.h @@ -0,0 +1,19 @@ + +/* ------------------------------------------- + + Copyright (C) 2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include + +namespace LibCF +{ + class CFWindowContainer; + class CFWindowFrame; + class CFWindowTab; + + class CFDesktopMenu; +} // namespace LibCF \ No newline at end of file diff --git a/public/tools/make_app/Steps.h b/public/tools/make_app/Steps.h index d7f78b81..b742724d 100644 --- a/public/tools/make_app/Steps.h +++ b/public/tools/make_app/Steps.h @@ -9,6 +9,15 @@ #include #include -#define kStepsExtension ".steps" +#define kStepsExtension ".stp" + +struct StepsCommonRecord final +{ + char setup_name[255]; + char setup_company[255]; + char setup_author[255]; + int32_t setup_version; + int32_t setup_pages; +}; #endif // ifndef APPS_STEPS_H \ No newline at end of file diff --git a/public/tools/open/src/CommandLine.cc b/public/tools/open/src/CommandLine.cc index 86282059..a2439e40 100644 --- a/public/tools/open/src/CommandLine.cc +++ b/public/tools/open/src/CommandLine.cc @@ -36,12 +36,9 @@ int main(int argc, char* argv[]) Char base_path[FILE_MAX_LEN] = OPEN_APP_BASE_PATH; MmCopyMemory(base_path + MmStrLen(OPEN_APP_BASE_PATH), argv[i + 1], MmStrLen(argv[i + 1])); - Bool ret = RtlSpawnProcess(base_path, 0, nullptr, nullptr, 0); + UIntPtr ret = RtlSpawnProcess(base_path, 0, nullptr, nullptr, 0); - if (ret > 0) - return EXIT_SUCCESS; - - break; + return ret; } } -- cgit v1.2.3