diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-05 19:53:08 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-09-05 19:53:40 +0200 |
| commit | 3b60a1e87ab02a1b72d8bb9f7392780899d5a0d7 (patch) | |
| tree | 438f1337c0eb2ae83cf3d409c29848d396be08b2 /dev/ZKA | |
| parent | 432e68391357423914547a7b34311258d7598808 (diff) | |
[ IMP ] HPFS EBS and NeFS overhaul.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKA')
| -rw-r--r-- | dev/ZKA/FSKit/HPFS.hxx (renamed from dev/ZKA/FSKit/FAT32.hxx) | 4 | ||||
| -rw-r--r-- | dev/ZKA/FSKit/NeFS.hxx | 13 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/FileMgr.hxx | 8 | ||||
| -rw-r--r-- | dev/ZKA/KernelKit/PEFCodeMgr.hxx | 4 | ||||
| -rw-r--r-- | dev/ZKA/NewKit/Macros.hxx | 2 | ||||
| -rw-r--r-- | dev/ZKA/Sources/DLLMain.cxx | 97 | ||||
| -rw-r--r-- | dev/ZKA/Sources/DriveMgr.cxx | 10 | ||||
| -rw-r--r-- | dev/ZKA/Sources/FS/FAT32.cxx | 4 | ||||
| -rw-r--r-- | dev/ZKA/Sources/FS/NeFS.cxx | 28 | ||||
| -rw-r--r-- | dev/ZKA/Sources/FileMgr.cxx | 4 | ||||
| -rw-r--r-- | dev/ZKA/Sources/NeFS+FileMgr.cxx (renamed from dev/ZKA/Sources/NewFS+FileMgr.cxx) | 4 | ||||
| -rw-r--r-- | dev/ZKA/Sources/NeFS+IO.cxx (renamed from dev/ZKA/Sources/NewFS+IO.cxx) | 24 | ||||
| -rw-r--r-- | dev/ZKA/Sources/NewFS+Journal.cxx | 22 | ||||
| -rw-r--r-- | dev/ZKA/Sources/UserProcessScheduler.cxx | 23 | ||||
| -rw-r--r-- | dev/ZKA/Sources/compile_flags.txt | 2 | ||||
| -rw-r--r-- | dev/ZKA/amd64-efi.make | 2 | ||||
| -rw-r--r-- | dev/ZKA/arm64-efi.make | 2 |
17 files changed, 79 insertions, 174 deletions
diff --git a/dev/ZKA/FSKit/FAT32.hxx b/dev/ZKA/FSKit/HPFS.hxx index 04fa0c6d..6f5ff3f4 100644 --- a/dev/ZKA/FSKit/FAT32.hxx +++ b/dev/ZKA/FSKit/HPFS.hxx @@ -8,5 +8,5 @@ #include <NewKit/Defines.hxx>
-/// @file FAT32.hxx
-/// @brief FAT32 support.
\ No newline at end of file +/// @file HPFS.hxx
+/// @brief HPFS support.
\ No newline at end of file diff --git a/dev/ZKA/FSKit/NeFS.hxx b/dev/ZKA/FSKit/NeFS.hxx index d1c0c9c7..2bf17863 100644 --- a/dev/ZKA/FSKit/NeFS.hxx +++ b/dev/ZKA/FSKit/NeFS.hxx @@ -3,7 +3,7 @@ Copyright ZKA Technologies. FILE: NeFS.hxx - PURPOSE: NeFS (New FileSystem) kernel support. + PURPOSE: NeFS (New FileSystem) support, can be used with kernel, HPFS is preferred. Revision History: @@ -31,11 +31,11 @@ default. #define kNeFSNodeNameLen (256) #define kNeFSSectorSz (512) -#define kNeFSForkDataSz (gib_cast(16)) +#define kNeFSForkDataSz (kib_cast(8)) #define kNeFSIdentLen (8) -#define kNeFSIdent " NewFS" -#define kNeFSPadLen (400) +#define kNeFSIdent " NeFS" +#define kNeFSPadLen (392) #define kNeFSMetaFilePrefix '$' @@ -69,8 +69,9 @@ default. #define kNeFSCatalogKindLock (10) #define kNeFSCatalogKindRLE (11) - #define kNeFSCatalogKindMetaFile (12) +#define kNeFSCatalogKindTTF (13) +#define kNeFSCatalogKindRIFF (14) #define kNeFSSeparator '\\' #define kNeFSSeparatorAlt '/' @@ -193,7 +194,7 @@ struct PACKED NFS_ROOT_PARTITION_BLOCK final Kernel::Lba EpmBlock; - Kernel::Char Pad[kNeFSPadLen - sizeof(Kernel::Lba)]; + Kernel::Char Pad[kNeFSPadLen]; }; namespace Kernel diff --git a/dev/ZKA/KernelKit/FileMgr.hxx b/dev/ZKA/KernelKit/FileMgr.hxx index a46216db..86eade6a 100644 --- a/dev/ZKA/KernelKit/FileMgr.hxx +++ b/dev/ZKA/KernelKit/FileMgr.hxx @@ -19,9 +19,9 @@ #pragma once -#ifdef __FSKIT_USE_NEWFS__ +#ifdef __FSKIT_USE_NEFS__ #include <FSKit/NeFS.hxx> -#endif // __FSKIT_USE_NEWFS__ +#endif // __FSKIT_USE_NEFS__ #include <CompilerKit/CompilerKit.hxx> #include <HintKit/CompilerHint.hxx> @@ -135,7 +135,7 @@ namespace Kernel virtual bool Rewind(_Input NodePtr node) = 0; }; -#ifdef __FSKIT_USE_NEWFS__ +#ifdef __FSKIT_USE_NEFS__ /** * @brief Based of FilesystemMgrInterface, takes care of managing NeFS * disks. @@ -184,7 +184,7 @@ namespace Kernel NeFSParser* fImpl{nullptr}; }; -#endif // ifdef __FSKIT_USE_NEWFS__ +#endif // ifdef __FSKIT_USE_NEFS__ /** * Usable FileStream diff --git a/dev/ZKA/KernelKit/PEFCodeMgr.hxx b/dev/ZKA/KernelKit/PEFCodeMgr.hxx index 74cc8eb0..c2938fae 100644 --- a/dev/ZKA/KernelKit/PEFCodeMgr.hxx +++ b/dev/ZKA/KernelKit/PEFCodeMgr.hxx @@ -46,11 +46,11 @@ namespace Kernel bool IsLoaded() noexcept; private: -#ifdef __FSKIT_USE_NEWFS__ +#ifdef __FSKIT_USE_NEFS__ OwnPtr<FileStream<Char, NewFilesystemMgr>> fFile; #else OwnPtr<FileStream<Char>> fFile; -#endif // __FSKIT_USE_NEWFS__ +#endif // __FSKIT_USE_NEFS__ Ref<StringView> fPath; VoidPtr fCachedBlob; diff --git a/dev/ZKA/NewKit/Macros.hxx b/dev/ZKA/NewKit/Macros.hxx index 0de25216..b20ddb8a 100644 --- a/dev/ZKA/NewKit/Macros.hxx +++ b/dev/ZKA/NewKit/Macros.hxx @@ -126,5 +126,3 @@ /// @brief The main kernel file. #define kSysChime "\\System\\startup.wav" -/// @brief The main kernel file. -#define kSysKrnl "\\System\\newoskrnl.exe" diff --git a/dev/ZKA/Sources/DLLMain.cxx b/dev/ZKA/Sources/DLLMain.cxx index 0fa3a181..2aed9bf7 100644 --- a/dev/ZKA/Sources/DLLMain.cxx +++ b/dev/ZKA/Sources/DLLMain.cxx @@ -79,8 +79,8 @@ namespace Kernel::Detail if (catalogDir) { - CG::CGDrawStringToWnd(cKernelWnd, "Catalog directory already exists: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Catalog directory already exists: ")), RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "Directory already exists: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory already exists: ")), RGB(0, 0, 0)); delete catalogDir; continue; @@ -89,101 +89,12 @@ namespace Kernel::Detail catalogDir = fNeFS->GetParser()->CreateCatalog(cDirStr[dirIndx], 0, kNeFSCatalogKindDir); - CG::CGDrawStringToWnd(cKernelWnd, "Catalog directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Catalog directory has been created: ")), RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, "Directory has been created: ", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); + CG::CGDrawStringToWnd(cKernelWnd, catalogDir->Name, 10 + (10 * (dirIndx + 1)), 10 + (FONT_SIZE_X * rt_string_len("Directory has been created: ")), RGB(0, 0, 0)); delete catalogDir; } } - - constexpr auto cFileToFormatCnt = 5; - - struct - { - VoidPtr fBlob; - Size fBlobSz; - Int32 fFlags; - Char fName[kNeFSNodeNameLen]; - } cFiles[cFileToFormatCnt] = { - { - .fBlob = kHandoverHeader->f_KernelImage, - .fBlobSz = kHandoverHeader->f_KernelSz, - .fFlags = kNeFSCatalogKindExecutable, - .fName = kSysKrnl, - }, - { - .fBlob = kHandoverHeader->f_StartupImage, - .fBlobSz = kHandoverHeader->f_StartupSz, - .fFlags = kNeFSCatalogKindExecutable, - .fName = kSysDrv, - }, - { - .fBlob = 0, - .fBlobSz = mib_cast(32), - .fFlags = kNeFSCatalogKindPage, - .fName = kSysPage, - }, - { - .fBlob = kHandoverHeader->f_TTFallbackFont, - .fBlobSz = kHandoverHeader->f_FontSz, - .fFlags = kNeFSCatalogKindResource, - .fName = kSysTTF, - }, - { - .fBlob = kHandoverHeader->f_StartupChime, - .fBlobSz = kHandoverHeader->f_ChimeSz, - .fFlags = kNeFSCatalogKindResource, - .fName = kSysChime, - } - - }; - - for (size_t i = 0; i < cFileToFormatCnt; i++) - { - NFS_CATALOG_STRUCT* catalogDisk = - this->fNeFS->GetParser()->GetCatalog(cFiles[i].fName); - - const Kernel::Char* cSrcName = cFiles[i].fName; - - if (catalogDisk) - { - CG::CGDrawStringToWnd(cKernelWnd, "File already exists: ", 10 + (10 * (cDirCount + i + 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, cFiles[i].fName, 10 + (10 * (cDirCount + i+ 1)), 10 + (FONT_SIZE_X * rt_string_len("File already exists: ")), RGB(0, 0, 0)); - - delete catalogDisk; - } - else - { - CG::CGDrawStringToWnd(cKernelWnd, "File created: ", 10 + (10 * (cDirCount + i+ 1)), 10, RGB(0, 0, 0)); - CG::CGDrawStringToWnd(cKernelWnd, cFiles[i].fName, 10 + (10 * (cDirCount + i + 1)), 10 + (FONT_SIZE_X * rt_string_len("File created: ")), RGB(0, 0, 0)); - - catalogDisk = - (NFS_CATALOG_STRUCT*)this->Leak()->CreateSwapFile(cFiles[i].fName); - - NFS_FORK_STRUCT theDiskFork{0}; - - Kernel::rt_copy_memory((Kernel::VoidPtr)(cSrcName), theDiskFork.ForkName, - Kernel::rt_string_len(cSrcName)); - - Kernel::rt_copy_memory((Kernel::VoidPtr)(catalogDisk->Name), - theDiskFork.CatalogName, - Kernel::rt_string_len(catalogDisk->Name)); - - theDiskFork.DataSize = cFiles[i].fBlobSz; - theDiskFork.ResourceId = cFiles[i].fFlags; - theDiskFork.ResourceKind = Kernel::kNeFSDataForkKind; - theDiskFork.Kind = Kernel::kNeFSDataForkKind; - - fNeFS->GetParser()->CreateFork(catalogDisk, theDiskFork); - - if (theDiskFork.ResourceId != kNeFSCatalogKindPage) - { - fNeFS->GetParser()->WriteCatalog(catalogDisk, false, cFiles[i].fBlob, cFiles[i].fBlobSz, theDiskFork.ForkName); - } - - delete catalogDisk; - } - } } ~FilesystemInstaller() = default; diff --git a/dev/ZKA/Sources/DriveMgr.cxx b/dev/ZKA/Sources/DriveMgr.cxx index e39c9c33..5d0f7fc3 100644 --- a/dev/ZKA/Sources/DriveMgr.cxx +++ b/dev/ZKA/Sources/DriveMgr.cxx @@ -6,17 +6,20 @@ #include <KernelKit/DebugOutput.hxx> #include <KernelKit/DriveMgr.hxx> +#include <NewKit/Utils.hxx> + + #include <Modules/ATA/ATA.hxx> #include <Modules/AHCI/AHCI.hxx> -#include <NewKit/Utils.hxx> +#include <Modules/NVME/Defines.hxx> /// @file DriveMgr.cxx /// @brief Kernel drive manager. namespace Kernel { - static UInt16 kATAIO = 0U; - static UInt8 kATAMaster = 0U; + STATIC UInt16 kATAIO = 0U; + STATIC UInt8 kATAMaster = 0U; /// @brief reads from an ATA drive. /// @param pckt @@ -106,6 +109,7 @@ namespace Kernel /// @return Void io_drv_unimplemented(DriveTrait::DrivePacket* pckt) { + ZKA_UNUSED(pckt); } /// @brief Makes a new drive. diff --git a/dev/ZKA/Sources/FS/FAT32.cxx b/dev/ZKA/Sources/FS/FAT32.cxx index 1f5e194b..9e22e2a8 100644 --- a/dev/ZKA/Sources/FS/FAT32.cxx +++ b/dev/ZKA/Sources/FS/FAT32.cxx @@ -4,9 +4,9 @@ ------------------------------------------- */ -#ifdef __FSKIT_INCLUDES_FAT32__ +#ifdef __FSKIT_INCLUDES_HPFS__ #include <FirmwareKit/GPT.hxx> #include <FirmwareKit/EPM.hxx> -#endif // ifdef __FSKIT_INCLUDES_FAT32__ +#endif // ifdef __FSKIT_INCLUDES_HPFS__ diff --git a/dev/ZKA/Sources/FS/NeFS.cxx b/dev/ZKA/Sources/FS/NeFS.cxx index 5bae8d4a..68078ec3 100644 --- a/dev/ZKA/Sources/FS/NeFS.cxx +++ b/dev/ZKA/Sources/FS/NeFS.cxx @@ -4,7 +4,7 @@ ------------------------------------------- */ -#ifdef __FSKIT_USE_NEWFS__ +#ifdef __FSKIT_USE_NEFS__ #include <Modules/AHCI/AHCI.hxx> #include <Modules/ATA/ATA.hxx> @@ -143,9 +143,9 @@ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catal 4; /// this value gives us space for the data offset. theFork.Flags = kNeFSFlagCreated; - theFork.DataOffset = lba - sizeof(NFS_FORK_STRUCT) * cForkPadding; + theFork.DataOffset = lba - sizeof(NFS_FORK_STRUCT) - theFork.DataSize; theFork.PreviousSibling = lbaOfPreviousFork; - theFork.NextSibling = theFork.DataOffset - theFork.DataSize; + theFork.NextSibling = theFork.DataOffset + sizeof(NFS_FORK_STRUCT) + theFork.DataSize; drv.fPacket.fLba = lba; drv.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT); @@ -635,9 +635,13 @@ bool NeFSParser::Format(_Input _Output DriveTrait* drive, _Input const Lba endLb /// @return if the catalog w rote the contents successfully. bool NeFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool isRsrcFork, _Input VoidPtr data, _Input SizeT sizeOfData, _Input const Char* forkName) { - if (sizeOfData > kNeFSForkDataSz) + if (sizeOfData > kNeFSForkDataSz || + sizeOfData == 0) return No; + auto buf = new UInt8[kNeFSForkDataSz]; + rt_copy_memory(data, buf, sizeOfData); + auto drive = sMountpointInterface.A(); rt_copy_memory((VoidPtr) "fs/newfs-packet", drive.fPacket.fPacketMime, @@ -671,31 +675,31 @@ bool NeFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool i if (forkDataIn->Flags != kNeFSFlagUnallocated && forkDataIn->Flags != kNeFSFlagDeleted && StringBuilder::Equals(forkDataIn->ForkName, forkName) && - StringBuilder::Equals(forkDataIn->CatalogName, catalog->Name)) + StringBuilder::Equals(forkDataIn->CatalogName, catalog->Name) && + forkDataIn->DataSize == sizeOfData) { // ===================================================== // // Store the blob now. // ===================================================== // forkDataIn->Flags = kNeFSFlagCreated; - forkDataIn->DataOffset = startFork - sizeof(NFS_FORK_STRUCT); - forkDataIn->DataSize = sizeOfData; - drive.fPacket.fPacketContent = data; - drive.fPacket.fPacketSize = sizeOfData; + drive.fPacket.fPacketContent = buf; + drive.fPacket.fPacketSize = kNeFSForkDataSz; drive.fPacket.fLba = forkDataIn->DataOffset; kcout << "data offset: " << hex_number(forkDataIn->DataOffset) << endl; drive.fOutput(&drive.fPacket); - drive.fPacket.fPacketContent = &forkDataIn; + drive.fPacket.fPacketContent = forkDataIn; drive.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT); - drive.fPacket.fLba = startFork; + drive.fPacket.fLba = startFork - sizeof(NFS_FORK_STRUCT); drive.fOutput(&drive.fPacket); kcout << "wrote fork at offset: " << hex_number(forkDataIn->DataOffset) << endl; + kcout << "wrote fork at offset: " << hex_number(startFork - sizeof(NFS_FORK_STRUCT)) << endl; delete catalog; @@ -1042,4 +1046,4 @@ namespace Kernel::Detail } } // namespace Kernel::Detail -#endif // ifdef __FSKIT_USE_NEWFS__ +#endif // ifdef __FSKIT_USE_NEFS__ diff --git a/dev/ZKA/Sources/FileMgr.cxx b/dev/ZKA/Sources/FileMgr.cxx index cbd2a4f4..3e3977ab 100644 --- a/dev/ZKA/Sources/FileMgr.cxx +++ b/dev/ZKA/Sources/FileMgr.cxx @@ -50,7 +50,7 @@ namespace Kernel return false; } -#ifdef __FSKIT_USE_NEWFS__ +#ifdef __FSKIT_USE_NEFS__ /// @brief Opens a new file. /// @param path /// @param r @@ -186,5 +186,5 @@ namespace Kernel { return fImpl; } -#endif // __FSKIT_USE_NEWFS__ +#endif // __FSKIT_USE_NEFS__ } // namespace Kernel diff --git a/dev/ZKA/Sources/NewFS+FileMgr.cxx b/dev/ZKA/Sources/NeFS+FileMgr.cxx index 29beda45..b3ad381f 100644 --- a/dev/ZKA/Sources/NewFS+FileMgr.cxx +++ b/dev/ZKA/Sources/NeFS+FileMgr.cxx @@ -7,7 +7,7 @@ #include <KernelKit/FileMgr.hxx> #include <KernelKit/Heap.hxx> -#ifdef __FSKIT_USE_NEWFS__ +#ifdef __FSKIT_USE_NEFS__ /// @brief NeFS File manager. /// BUGS: 0 @@ -106,4 +106,4 @@ namespace Kernel } } // namespace Kernel -#endif // ifdef __FSKIT_USE_NEWFS__ +#endif // ifdef __FSKIT_USE_NEFS__ diff --git a/dev/ZKA/Sources/NewFS+IO.cxx b/dev/ZKA/Sources/NeFS+IO.cxx index 7917c1bb..a86e9c29 100644 --- a/dev/ZKA/Sources/NewFS+IO.cxx +++ b/dev/ZKA/Sources/NeFS+IO.cxx @@ -17,14 +17,14 @@ * *************************************************************/ -#ifdef __FSKIT_USE_NEWFS__ +#ifdef __FSKIT_USE_NEFS__ #include <FirmwareKit/EPM.hxx> /// Useful macros. -#define NEWFS_WRITE(DRV, TRAITS, MP) (MP->DRV()).fOutput(&TRAITS) -#define NEWFS_READ(DRV, TRAITS, MP) (MP->DRV()).fInput(&TRAITS) +#define NEFS_WRITE(DRV, TRAITS, MP) (MP->DRV()).fOutput(&TRAITS) +#define NEFS_READ(DRV, TRAITS, MP) (MP->DRV()).fInput(&TRAITS) using namespace Kernel; @@ -43,19 +43,19 @@ Int32 fs_newfs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvInd switch (DrvIndex) { case kNeFSSubDriveA: { - NEWFS_READ(A, DrvTrait.fPacket, Mnt); + NEFS_READ(A, DrvTrait.fPacket, Mnt); break; } case kNeFSSubDriveB: { - NEWFS_READ(B, DrvTrait.fPacket, Mnt); + NEFS_READ(B, DrvTrait.fPacket, Mnt); break; } case kNeFSSubDriveC: { - NEWFS_READ(C, DrvTrait.fPacket, Mnt); + NEFS_READ(C, DrvTrait.fPacket, Mnt); break; } case kNeFSSubDriveD: { - NEWFS_READ(D, DrvTrait.fPacket, Mnt); + NEFS_READ(D, DrvTrait.fPacket, Mnt); break; } } @@ -78,19 +78,19 @@ Int32 fs_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIn switch (DrvIndex) { case kNeFSSubDriveA: { - NEWFS_WRITE(A, DrvTrait.fPacket, Mnt); + NEFS_WRITE(A, DrvTrait.fPacket, Mnt); break; } case kNeFSSubDriveB: { - NEWFS_WRITE(B, DrvTrait.fPacket, Mnt); + NEFS_WRITE(B, DrvTrait.fPacket, Mnt); break; } case kNeFSSubDriveC: { - NEWFS_WRITE(C, DrvTrait.fPacket, Mnt); + NEFS_WRITE(C, DrvTrait.fPacket, Mnt); break; } case kNeFSSubDriveD: { - NEWFS_WRITE(D, DrvTrait.fPacket, Mnt); + NEFS_WRITE(D, DrvTrait.fPacket, Mnt); break; } } @@ -98,4 +98,4 @@ Int32 fs_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIn return DrvTrait.fPacket.fPacketGood; } -#endif // ifdef __FSKIT_USE_NEWFS__ +#endif // ifdef __FSKIT_USE_NEFS__ diff --git a/dev/ZKA/Sources/NewFS+Journal.cxx b/dev/ZKA/Sources/NewFS+Journal.cxx deleted file mode 100644 index f8d82fcd..00000000 --- a/dev/ZKA/Sources/NewFS+Journal.cxx +++ /dev/null @@ -1,22 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#include <KernelKit/DebugOutput.hxx> -#include <KernelKit/FileMgr.hxx> - -#ifdef __FSKIT_USE_NEWFS__ - -///! BUGS: 0 -///! @file NeFS+Journal.cxx -///! @brief Journaling for NeFS. - -namespace Kernel::Journal -{ -} // namespace Kernel::Journal - -using namespace Kernel; - -#endif // ifdef __FSKIT_USE_NEWFS__ diff --git a/dev/ZKA/Sources/UserProcessScheduler.cxx b/dev/ZKA/Sources/UserProcessScheduler.cxx index 4e0c8902..8c46b1cf 100644 --- a/dev/ZKA/Sources/UserProcessScheduler.cxx +++ b/dev/ZKA/Sources/UserProcessScheduler.cxx @@ -2,6 +2,9 @@ Copyright ZKA Technologies. + FILE: UserProcessScheduler.cxx + PURPOSE: User sided process scheduler. + ------------------------------------------- */ /***********************************************************************************/ @@ -34,7 +37,7 @@ namespace Kernel /// @brief User Process scheduler global object. /***********************************************************************************/ - STATIC UserProcessScheduler* cProcessScheduler = nullptr; + UserProcessScheduler* cProcessScheduler = nullptr; /// @brief Gets the last exit code. /// @note Not thread-safe. @@ -264,6 +267,7 @@ namespace Kernel { if (process.Kind != UserProcess::kDLLKind) { + process.Crash(); return -kErrorProcessFault; } } @@ -273,6 +277,9 @@ namespace Kernel ++mTeam.mProcessAmount; + while (1) + ; + mTeam.AsArray()[process.ProcessId] = process; return process.ProcessId; @@ -297,7 +304,7 @@ namespace Kernel // check if process is within range. if (process_id > mTeam.AsArray().Count()) return false; - + mTeam.AsArray()[process_id].Status = ProcessStatusKind::kDead; --mTeam.mProcessAmount; @@ -373,10 +380,12 @@ namespace Kernel Void UserProcessHelper::Init() { - if (!cProcessScheduler) - { - cProcessScheduler = new UserProcessScheduler(); - } + if (mm_is_valid_heap(cProcessScheduler)) + delete cProcessScheduler; + + cProcessScheduler = nullptr; + cProcessScheduler = new UserProcessScheduler(); + MUST_PASS(cProcessScheduler); } /// @brief Check if process can be schedulded. @@ -435,7 +444,7 @@ namespace Kernel HardwareThreadScheduler::The()[index].Leak()->Kind() != ThreadKind::kHartSystemReserved) { - PID prev_pid = UserProcessHelper::TheCurrentPID(); + PID prev_pid = UserProcessHelper::TheCurrentPID(); UserProcessHelper::TheCurrentPID() = new_pid; bool ret = HardwareThreadScheduler::The()[index].Leak()->Switch(image_ptr, stack, frame_ptr); diff --git a/dev/ZKA/Sources/compile_flags.txt b/dev/ZKA/Sources/compile_flags.txt index 33aadad4..a22ed881 100644 --- a/dev/ZKA/Sources/compile_flags.txt +++ b/dev/ZKA/Sources/compile_flags.txt @@ -3,5 +3,5 @@ -std=c++20 -I../ -I$(HOME)/ --D__FSKIT_USE_NEWFS__ +-D__FSKIT_USE_NEFS__ -D__ZKA_AMD64__ diff --git a/dev/ZKA/amd64-efi.make b/dev/ZKA/amd64-efi.make index 4d1f9403..00c2664e 100644 --- a/dev/ZKA/amd64-efi.make +++ b/dev/ZKA/amd64-efi.make @@ -6,7 +6,7 @@ CC = x86_64-w64-mingw32-g++ LD = x86_64-w64-mingw32-ld CCFLAGS = -fshort-wchar -c -D__ZKA_AMD64__ -mno-red-zone -fno-rtti -fno-exceptions \ - -std=c++20 -D__ZKA_SUPPORT_NX__ -I../Vendor -D__FSKIT_USE_NEWFS__ \ + -std=c++20 -D__ZKA_SUPPORT_NX__ -I../Vendor -D__FSKIT_USE_NEFS__ \ -D__NEWOSKRNL__ -D__HAVE_ZKA_APIS__ -D__FREESTANDING__ -D__ZKA__ -I./ -I../ -I../ZBA ASM = nasm diff --git a/dev/ZKA/arm64-efi.make b/dev/ZKA/arm64-efi.make index 65f3a0ae..a801ed3e 100644 --- a/dev/ZKA/arm64-efi.make +++ b/dev/ZKA/arm64-efi.make @@ -7,7 +7,7 @@ CC = clang++ LD = lld-link CCFLAGS = -fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__ZKA_ARM64__ -fno-rtti -fno-exceptions -I./ \ -target aarch64-unknown-windows \ - -std=c++20 -D__FSKIT_USE_NEWFS__ -D__ZETA_MACHINE__ -D__NEWOSKRNL__ -D__HAVE_ZKA_APIS__ -D__ZKA__ -I../ + -std=c++20 -D__FSKIT_USE_NEFS__ -D__ZETA_MACHINE__ -D__NEWOSKRNL__ -D__HAVE_ZKA_APIS__ -D__ZKA__ -I../ ASM = clang++ |
