diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-15 20:37:20 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-15 20:39:36 +0100 |
| commit | 8f9b5e08f53f6e49a1f4c6b20e17c54298da9c44 (patch) | |
| tree | 6436b7deedeffc32cdc9e27c24a868ac896db89a | |
| parent | a87a74f9d56078ec55b3b73c81cfc422dca6554c (diff) | |
HCR-14: HCFS and NewFS: Reworked some parts of it, will also work on
exposing objects for it.
- Expsoing objects to the API is important so that the developer can
take advantage of these filesystem specific APIs.
- Update XRN UUID formatting.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
| -rw-r--r-- | .vscode/c_cpp_properties.json | 13 | ||||
| -rw-r--r-- | Private/CFKit/GUIDWrapper.hpp | 3 | ||||
| -rw-r--r-- | Private/Drivers/ATA/Defines.hxx | 2 | ||||
| -rw-r--r-- | Private/FSKit/HCFS.hxx | 37 | ||||
| -rw-r--r-- | Private/FSKit/NewFS.hxx | 14 | ||||
| -rw-r--r-- | Private/FirmwareKit/EFI/EFI.hxx | 2 | ||||
| -rw-r--r-- | Private/FirmwareKit/EPM.hxx | 6 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalKernelMain.cxx | 10 | ||||
| -rw-r--r-- | Private/KernelKit/HError.hpp | 4 | ||||
| -rw-r--r-- | Private/KernelKit/LoaderInterface.hpp | 10 | ||||
| -rw-r--r-- | Private/KernelKit/PECodeManager.hxx | 2 | ||||
| -rw-r--r-- | Private/KernelKit/ProcessScheduler.hpp | 1 | ||||
| -rw-r--r-- | Private/ObjectKit/Object.hxx | 18 | ||||
| -rw-r--r-- | Private/Tools/Makefile | 8 | ||||
| -rw-r--r-- | Private/Tools/make_hcfs.cxx (renamed from Private/Tools/make_hcfs.c) | 5 | ||||
| -rw-r--r-- | Private/Tools/make_hcfs.hxx (renamed from Private/Tools/disk_api.h) | 14 | ||||
| -rw-r--r-- | TODO_LIST.TXT | 4 |
17 files changed, 119 insertions, 34 deletions
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index a6a60a86..549f3266 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -35,7 +35,18 @@ "cStandard": "c17", "cppStandard": "c++20", "compilerPath": "/usr/bin/gcc", - "intelliSenseMode": "gcc-arm64" + "intelliSenseMode": "macos-gcc-arm64" + }, + { + "name": "HCore Tools (Win)", + "includePath": [ + "${workspaceFolder}/Private/Tools/**" + ], + "defines": [], + "cStandard": "c17", + "cppStandard": "c++20", + "compilerPath": "C:/cygwin64/bin/x86_64-w64-mingw32-gcc.exe", + "intelliSenseMode": "windows-gcc-x64" } ], "version": 4 diff --git a/Private/CFKit/GUIDWrapper.hpp b/Private/CFKit/GUIDWrapper.hpp index 97125fc9..c237985c 100644 --- a/Private/CFKit/GUIDWrapper.hpp +++ b/Private/CFKit/GUIDWrapper.hpp @@ -12,7 +12,7 @@ /* GUID for C++ Components */ -#define NULL_GUID "XRN:{........-....-M...-N...-............}" +#define kXRNNil "@{........-....-M...-N...-............}" // eXtensible Resource Information namespace HCore::XRN { @@ -41,7 +41,6 @@ class GUID final { public: GUIDSequence &operator->() noexcept { return m_UUID; } - GUIDSequence &Leak() noexcept { return m_UUID; } private: diff --git a/Private/Drivers/ATA/Defines.hxx b/Private/Drivers/ATA/Defines.hxx index cc1c191f..f4a02467 100644 --- a/Private/Drivers/ATA/Defines.hxx +++ b/Private/Drivers/ATA/Defines.hxx @@ -115,4 +115,4 @@ using namespace HCore; #define ATA_ADDRESS1(x) (x + 3) #define ATA_ADDRESS2(x) (x + 4) #define ATA_ADDRESS3(x) (x + 5) -#define ATA_COMMAND(x) (x + 7) +#define ATA_COMMAND(x) (x + 7) diff --git a/Private/FSKit/HCFS.hxx b/Private/FSKit/HCFS.hxx new file mode 100644 index 00000000..dcbe1a7b --- /dev/null +++ b/Private/FSKit/HCFS.hxx @@ -0,0 +1,37 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#pragma once + +#include <NewKit/Defines.hpp> +#include <FirmwareKit/EPM.hxx> + +#define kHCFSNameLen 256 + +/// @brief HCFS Balanced Tree structure. +/// @author Amlal El Mahrouss +typedef struct HCFSBTree final { + HCore::WideChar fCatalogName[kHCFSNameLen]; + + struct { + HCore::Lba fDataCatalog; + HCore::Lba fRsrcCatalog; + HCore::SizeT fDataCatalogSize; + HCore::SizeT fRsrcCatalogSize; + } fCatalogData; +} PACKED HCFSBTree; + +#define kHCFSGuid "@{0771b3c9-b977-440a-a9ca-396b6d3f07b5}" + +enum { + kHCFSHardDrive = 0xC0, // Hard Drive + kHCFSOpticalDrive = 0x0C, // Blu-Ray/DVD + kHCFSMassStorageDevice = 0xCC, // USB + kHCFSUnknown = 0xFF, // unknown device or unsupported (floppy) + kHCFSDriveCount = 4, +}; + +// EOF. diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx index 75578af0..db950fb4 100644 --- a/Private/FSKit/NewFS.hxx +++ b/Private/FSKit/NewFS.hxx @@ -28,11 +28,11 @@ #define kNewFSNodeNameLen 256 #define kNewFSIdentLen 8 -#define kNewFSIdent " HCFS" +#define kNewFSIdent " NEFS" #define kPadLen 16 //! On EPM and GPT disks. -#define kNewFSUUID "DD997393-9CCE-4288-A8D5-C0FDE3908DBE" +#define kNewFSUUID "@{DD997393-9CCE-4288-A8D5-C0FDE3908DBE}" #define kNewFSVersionInteger 0x120 #define kNewFSVerionString "1.2.0" @@ -47,17 +47,19 @@ enum { kNewFSDriveCount = 4, }; +/// @brief NewFS filesystem block. +/// @author Amlal El Mahrouss. struct PACKED NewBootBlock final { NewCharType Ident[kNewFSIdentLen]; NewCharType Shell[kNewFSNodeNameLen]; - HCore::Int64 NumParts; + HCore::Int64 NumParts; // number of sub-partitions. HCore::Int64 FreeSectors; HCore::Int64 SectorCount; HCore::Int64 SectorSz; - HCore::Int64 DiskSize; - HCore::Int32 DiskKind; + HCore::Int64 DiskSize; // size of media. + HCore::Int32 DiskKind; // kind of disk. HCore::Lba FirstPartBlock; HCore::Lba LastPartBlock; @@ -73,6 +75,8 @@ struct PACKED NewBootBlock final { #define kKindDirectory 2 #define kKindSymlink 3 #define kKindPartition 4 +#define kKindDevice 5 +#define kKindNetwork 6 struct PACKED NewCatalog final { NewCharType Name[kNewFSNodeNameLen]; diff --git a/Private/FirmwareKit/EFI/EFI.hxx b/Private/FirmwareKit/EFI/EFI.hxx index bec95655..463d757b 100644 --- a/Private/FirmwareKit/EFI/EFI.hxx +++ b/Private/FirmwareKit/EFI/EFI.hxx @@ -437,7 +437,7 @@ typedef UInt64(EFI_API *EfiGetMemoryMap)(UInt32 *MapSize, /** * @brief GUID type, something you can also find in CFKit. */ -typedef struct EfiGUID { +typedef struct EfiGUID final { UInt32 Data1; UInt16 Data2; UInt16 Data3; diff --git a/Private/FirmwareKit/EPM.hxx b/Private/FirmwareKit/EPM.hxx index e941eedb..50d7897f 100644 --- a/Private/FirmwareKit/EPM.hxx +++ b/Private/FirmwareKit/EPM.hxx @@ -11,6 +11,8 @@ #ifndef __PARTITION_MAP__ #define __PARTITION_MAP__ +#include <NewKit/Defines.hpp> + #define kEPMUUIDLength 37 #define kEPMNameLength 32 #define kEPMMagicLength 4 @@ -21,7 +23,7 @@ * @brief The EPM bootloader block. * boot code info */ -struct __attribute__((packed)) BootBlock { +struct PACKED BootBlock { char magic[kEPMMagicLength]; char name[kEPMNameLength]; char uuid[kEPMUUIDLength]; @@ -35,7 +37,7 @@ struct __attribute__((packed)) BootBlock { * @brief The EPM partition block. * used to describe a partition inside a media. */ -struct __attribute__((packed)) PartitionBlock { +struct PACKED PartitionBlock { char name[32]; int magic; long long int sector_end; diff --git a/Private/HALKit/AMD64/HalKernelMain.cxx b/Private/HALKit/AMD64/HalKernelMain.cxx index 24f03ce9..1f4256a9 100644 --- a/Private/HALKit/AMD64/HalKernelMain.cxx +++ b/Private/HALKit/AMD64/HalKernelMain.cxx @@ -74,18 +74,16 @@ EXTERN_C void RuntimeMain( HCore::HAL::Detail::_ke_power_on_self_test(); /// END POST + + /// Mounts a NewFS block. + HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager()); /// We already have an install of HCore. if (HandoverHeader->f_Bootloader == kInstalledMedia) { - /// Mounts a NewFS block. - HCore::IFilesystemManager::Mount(new HCore::NewFilesystemManager()); - + HCore::kcout << "HCoreKrnl: Running kernel...\r\n"; /// TODO: Parse system configuration. } else { HCore::kcout << "HCoreKrnl: Running setup...\r\n"; - - //HCore::Forms::SetupWizardControl wizard; - //wizard.ShowDialog(); } HCore::ke_stop(RUNTIME_CHECK_BOOTSTRAP); diff --git a/Private/KernelKit/HError.hpp b/Private/KernelKit/HError.hpp index 41bfaf3d..6fb55f5a 100644 --- a/Private/KernelKit/HError.hpp +++ b/Private/KernelKit/HError.hpp @@ -14,7 +14,7 @@ typedef Int32 HError; inline constexpr HError kErrorSuccess = 0; inline constexpr HError kErrorExecutable = 33; -inline constexpr HError kErrorExecutableLib = 34; +inline constexpr HError kErrorExecutableLib = 34; // no such library!!! inline constexpr HError kErrorFileNotFound = 35; inline constexpr HError kErrorDirectoryNotFound = 36; inline constexpr HError kErrorDiskReadOnly = 37; @@ -27,6 +27,8 @@ inline constexpr HError kErrorNoNetwork = 43; inline constexpr HError kErrorHeapOutOfMemory = 44; inline constexpr HError kErrorNoSuchDisk = 45; inline constexpr HError kErrorFileExists = 46; +inline constexpr HError kErrorFormatFailed = 47; +inline constexpr HError kErrorNetworkTimeout = 48; inline constexpr HError kErrorUnimplemented = 0; Boolean ke_bug_check(void) noexcept; diff --git a/Private/KernelKit/LoaderInterface.hpp b/Private/KernelKit/LoaderInterface.hpp index a19ba483..51257e72 100644 --- a/Private/KernelKit/LoaderInterface.hpp +++ b/Private/KernelKit/LoaderInterface.hpp @@ -21,10 +21,10 @@ class LoaderInterface { HCORE_COPY_DEFAULT(LoaderInterface); public: - virtual const char* Format() = 0; - virtual const char* MIME() = 0; - virtual const char* Path() = 0; - virtual ErrorOr<VoidPtr> FindStart() = 0; - virtual VoidPtr FindSymbol(const char* name, Int32 kind) = 0; + virtual _Output const char* Format() = 0; + virtual _Output const char* MIME() = 0; + virtual _Output const char* Path() = 0; + virtual _Output ErrorOr<VoidPtr> FindStart() = 0; + virtual _Output VoidPtr FindSymbol(_Input const char* name, _Input Int32 kind) = 0; }; } // namespace HCore diff --git a/Private/KernelKit/PECodeManager.hxx b/Private/KernelKit/PECodeManager.hxx index bd72f4ec..1f15a742 100644 --- a/Private/KernelKit/PECodeManager.hxx +++ b/Private/KernelKit/PECodeManager.hxx @@ -21,4 +21,4 @@ #include <KernelKit/PE.hpp> #include <NewKit/ErrorOr.hpp> -#include <NewKit/String.hpp>
\ No newline at end of file +#include <NewKit/String.hpp> diff --git a/Private/KernelKit/ProcessScheduler.hpp b/Private/KernelKit/ProcessScheduler.hpp index e69d2fcf..733c7c65 100644 --- a/Private/KernelKit/ProcessScheduler.hpp +++ b/Private/KernelKit/ProcessScheduler.hpp @@ -16,6 +16,7 @@ #include <NewKit/UserHeap.hpp> #define kMinMicroTime AffinityKind::kHartStandard +#define kPIDInvalid (-1) //////////////////////////////////////////////////// diff --git a/Private/ObjectKit/Object.hxx b/Private/ObjectKit/Object.hxx index 1cb9e084..af228163 100644 --- a/Private/ObjectKit/Object.hxx +++ b/Private/ObjectKit/Object.hxx @@ -7,13 +7,21 @@ #pragma once #include <NewKit/Defines.hpp> +#include <CFKit/GUIDWrapper.hpp> + +#define kObjectGlobalNamespaceSystem "HCORE_ROOT\\" +#define kObjectGlobalNamespaceUser "HCORE_USER_ROOT\\" namespace HCore { -/// \brief Object Manager handle. -typedef struct Object { - Void(*Release)(Void); - Void(*Invoke)(Void); - Void(*QueryInterface)(Void); +/// \brief Object handle. +typedef struct Object final { + WideChar ObjectName[255]; + Int32 ObjectType; + WideChar ObjectNamespace[255]; + + Void(*Release)(struct Object* Self); + Void(*Invoke)(struct Object* Self, Int32 Sel, ...); + Void(*QueryInterface)(VoidPtr* Dst, SizeT SzDst, XRN::GUIDSequence GuidOf); } Ojbect, *ObjectPtr; } // namespace HCore diff --git a/Private/Tools/Makefile b/Private/Tools/Makefile new file mode 100644 index 00000000..8999e00c --- /dev/null +++ b/Private/Tools/Makefile @@ -0,0 +1,8 @@ +################################################## +# ; (C) Mahrouss Logic, 2024, all rights reserved. +# This is the tools makefile. +################################################## + +.PHONY: make_hcfs +make_hcfs: + g++ -I./ -std=c++20 make_hcfs.cxx -o make_hcfs.exe
\ No newline at end of file diff --git a/Private/Tools/make_hcfs.c b/Private/Tools/make_hcfs.cxx index 273cd0fc..9ffeca30 100644 --- a/Private/Tools/make_hcfs.c +++ b/Private/Tools/make_hcfs.cxx @@ -16,10 +16,11 @@ /// @brief NewFS partition program. /***********************************************************************************/ -#include <disk_api.h> +#include <make_hcfs.hxx> int main(void) { - printf("%s\n", "makeHCFS, brought to you by Amlal El Mahrouss."); + printf("%s\n", "HCFS Partition Tool, brought to you by Amlal El Mahrouss."); + printf("%s\n", "Copyright Mahrouss Logic, all rights reserved."); return 0; } diff --git a/Private/Tools/disk_api.h b/Private/Tools/make_hcfs.hxx index 27a446c2..3db4a764 100644 --- a/Private/Tools/disk_api.h +++ b/Private/Tools/make_hcfs.hxx @@ -27,3 +27,17 @@ typedef struct __sDISK uintptr_t fDiskCursor; size_t fDiskSize; } DISK, *PDISK; + +#define PACKED __attribute__((packed)) + +typedef struct HCFSBTree final { + wchar_t fCatalogName[255]; + struct { + uint64_t fDataCatalog; + uint64_t fRsrcCatalog; + size_t fDataCatalogSize; + size_t fRsrcCatalogSize; + } fCatalogData; + struct HCFSBTree* fPrevElement; + struct HCFSBTree* fNextElement; +} PACKED HCFSBTree;
\ No newline at end of file diff --git a/TODO_LIST.TXT b/TODO_LIST.TXT index 6f7b8b7c..53d9bddb 100644 --- a/TODO_LIST.TXT +++ b/TODO_LIST.TXT @@ -11,8 +11,8 @@ - AHCI driver [ WiP ] - Context switch x87/SSE/AVX registers [ X ] - Framebuffer and AHCI support [ X ] -- Native Subsystem and GUI [ ] -- Make installer [ ] +- HCore API and HCore Forms. [ ] +- Make installer form class [ ] Status: |
