diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-12-17 10:42:10 +0100 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-12-17 10:42:10 +0100 |
| commit | 03902f82edb1bac41631a3c2aeac866089ccaef8 (patch) | |
| tree | 06ac75fdd12446915091a5307981459f048a9d5c /dev/ZKAKit/src | |
| parent | 83cf6299a17d60ece650baa05069f657f783c911 (diff) | |
Kernel: Lots of fixes and improvements on the kernel's KWindow and Filesystem.
Diffstat (limited to 'dev/ZKAKit/src')
| -rw-r--r-- | dev/ZKAKit/src/FS/NeFS.cc | 24 | ||||
| -rw-r--r-- | dev/ZKAKit/src/IPEFDLLObject.cc | 10 | ||||
| -rw-r--r-- | dev/ZKAKit/src/KernelMain.cc | 58 | ||||
| -rw-r--r-- | dev/ZKAKit/src/User.cc | 15 | ||||
| -rw-r--r-- | dev/ZKAKit/src/UserProcessScheduler.cc | 12 |
5 files changed, 61 insertions, 58 deletions
diff --git a/dev/ZKAKit/src/FS/NeFS.cc b/dev/ZKAKit/src/FS/NeFS.cc index eb2b293f..c062d16a 100644 --- a/dev/ZKAKit/src/FS/NeFS.cc +++ b/dev/ZKAKit/src/FS/NeFS.cc @@ -717,11 +717,15 @@ bool NeFileSystemParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog } /// @brief -/// @param catalogName the catalog name. +/// @param catalog_name the catalog name. /// @return the newly found catalog. -_Output NFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* catalogName, +_Output NFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* catalog_name, Lba& out_lba) { + if (!catalog_name || + *catalog_name == 0) + return nullptr; + kcout << "Start finding catalog...\r"; NFS_ROOT_PARTITION_BLOCK fs_buf{0}; @@ -751,13 +755,13 @@ _Output NFS_CATALOG_STRUCT* NeFileSystemParser::FindCatalog(_Input const Char* c drive.fInput(&drive.fPacket); - if (!StringBuilder::Equals(catalogName, NeFileSystemHelper::Root())) + if (!StringBuilder::Equals(catalog_name, NeFileSystemHelper::Root())) { Char parentName[kNeFSNodeNameLen] = {0}; - for (SizeT indexFill = 0; indexFill < rt_string_len(catalogName); ++indexFill) + for (SizeT indexFill = 0; indexFill < rt_string_len(catalog_name); ++indexFill) { - parentName[indexFill] = catalogName[indexFill]; + parentName[indexFill] = catalog_name[indexFill]; } SizeT indexReverseCopy = rt_string_len(parentName); @@ -807,7 +811,7 @@ NeFSSearchThroughCatalogList: NFS_CATALOG_STRUCT* catalog = (NFS_CATALOG_STRUCT*)&temporary_catalog; - if (StringBuilder::Equals(catalogName, catalog->Name)) + if (StringBuilder::Equals(catalog_name, catalog->Name)) { /// ignore unallocated catalog, break if (!(catalog->Flags & kNeFSFlagCreated)) @@ -870,17 +874,17 @@ Boolean NeFileSystemParser::CloseCatalog(_Input _Output NFS_CATALOG_STRUCT* cata /// @brief Mark catalog as removed. /// @param catalog The catalog structure. /// @return if the catalog was removed or not. -Boolean NeFileSystemParser::RemoveCatalog(_Input const Char* catalogName) +Boolean NeFileSystemParser::RemoveCatalog(_Input const Char* catalog_name) { - if (!catalogName || - StringBuilder::Equals(catalogName, NeFileSystemHelper::Root())) + if (!catalog_name || + StringBuilder::Equals(catalog_name, NeFileSystemHelper::Root())) { err_local_get() = kErrorInternal; return false; } Lba out_lba = 0; - auto catalog = this->FindCatalog(catalogName, out_lba); + auto catalog = this->FindCatalog(catalog_name, out_lba); if (out_lba >= kNeFSCatalogStartAddress || catalog->Flags & kNeFSFlagCreated) diff --git a/dev/ZKAKit/src/IPEFDLLObject.cc b/dev/ZKAKit/src/IPEFDLLObject.cc index aa2fe78d..a7d80081 100644 --- a/dev/ZKAKit/src/IPEFDLLObject.cc +++ b/dev/ZKAKit/src/IPEFDLLObject.cc @@ -18,11 +18,11 @@ Revision History: - 01/02/24: Reworked dll ABI, expect a rtl_init_dll and - rtl_fini_dll (amlel) 15/02/24: Breaking changes, changed the name of the + 01/02/24: Reworked dll ABI, expect a rtl_init_dylib and + rtl_fini_dylib (amlel) 15/02/24: Breaking changes, changed the name of the routines. (amlel) - 07/28/24: Replace rt_library_free with rtl_fini_dll + 07/28/24: Replace rt_library_free with rtl_fini_dylib 10/8/24: FIX: Fix log comment. @@ -39,7 +39,7 @@ using namespace Kernel; /** @brief Library initializer. */ /***********************************************************************************/ -EXTERN_C IDLL rtl_init_dll(UserProcess* header) +EXTERN_C IDLL rtl_init_dylib(UserProcess* header) { IDLL dll_obj = tls_new_class<IPEFDLLObject>(); @@ -83,7 +83,7 @@ EXTERN_C IDLL rtl_init_dll(UserProcess* header) /** @param successful Reports if successful or not. */ /***********************************************************************************/ -EXTERN_C Void rtl_fini_dll(UserProcess* header, IDLL dll_obj, Bool* successful) +EXTERN_C Void rtl_fini_dylib(UserProcess* header, IDLL dll_obj, Bool* successful) { MUST_PASS(successful); diff --git a/dev/ZKAKit/src/KernelMain.cc b/dev/ZKAKit/src/KernelMain.cc index 6832cd9d..aa1638c7 100644 --- a/dev/ZKAKit/src/KernelMain.cc +++ b/dev/ZKAKit/src/KernelMain.cc @@ -50,58 +50,58 @@ namespace Kernel::Detail for (Kernel::SizeT dirIndx = 0UL; dirIndx < kFolderCount; ++dirIndx) { - auto catalogDir = fNeFS->GetParser()->GetCatalog(kFolderStr[dirIndx]); + auto catalog_folder = fNeFS->GetParser()->GetCatalog(kFolderStr[dirIndx]); - if (catalogDir) + if (catalog_folder) { kcout << "newoskrnl: Already exists.\r"; CG::CGDrawStringToWnd(kKernelWnd, "MinOSKrnl: Catalog already exists...", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - delete catalogDir; + delete catalog_folder; continue; } - catalogDir = fNeFS->GetParser()->CreateCatalog(kFolderStr[dirIndx], 0, + catalog_folder = fNeFS->GetParser()->CreateCatalog(kFolderStr[dirIndx], 0, kNeFSCatalogKindDir); - NFS_FORK_STRUCT theFork{0}; + NFS_FORK_STRUCT fork_folder{0}; const Kernel::Char* kSrcFolderName = kFolderInfo; - Kernel::rt_copy_memory((Kernel::VoidPtr)(kSrcFolderName), theFork.ForkName, + Kernel::rt_copy_memory((Kernel::VoidPtr)(kSrcFolderName), fork_folder.ForkName, Kernel::rt_string_len(kSrcFolderName)); - Kernel::rt_copy_memory((Kernel::VoidPtr)(catalogDir->Name), - theFork.CatalogName, - Kernel::rt_string_len(catalogDir->Name)); + Kernel::rt_copy_memory((Kernel::VoidPtr)(catalog_folder->Name), + fork_folder.CatalogName, + Kernel::rt_string_len(catalog_folder->Name)); - theFork.DataSize = kNeFSForkSize; - theFork.ResourceId = 0; - theFork.ResourceKind = Kernel::kNeFSRsrcForkKind; - theFork.Kind = Kernel::kNeFSDataForkKind; + fork_folder.DataSize = kNeFSForkSize; + fork_folder.ResourceId = 0; + fork_folder.ResourceKind = Kernel::kNeFSRsrcForkKind; + fork_folder.Kind = Kernel::kNeFSDataForkKind; - Kernel::KString metadataFolder(kNeFSSectorSz); + Kernel::KString folder_metadata(kNeFSSectorSz); - metadataFolder += + folder_metadata += "<!properties/>\r<p>Kind: folder</p>\r<p>Created by: system</p>\r<p>Edited by: " "system</p>\r<p>Volume Type: Zeta</p>\r"; - metadataFolder += "<p>Path: "; - metadataFolder += kFolderStr[dirIndx]; - metadataFolder += "</p>\r"; + folder_metadata += "<p>Path: "; + folder_metadata += kFolderStr[dirIndx]; + folder_metadata += "</p>\r"; - const Kernel::SizeT metadataSz = kNeFSSectorSz; + const Kernel::SizeT kMetaDataSz = kNeFSSectorSz; - fNeFS->GetParser()->CreateFork(catalogDir, theFork); + fNeFS->GetParser()->CreateFork(catalog_folder, fork_folder); fNeFS->GetParser()->WriteCatalog( - catalogDir, true, (Kernel::VoidPtr)(metadataFolder.CData()), - metadataSz, kFolderInfo); + catalog_folder, true, (Kernel::VoidPtr)(folder_metadata.CData()), + kMetaDataSz, kFolderInfo); CG::CGDrawStringToWnd(kKernelWnd, "MinOSKrnl: Catalog has been created...", 10 + (10 * (dirIndx + 1)), 10, RGB(0, 0, 0)); - delete catalogDir; + delete catalog_folder; } } @@ -159,23 +159,21 @@ namespace Kernel::Detail /// @brief Application entrypoint. /// @param Void /// @return Void -EXTERN_C Kernel::Void gsh_dll_main(Kernel::Void) +EXTERN_C Kernel::Void rtl_kernel_main(Kernel::SizeT argc, char** argv, char** envp, Kernel::SizeT envp_len) { Kernel::IFilesystemMgr::Mount(new Kernel::NeFileSystemMgr()); - Kernel::Detail::FilesystemInstaller installer; - CG::CGDrawBackground(); - - kKernelWnd = CG::CGCreateWindow(CG::kWndFlagWindow, "ZKA | System Build: " KERNEL_VERSION, "Window", 20, 20, 800, 600); + kKernelWnd = CG::CGCreateWindow(CG::kWndFlagWindow, "ZKA | System Build: " KERNEL_VERSION, "Window", 10, 10, 1280, 720); if (kKernelWnd) { kKernelWnd->w_sub_type = CG::kWndFlagCloseControlSelect; - kKernelWnd->w_x = 10; - kKernelWnd->w_y = 10; + kKernelWnd->w_child_count = 0; kKernelWnd->w_needs_repaint = Yes; CG::CGDrawWindowList(&kKernelWnd, 1); + + Kernel::Detail::FilesystemInstaller installer; } } diff --git a/dev/ZKAKit/src/User.cc b/dev/ZKAKit/src/User.cc index 0cd0a90e..d45c8e1b 100644 --- a/dev/ZKAKit/src/User.cc +++ b/dev/ZKAKit/src/User.cc @@ -20,7 +20,8 @@ #define kStdUserType (0xCE) #define kSuperUserType (0xEC) -/// BUGS: 0 +/// @file User.cc +/// @brief User support (or also called ) namespace Kernel { @@ -34,7 +35,7 @@ namespace Kernel if (!password || !user) return 1; - kcout << "Hashing user password...\r"; + kcout << "cred_construct_token: Hashing user password...\r"; for (Size i_pass = 0; i_pass < length; ++i_pass) { @@ -46,7 +47,7 @@ namespace Kernel password[i_pass] = cur_chr | (user->IsStdUser() ? kStdUserType : kSuperUserType); } - kcout << "DONE: hashed user password.\r"; + kcout << "cred_construct_token: Hashed user password.\r"; return 0; } @@ -101,7 +102,7 @@ namespace Kernel delete[] password; password = nullptr; - kcout << "Saved password successfully...\r"; + kcout << "User::Save: Saved password successfully...\r"; return Yes; } @@ -130,16 +131,16 @@ namespace Kernel return No; } - kcout << "Validating hashed passwords...\r"; + kcout << "User::Matches: Validating hashed passwords...\r"; // now check if the password matches. if (rt_string_cmp(password, this->mUserToken, rt_string_len(this->mUserToken)) == 0) { - kcout << "Password is valid.\r"; + kcout << "User::Matches: Password is valid.\r"; return Yes; } - kcout << "Password isn't valid.\r"; + kcout << "User::Matches: Password isn't valid.\r"; return No; } diff --git a/dev/ZKAKit/src/UserProcessScheduler.cc b/dev/ZKAKit/src/UserProcessScheduler.cc index 360625e4..637eb151 100644 --- a/dev/ZKAKit/src/UserProcessScheduler.cc +++ b/dev/ZKAKit/src/UserProcessScheduler.cc @@ -255,14 +255,14 @@ namespace Kernel { Bool success = false; - rtl_fini_dll(this, reinterpret_cast<IPEFDLLObject*>(this->PefDLLDelegate), &success); + rtl_fini_dylib(this, reinterpret_cast<IPEFDLLObject*>(this->DylibDelegate), &success); if (!success) { ke_stop(RUNTIME_CHECK_PROCESS); } - this->PefDLLDelegate = nullptr; + this->DylibDelegate = nullptr; } if (this->StackReserve) @@ -314,10 +314,10 @@ namespace Kernel // Create heap according to type of process-> if (process->Kind == UserProcess::kExectuableDLLKind) { - process->PefDLLDelegate = rtl_init_dll(process); - MUST_PASS(process->PefDLLDelegate); + process->DylibDelegate = rtl_init_dylib(process); + MUST_PASS(process->DylibDelegate); - kcout << "Create DLL Delegate for: " << process->Name << endl; + kcout << "Created Library Interface for process: " << process->Name << endl; } process->StackReserve = new UInt8[process->StackSize]; @@ -334,7 +334,7 @@ namespace Kernel return -kErrorProcessFault; } - kcout << "Create stack reserve for: " << process->Name << endl; + kcout << "Created Reserved Stack for process: " << process->Name << endl; ProcessID pid = mTeam.mProcessCount; |
