diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-10 10:33:39 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-10 10:34:53 +0200 |
| commit | 5aef44da0ce752e7ac6bd9c95489942b1a0319ae (patch) | |
| tree | f3c6f613048ab091def7afc726f0227f552df519 /dev/ZKA/Sources | |
| parent | b11bf31c59d447e62e6ba9b3d8455f9b2828703f (diff) | |
Fix: See below.
- Fixing PML4 mapping and getting it to work.
- Don't update cr4, instead do lidt to triple fault.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/ZKA/Sources')
| -rw-r--r-- | dev/ZKA/Sources/ExeMain.cxx | 26 | ||||
| -rw-r--r-- | dev/ZKA/Sources/FS/NeFS.cxx | 58 | ||||
| -rw-r--r-- | dev/ZKA/Sources/FileMgr.cxx | 18 | ||||
| -rw-r--r-- | dev/ZKA/Sources/KernelCheck.cxx | 46 | ||||
| -rw-r--r-- | dev/ZKA/Sources/NeFS+FileMgr.cxx | 24 | ||||
| -rw-r--r-- | dev/ZKA/Sources/PageAllocator.cxx | 42 |
6 files changed, 101 insertions, 113 deletions
diff --git a/dev/ZKA/Sources/ExeMain.cxx b/dev/ZKA/Sources/ExeMain.cxx index 93bbb3e5..44dedfd7 100644 --- a/dev/ZKA/Sources/ExeMain.cxx +++ b/dev/ZKA/Sources/ExeMain.cxx @@ -44,7 +44,7 @@ namespace Kernel::Detail /// @brief Filesystem auto formatter, additional checks are also done by the class. class FilesystemInstaller final { - Kernel::NewFilesystemMgr* fNeFS{nullptr}; + Kernel::NeFileSystemMgr* fNeFS{nullptr}; public: /// @brief wizard constructor. @@ -53,12 +53,12 @@ namespace Kernel::Detail if (Kernel::IFilesystemMgr::GetMounted()) { CG::CGDrawStringToWnd(cKernelWnd, "NeFS IFS already mounted by HAL (A:)", 10, 10, RGB(0, 0, 0)); - fNeFS = reinterpret_cast<Kernel::NewFilesystemMgr*>(Kernel::IFilesystemMgr::GetMounted()); + fNeFS = reinterpret_cast<Kernel::NeFileSystemMgr*>(Kernel::IFilesystemMgr::GetMounted()); } else { // Mounts a NeFS from main drive. - fNeFS = new Kernel::NewFilesystemMgr(); + fNeFS = new Kernel::NeFileSystemMgr(); Kernel::IFilesystemMgr::Mount(fNeFS); @@ -92,6 +92,22 @@ namespace Kernel::Detail 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)); + NFS_FORK_STRUCT theFork{ 0 }; + + rt_copy_memory(catalogDir->Name, theFork.CatalogName, rt_string_len(catalogDir->Name)); + rt_copy_memory(catalogDir->Name, theFork.ForkName, rt_string_len(catalogDir->Name)); + + theFork.DataSize = kNeFSForkDataSz; + theFork.Kind = kNeFSDataForkKind; + theFork.ResourceId = 0; + + fNeFS->GetParser()->CreateFork(catalogDir, theFork); + + auto data_len = 4096; + Char data[4096] = R"({ "FolderKind": "System", "Owner": "ZKA USER\\SUPER", "Important": true })"; + + fNeFS->GetParser()->WriteCatalog(catalogDir, false, data, data_len, theFork.ForkName); + delete catalogDir; } } @@ -102,8 +118,8 @@ namespace Kernel::Detail ZKA_COPY_DEFAULT(FilesystemInstaller); /// @brief Grab the disk's NeFS reference. - /// @return NewFilesystemMgr the filesystem interface - Kernel::NewFilesystemMgr* Leak() + /// @return NeFileSystemMgr the filesystem interface + Kernel::NeFileSystemMgr* Leak() { return fNeFS; } diff --git a/dev/ZKA/Sources/FS/NeFS.cxx b/dev/ZKA/Sources/FS/NeFS.cxx index 1a9b89f7..ad4dd031 100644 --- a/dev/ZKA/Sources/FS/NeFS.cxx +++ b/dev/ZKA/Sources/FS/NeFS.cxx @@ -56,16 +56,16 @@ STATIC MountpointInterface sMountpointInterface; /***********************************************************************************/ /// @brief Creates a new fork inside the New filesystem partition. /// @param catalog it's catalog -/// @param theFork the fork itself. +/// @param the_fork the fork itself. /// @return the fork /***********************************************************************************/ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catalog, - _Input NFS_FORK_STRUCT& theFork) + _Input NFS_FORK_STRUCT& the_fork) { - if (catalog && theFork.ForkName[0] != 0 && - theFork.DataSize <= kNeFSForkDataSz) + if (catalog && the_fork.ForkName[0] != 0 && + the_fork.DataSize <= kNeFSForkDataSz) { - Lba lba = (theFork.Kind == kNeFSDataForkKind) ? catalog->DataFork + Lba lba = (the_fork.Kind == kNeFSDataForkKind) ? catalog->DataFork : catalog->ResourceFork; kcout << "fork lba: " << hex_number(lba) << endl; @@ -103,12 +103,12 @@ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catal kcout << "next fork: " << hex_number(curFork.NextSibling) << endl; - if (curFork.Flags == kNeFSFlagCreated) + if (curFork.Flags & kNeFSFlagCreated) { kcout << "fork already exists.\r"; /// sanity check. - if (StringBuilder::Equals(curFork.ForkName, theFork.ForkName) && + if (StringBuilder::Equals(curFork.ForkName, the_fork.ForkName) && StringBuilder::Equals(curFork.CatalogName, catalog->Name)) return nullptr; @@ -142,24 +142,24 @@ _Output NFS_FORK_STRUCT* NeFSParser::CreateFork(_Input NFS_CATALOG_STRUCT* catal constexpr auto cForkPadding = 4; /// this value gives us space for the data offset. - theFork.Flags = kNeFSFlagCreated; - theFork.DataOffset = lba - sizeof(NFS_FORK_STRUCT) - theFork.DataSize; - theFork.PreviousSibling = lbaOfPreviousFork; - theFork.NextSibling = theFork.DataOffset + sizeof(NFS_FORK_STRUCT) + theFork.DataSize; + the_fork.Flags |= kNeFSFlagCreated; + the_fork.DataOffset = lba - sizeof(NFS_FORK_STRUCT); + the_fork.PreviousSibling = lbaOfPreviousFork; + the_fork.NextSibling = the_fork.DataOffset - the_fork.DataSize - sizeof(NFS_FORK_STRUCT); drv.fPacket.fLba = lba; drv.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT); - drv.fPacket.fPacketContent = &theFork; + drv.fPacket.fPacketContent = &the_fork; drv.fOutput(&drv.fPacket); /// log what we have now. - kcout << "Wrote fork data at: " << hex_number(theFork.DataOffset) + kcout << "Wrote fork data at: " << hex_number(the_fork.DataOffset) << endl; kcout << "Wrote fork at: " << hex_number(lba) << endl; - return &theFork; + return &the_fork; } return nullptr; @@ -176,7 +176,7 @@ _Output NFS_FORK_STRUCT* NeFSParser::FindFork(_Input NFS_CATALOG_STRUCT* catalog Boolean isDataFork) { auto drv = sMountpointInterface.A(); - NFS_FORK_STRUCT* theFork = nullptr; + NFS_FORK_STRUCT* the_fork = nullptr; Lba lba = isDataFork ? catalog->DataFork : catalog->ResourceFork; @@ -184,7 +184,7 @@ _Output NFS_FORK_STRUCT* NeFSParser::FindFork(_Input NFS_CATALOG_STRUCT* catalog { drv.fPacket.fLba = lba; drv.fPacket.fPacketSize = sizeof(NFS_FORK_STRUCT); - drv.fPacket.fPacketContent = (VoidPtr)theFork; + drv.fPacket.fPacketContent = (VoidPtr)the_fork; rt_copy_memory((VoidPtr) "fs/newfs-packet", drv.fPacket.fPacketMime, 16); @@ -209,15 +209,15 @@ _Output NFS_FORK_STRUCT* NeFSParser::FindFork(_Input NFS_CATALOG_STRUCT* catalog return nullptr; } - if (StringBuilder::Equals(theFork->ForkName, name)) + if (StringBuilder::Equals(the_fork->ForkName, name)) { break; } - lba = theFork->NextSibling; + lba = the_fork->NextSibling; } - return theFork; + return the_fork; } /***********************************************************************************/ @@ -250,12 +250,12 @@ _Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name, /// a directory should have a slash in the end. if (kind == kNeFSCatalogKindDir && - name[rt_string_len(name) - 1] != NewFilesystemHelper::Separator()) + name[rt_string_len(name) - 1] != NeFileSystemHelper::Separator()) return nullptr; /// a file shouldn't have a slash in the end. if (kind != kNeFSCatalogKindDir && - name[rt_string_len(name) - 1] == NewFilesystemHelper::Separator()) + name[rt_string_len(name) - 1] == NeFileSystemHelper::Separator()) return nullptr; NFS_CATALOG_STRUCT* catalog_copy = this->FindCatalog(name, out_lba); @@ -297,7 +297,7 @@ _Output NFS_CATALOG_STRUCT* NeFSParser::CreateCatalog(_Input const Char* name, // mandatory / character, zero it. parentName[--indexReverseCopy] = 0; - while (parentName[indexReverseCopy] != NewFilesystemHelper::Separator()) + while (parentName[indexReverseCopy] != NeFileSystemHelper::Separator()) { parentName[indexReverseCopy] = 0; --indexReverseCopy; @@ -684,7 +684,7 @@ bool NeFSParser::WriteCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog, Bool i // Store the blob now. // ===================================================== // - fork_data_input->Flags = kNeFSFlagCreated; + fork_data_input->Flags |= kNeFSFlagCreated; drive.fPacket.fPacketContent = buf; drive.fPacket.fPacketSize = kNeFSForkDataSz; @@ -753,7 +753,7 @@ _Output NFS_CATALOG_STRUCT* NeFSParser::FindCatalog(_Input const Char* catalogNa drive.fInput(&drive.fPacket); - if (!StringBuilder::Equals(catalogName, NewFilesystemHelper::Root())) + if (!StringBuilder::Equals(catalogName, NeFileSystemHelper::Root())) { Char parentName[kNeFSNodeNameLen] = {0}; @@ -770,7 +770,7 @@ _Output NFS_CATALOG_STRUCT* NeFSParser::FindCatalog(_Input const Char* catalogNa // mandatory '/' character. parentName[--indexReverseCopy] = 0; - while (parentName[indexReverseCopy] != NewFilesystemHelper::Separator()) + while (parentName[indexReverseCopy] != NeFileSystemHelper::Separator()) { parentName[indexReverseCopy] = 0; --indexReverseCopy; @@ -779,7 +779,7 @@ _Output NFS_CATALOG_STRUCT* NeFSParser::FindCatalog(_Input const Char* catalogNa NFS_CATALOG_STRUCT* parentCatalog = this->FindCatalog(parentName, out_lba); if (parentCatalog && - !StringBuilder::Equals(parentName, NewFilesystemHelper::Root())) + !StringBuilder::Equals(parentName, NeFileSystemHelper::Root())) { startCatalogList = parentCatalog->NextSibling; delete parentCatalog; @@ -871,7 +871,7 @@ Boolean NeFSParser::CloseCatalog(_Input _Output NFS_CATALOG_STRUCT* catalog) Boolean NeFSParser::RemoveCatalog(_Input const Char* catalogName) { if (!catalogName || - StringBuilder::Equals(catalogName, NewFilesystemHelper::Root())) + StringBuilder::Equals(catalogName, NeFileSystemHelper::Root())) { ErrLocal() = kErrorInternal; return false; @@ -881,9 +881,9 @@ Boolean NeFSParser::RemoveCatalog(_Input const Char* catalogName) auto catalog = this->FindCatalog(catalogName, out_lba); if (out_lba >= kNeFSCatalogStartAddress || - catalog->Flags == kNeFSFlagCreated) + catalog->Flags & kNeFSFlagCreated) { - catalog->Flags = kNeFSFlagDeleted; + catalog->Flags |= kNeFSFlagDeleted; auto drive = sMountpointInterface.A(); diff --git a/dev/ZKA/Sources/FileMgr.cxx b/dev/ZKA/Sources/FileMgr.cxx index eff3c334..88e8c433 100644 --- a/dev/ZKA/Sources/FileMgr.cxx +++ b/dev/ZKA/Sources/FileMgr.cxx @@ -55,7 +55,7 @@ namespace Kernel /// @param path /// @param r /// @return - _Output NodePtr NewFilesystemMgr::Open(_Input const Char* path, _Input const Char* r) + _Output NodePtr NeFileSystemMgr::Open(_Input const Char* path, _Input const Char* r) { if (!path || *path == 0) return nullptr; @@ -73,7 +73,7 @@ namespace Kernel /// @param data the data. /// @param flags the size. /// @return - Void NewFilesystemMgr::Write(_Input NodePtr node, _Input VoidPtr data, _Input Int32 flags, _Input SizeT size) + Void NeFileSystemMgr::Write(_Input NodePtr node, _Input VoidPtr data, _Input Int32 flags, _Input SizeT size) { if (!node) return; @@ -89,7 +89,7 @@ namespace Kernel /// @param flags the flags with it. /// @param sz the size to read. /// @return - _Output VoidPtr NewFilesystemMgr::Read(_Input NodePtr node, _Input Int32 flags, _Input SizeT size) + _Output VoidPtr NeFileSystemMgr::Read(_Input NodePtr node, _Input Int32 flags, _Input SizeT size) { if (!node) return nullptr; @@ -100,7 +100,7 @@ namespace Kernel return this->Read(cDataForkName, node, flags, size); } - Void NewFilesystemMgr::Write(_Input const Char* name, + Void NeFileSystemMgr::Write(_Input const Char* name, _Input NodePtr node, _Input VoidPtr data, _Input Int32 flags, @@ -120,7 +120,7 @@ namespace Kernel name); } - _Output VoidPtr NewFilesystemMgr::Read(_Input const Char* name, + _Output VoidPtr NeFileSystemMgr::Read(_Input const Char* name, _Input NodePtr node, _Input Int32 flags, _Input SizeT sz) @@ -146,7 +146,7 @@ namespace Kernel /// @retval true always returns false, this is unimplemented. /// @retval false always returns this, it is unimplemented. - _Output Bool NewFilesystemMgr::Seek(NodePtr node, SizeT off) + _Output Bool NeFileSystemMgr::Seek(NodePtr node, SizeT off) { if (!node || off == 0) return false; @@ -159,7 +159,7 @@ namespace Kernel /// @retval true always returns false, this is unimplemented. /// @retval false always returns this, it is unimplemented. - _Output SizeT NewFilesystemMgr::Tell(NodePtr node) + _Output SizeT NeFileSystemMgr::Tell(NodePtr node) { if (!node) return kNPos; @@ -172,7 +172,7 @@ namespace Kernel /// @retval true always returns false, this is unimplemented. /// @retval false always returns this, it is unimplemented. - _Output Bool NewFilesystemMgr::Rewind(NodePtr node) + _Output Bool NeFileSystemMgr::Rewind(NodePtr node) { if (!node) return false; @@ -182,7 +182,7 @@ namespace Kernel /// @brief Returns the filesystem parser. /// @return the Filesystem parser class. - _Output NeFSParser* NewFilesystemMgr::GetParser() noexcept + _Output NeFSParser* NeFileSystemMgr::GetParser() noexcept { return fImpl; } diff --git a/dev/ZKA/Sources/KernelCheck.cxx b/dev/ZKA/Sources/KernelCheck.cxx index ff71950a..833ac6de 100644 --- a/dev/ZKA/Sources/KernelCheck.cxx +++ b/dev/ZKA/Sources/KernelCheck.cxx @@ -11,7 +11,7 @@ #include <NewKit/String.hxx> #include <FirmwareKit/Handover.hxx> #include <Modules/ACPI/ACPIFactoryInterface.hxx> - +#include <KernelKit/FileMgr.hxx> #include <Modules/CoreCG/Accessibility.hxx> #include <Modules/CoreCG/FbRenderer.hxx> #include <Modules/CoreCG/TextRenderer.hxx> @@ -69,50 +69,58 @@ namespace Kernel RecoveryFactory::Recover(); } case RUNTIME_CHECK_FILESYSTEM: { - CGDrawString("0x0000000A Filesystem corruption error.", start_y, x, panicTxt); - RecoveryFactory::Recover(); + CGDrawString("0x0000000A Filesystem error.", start_y, x, panicTxt); + + PowerFactoryInterface power(nullptr); + power.Shutdown(); break; } case RUNTIME_CHECK_POINTER: { - CGDrawString("0x00000000 Kernel heap pointer error, surely corrupted.", start_y, x, panicTxt); - RecoveryFactory::Recover(); + CGDrawString("0x00000000 Heap error, the heap is corrupted.", start_y, x, panicTxt); + + PowerFactoryInterface power(nullptr); + power.Shutdown(); break; } case RUNTIME_CHECK_BAD_BEHAVIOR: { - CGDrawString("0x00000009 Undefined behavior error, image had to stop.", start_y, x, panicTxt); - RecoveryFactory::Recover(); + CGDrawString("0x00000009 CPU access error.", start_y, x, panicTxt); + + PowerFactoryInterface power(nullptr); + power.Shutdown(); break; } case RUNTIME_CHECK_BOOTSTRAP: { - CGDrawString("0x0000000A End of boot code...", start_y, x, panicTxt); - RecoveryFactory::Recover(); + CGDrawString("0x0000000A Boot Processor finished executing.", start_y, x, panicTxt); + + PowerFactoryInterface power(nullptr); + power.Shutdown(); break; } case RUNTIME_CHECK_HANDSHAKE: { - CGDrawString("0x00000005 Bad handshake error.", start_y, x, panicTxt); + CGDrawString("0x00000005 Handshake fault.", start_y, x, panicTxt); RecoveryFactory::Recover(); break; } case RUNTIME_CHECK_IPC: { - CGDrawString("0x00000003 Bad Kernel IPC error.", start_y, x, panicTxt); + CGDrawString("0x00000003 Bad IPC/XPCOM message.", start_y, x, panicTxt); RecoveryFactory::Recover(); break; } case RUNTIME_CHECK_INVALID_PRIVILEGE: { - CGDrawString("0x00000007 Kernel privilege violation.", start_y, x, panicTxt); + CGDrawString("0x00000007 Privilege access violation.", start_y, x, panicTxt); RecoveryFactory::Recover(); break; case RUNTIME_CHECK_UNEXCPECTED: { - CGDrawString("0x0000000B Unexpected Kernel failure.", start_y, x, panicTxt); + CGDrawString("0x0000000B Kernel access violation.", start_y, x, panicTxt); break; } case RUNTIME_CHECK_VIRTUAL_OUT_OF_MEM: { - CGDrawString("0x10000001 Out of Virtual Memory. (Catastrophic Failure)", start_y, x, panicTxt); + CGDrawString("0x10000001 Out of virtual memory.", start_y, x, panicTxt); RecoveryFactory::Recover(); break; } case RUNTIME_CHECK_FAILED: { - CGDrawString("0x10000001 Kernel Check.", start_y, x, panicTxt); + CGDrawString("0x10000001 Kernel Bug check failed.", start_y, x, panicTxt); RecoveryFactory::Recover(); break; } @@ -130,8 +138,14 @@ namespace Kernel Void RecoveryFactory::Recover() noexcept { + if (NeFileSystemMgr::GetMounted()) + { + NeFileSystemMgr::GetMounted()->CreateSwapFile("\\Boot\\$DUMP"); + NeFileSystemMgr::GetMounted()->CreateSwapFile("\\Support\\$CHKDSK"); + } + PowerFactoryInterface power(nullptr); - power.Shutdown(); + power.Reboot(); } void ke_runtime_check(bool expr, const Char* file, const Char* line) diff --git a/dev/ZKA/Sources/NeFS+FileMgr.cxx b/dev/ZKA/Sources/NeFS+FileMgr.cxx index 609f2ece..85630018 100644 --- a/dev/ZKA/Sources/NeFS+FileMgr.cxx +++ b/dev/ZKA/Sources/NeFS+FileMgr.cxx @@ -15,16 +15,16 @@ namespace Kernel { /// @brief C++ constructor - NewFilesystemMgr::NewFilesystemMgr() + NeFileSystemMgr::NeFileSystemMgr() { MUST_PASS(Detail::fs_init_newfs()); fImpl = mm_new_class<NeFSParser>(); MUST_PASS(fImpl); - kcout << "We are done here... (NewFilesystemMgr).\r"; + kcout << "We are done here... (NeFileSystemMgr).\r"; } - NewFilesystemMgr::~NewFilesystemMgr() + NeFileSystemMgr::~NeFileSystemMgr() { kcout << "Destroying it...\r"; @@ -37,7 +37,7 @@ namespace Kernel /// @brief Removes a node from the filesystem. /// @param fileName The filename /// @return If it was deleted or not. - bool NewFilesystemMgr::Remove(const Char* fileName) + bool NeFileSystemMgr::Remove(const Char* fileName) { if (fileName == nullptr || *fileName == 0) return false; @@ -48,7 +48,7 @@ namespace Kernel /// @brief Creates a node with the specified. /// @param path The filename path. /// @return The Node pointer. - NodePtr NewFilesystemMgr::Create(const Char* path) + NodePtr NeFileSystemMgr::Create(const Char* path) { return node_cast(fImpl->CreateCatalog(path)); } @@ -56,7 +56,7 @@ namespace Kernel /// @brief Creates a node with is a directory. /// @param path The filename path. /// @return The Node pointer. - NodePtr NewFilesystemMgr::CreateDirectory(const Char* path) + NodePtr NeFileSystemMgr::CreateDirectory(const Char* path) { return node_cast(fImpl->CreateCatalog(path, 0, kNeFSCatalogKindDir)); } @@ -64,7 +64,7 @@ namespace Kernel /// @brief Creates a node with is a alias. /// @param path The filename path. /// @return The Node pointer. - NodePtr NewFilesystemMgr::CreateAlias(const Char* path) + NodePtr NeFileSystemMgr::CreateAlias(const Char* path) { return node_cast(fImpl->CreateCatalog(path, 0, kNeFSCatalogKindAlias)); } @@ -72,35 +72,35 @@ namespace Kernel /// @brief Creates a node with is a page file. /// @param path The filename path. /// @return The Node pointer. - NodePtr NewFilesystemMgr::CreateSwapFile(const Char* path) + NodePtr NeFileSystemMgr::CreateSwapFile(const Char* path) { return node_cast(fImpl->CreateCatalog(path, 0, kNeFSCatalogKindPage)); } /// @brief Gets the root directory. /// @return - const Char* NewFilesystemHelper::Root() + const Char* NeFileSystemHelper::Root() { return kNeFSRoot; } /// @brief Gets the up-dir directory. /// @return - const Char* NewFilesystemHelper::UpDir() + const Char* NeFileSystemHelper::UpDir() { return kNeFSUpDir; } /// @brief Gets the separator character. /// @return - const Char NewFilesystemHelper::Separator() + const Char NeFileSystemHelper::Separator() { return kNeFSSeparator; } /// @brief Gets the metafile character. /// @return - const Char NewFilesystemHelper::MetaFile() + const Char NeFileSystemHelper::MetaFile() { return kNeFSMetaFilePrefix; } diff --git a/dev/ZKA/Sources/PageAllocator.cxx b/dev/ZKA/Sources/PageAllocator.cxx deleted file mode 100644 index e68d0659..00000000 --- a/dev/ZKA/Sources/PageAllocator.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Technologies. - -------------------------------------------- */ - -#include <ArchKit/ArchKit.hxx> -#include <KernelKit/DebugOutput.hxx> -#include <NewKit/PageAllocator.hxx> - -/// @brief Internal namespace, used internally by Kernel. -namespace Kernel::Detail -{ - void exec_disable(UIntPtr VirtualAddr) - { -#ifdef __ZKA_SUPPORT_NX__ - PTE* VirtualAddrTable = reinterpret_cast<PTE*>(VirtualAddr); - - MUST_PASS(!VirtualAddrTable->ExecDisable == false); - VirtualAddrTable->ExecDisable = true; - - hal_flush_tlb(); -#endif // ifdef __ZKA_SUPPORT_NX__ - } - - bool page_disable(UIntPtr VirtualAddr) - { - if (VirtualAddr) - { - auto VirtualAddrTable = (PTE*)(VirtualAddr); - - MUST_PASS(!VirtualAddrTable->Present == true); - VirtualAddrTable->Present = false; - - hal_flush_tlb(); - - return true; - } - - return false; - } -} // namespace Kernel::Detail |
