summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/PageManager.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
commit09dd11ddf800898c00ecb04a65fb5cd10fb481fa (patch)
treeeda0b4e23d6a71da7de3a78f0bb76ec3201dd2f9 /Private/Source/PageManager.cxx
parentca83108fd138cc0398f900e6a6c0a53ad51aee31 (diff)
MHR-23: :boom: changes, reworked project tree.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/PageManager.cxx')
-rw-r--r--Private/Source/PageManager.cxx118
1 files changed, 0 insertions, 118 deletions
diff --git a/Private/Source/PageManager.cxx b/Private/Source/PageManager.cxx
deleted file mode 100644
index 7225d4ad..00000000
--- a/Private/Source/PageManager.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#include <KernelKit/DebugOutput.hpp>
-#include <NewKit/PageManager.hpp>
-
-#ifdef __x86_64__
-#include <HALKit/AMD64/HalPageAlloc.hpp>
-#endif // ifdef __x86_64__
-
-//! null deref will throw (Page Zero detected, aborting app!)
-#define kProtectedRegionEnd (512)
-
-namespace NewOS
-{
- PTEWrapper::PTEWrapper(Boolean Rw, Boolean User, Boolean ExecDisable, UIntPtr VirtAddr)
- : fRw(Rw),
- fUser(User),
- fExecDisable(ExecDisable),
- fVirtAddr(VirtAddr),
- fCache(false),
- fShareable(false),
- fWt(false),
- fPresent(true),
- fAccessed(false)
- {
- }
-
- PTEWrapper::~PTEWrapper()
- {
- }
-
- /// @brief Flush virtual address.
- /// @param VirtAddr
- void PageManager::FlushTLB(UIntPtr VirtAddr)
- {
- if (VirtAddr == kBadAddress)
- return;
-
- hal_flush_tlb();
- }
-
- /// @brief Reclaim freed page.
- /// @return
- bool PTEWrapper::Reclaim()
- {
- if (!this->fPresent)
- {
- this->fPresent = true;
- return true;
- }
-
- return false;
- }
-
- /// @brief Request a PTE.
- /// @param Rw r/w?
- /// @param User user mode?
- /// @param ExecDisable disable execution on page?
- /// @return
- PTEWrapper PageManager::Request(Boolean Rw, Boolean User, Boolean ExecDisable, SizeT Sz)
- {
- // Store PTE wrapper right after PTE.
- VoidPtr ptr = NewOS::HAL::hal_alloc_page(Rw, User, Sz);
-
- return PTEWrapper{Rw, User, ExecDisable, reinterpret_cast<UIntPtr>(ptr)};
- }
-
- /// @brief Disable PTE.
- /// @param wrapper the wrapper.
- /// @return
- bool PageManager::Free(Ref<PTEWrapper*>& wrapper)
- {
- if (wrapper)
- {
- if (!Detail::page_disable(wrapper->VirtualAddress()))
- return false;
- return true;
- }
-
- return false;
- }
-
- /// @brief Virtual PTE address.
- /// @return The virtual address of the page.
- const UIntPtr PTEWrapper::VirtualAddress()
- {
- return (fVirtAddr);
- }
-
- bool PTEWrapper::Shareable()
- {
- return fShareable;
- }
-
- bool PTEWrapper::Present()
- {
- return fPresent;
- }
-
- bool PTEWrapper::Access()
- {
- return fAccessed;
- }
-
- void PTEWrapper::NoExecute(const bool enable)
- {
- this->fExecDisable = enable;
- }
-
- const bool& PTEWrapper::NoExecute()
- {
- return this->fExecDisable;
- }
-} // namespace NewOS