Implement address validation by querying the task's page directory.

This is way better than walking the region lists. I suppose we could
even let the hardware trigger a page fault and handle that. That'll
be the next step in the evolution here I guess.
This commit is contained in:
Andreas Kling 2018-11-01 12:45:51 +01:00
parent f76fcd1e62
commit 0f70b9105f
Notes: sideshowbarker 2024-07-19 18:35:09 +09:00
5 changed files with 82 additions and 34 deletions

View file

@ -40,6 +40,8 @@ bool is_kmalloc_address(void* ptr)
{
if (ptr >= (byte*)ETERNAL_BASE_PHYSICAL && ptr < s_next_eternal_ptr)
return true;
if (ptr >= (byte*)PAGE_ALIGNED_BASE_PHYSICAL && ptr < s_next_page_aligned_ptr)
return true;
return ptr >= (void*)BASE_PHYS && ptr <= ((void*)BASE_PHYS + POOL_SIZE);
}