Kernel: Add PageTable::Flags::CacheDisable

Also fix multiple places where we were using uint8_t as page table
flags instead of PageTable::flags_t which we promoted to uint16_t
while back.
This commit is contained in:
Bananymous
2023-08-06 23:59:30 +03:00
parent 3df97c36e6
commit 6fcb191ca0
7 changed files with 36 additions and 18 deletions

View File

@@ -13,12 +13,13 @@ namespace Kernel
using flags_t = uint16_t;
enum Flags : flags_t
{
Present = 1,
ReadWrite = 2,
UserSupervisor = 4,
Execute = 8,
Reserved = 256,
Present = (1 << 0),
ReadWrite = (1 << 1),
UserSupervisor = (1 << 2),
CacheDisable = (1 << 4),
Reserved = (1 << 9),
Execute = (1 << 15),
Used = Present | Reserved,
};

View File

@@ -15,9 +15,9 @@ namespace Kernel
public:
// Create virtual range to fixed virtual address
static BAN::ErrorOr<BAN::UniqPtr<VirtualRange>> create_to_vaddr(PageTable&, vaddr_t, size_t, uint8_t flags);
static BAN::ErrorOr<BAN::UniqPtr<VirtualRange>> create_to_vaddr(PageTable&, vaddr_t, size_t, PageTable::flags_t flags);
// Create virtual range to virtual address range
static BAN::ErrorOr<BAN::UniqPtr<VirtualRange>> create_to_vaddr_range(PageTable&, vaddr_t vaddr_start, vaddr_t vaddr_end, size_t, uint8_t flags);
static BAN::ErrorOr<BAN::UniqPtr<VirtualRange>> create_to_vaddr_range(PageTable&, vaddr_t vaddr_start, vaddr_t vaddr_end, size_t, PageTable::flags_t flags);
// Create virtual range in kernel memory with kmalloc
static BAN::ErrorOr<BAN::UniqPtr<VirtualRange>> create_kmalloc(size_t);
~VirtualRange();
@@ -26,7 +26,7 @@ namespace Kernel
vaddr_t vaddr() const { return m_vaddr; }
size_t size() const { return m_size; }
uint8_t flags() const { return m_flags; }
PageTable::flags_t flags() const { return m_flags; }
void set_zero();
void copy_from(size_t offset, const uint8_t* buffer, size_t bytes);
@@ -39,7 +39,7 @@ namespace Kernel
bool m_kmalloc { false };
vaddr_t m_vaddr { 0 };
size_t m_size { 0 };
uint8_t m_flags { 0 };
PageTable::flags_t m_flags { 0 };
BAN::Vector<paddr_t> m_physical_pages;
};