NeKernel dev
Loading...
Searching...
No Matches
PageMgr.h
Go to the documentation of this file.
1// a way to create and find our pages.
2// I'm thinking about a separate way of getting a paged area.
3
4/* ========================================
5
6 Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
7
8======================================== */
9
10#pragma once
11
12#include <NeKit/Config.h>
13#include <NeKit/Ref.h>
14
15namespace Kernel {
16class PageMgr;
17
18class PTEWrapper final {
19 public:
20 explicit PTEWrapper(Boolean Rw = false, Boolean User = false, Boolean ExecDisable = false,
21 UIntPtr Address = 0);
22
24
25 PTEWrapper& operator=(const PTEWrapper&) = default;
26 PTEWrapper(const PTEWrapper&) = default;
27
28 public:
30
31 Void NoExecute(const bool enable = false);
33
34 operator bool() { return fVirtAddr; }
35
36 bool Reclaim();
37 bool Shareable();
38 bool Present();
39 bool Access();
40
41 private:
51
52 private:
53 friend class PageMgr;
54 friend class Pmm;
55};
56
57struct PageMgr final {
58 public:
59 PageMgr() = default;
60 ~PageMgr() = default;
61
62 PageMgr& operator=(const PageMgr&) = default;
63 PageMgr(const PageMgr&) = default;
64
65 public:
66 PTEWrapper Request(Boolean Rw, Boolean User, Boolean ExecDisable, SizeT Sz, SizeT Pad);
67 bool Free(Ref<PTEWrapper>& wrapper);
68
69 private:
70 void FlushTLB();
71
72 private:
73 friend PTEWrapper;
74 friend class Pmm;
75};
76} // namespace Kernel
friend class PageMgr
Definition PageMgr.h:53
UIntPtr fVirtAddr
Definition PageMgr.h:45
UIntPtr VirtualAddress()
Virtual PTE address.
Definition PageMgr.cc:72
Boolean fUser
Definition PageMgr.h:43
PTEWrapper(Boolean Rw=false, Boolean User=false, Boolean ExecDisable=false, UIntPtr Address=0)
Definition PageMgr.cc:17
friend class Pmm
Definition PageMgr.h:54
Boolean fCache
Definition PageMgr.h:46
PTEWrapper & operator=(const PTEWrapper &)=default
bool Present()
Definition PageMgr.cc:80
Boolean fWt
Definition PageMgr.h:48
Boolean fPresent
Definition PageMgr.h:49
PTEWrapper(const PTEWrapper &)=default
bool Access()
Definition PageMgr.cc:84
bool Reclaim()
Reclaim freed page.
Definition PageMgr.cc:40
bool Shareable()
Definition PageMgr.cc:76
Boolean fExecDisable
Definition PageMgr.h:44
Boolean fAccessed
Definition PageMgr.h:50
Bool NoExecute()
Definition PageMgr.cc:92
Boolean fShareable
Definition PageMgr.h:47
Boolean fRw
Definition PageMgr.h:42
Reference wrapper class. /// =========================================================== ///.
Definition Ref.h:22
System User class.
Definition UserMgr.h:49
UPS inline definitions.
Definition Device.h:12
void Void
Definition Config.h:87
__SIZE_TYPE__ SizeT
Definition Config.h:60
bool Boolean
Definition Config.h:49
__UINTPTR_TYPE__ UIntPtr
Definition Config.h:62
bool Bool
Definition Config.h:50
Definition PageMgr.h:57
PTEWrapper Request(Boolean Rw, Boolean User, Boolean ExecDisable, SizeT Sz, SizeT Pad)
Request a PTE.
Definition PageMgr.cc:54
PageMgr(const PageMgr &)=default
PageMgr & operator=(const PageMgr &)=default
friend class Pmm
Definition PageMgr.h:74
~PageMgr()=default
PageMgr()=default
void FlushTLB()
Flush virtual address.
Definition PageMgr.cc:32
friend PTEWrapper
Definition PageMgr.h:73
bool Free(Ref< PTEWrapper > &wrapper)
Disable BitMap.
Definition PageMgr.cc:64