From 6ce7dffe92775f262384a028af233999a7d18048 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 1 Feb 2024 17:24:09 +0100 Subject: Kernel: Really big improvements on Paged Memory Model. Bootloader: Design shift in BFileReader class. Signed-off-by: Amlal El Mahrouss --- Private/NewKit/PageManager.hpp | 103 +++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 51 deletions(-) (limited to 'Private/NewKit/PageManager.hpp') diff --git a/Private/NewKit/PageManager.hpp b/Private/NewKit/PageManager.hpp index b5337268..fdde95f8 100644 --- a/Private/NewKit/PageManager.hpp +++ b/Private/NewKit/PageManager.hpp @@ -18,64 +18,65 @@ #ifndef kBadAddress #define kBadAddress (0) -#endif // #ifndef kBadAddress +#endif // #ifndef kBadAddress -namespace HCore -{ +namespace HCore { class PageManager; -class PTEWrapper final -{ - public: - explicit PTEWrapper(Boolean Rw = false, Boolean User = false, Boolean ExecDisable = false, UIntPtr Address = 0); - ~PTEWrapper(); - - PTEWrapper &operator=(const PTEWrapper &) = default; - PTEWrapper(const PTEWrapper &) = default; - - public: - void FlushTLB(Ref &pm); - const UIntPtr &VirtualAddress(); - - bool Reclaim(); - bool Shareable(); - bool Present(); - bool Access(); - - private: - Boolean m_Rw; - Boolean m_User; - Boolean m_ExecDisable; - UIntPtr m_VirtAddr; - Boolean m_Cache; - Boolean m_Shareable; - Boolean m_Wt; - Boolean m_Present; - Boolean m_Accessed; - - private: - friend class PageManager; - friend class Pmm; +class PTEWrapper final { + public: + explicit PTEWrapper(Boolean Rw = false, Boolean User = false, + Boolean ExecDisable = false, UIntPtr Address = 0); + ~PTEWrapper(); + + PTEWrapper &operator=(const PTEWrapper &) = default; + PTEWrapper(const PTEWrapper &) = default; + + public: + void FlushTLB(Ref &pm); + const UIntPtr &VirtualAddress(); + + void NoExecute(const bool enable = false); + const bool &NoExecute(); + + bool Reclaim(); + bool Shareable(); + bool Present(); + bool Access(); + + private: + Boolean m_Rw; + Boolean m_User; + Boolean m_ExecDisable; + UIntPtr m_VirtAddr; + Boolean m_Cache; + Boolean m_Shareable; + Boolean m_Wt; + Boolean m_Present; + Boolean m_Accessed; + + private: + friend class PageManager; + friend class Pmm; }; -struct PageManager final -{ - public: - PageManager() = default; - ~PageManager() = default; +struct PageManager final { + public: + PageManager() = default; + ~PageManager() = default; - PageManager &operator=(const PageManager &) = default; - PageManager(const PageManager &) = default; + PageManager &operator=(const PageManager &) = default; + PageManager(const PageManager &) = default; - public: - PTEWrapper *Request(Boolean Rw, Boolean User, Boolean ExecDisable); - bool Free(Ref &wrapper); + public: + PTEWrapper *Request(Boolean Rw, Boolean User, Boolean ExecDisable); + bool Free(Ref &wrapper); - private: - void FlushTLB(UIntPtr VirtAddr); + private: + void FlushTLB(UIntPtr VirtAddr); - private: - friend PTEWrapper; - friend class Pmm; + private: + friend PTEWrapper; + friend class Pmm; }; -} // namespace HCore +} // namespace HCore -- cgit v1.2.3