From 8b1114ea205ef6560fb7bf5713577d1ab7deb5be Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 4 Sep 2024 17:29:07 +0200 Subject: [ MR ] BUMP commit. Signed-off-by: Amlal El Mahrouss --- dev/ZKA/KernelKit/CodeManager.hxx | 31 --- dev/ZKA/KernelKit/CodeMgr.hxx | 31 +++ dev/ZKA/KernelKit/DLLInterface.hxx | 11 +- dev/ZKA/KernelKit/DebugOutput.hxx | 2 +- dev/ZKA/KernelKit/DeviceManager.hxx | 130 --------- dev/ZKA/KernelKit/DeviceMgr.hxx | 132 +++++++++ dev/ZKA/KernelKit/DriveManager.hxx | 151 ----------- dev/ZKA/KernelKit/DriveMgr.hxx | 151 +++++++++++ dev/ZKA/KernelKit/FileManager.hxx | 420 ----------------------------- dev/ZKA/KernelKit/FileMgr.hxx | 420 +++++++++++++++++++++++++++++ dev/ZKA/KernelKit/MP.hxx | 2 +- dev/ZKA/KernelKit/PCI/Dma.hxx | 2 +- dev/ZKA/KernelKit/PECodeManager.hxx | 24 -- dev/ZKA/KernelKit/PECodeMgr.hxx | 24 ++ dev/ZKA/KernelKit/PEFCodeManager.hxx | 67 ----- dev/ZKA/KernelKit/PEFCodeMgr.hxx | 67 +++++ dev/ZKA/KernelKit/PEFDLLInterface.hxx | 4 +- dev/ZKA/KernelKit/UserProcessScheduler.hxx | 5 +- 18 files changed, 842 insertions(+), 832 deletions(-) delete mode 100644 dev/ZKA/KernelKit/CodeManager.hxx create mode 100644 dev/ZKA/KernelKit/CodeMgr.hxx delete mode 100644 dev/ZKA/KernelKit/DeviceManager.hxx create mode 100644 dev/ZKA/KernelKit/DeviceMgr.hxx delete mode 100644 dev/ZKA/KernelKit/DriveManager.hxx create mode 100644 dev/ZKA/KernelKit/DriveMgr.hxx delete mode 100644 dev/ZKA/KernelKit/FileManager.hxx create mode 100644 dev/ZKA/KernelKit/FileMgr.hxx delete mode 100644 dev/ZKA/KernelKit/PECodeManager.hxx create mode 100644 dev/ZKA/KernelKit/PECodeMgr.hxx delete mode 100644 dev/ZKA/KernelKit/PEFCodeManager.hxx create mode 100644 dev/ZKA/KernelKit/PEFCodeMgr.hxx (limited to 'dev/ZKA/KernelKit') diff --git a/dev/ZKA/KernelKit/CodeManager.hxx b/dev/ZKA/KernelKit/CodeManager.hxx deleted file mode 100644 index ef9d18f4..00000000 --- a/dev/ZKA/KernelKit/CodeManager.hxx +++ /dev/null @@ -1,31 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - File: CodeManager.hpp - Purpose: Code Manager and Shared Objects. - - Revision History: - - 30/01/24: Added file (amlel) - 3/8/24: Add UPP struct. - -------------------------------------------- */ - -#pragma once - -#include -#include -#include - -namespace Kernel -{ - /// @brief Main process entrypoint. - typedef void (*MainKind)(void); - - /// @brief Executes a new process from a function. Kernel code only. - /// @note This sets up a new stack, anything on the main function that calls the Kernel will not be accessible. - /// @param main the start of the process. - /// @return if the process was started or not. - bool sched_execute_thread(MainKind main, const Char* process_name) noexcept; -} // namespace Kernel diff --git a/dev/ZKA/KernelKit/CodeMgr.hxx b/dev/ZKA/KernelKit/CodeMgr.hxx new file mode 100644 index 00000000..8c4f090f --- /dev/null +++ b/dev/ZKA/KernelKit/CodeMgr.hxx @@ -0,0 +1,31 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + File: CodeMgr.hpp + Purpose: Code Mgr and Shared Objects. + + Revision History: + + 30/01/24: Added file (amlel) + 3/8/24: Add UPP struct. + +------------------------------------------- */ + +#pragma once + +#include +#include +#include + +namespace Kernel +{ + /// @brief Main process entrypoint. + typedef void (*MainKind)(void); + + /// @brief Executes a new process from a function. Kernel code only. + /// @note This sets up a new stack, anything on the main function that calls the Kernel will not be accessible. + /// @param main the start of the process. + /// @return if the process was started or not. + bool sched_execute_thread(MainKind main, const Char* process_name) noexcept; +} // namespace Kernel diff --git a/dev/ZKA/KernelKit/DLLInterface.hxx b/dev/ZKA/KernelKit/DLLInterface.hxx index 370363b7..13f36b82 100644 --- a/dev/ZKA/KernelKit/DLLInterface.hxx +++ b/dev/ZKA/KernelKit/DLLInterface.hxx @@ -35,8 +35,15 @@ namespace Kernel virtual DLL_TRAITS** GetAddressOf() = 0; virtual DLL_TRAITS* Get() = 0; - virtual void Mount(DLL_TRAITS* to_mount) = 0; - virtual void Unmount() = 0; + virtual Void Mount(DLL_TRAITS* to_mount) = 0; + virtual Void Unmount() = 0; + + + template + SymbolType Load(const Char* symbol_name, SizeT len, Int32 kind) + { + return nullptr; + } }; /// @brief Pure implementation, missing method/function handler. diff --git a/dev/ZKA/KernelKit/DebugOutput.hxx b/dev/ZKA/KernelKit/DebugOutput.hxx index fcf18bff..66105aa1 100644 --- a/dev/ZKA/KernelKit/DebugOutput.hxx +++ b/dev/ZKA/KernelKit/DebugOutput.hxx @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include diff --git a/dev/ZKA/KernelKit/DeviceManager.hxx b/dev/ZKA/KernelKit/DeviceManager.hxx deleted file mode 100644 index 5164ae28..00000000 --- a/dev/ZKA/KernelKit/DeviceManager.hxx +++ /dev/null @@ -1,130 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -/* ------------------------------------------- - - Revision History: - - 31/01/24: Add kDeviceCnt (amlel) - - ------------------------------------------- */ - -#pragma once - -/* Kernel device interface manager. */ -/* @file KernelKit/DeviceManager.hpp */ -/* @brief Device abstraction and I/O buffer. */ - -#include -#include - -// Last Rev -// Wed, Apr 3, 2024 9:09:41 AM - -namespace Kernel -{ - template - class DeviceInterface; - - template - class DeviceInterface - { - public: - explicit DeviceInterface(void (*Out)(T), void (*In)(T)) - : fOut(Out), fIn(In) - { - } - - virtual ~DeviceInterface() = default; - - public: - DeviceInterface& operator=(const DeviceInterface&) = default; - DeviceInterface(const DeviceInterface&) = default; - - public: - virtual DeviceInterface& operator<<(T Data) - { - fOut(Data); - return *this; - } - - virtual DeviceInterface& operator>>(T Data) - { - fIn(Data); - return *this; - } - - virtual const char* Name() const - { - return "DeviceInterface"; - } - - operator bool() - { - return fOut && fIn; - } - - Bool operator!() - { - return !fOut || !fIn; - } - - private: - Void (*fOut)(T Data) = {nullptr}; - Void (*fIn)(T Data) = {nullptr}; - }; - - /// - /// @brief Input Output Buffer - /// Used mainly to communicate between hardware. - /// - template - class IOBuf final - { - public: - explicit IOBuf(T Dat) - : fData(Dat) - { - // at least pass something valid when instancating this struct. - MUST_PASS(Dat); - } - - IOBuf& operator=(const IOBuf&) = default; - IOBuf(const IOBuf&) = default; - - ~IOBuf() = default; - - public: - template - R operator->() const - { - return fData; - } - - template - R& operator[](Size index) const - { - return fData[index]; - } - - private: - T fData; - }; - - ///! @brief Device enum types. - enum - { - kDeviceTypeIDE, - kDeviceTypeEthernet, - kDeviceTypeWiFi, - kDeviceTypeRS232, - kDeviceTypeSCSI, - kDeviceTypeSHCI, - kDeviceTypeUSB, - kDeviceTypeMedia, - kDeviceTypeCount, - }; -} // namespace Kernel diff --git a/dev/ZKA/KernelKit/DeviceMgr.hxx b/dev/ZKA/KernelKit/DeviceMgr.hxx new file mode 100644 index 00000000..473af601 --- /dev/null +++ b/dev/ZKA/KernelKit/DeviceMgr.hxx @@ -0,0 +1,132 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +/* ------------------------------------------- + + Revision History: + + 31/01/24: Add kDeviceCnt (amlel) + + ------------------------------------------- */ + +#pragma once + +/* Device manager. */ +/* @file KernelKit/DeviceMgr.hpp */ +/* @brief Device abstraction and I/O buffer. */ + +#include +#include + +#define cDevicePath "\\Mount\\" + +// Last Rev +// Wed, Apr 3, 2024 9:09:41 AM + +namespace Kernel +{ + template + class DeviceInterface; + + template + class DeviceInterface + { + public: + explicit DeviceInterface(void (*Out)(T), void (*In)(T)) + : fOut(Out), fIn(In) + { + } + + virtual ~DeviceInterface() = default; + + public: + DeviceInterface& operator=(const DeviceInterface&) = default; + DeviceInterface(const DeviceInterface&) = default; + + public: + virtual DeviceInterface& operator<<(T Data) + { + fOut(Data); + return *this; + } + + virtual DeviceInterface& operator>>(T Data) + { + fIn(Data); + return *this; + } + + virtual const char* Name() const + { + return "DeviceInterface"; + } + + operator bool() + { + return fOut && fIn; + } + + Bool operator!() + { + return !fOut || !fIn; + } + + private: + Void (*fOut)(T Data) = {nullptr}; + Void (*fIn)(T Data) = {nullptr}; + }; + + /// + /// @brief Input Output Buffer + /// Used mainly to communicate between hardware. + /// + template + class IOBuf final + { + public: + explicit IOBuf(T Dat) + : fData(Dat) + { + // at least pass something valid when instancating this struct. + MUST_PASS(Dat); + } + + IOBuf& operator=(const IOBuf&) = default; + IOBuf(const IOBuf&) = default; + + ~IOBuf() = default; + + public: + template + R operator->() const + { + return fData; + } + + template + R& operator[](Size index) const + { + return fData[index]; + } + + private: + T fData; + }; + + ///! @brief Device enum types. + enum + { + kDeviceTypeIDE, + kDeviceTypeEthernet, + kDeviceTypeWiFi, + kDeviceTypeRS232, + kDeviceTypeSCSI, + kDeviceTypeSHCI, + kDeviceTypeUSB, + kDeviceTypeMedia, + kDeviceTypeCount, + }; +} // namespace Kernel diff --git a/dev/ZKA/KernelKit/DriveManager.hxx b/dev/ZKA/KernelKit/DriveManager.hxx deleted file mode 100644 index 96fbd95d..00000000 --- a/dev/ZKA/KernelKit/DriveManager.hxx +++ /dev/null @@ -1,151 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#ifndef __INC_DRIVE_MANAGER_HXX__ -#define __INC_DRIVE_MANAGER_HXX__ - -#include -#include -#include -#include -#include -#include -#include - -#define kDriveManagerCount (4U) - -#define kDriveInvalidID (-1) -#define kDriveNameLen (32) - -#define drv_get_sector_count(SIZE, SECTOR_SZ) (((SIZE) + (SECTOR_SZ)) / (SECTOR_SZ)) - -namespace Kernel -{ - enum - { - kInvalidDrive = -1, - kBlockDevice = 0xAD, - kMassStorage = 0xDA, - kFloppyDisc = 0xCD, - kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray - /// combine with below. - kReadOnly = 0x10, // Read only drive - kEPMDrive = 0x11, // Explicit Partition Map. - kEPTDrive = 0x12, // ESP w/ EPM partition. - kMBRDrive = 0x13, // IBM PC classic partition scheme - kDriveCnt = 9, - }; - - typedef Int64 rt_drive_id_type; - - /// @brief Media drive trait type. - struct DriveTrait final - { - Char fName[kDriveNameLen]; // /System, /Boot, //./Devices/USB... - Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc. - rt_drive_id_type fId; // Drive id. - Int32 fFlags; // fReadOnly, fXPMDrive, fXPTDrive - - /// @brief Packet drive (StorageKit compilant.) - struct DrivePacket final - { - VoidPtr fPacketContent; //! packet body. - Char fPacketMime[kDriveNameLen]; //! identify what we're sending. - SizeT fPacketSize; //! packet size - UInt32 fPacketCRC32; //! sanity crc, in case if good is set to false - Boolean fPacketGood; - Lba fLba; - } fPacket; - - Void (*fInput)(DrivePacket* packetPtr); - Void (*fOutput)(DrivePacket* packetPtr); - Void (*fVerify)(DrivePacket* packetPtr); - const Char* (*fDriveKind)(Void); - }; - - ///! drive as a device. - typedef DriveTrait* DriveTraitPtr; - - /** - * @brief Mounted drives interface. - * @note This class has all of it's drive set to nullptr, allocate them using - * GetAddressOf(index). - */ - class MountpointInterface final - { - public: - explicit MountpointInterface() = default; - ~MountpointInterface() = default; - - ZKA_COPY_DEFAULT(MountpointInterface); - - public: - DriveTrait& A() - { - return mA; - } - DriveTrait& B() - { - return mB; - } - DriveTrait& C() - { - return mC; - } - DriveTrait& D() - { - return mD; - } - - DriveTraitPtr GetAddressOf(Int32 index) - { - ErrLocal() = kErrorSuccess; - - switch (index) - { - case 0: - return &mA; - case 1: - return &mB; - case 2: - return &mC; - case 3: - return &mD; - default: { - ErrLocal() = kErrorNoSuchDisk; - kcout << "newoskrnl.exe: No such disk.\n"; - - break; - } - } - - return nullptr; - } - - private: - DriveTrait mA, mB, mC, mD; - }; - - /// @brief Unimplemented drive. - /// @param pckt - /// @return - Void io_drv_unimplemented(DriveTrait::DrivePacket* pckt); - - /// @brief Gets the drive kind (ATA, SCSI, AHCI...) - /// @param - /// @return the drive kind (ATA, Flash, NVM) - const Char* io_drive_kind(Void); - - /// @brief Makes a new drive. - /// @return the new drive as a trait. - DriveTrait io_construct_drive(void) noexcept; - - /// @brief Fetches the main drive. - /// @return the new drive as a trait. - DriveTrait io_construct_main_drive(void) noexcept; -} // namespace Kernel - -#endif /* ifndef __INC_DRIVE_MANAGER_HXX__ */ diff --git a/dev/ZKA/KernelKit/DriveMgr.hxx b/dev/ZKA/KernelKit/DriveMgr.hxx new file mode 100644 index 00000000..4b2cdc73 --- /dev/null +++ b/dev/ZKA/KernelKit/DriveMgr.hxx @@ -0,0 +1,151 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#ifndef __INC_DRIVE_MANAGER_HXX__ +#define __INC_DRIVE_MANAGER_HXX__ + +#include +#include +#include +#include +#include +#include +#include + +#define kDriveMgrCount (4U) + +#define kDriveInvalidID (-1) +#define kDriveNameLen (32) + +#define drv_get_sector_count(SIZE, SECTOR_SZ) (((SIZE) + (SECTOR_SZ)) / (SECTOR_SZ)) + +namespace Kernel +{ + enum + { + kInvalidDrive = -1, + kBlockDevice = 0xAD, + kMassStorage = 0xDA, + kFloppyDisc = 0xCD, + kOpticalDisc = 0xDC, // CD-ROM/DVD-ROM/Blu-Ray + /// combine with below. + kReadOnly = 0x10, // Read only drive + kEPMDrive = 0x11, // Explicit Partition Map. + kEPTDrive = 0x12, // ESP w/ EPM partition. + kMBRDrive = 0x13, // IBM PC classic partition scheme + kDriveCnt = 9, + }; + + typedef Int64 rt_drive_id_type; + + /// @brief Media drive trait type. + struct DriveTrait final + { + Char fName[kDriveNameLen]; // /System, /Boot, //./Devices/USB... + Int32 fKind; // fMassStorage, fFloppy, fOpticalDisc. + rt_drive_id_type fId; // Drive id. + Int32 fFlags; // fReadOnly, fXPMDrive, fXPTDrive + + /// @brief Packet drive (StorageKit compilant.) + struct DrivePacket final + { + VoidPtr fPacketContent; //! packet body. + Char fPacketMime[kDriveNameLen]; //! identify what we're sending. + SizeT fPacketSize; //! packet size + UInt32 fPacketCRC32; //! sanity crc, in case if good is set to false + Boolean fPacketGood; + Lba fLba; + } fPacket; + + Void (*fInput)(DrivePacket* packetPtr); + Void (*fOutput)(DrivePacket* packetPtr); + Void (*fVerify)(DrivePacket* packetPtr); + const Char* (*fDriveKind)(Void); + }; + + ///! drive as a device. + typedef DriveTrait* DriveTraitPtr; + + /** + * @brief Mounted drives interface. + * @note This class has all of it's drive set to nullptr, allocate them using + * GetAddressOf(index). + */ + class MountpointInterface final + { + public: + explicit MountpointInterface() = default; + ~MountpointInterface() = default; + + ZKA_COPY_DEFAULT(MountpointInterface); + + public: + DriveTrait& A() + { + return mA; + } + DriveTrait& B() + { + return mB; + } + DriveTrait& C() + { + return mC; + } + DriveTrait& D() + { + return mD; + } + + DriveTraitPtr GetAddressOf(Int32 index) + { + ErrLocal() = kErrorSuccess; + + switch (index) + { + case 0: + return &mA; + case 1: + return &mB; + case 2: + return &mC; + case 3: + return &mD; + default: { + ErrLocal() = kErrorNoSuchDisk; + kcout << "newoskrnl.exe: No such disk.\n"; + + break; + } + } + + return nullptr; + } + + private: + DriveTrait mA, mB, mC, mD; + }; + + /// @brief Unimplemented drive. + /// @param pckt + /// @return + Void io_drv_unimplemented(DriveTrait::DrivePacket* pckt); + + /// @brief Gets the drive kind (ATA, SCSI, AHCI...) + /// @param + /// @return the drive kind (ATA, Flash, NVM) + const Char* io_drive_kind(Void); + + /// @brief Makes a new drive. + /// @return the new drive as a trait. + DriveTrait io_construct_drive(void) noexcept; + + /// @brief Fetches the main drive. + /// @return the new drive as a trait. + DriveTrait io_construct_main_drive(void) noexcept; +} // namespace Kernel + +#endif /* ifndef __INC_DRIVE_MANAGER_HXX__ */ diff --git a/dev/ZKA/KernelKit/FileManager.hxx b/dev/ZKA/KernelKit/FileManager.hxx deleted file mode 100644 index 05f74a63..00000000 --- a/dev/ZKA/KernelKit/FileManager.hxx +++ /dev/null @@ -1,420 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - File: FileManager.hxx - Purpose: Kernel file manager. - -------------------------------------------- */ - -/* ------------------------------------------- - - Revision History: - - 31/01/24: Update documentation (amlel) - 05/07/24: NewFS support, and fork support, updated constants and specs - as well. - - ------------------------------------------- */ - -#pragma once - -#ifdef __FSKIT_USE_NEWFS__ -#include -#endif // __FSKIT_USE_NEWFS__ - -#include -#include -#include -#include -#include -#include -#include -#include - -/// @brief Filesystem manager, abstraction over mounted filesystem. -/// Works like the VFS or IFS. - -#define cRestrictR "r" -#define cRestrictRB "rb" -#define cRestrictW "w" -#define cRestrictWB "rw" -#define cRestrictRWB "rwb" - -#define cRestrictMax 5 - -#define node_cast(PTR) reinterpret_cast(PTR) - -/** - @note Refer to first enum. -*/ -#define cFileOpsCount 4 -#define cFileMimeGeneric "n-application-kind/all" - -/** @brief invalid position. (n-pos) */ -#define kNPos (SizeT)(-1); - -namespace Kernel -{ - enum - { - cFileWriteAll = 100, - cFileReadAll = 101, - cFileReadChunk = 102, - cFileWriteChunk = 103, - cFileIOCnt = (cFileWriteChunk - cFileWriteAll) + 1, - // file flags - cFileFlagRsrc = 104, - cFileFlagData = 105, - }; - - typedef VoidPtr NodePtr; - - /** - @brief Filesystem Manager Interface class - @brief Used to provide common I/O for a specific filesystem. -*/ - class FilesystemManagerInterface - { - public: - explicit FilesystemManagerInterface() = default; - virtual ~FilesystemManagerInterface() = default; - - public: - ZKA_COPY_DEFAULT(FilesystemManagerInterface); - - public: - /// @brief Mounts a new filesystem into an active state. - /// @param interface the filesystem interface - /// @return - static bool Mount(FilesystemManagerInterface* interface); - - /// @brief Unmounts the active filesystem - /// @return - static FilesystemManagerInterface* Unmount(); - - /// @brief Getter, gets the active filesystem. - /// @return - static FilesystemManagerInterface* GetMounted(); - - public: - virtual NodePtr Create(_Input const Char* path) = 0; - virtual NodePtr CreateAlias(_Input const Char* path) = 0; - virtual NodePtr CreateDirectory(_Input const Char* path) = 0; - virtual NodePtr CreateSwapFile(const Char* path) = 0; - - public: - virtual bool Remove(_Input const Char* path) = 0; - - public: - virtual NodePtr Open(_Input const Char* path, _Input const Char* r) = 0; - - public: - virtual Void Write(_Input NodePtr node, _Input VoidPtr data, _Input Int32 flags, _Input SizeT size) = 0; - - virtual _Output VoidPtr Read(_Input NodePtr node, - _Input Int32 flags, - _Input SizeT sz) = 0; - - virtual Void Write(_Input const Char* name, - _Input NodePtr node, - _Input VoidPtr data, - _Input Int32 flags, - _Input SizeT size) = 0; - - virtual _Output VoidPtr Read(_Input const Char* name, - _Input NodePtr node, - _Input Int32 flags, - _Input SizeT sz) = 0; - - public: - virtual bool Seek(_Input NodePtr node, _Input SizeT off) = 0; - - public: - virtual SizeT Tell(_Input NodePtr node) = 0; - virtual bool Rewind(_Input NodePtr node) = 0; - }; - -#ifdef __FSKIT_USE_NEWFS__ - /** - * @brief Based of FilesystemManagerInterface, takes care of managing NewFS - * disks. - */ - class NewFilesystemManager final : public FilesystemManagerInterface - { - public: - explicit NewFilesystemManager(); - ~NewFilesystemManager() override; - - public: - ZKA_COPY_DEFAULT(NewFilesystemManager); - - public: - NodePtr Create(const Char* path) override; - NodePtr CreateAlias(const Char* path) override; - NodePtr CreateDirectory(const Char* path) override; - NodePtr CreateSwapFile(const Char* path) override; - - public: - bool Remove(const Char* path) override; - NodePtr Open(const Char* path, const Char* r) override; - Void Write(NodePtr node, VoidPtr data, Int32 flags, SizeT sz) override; - VoidPtr Read(NodePtr node, Int32 flags, SizeT sz) override; - bool Seek(NodePtr node, SizeT off) override; - SizeT Tell(NodePtr node) override; - bool Rewind(NodePtr node) override; - - Void Write(_Input const Char* name, - _Input NodePtr node, - _Input VoidPtr data, - _Input Int32 flags, - _Input SizeT size) override; - - _Output VoidPtr Read(_Input const Char* name, - _Input NodePtr node, - _Input Int32 flags, - _Input SizeT sz) override; - - public: - /// @brief Get NewFS parser class. - /// @return The filesystem parser class. - NewFSParser* GetParser() noexcept; - - private: - NewFSParser* fImpl{nullptr}; - }; - -#endif // ifdef __FSKIT_USE_NEWFS__ - - /** - * Usable FileStream - * @tparam Encoding file encoding (char, wchar_t...) - * @tparam FSClass Filesystem contract who takes care of it. - */ - template - class FileStream final - { - public: - explicit FileStream(const Encoding* path, const Encoding* restrict_type); - ~FileStream(); - - public: - FileStream& operator=(const FileStream&); - FileStream(const FileStream&); - - public: - ErrorOr WriteAll(const VoidPtr data) noexcept - { - if (this->fFileRestrict != eRestrictReadWrite && - this->fFileRestrict != eRestrictReadWriteBinary && - this->fFileRestrict != eRestrictWrite && - this->fFileRestrict != eRestrictWriteBinary) - return ErrorOr(kErrorInvalidData); - - if (data == nullptr) - return ErrorOr(kErrorInvalidData); - - auto man = FSClass::GetMounted(); - - if (man) - { - man->Write(fFile, data, cFileWriteAll); - return ErrorOr(0); - } - - return ErrorOr(kErrorInvalidData); - } - - VoidPtr ReadAll() noexcept - { - if (this->fFileRestrict != eRestrictReadWrite && - this->fFileRestrict != eRestrictReadWriteBinary && - this->fFileRestrict != eRestrictRead && - this->fFileRestrict != eRestrictReadBinary) - return nullptr; - - auto man = FSClass::GetMounted(); - - if (man) - { - VoidPtr ret = man->Read(fFile, cFileReadAll, 0); - return ret; - } - - return nullptr; - } - - ErrorOr WriteAll(const Char* fName, const VoidPtr data) noexcept - { - if (this->fFileRestrict != eRestrictReadWrite && - this->fFileRestrict != eRestrictReadWriteBinary && - this->fFileRestrict != eRestrictWrite && - this->fFileRestrict != eRestrictWriteBinary) - return ErrorOr(kErrorInvalidData); - - if (data == nullptr) - return ErrorOr(kErrorInvalidData); - - auto man = FSClass::GetMounted(); - - if (man) - { - man->Write(fName, fFile, data, cFileWriteAll); - return ErrorOr(0); - } - - return ErrorOr(kErrorInvalidData); - } - - VoidPtr Read(const Char* fName) noexcept - { - if (this->fFileRestrict != eRestrictReadWrite && - this->fFileRestrict != eRestrictReadWriteBinary && - this->fFileRestrict != eRestrictRead && - this->fFileRestrict != eRestrictReadBinary) - return nullptr; - - auto man = FSClass::GetMounted(); - - if (man) - { - VoidPtr ret = man->Read(fName, fFile, cFileReadAll, 0); - return ret; - } - - return nullptr; - } - - VoidPtr Read(SizeT offset, SizeT sz) - { - if (this->fFileRestrict != eRestrictReadWrite && - this->fFileRestrict != eRestrictReadWriteBinary && - this->fFileRestrict != eRestrictRead && - this->fFileRestrict != eRestrictReadBinary) - return nullptr; - - auto man = FSClass::GetMounted(); - - if (man) - { - man->Seek(fFile, offset); - auto ret = man->Read(fFile, cFileReadChunk, sz); - - return ret; - } - - return nullptr; - } - - Void Write(SizeT offset, voidPtr data, SizeT sz) - { - if (this->fFileRestrict != eRestrictReadWrite && - this->fFileRestrict != eRestrictReadWriteBinary && - this->fFileRestrict != eRestrictWrite && - this->fFileRestrict != eRestrictWriteBinary) - return; - - auto man = FSClass::GetMounted(); - - if (man) - { - man->Seek(fFile, offset); - man->Write(fFile, data, sz, cFileReadChunk); - } - } - - public: - /// @brief Leak node pointer. - /// @return The node pointer. - NodePtr Leak() - { - return fFile; - } - - /// @brief Leak MIME. - /// @return The MIME. - Char* MIME() noexcept - { - return const_cast(fMime); - } - - enum - { - eRestrictRead, - eRestrictReadBinary, - eRestrictWrite, - eRestrictWriteBinary, - eRestrictReadWrite, - eRestrictReadWriteBinary, - }; - - private: - NodePtr fFile{nullptr}; - Int32 fFileRestrict{}; - const Char* fMime{cFileMimeGeneric}; - }; - - using FileStreamUTF8 = FileStream; - using FileStreamUTF16 = FileStream; - - typedef UInt64 CursorType; - - /// @brief constructor - template - FileStream::FileStream(const Encoding* path, - const Encoding* restrict_type) - : fFile(Class::GetMounted()->Open(path, restrict_type)) - { - static const auto cLength = 255; - - /// @brief restrict information about the file descriptor. - struct RESTRICT_MAP final - { - Char fRestrict[cLength]; - Int32 fMappedTo; - }; - - const SizeT cRestrictCount = cRestrictMax; - const RESTRICT_MAP cRestrictList[] = { - { - .fRestrict = cRestrictR, - .fMappedTo = eRestrictRead, - }, - { - .fRestrict = cRestrictRB, - .fMappedTo = eRestrictReadBinary, - }, - { - .fRestrict = cRestrictRWB, - .fMappedTo = eRestrictReadWriteBinary, - }, - { - .fRestrict = cRestrictW, - .fMappedTo = eRestrictWrite, - }, - { - .fRestrict = cRestrictWB, - .fMappedTo = eRestrictReadWrite, - }}; - - for (SizeT index = 0; index < cRestrictCount; ++index) - { - if (rt_string_cmp(restrict_type, cRestrictList[index].fRestrict, - rt_string_len(cRestrictList[index].fRestrict)) == 0) - { - fFileRestrict = cRestrictList[index].fMappedTo; - break; - } - } - - kcout << "newoskrnl.exe: new file: " << path << ".\r"; - } - - /// @brief destructor - template - FileStream::~FileStream() - { - mm_delete_ke_heap(fFile); - } -} // namespace Kernel diff --git a/dev/ZKA/KernelKit/FileMgr.hxx b/dev/ZKA/KernelKit/FileMgr.hxx new file mode 100644 index 00000000..7a97f821 --- /dev/null +++ b/dev/ZKA/KernelKit/FileMgr.hxx @@ -0,0 +1,420 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + File: FileMgr.hxx + Purpose: Kernel file manager. + +------------------------------------------- */ + +/* ------------------------------------------- + + Revision History: + + 31/01/24: Update documentation (amlel) + 05/07/24: NewFS support, and fork support, updated constants and specs + as well. + + ------------------------------------------- */ + +#pragma once + +#ifdef __FSKIT_USE_NEWFS__ +#include +#endif // __FSKIT_USE_NEWFS__ + +#include +#include +#include +#include +#include +#include +#include +#include + +/// @brief Filesystem manager, abstraction over mounted filesystem. +/// Works like the VFS or IFS. + +#define cRestrictR "r" +#define cRestrictRB "rb" +#define cRestrictW "w" +#define cRestrictWB "rw" +#define cRestrictRWB "rwb" + +#define cRestrictMax 5 + +#define node_cast(PTR) reinterpret_cast(PTR) + +/** + @note Refer to first enum. +*/ +#define cFileOpsCount 4 +#define cFileMimeGeneric "n-application-kind/all" + +/** @brief invalid position. (n-pos) */ +#define kNPos (SizeT)(-1); + +namespace Kernel +{ + enum + { + cFileWriteAll = 100, + cFileReadAll = 101, + cFileReadChunk = 102, + cFileWriteChunk = 103, + cFileIOCnt = (cFileWriteChunk - cFileWriteAll) + 1, + // file flags + cFileFlagRsrc = 104, + cFileFlagData = 105, + }; + + typedef VoidPtr NodePtr; + + /** + @brief Filesystem Mgr Interface class + @brief Used to provide common I/O for a specific filesystem. +*/ + class FilesystemMgrInterface + { + public: + explicit FilesystemMgrInterface() = default; + virtual ~FilesystemMgrInterface() = default; + + public: + ZKA_COPY_DEFAULT(FilesystemMgrInterface); + + public: + /// @brief Mounts a new filesystem into an active state. + /// @param interface the filesystem interface + /// @return + static bool Mount(FilesystemMgrInterface* interface); + + /// @brief Unmounts the active filesystem + /// @return + static FilesystemMgrInterface* Unmount(); + + /// @brief Getter, gets the active filesystem. + /// @return + static FilesystemMgrInterface* GetMounted(); + + public: + virtual NodePtr Create(_Input const Char* path) = 0; + virtual NodePtr CreateAlias(_Input const Char* path) = 0; + virtual NodePtr CreateDirectory(_Input const Char* path) = 0; + virtual NodePtr CreateSwapFile(const Char* path) = 0; + + public: + virtual bool Remove(_Input const Char* path) = 0; + + public: + virtual NodePtr Open(_Input const Char* path, _Input const Char* r) = 0; + + public: + virtual Void Write(_Input NodePtr node, _Input VoidPtr data, _Input Int32 flags, _Input SizeT size) = 0; + + virtual _Output VoidPtr Read(_Input NodePtr node, + _Input Int32 flags, + _Input SizeT sz) = 0; + + virtual Void Write(_Input const Char* name, + _Input NodePtr node, + _Input VoidPtr data, + _Input Int32 flags, + _Input SizeT size) = 0; + + virtual _Output VoidPtr Read(_Input const Char* name, + _Input NodePtr node, + _Input Int32 flags, + _Input SizeT sz) = 0; + + public: + virtual bool Seek(_Input NodePtr node, _Input SizeT off) = 0; + + public: + virtual SizeT Tell(_Input NodePtr node) = 0; + virtual bool Rewind(_Input NodePtr node) = 0; + }; + +#ifdef __FSKIT_USE_NEWFS__ + /** + * @brief Based of FilesystemMgrInterface, takes care of managing NewFS + * disks. + */ + class NewFilesystemMgr final : public FilesystemMgrInterface + { + public: + explicit NewFilesystemMgr(); + ~NewFilesystemMgr() override; + + public: + ZKA_COPY_DEFAULT(NewFilesystemMgr); + + public: + NodePtr Create(const Char* path) override; + NodePtr CreateAlias(const Char* path) override; + NodePtr CreateDirectory(const Char* path) override; + NodePtr CreateSwapFile(const Char* path) override; + + public: + bool Remove(const Char* path) override; + NodePtr Open(const Char* path, const Char* r) override; + Void Write(NodePtr node, VoidPtr data, Int32 flags, SizeT sz) override; + VoidPtr Read(NodePtr node, Int32 flags, SizeT sz) override; + bool Seek(NodePtr node, SizeT off) override; + SizeT Tell(NodePtr node) override; + bool Rewind(NodePtr node) override; + + Void Write(_Input const Char* name, + _Input NodePtr node, + _Input VoidPtr data, + _Input Int32 flags, + _Input SizeT size) override; + + _Output VoidPtr Read(_Input const Char* name, + _Input NodePtr node, + _Input Int32 flags, + _Input SizeT sz) override; + + public: + /// @brief Get NewFS parser class. + /// @return The filesystem parser class. + NewFSParser* GetParser() noexcept; + + private: + NewFSParser* fImpl{nullptr}; + }; + +#endif // ifdef __FSKIT_USE_NEWFS__ + + /** + * Usable FileStream + * @tparam Encoding file encoding (char, wchar_t...) + * @tparam FSClass Filesystem contract who takes care of it. + */ + template + class FileStream final + { + public: + explicit FileStream(const Encoding* path, const Encoding* restrict_type); + ~FileStream(); + + public: + FileStream& operator=(const FileStream&); + FileStream(const FileStream&); + + public: + ErrorOr WriteAll(const VoidPtr data) noexcept + { + if (this->fFileRestrict != eRestrictReadWrite && + this->fFileRestrict != eRestrictReadWriteBinary && + this->fFileRestrict != eRestrictWrite && + this->fFileRestrict != eRestrictWriteBinary) + return ErrorOr(kErrorInvalidData); + + if (data == nullptr) + return ErrorOr(kErrorInvalidData); + + auto man = FSClass::GetMounted(); + + if (man) + { + man->Write(fFile, data, cFileWriteAll); + return ErrorOr(0); + } + + return ErrorOr(kErrorInvalidData); + } + + VoidPtr ReadAll() noexcept + { + if (this->fFileRestrict != eRestrictReadWrite && + this->fFileRestrict != eRestrictReadWriteBinary && + this->fFileRestrict != eRestrictRead && + this->fFileRestrict != eRestrictReadBinary) + return nullptr; + + auto man = FSClass::GetMounted(); + + if (man) + { + VoidPtr ret = man->Read(fFile, cFileReadAll, 0); + return ret; + } + + return nullptr; + } + + ErrorOr WriteAll(const Char* fName, const VoidPtr data) noexcept + { + if (this->fFileRestrict != eRestrictReadWrite && + this->fFileRestrict != eRestrictReadWriteBinary && + this->fFileRestrict != eRestrictWrite && + this->fFileRestrict != eRestrictWriteBinary) + return ErrorOr(kErrorInvalidData); + + if (data == nullptr) + return ErrorOr(kErrorInvalidData); + + auto man = FSClass::GetMounted(); + + if (man) + { + man->Write(fName, fFile, data, cFileWriteAll); + return ErrorOr(0); + } + + return ErrorOr(kErrorInvalidData); + } + + VoidPtr Read(const Char* fName) noexcept + { + if (this->fFileRestrict != eRestrictReadWrite && + this->fFileRestrict != eRestrictReadWriteBinary && + this->fFileRestrict != eRestrictRead && + this->fFileRestrict != eRestrictReadBinary) + return nullptr; + + auto man = FSClass::GetMounted(); + + if (man) + { + VoidPtr ret = man->Read(fName, fFile, cFileReadAll, 0); + return ret; + } + + return nullptr; + } + + VoidPtr Read(SizeT offset, SizeT sz) + { + if (this->fFileRestrict != eRestrictReadWrite && + this->fFileRestrict != eRestrictReadWriteBinary && + this->fFileRestrict != eRestrictRead && + this->fFileRestrict != eRestrictReadBinary) + return nullptr; + + auto man = FSClass::GetMounted(); + + if (man) + { + man->Seek(fFile, offset); + auto ret = man->Read(fFile, cFileReadChunk, sz); + + return ret; + } + + return nullptr; + } + + Void Write(SizeT offset, voidPtr data, SizeT sz) + { + if (this->fFileRestrict != eRestrictReadWrite && + this->fFileRestrict != eRestrictReadWriteBinary && + this->fFileRestrict != eRestrictWrite && + this->fFileRestrict != eRestrictWriteBinary) + return; + + auto man = FSClass::GetMounted(); + + if (man) + { + man->Seek(fFile, offset); + man->Write(fFile, data, sz, cFileReadChunk); + } + } + + public: + /// @brief Leak node pointer. + /// @return The node pointer. + NodePtr Leak() + { + return fFile; + } + + /// @brief Leak MIME. + /// @return The MIME. + Char* MIME() noexcept + { + return const_cast(fMime); + } + + enum + { + eRestrictRead, + eRestrictReadBinary, + eRestrictWrite, + eRestrictWriteBinary, + eRestrictReadWrite, + eRestrictReadWriteBinary, + }; + + private: + NodePtr fFile{nullptr}; + Int32 fFileRestrict{}; + const Char* fMime{cFileMimeGeneric}; + }; + + using FileStreamUTF8 = FileStream; + using FileStreamUTF16 = FileStream; + + typedef UInt64 CursorType; + + /// @brief constructor + template + FileStream::FileStream(const Encoding* path, + const Encoding* restrict_type) + : fFile(Class::GetMounted()->Open(path, restrict_type)) + { + static const auto cLength = 255; + + /// @brief restrict information about the file descriptor. + struct RESTRICT_MAP final + { + Char fRestrict[cLength]; + Int32 fMappedTo; + }; + + const SizeT cRestrictCount = cRestrictMax; + const RESTRICT_MAP cRestrictList[] = { + { + .fRestrict = cRestrictR, + .fMappedTo = eRestrictRead, + }, + { + .fRestrict = cRestrictRB, + .fMappedTo = eRestrictReadBinary, + }, + { + .fRestrict = cRestrictRWB, + .fMappedTo = eRestrictReadWriteBinary, + }, + { + .fRestrict = cRestrictW, + .fMappedTo = eRestrictWrite, + }, + { + .fRestrict = cRestrictWB, + .fMappedTo = eRestrictReadWrite, + }}; + + for (SizeT index = 0; index < cRestrictCount; ++index) + { + if (rt_string_cmp(restrict_type, cRestrictList[index].fRestrict, + rt_string_len(cRestrictList[index].fRestrict)) == 0) + { + fFileRestrict = cRestrictList[index].fMappedTo; + break; + } + } + + kcout << "newoskrnl.exe: new file: " << path << ".\r"; + } + + /// @brief destructor + template + FileStream::~FileStream() + { + mm_delete_ke_heap(fFile); + } +} // namespace Kernel diff --git a/dev/ZKA/KernelKit/MP.hxx b/dev/ZKA/KernelKit/MP.hxx index 51f3472a..cf5d6754 100644 --- a/dev/ZKA/KernelKit/MP.hxx +++ b/dev/ZKA/KernelKit/MP.hxx @@ -103,7 +103,7 @@ namespace Kernel operator bool() noexcept; public: - /// @brief Shared instance of the MP Manager. + /// @brief Shared instance of the MP Mgr. /// @return the reference to the mp manager class. STATIC HardwareThreadScheduler& The(); diff --git a/dev/ZKA/KernelKit/PCI/Dma.hxx b/dev/ZKA/KernelKit/PCI/Dma.hxx index 43df13f0..8e51bc45 100644 --- a/dev/ZKA/KernelKit/PCI/Dma.hxx +++ b/dev/ZKA/KernelKit/PCI/Dma.hxx @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include diff --git a/dev/ZKA/KernelKit/PECodeManager.hxx b/dev/ZKA/KernelKit/PECodeManager.hxx deleted file mode 100644 index f42c7c21..00000000 --- a/dev/ZKA/KernelKit/PECodeManager.hxx +++ /dev/null @@ -1,24 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - - File: PECodeManager.hxx - Purpose: PE32+ Code Manager and Shared Objects. - - Revision History: - - 12/02/24: Added file (amlel) - -------------------------------------------- */ - -#pragma once - -//////////////////////////////////////////////////// - -// LAST REV: Mon Feb 12 13:52:01 CET 2024 - -//////////////////////////////////////////////////// - -#include -#include -#include diff --git a/dev/ZKA/KernelKit/PECodeMgr.hxx b/dev/ZKA/KernelKit/PECodeMgr.hxx new file mode 100644 index 00000000..7b84fbc1 --- /dev/null +++ b/dev/ZKA/KernelKit/PECodeMgr.hxx @@ -0,0 +1,24 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + + File: PECodeMgr.hxx + Purpose: PE32+ Code Mgr and Shared Objects. + + Revision History: + + 12/02/24: Added file (amlel) + +------------------------------------------- */ + +#pragma once + +//////////////////////////////////////////////////// + +// LAST REV: Mon Feb 12 13:52:01 CET 2024 + +//////////////////////////////////////////////////// + +#include +#include +#include diff --git a/dev/ZKA/KernelKit/PEFCodeManager.hxx b/dev/ZKA/KernelKit/PEFCodeManager.hxx deleted file mode 100644 index dd6daca5..00000000 --- a/dev/ZKA/KernelKit/PEFCodeManager.hxx +++ /dev/null @@ -1,67 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#ifndef _INC_CODE_MANAGER_PEF_HXX_ -#define _INC_CODE_MANAGER_PEF_HXX_ - -#include -#include -#include -#include - -#define kPefApplicationMime "application/x-newos-exec" - -namespace Kernel -{ - /// - /// \name PEFLoader - /// \brief PEF loader class. - /// - class PEFLoader : public LoaderInterface - { - private: - explicit PEFLoader() = delete; - - public: - explicit PEFLoader(const VoidPtr blob); - explicit PEFLoader(const Char* path); - ~PEFLoader() override; - - public: - ZKA_COPY_DEFAULT(PEFLoader); - - public: - const Char* Path() override; - const Char* AsString() override; - const Char* MIME() override; - - public: - ErrorOr FindStart() override; - VoidPtr FindSymbol(const Char* name, Int32 kind) override; - - public: - bool IsLoaded() noexcept; - - private: -#ifdef __FSKIT_USE_NEWFS__ - OwnPtr> fFile; -#else - OwnPtr> fFile; -#endif // __FSKIT_USE_NEWFS__ - - Ref fPath; - VoidPtr fCachedBlob; - bool fFatBinary; - bool fBad; - }; - - namespace Utils - { - bool execute_from_image(PEFLoader& exec, const Int32& procKind) noexcept; - } // namespace Utils -} // namespace Kernel - -#endif // ifndef _INC_CODE_MANAGER_PEF_HXX_ diff --git a/dev/ZKA/KernelKit/PEFCodeMgr.hxx b/dev/ZKA/KernelKit/PEFCodeMgr.hxx new file mode 100644 index 00000000..74cc8eb0 --- /dev/null +++ b/dev/ZKA/KernelKit/PEFCodeMgr.hxx @@ -0,0 +1,67 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#ifndef _INC_CODE_MANAGER_PEF_HXX_ +#define _INC_CODE_MANAGER_PEF_HXX_ + +#include +#include +#include +#include + +#define kPefApplicationMime "application/x-newos-exec" + +namespace Kernel +{ + /// + /// \name PEFLoader + /// \brief PEF loader class. + /// + class PEFLoader : public LoaderInterface + { + private: + explicit PEFLoader() = delete; + + public: + explicit PEFLoader(const VoidPtr blob); + explicit PEFLoader(const Char* path); + ~PEFLoader() override; + + public: + ZKA_COPY_DEFAULT(PEFLoader); + + public: + const Char* Path() override; + const Char* AsString() override; + const Char* MIME() override; + + public: + ErrorOr FindStart() override; + VoidPtr FindSymbol(const Char* name, Int32 kind) override; + + public: + bool IsLoaded() noexcept; + + private: +#ifdef __FSKIT_USE_NEWFS__ + OwnPtr> fFile; +#else + OwnPtr> fFile; +#endif // __FSKIT_USE_NEWFS__ + + Ref fPath; + VoidPtr fCachedBlob; + bool fFatBinary; + bool fBad; + }; + + namespace Utils + { + bool execute_from_image(PEFLoader& exec, const Int32& procKind) noexcept; + } // namespace Utils +} // namespace Kernel + +#endif // ifndef _INC_CODE_MANAGER_PEF_HXX_ diff --git a/dev/ZKA/KernelKit/PEFDLLInterface.hxx b/dev/ZKA/KernelKit/PEFDLLInterface.hxx index ef1a844f..d664bfd8 100644 --- a/dev/ZKA/KernelKit/PEFDLLInterface.hxx +++ b/dev/ZKA/KernelKit/PEFDLLInterface.hxx @@ -11,7 +11,7 @@ #define __KERNELKIT_SHARED_OBJECT_HXX__ #include -#include +#include #include #include @@ -96,7 +96,7 @@ namespace Kernel PEFLoader* fLoader{nullptr}; }; - typedef PEFDLLInterface* DLLInterfacePtr; + typedef DLLInterface* DLLInterfacePtr; EXTERN_C DLLInterfacePtr rtl_init_shared_object(UserProcess* header); EXTERN_C Void rtl_fini_shared_object(UserProcess* header, DLLInterfacePtr lib, Bool* successful); diff --git a/dev/ZKA/KernelKit/UserProcessScheduler.hxx b/dev/ZKA/KernelKit/UserProcessScheduler.hxx index 809dbb7f..78d75af6 100644 --- a/dev/ZKA/KernelKit/UserProcessScheduler.hxx +++ b/dev/ZKA/KernelKit/UserProcessScheduler.hxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #define kSchedMinMicroTime (AffinityKind::kStandard) @@ -158,13 +159,13 @@ namespace Kernel SizeT StackSize{mib_cast(8)}; // shared library handle, reserved for kDLLKind types of executables only. - PEFDLLInterface* DLLPtr{nullptr}; + DLLInterface* DLLPtr{nullptr}; UserProcess* Parent{nullptr}; // Memory usage. SizeT UsedMemory{0}; SizeT FreeMemory{0}; - SizeT SizeMemory{gib_cast(4)}; + SizeT SizeMemory{mib_cast(64)}; enum { -- cgit v1.2.3