diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-12-12 09:01:44 +0100 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-12-12 09:03:35 +0100 |
| commit | 71ea4e60ed0b30590a48fde31a74b05e3dd14196 (patch) | |
| tree | cdfccef70e20622ef1e5219e2c58fa6a2f5b30d9 /dev | |
| parent | 5bd5a930755550d4fa7cb48c51aa8f9b9f3e5bae (diff) | |
NeFS.h: Add new fork types in NeFS specifications.
User.h/User.cc: Did code refactors in the User class.
Heap.cc: Also refactored the heap structure.
Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/ZKAKit/FSKit/NeFS.h | 16 | ||||
| -rw-r--r-- | dev/ZKAKit/FirmwareKit/EFI/EFI.h | 18 | ||||
| -rw-r--r-- | dev/ZKAKit/FirmwareKit/GPT.h | 8 | ||||
| -rw-r--r-- | dev/ZKAKit/HALKit/AMD64/Processor.h | 2 | ||||
| -rw-r--r-- | dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc | 2 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/LoaderInterface.h | 6 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/User.h | 12 | ||||
| -rw-r--r-- | dev/ZKAKit/KernelKit/XCOFF.h | 10 | ||||
| -rw-r--r-- | dev/ZKAKit/src/FS/NeFS.cc | 10 | ||||
| -rw-r--r-- | dev/ZKAKit/src/Heap.cc | 42 | ||||
| -rw-r--r-- | dev/ZKAKit/src/User.cc | 26 | ||||
| -rw-r--r-- | dev/ZKAKit/src/UserProcessTeam.cc | 12 |
12 files changed, 83 insertions, 81 deletions
diff --git a/dev/ZKAKit/FSKit/NeFS.h b/dev/ZKAKit/FSKit/NeFS.h index 1520daeb..aea36b25 100644 --- a/dev/ZKAKit/FSKit/NeFS.h +++ b/dev/ZKAKit/FSKit/NeFS.h @@ -23,7 +23,7 @@ default. /** @brief New File System specification. - @author ELMH GROUP (ELMH GROUP amlalelmahrouss at icloud dot com) + @author ELMH GROUP (Amlal EL Mahrouss, amlalelmahrouss at icloud dot com) */ #define kNeFSInvalidFork (-1) @@ -74,6 +74,8 @@ default. #define kNeFSCatalogKindTTF (13) #define kNeFSCatalogKindRIFF (14) +#define kNeFSCatalogKindMPEG (15) +#define kNeFSCatalogKindDVX (16) #define kNeFSSeparator '/' #define kNeFSSeparatorAlt '/' @@ -239,15 +241,15 @@ namespace Kernel /// @param theFork the fork itself. /// @return the fork _Output NFS_FORK_STRUCT* CreateFork(_Input NFS_CATALOG_STRUCT* catalog, - _Input NFS_FORK_STRUCT& theFork); + _Input NFS_FORK_STRUCT& theFork); /// @brief Find fork inside New filesystem. /// @param catalog the catalog. /// @param name the fork name. /// @return the fork. _Output NFS_FORK_STRUCT* FindFork(_Input NFS_CATALOG_STRUCT* catalog, - _Input const Char* name, - Boolean dataOrRsrc); + _Input const Char* name, + Boolean dataOrRsrc); _Output Void RemoveFork(_Input NFS_FORK_STRUCT* fork); @@ -257,7 +259,7 @@ namespace Kernel _Output NFS_CATALOG_STRUCT* GetCatalog(_Input const Char* name); - _Output NFS_CATALOG_STRUCT* CreateCatalog(_Input const Char* name, + _Output NFS_CATALOG_STRUCT* CreateCatalog(_Input const Char* name, _Input const Int32& flags, _Input const Int32& kind); @@ -267,12 +269,12 @@ namespace Kernel _Input Bool isRsrcFork, _Input VoidPtr data, _Input SizeT sizeOfData, - _Input const Char* forkName); + _Input const Char* forkName); VoidPtr ReadCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, _Input Bool isRsrcFork, _Input SizeT dataSz, - _Input const Char* forkName); + _Input const Char* forkName); bool Seek(_Input _Output NFS_CATALOG_STRUCT* catalog, SizeT off); diff --git a/dev/ZKAKit/FirmwareKit/EFI/EFI.h b/dev/ZKAKit/FirmwareKit/EFI/EFI.h index 4950d89b..14c2c2cb 100644 --- a/dev/ZKAKit/FirmwareKit/EFI/EFI.h +++ b/dev/ZKAKit/FirmwareKit/EFI/EFI.h @@ -823,11 +823,11 @@ typedef struct _EfiProcessorInformation typedef EfiStatusType EFI_API (*EfiMpServicesGetNumberOfProcessors)( IN struct _EfiMpServicesProtocol* Self, - OUT UInt32* NumberOfProcessors, - OUT UInt32* NumberOfEnabledProcessors); + OUT UInt32* NumberOfProcessors, + OUT UInt32* NumberOfEnabledProcessors); typedef EfiStatusType EFI_API (*EfiMpServicesGetProcessorInfo)( - IN struct _EfiMpServicesProtocol* Self, + IN struct _EfiMpServicesProtocol* Self, IN UInt32* ProcessorNumber, OUT struct _EfiProcessorInformation* NumberOfEnabledProcessors); @@ -840,8 +840,8 @@ typedef EfiStatusType EFI_API (*EfiMpServicesStartupAllAPS)( IN Boolean SingleThread, IN VoidPtr WaitEvent OPTIONAL, // EFI_EVENT first, but unused here. IN UInt32 TimeoutInMicroSeconds, - IN Void* ProcedureArgument OPTIONAL, - OUT UInt32** FailedCpuList OPTIONAL); + IN Void* ProcedureArgument OPTIONAL, + OUT UInt32** FailedCpuList OPTIONAL); typedef EfiStatusType EFI_API (*EfiMpServicesSwitchBSP)( IN struct _EfiMpServicesProtocol* Self, @@ -854,18 +854,18 @@ typedef EfiStatusType EFI_API (*EfiMpServicesStartupThisAP)( IN UInt32 ProcessorNumber, IN VoidPtr WaitEvent OPTIONAL, IN UInt32 TimeoutInMicroseconds, - IN Void* ProcedureArgument OPTIONAL, - OUT Boolean* Finished OPTIONAL); + 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* HealthFlag OPTIONAL); + IN UInt32* HealthFlag OPTIONAL); typedef EfiStatusType EFI_API (*EfiMpServicesWhoAmI)( IN struct _EfiMpServicesProtocol* Self, - OUT UInt32* ProcessorNumber); + OUT UInt32* ProcessorNumber); typedef struct _EfiMpServicesProtocol { diff --git a/dev/ZKAKit/FirmwareKit/GPT.h b/dev/ZKAKit/FirmwareKit/GPT.h index fc60a23f..f2f0f42f 100644 --- a/dev/ZKAKit/FirmwareKit/GPT.h +++ b/dev/ZKAKit/FirmwareKit/GPT.h @@ -40,9 +40,9 @@ namespace Kernel { GPT_GUID PartitionTypeGUID; GPT_GUID UniquePartitionGUID; - UInt64 StartLBA; - UInt64 EndLBA; - UInt64 Attributes; - UInt8 Name[72]; + UInt64 StartLBA; + UInt64 EndLBA; + UInt64 Attributes; + UInt8 Name[72]; }; } // namespace Kernel diff --git a/dev/ZKAKit/HALKit/AMD64/Processor.h b/dev/ZKAKit/HALKit/AMD64/Processor.h index 57f4f211..bbd51318 100644 --- a/dev/ZKAKit/HALKit/AMD64/Processor.h +++ b/dev/ZKAKit/HALKit/AMD64/Processor.h @@ -305,7 +305,7 @@ namespace Kernel::HAL EXTERN_C UInt8 rt_in8(UInt16 port); EXTERN_C UInt16 rt_in16(UInt16 port); - EXTERN_C UInt32 rt_in32(UInt16 port); + EXTERN_C UInt32 rt_in32(UInt16 port); EXTERN_C void rt_out16(UShort port, UShort byte); EXTERN_C void rt_out8(UShort port, UChar byte); diff --git a/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc b/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc index 45fc7e84..b4a8615d 100644 --- a/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc +++ b/dev/ZKAKit/HALKit/AMD64/Storage/AHCI-DMA.cc @@ -52,7 +52,7 @@ enum }; STATIC Kernel::PCI::Device kAhciDevice; -STATIC HbaPort* kAhciPort = nullptr; +STATIC HbaPort* kAhciPort = nullptr; STATIC Kernel::Lba kCurrentDiskSectorCount = 0UL; Kernel::Void drv_calculate_disk_geometry() diff --git a/dev/ZKAKit/KernelKit/LoaderInterface.h b/dev/ZKAKit/KernelKit/LoaderInterface.h index 4c79aa47..c6e096b5 100644 --- a/dev/ZKAKit/KernelKit/LoaderInterface.h +++ b/dev/ZKAKit/KernelKit/LoaderInterface.h @@ -25,9 +25,9 @@ namespace Kernel public: virtual _Output ErrorOr<VoidPtr> GetBlob() = 0; - virtual _Output const Char* AsString() = 0; - virtual _Output const Char* MIME() = 0; - virtual _Output const Char* Path() = 0; + virtual _Output const Char* AsString() = 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; }; diff --git a/dev/ZKAKit/KernelKit/User.h b/dev/ZKAKit/KernelKit/User.h index 81fa6f0b..7d61b3d6 100644 --- a/dev/ZKAKit/KernelKit/User.h +++ b/dev/ZKAKit/KernelKit/User.h @@ -34,7 +34,7 @@ namespace Kernel kRingCount = 3, }; - typedef Char* UserPublicKey; + typedef Char* usr_public_key_kind; class User final { @@ -67,16 +67,16 @@ namespace Kernel Bool IsSuperUser() noexcept; /// @brief Saves a password from the public key. - Bool Save(const UserPublicKey password) noexcept; + Bool Save(const usr_public_key_kind password) noexcept; /// @brief Checks if a password matches the **password**. /// @param password the password to check. - Bool Matches(const UserPublicKey password) noexcept; + Bool Matches(const usr_public_key_kind password) noexcept; private: - UserRingKind fRing{UserRingKind::kRingStdUser}; - Char fUserName[kMaxUserNameLen] = {0}; - Char fUserToken[kMaxUserTokenLen] = {0}; + UserRingKind mUserRing{UserRingKind::kRingStdUser}; + Char mUserName[kMaxUserNameLen] = {0}; + Char mUserToken[kMaxUserTokenLen] = {0}; }; } // namespace Kernel diff --git a/dev/ZKAKit/KernelKit/XCOFF.h b/dev/ZKAKit/KernelKit/XCOFF.h index a4805846..ef13784d 100644 --- a/dev/ZKAKit/KernelKit/XCOFF.h +++ b/dev/ZKAKit/KernelKit/XCOFF.h @@ -16,12 +16,12 @@ #include <NewKit/Defines.h> -#define cXCOFF64Magic (0x01F7) +#define kXCOFF64Magic (0x01F7) -#define cXCOFFRelFlg (0x0001) -#define cXCOFFExecutable (0x0002) -#define cXCOFFLnno (0x0004) -#define cXCOFFLSyms (0x0008) +#define kXCOFFRelFlg (0x0001) +#define kXCOFFExecutable (0x0002) +#define kXCOFFLnno (0x0004) +#define kXCOFFLSyms (0x0008) struct XCoffFileHeader; struct XCoffForkHeader; diff --git a/dev/ZKAKit/src/FS/NeFS.cc b/dev/ZKAKit/src/FS/NeFS.cc index f959aa45..2e0e700c 100644 --- a/dev/ZKAKit/src/FS/NeFS.cc +++ b/dev/ZKAKit/src/FS/NeFS.cc @@ -61,7 +61,7 @@ STATIC MountpointInterface kDiskMountpoint; /// @return the fork /***********************************************************************************/ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catalog, - _Input NFS_FORK_STRUCT& the_fork) + _Input NFS_FORK_STRUCT& the_fork) { if (catalog && the_fork.ForkName[0] != 0 && the_fork.DataSize <= kNeFSForkDataSz) @@ -170,8 +170,8 @@ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catal /// @return the fork. /***********************************************************************************/ _Output NFS_FORK_STRUCT* NeFSParser::FindFork(_Input NFS_CATALOG_STRUCT* catalog, - _Input const Char* name, - Boolean isDataFork) + _Input const Char* name, + Boolean isDataFork) { auto drv = kDiskMountpoint.A(); NFS_FORK_STRUCT* the_fork = nullptr; @@ -236,7 +236,7 @@ _Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name) /// @param kind the catalog kind. /// @return catalog pointer. /***********************************************************************************/ -_Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name, +_Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name, _Input const Int32& flags, _Input const Int32& kind) { @@ -936,7 +936,7 @@ Boolean NeFSParser::RemoveCatalog(_Input const Char* catalogName) VoidPtr NeFSParser::ReadCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, _Input Bool is_rsrc_fork, _Input SizeT dataSz, - _Input const Char* forkName) + _Input const Char* forkName) { if (!catalog) { diff --git a/dev/ZKAKit/src/Heap.cc b/dev/ZKAKit/src/Heap.cc index 0ac0dab1..2073027e 100644 --- a/dev/ZKAKit/src/Heap.cc +++ b/dev/ZKAKit/src/Heap.cc @@ -46,13 +46,13 @@ namespace Kernel Boolean fPresent : 1; /// @brief Is this valued owned by the user? - Boolean fWr : 1; + Boolean fWriteRead : 1; /// @brief Is this valued owned by the user? Boolean fUser : 1; /// @brief Is this a page pointer? - Boolean fPage : 1; + Boolean fPagePtr : 1; /// @brief 32-bit CRC checksum. UInt32 fCRC32; @@ -134,14 +134,14 @@ namespace Kernel reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( wrapper.VirtualAddress() + sizeof(Detail::HEAP_INFORMATION_BLOCK)); - heap_info_ptr->fHeapSize = sz_fix; - heap_info_ptr->fMagic = kKernelHeapMagic; - heap_info_ptr->fCRC32 = No; // dont fill it for now. - heap_info_ptr->fHeapPtr = reinterpret_cast<UIntPtr>(heap_info_ptr) + sizeof(Detail::HEAP_INFORMATION_BLOCK); - heap_info_ptr->fPage = No; - heap_info_ptr->fWr = wr; - heap_info_ptr->fUser = user; - heap_info_ptr->fPresent = Yes; + heap_info_ptr->fHeapSize = sz_fix; + heap_info_ptr->fMagic = kKernelHeapMagic; + heap_info_ptr->fCRC32 = No; // dont fill it for now. + heap_info_ptr->fHeapPtr = reinterpret_cast<UIntPtr>(heap_info_ptr) + sizeof(Detail::HEAP_INFORMATION_BLOCK); + heap_info_ptr->fPagePtr = No; + heap_info_ptr->fWriteRead = wr; + heap_info_ptr->fUser = user; + heap_info_ptr->fPresent = Yes; rt_set_memory(heap_info_ptr->fPadding, 0, kKernelHeapAlignSz); @@ -164,10 +164,10 @@ namespace Kernel reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); - if (!heap_ptr) + if (!heap_info_ptr) return kErrorHeapNotPresent; - heap_info_ptr->fPage = true; + heap_info_ptr->fPagePtr = true; kcout << "Created page address: " << hex_number(reinterpret_cast<UIntPtr>(heap_info_ptr)) << endl; @@ -186,7 +186,7 @@ namespace Kernel reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); - if (!heap_ptr) + if (!heap_info_ptr) return kErrorHeapNotPresent; heap_info_ptr->fFlags = flags; @@ -202,7 +202,7 @@ namespace Kernel reinterpret_cast<Detail::HEAP_INFORMATION_BLOCK_PTR>( (UIntPtr)heap_ptr - sizeof(Detail::HEAP_INFORMATION_BLOCK)); - if (!heap_ptr) + if (!heap_info_ptr) return kErrorHeapNotPresent; return heap_info_ptr->fFlags; @@ -240,13 +240,13 @@ namespace Kernel } } - heap_info_ptr->fHeapSize = 0UL; - heap_info_ptr->fPresent = No; - heap_info_ptr->fHeapPtr = 0; - heap_info_ptr->fCRC32 = 0; - heap_info_ptr->fWr = No; - heap_info_ptr->fUser = No; - heap_info_ptr->fMagic = 0; + heap_info_ptr->fHeapSize = 0UL; + heap_info_ptr->fPresent = No; + heap_info_ptr->fHeapPtr = 0; + heap_info_ptr->fCRC32 = 0; + heap_info_ptr->fWriteRead = No; + heap_info_ptr->fUser = No; + heap_info_ptr->fMagic = 0; PTEWrapper pageWrapper(No, No, No, reinterpret_cast<UIntPtr>(heap_info_ptr) - sizeof(Detail::HEAP_INFORMATION_BLOCK)); Ref<PTEWrapper> pteAddress{pageWrapper}; diff --git a/dev/ZKAKit/src/User.cc b/dev/ZKAKit/src/User.cc index c00048c3..6c4c2a32 100644 --- a/dev/ZKAKit/src/User.cc +++ b/dev/ZKAKit/src/User.cc @@ -46,7 +46,7 @@ namespace Kernel password[i_pass] = cur_chr | (user->IsStdUser() ? kStdUserType : kSuperUserType); } - kcout << "Done hashing user password!\r"; + kcout << "DONE: hashed user password.\r"; return 0; } @@ -54,23 +54,23 @@ namespace Kernel /// @brief User ring constructor. User::User(const Int32& sel, const Char* userName) - : fRing((UserRingKind)sel) + : mUserRing((UserRingKind)sel) { MUST_PASS(sel >= 0); - rt_copy_memory((VoidPtr)userName, this->fUserName, rt_string_len(userName)); + rt_copy_memory((VoidPtr)userName, this->mUserName, rt_string_len(userName)); } /// @brief User ring constructor. User::User(const UserRingKind& ringKind, const Char* userName) - : fRing(ringKind) + : mUserRing(ringKind) { - rt_copy_memory((VoidPtr)userName, this->fUserName, rt_string_len(userName)); + rt_copy_memory((VoidPtr)userName, this->mUserName, rt_string_len(userName)); } /// @brief User destructor class. User::~User() = default; - Bool User::Save(const UserPublicKey password_to_fill) noexcept + Bool User::Save(const usr_public_key_kind password_to_fill) noexcept { if (!password_to_fill || *password_to_fill == 0) @@ -96,7 +96,7 @@ namespace Kernel // then store password. - rt_copy_memory(password, this->fUserToken, rt_string_len(password_to_fill)); + rt_copy_memory(password, this->mUserToken, rt_string_len(password_to_fill)); delete[] password; password = nullptr; @@ -106,7 +106,7 @@ namespace Kernel return Yes; } - Bool User::Matches(const UserPublicKey password_to_fill) noexcept + Bool User::Matches(const usr_public_key_kind password_to_fill) noexcept { if (!password_to_fill || *password_to_fill) @@ -133,7 +133,7 @@ namespace Kernel kcout << "Validating hashed passwords...\r"; // now check if the password matches. - if (rt_string_cmp(password, this->fUserToken, rt_string_len(this->fUserToken)) == 0) + if (rt_string_cmp(password, this->mUserToken, rt_string_len(this->mUserToken)) == 0) { kcout << "Password is valid.\r"; return Yes; @@ -145,24 +145,24 @@ namespace Kernel Bool User::operator==(const User& lhs) { - return lhs.fRing == this->fRing; + return lhs.mUserRing == this->mUserRing; } Bool User::operator!=(const User& lhs) { - return lhs.fRing != this->fRing; + return lhs.mUserRing != this->mUserRing; } Char* User::Name() noexcept { - return this->fUserName; + return this->mUserName; } /// @brief Returns the user's ring. /// @return The king of ring the user is attached to. const UserRingKind& User::Ring() noexcept { - return this->fRing; + return this->mUserRing; } Bool User::IsStdUser() noexcept diff --git a/dev/ZKAKit/src/UserProcessTeam.cc b/dev/ZKAKit/src/UserProcessTeam.cc index be28b93d..d7f7d966 100644 --- a/dev/ZKAKit/src/UserProcessTeam.cc +++ b/dev/ZKAKit/src/UserProcessTeam.cc @@ -6,7 +6,7 @@ /***********************************************************************************/ /// @file UserProcessTeam.cc -/// @brief UserProcess teams implementation. +/// @brief Process teams implementation. /***********************************************************************************/ #include <KernelKit/UserProcessScheduler.h> @@ -15,9 +15,9 @@ namespace Kernel { UserProcessTeam::UserProcessTeam() { - for (SizeT i = 0U; i < mProcessList.Count(); ++i) + for (SizeT i = 0U; i < this->mProcessList.Count(); ++i) { - mProcessList[i] = nullptr; + this->mProcessList[i] = nullptr; } } @@ -28,7 +28,7 @@ namespace Kernel Array<UserProcess*, kSchedProcessLimitPerTeam>& UserProcessTeam::AsArray() { - return mProcessList; + return this->mProcessList; } /***********************************************************************************/ @@ -38,7 +38,7 @@ namespace Kernel ProcessID& UserProcessTeam::Id() noexcept { - return mTeamId; + return this->mTeamId; } /***********************************************************************************/ @@ -48,7 +48,7 @@ namespace Kernel Ref<UserProcess>& UserProcessTeam::AsRef() { - return mCurrentProcess; + return this->mCurrentProcess; } } // namespace Kernel |
