mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Add CheckRegion function
This commit is contained in:
parent
a0b98e8c57
commit
053e167002
@ -66,6 +66,32 @@ namespace Memory
|
|||||||
PTFlag Flag = PTFlag::P,
|
PTFlag Flag = PTFlag::P,
|
||||||
MapType Type = MapType::FourKiB);
|
MapType Type = MapType::FourKiB);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check if the region has the specified flag.
|
||||||
|
*
|
||||||
|
* @param VirtualAddress Virtual address of the region.
|
||||||
|
* @param Length Length of the region.
|
||||||
|
* @param Flag Flag to check.
|
||||||
|
* @param Type Type of the page. Check MapType enum.
|
||||||
|
* @return true if the region has the specified flag, false otherwise.
|
||||||
|
*/
|
||||||
|
bool CheckRegion(void *VirtualAddress,
|
||||||
|
size_t Length,
|
||||||
|
PTFlag Flag = PTFlag::P,
|
||||||
|
MapType Type = MapType::FourKiB)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < Length; i += PAGE_SIZE_4K)
|
||||||
|
{
|
||||||
|
if (!this->Check((void *)((uintptr_t)VirtualAddress + i), Flag, Type))
|
||||||
|
{
|
||||||
|
debug("address %#lx for pt %#lx has flag(s) %#lx",
|
||||||
|
(uintptr_t)VirtualAddress + i, this->pTable, Flag);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get physical address of the page.
|
* @brief Get physical address of the page.
|
||||||
* @param VirtualAddress Virtual address of the page.
|
* @param VirtualAddress Virtual address of the page.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user