diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-07 02:35:15 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-07 02:35:15 +0200 |
| commit | 4f4ca1c5ce3a87b0b59249bd8d34aafb20bc0909 (patch) | |
| tree | fef71ca6afe0712ac69de83a0dc49ca70ec26219 | |
| parent | 256e54f04323215a6b4e964e3955c606563c2dae (diff) | |
PageManager.cxx: Add documentation.
| -rw-r--r-- | Private/Source/PageManager.cxx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Private/Source/PageManager.cxx b/Private/Source/PageManager.cxx index 0704734c..722df55e 100644 --- a/Private/Source/PageManager.cxx +++ b/Private/Source/PageManager.cxx @@ -29,12 +29,16 @@ PTEWrapper::PTEWrapper(Boolean Rw, Boolean User, Boolean ExecDisable, PTEWrapper::~PTEWrapper() {} +/// @brief Flush virtual address. +/// @param VirtAddr void PageManager::FlushTLB(UIntPtr VirtAddr) { if (VirtAddr == kBadAddress) return; hal_flush_tlb(VirtAddr); } +/// @brief Reclaim freed page. +/// @return bool PTEWrapper::Reclaim() { if (!this->fPresent) { this->fPresent = true; @@ -44,13 +48,21 @@ bool PTEWrapper::Reclaim() { 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) { // Store PTE wrapper right after PTE. VoidPtr ptr = NewOS::HAL::hal_alloc_page(Rw, User); - return PTEWrapper{Rw, User, ExecDisable, (UIntPtr)ptr}; + 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; @@ -60,8 +72,10 @@ bool PageManager::Free(Ref<PTEWrapper *> &wrapper) { return false; } +/// @brief Virtual PTE address. +/// @return const UIntPtr PTEWrapper::VirtualAddress() { - return (fVirtAddr + sizeof(PTE) + sizeof(PTEWrapper)); + return (fVirtAddr); } bool PTEWrapper::Shareable() { return fShareable; } |
