Kernel: Add pointer validation API to page table
This commit is contained in:
parent
d1183f0bf6
commit
dd0b8c4140
|
@ -110,6 +110,13 @@ namespace Kernel
|
||||||
return *s_current;
|
return *s_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PageTable::is_valid_pointer(uintptr_t pointer)
|
||||||
|
{
|
||||||
|
if (!is_canonical(pointer))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static uint64_t* allocate_zeroed_page_aligned_page()
|
static uint64_t* allocate_zeroed_page_aligned_page()
|
||||||
{
|
{
|
||||||
void* page = kmalloc(PAGE_SIZE, PAGE_SIZE, true);
|
void* page = kmalloc(PAGE_SIZE, PAGE_SIZE, true);
|
||||||
|
|
|
@ -29,13 +29,15 @@ namespace Kernel
|
||||||
static PageTable& kernel();
|
static PageTable& kernel();
|
||||||
static PageTable& current();
|
static PageTable& current();
|
||||||
|
|
||||||
|
static bool is_valid_pointer(uintptr_t);
|
||||||
|
|
||||||
static BAN::ErrorOr<PageTable*> create_userspace();
|
static BAN::ErrorOr<PageTable*> create_userspace();
|
||||||
~PageTable();
|
~PageTable();
|
||||||
|
|
||||||
void unmap_page(vaddr_t);
|
void unmap_page(vaddr_t);
|
||||||
void unmap_range(vaddr_t, size_t bytes);
|
void unmap_range(vaddr_t, size_t bytes);
|
||||||
|
|
||||||
void map_range_at(paddr_t, vaddr_t, size_t, flags_t);
|
void map_range_at(paddr_t, vaddr_t, size_t bytes, flags_t);
|
||||||
void map_page_at(paddr_t, vaddr_t, flags_t);
|
void map_page_at(paddr_t, vaddr_t, flags_t);
|
||||||
|
|
||||||
paddr_t physical_address_of(vaddr_t) const;
|
paddr_t physical_address_of(vaddr_t) const;
|
||||||
|
|
Loading…
Reference in New Issue