ptos/amd64+hal: Add page unmap interface
Signed-off-by: Chloe M <chloe@mensia.org>
This commit is contained in:
@@ -231,3 +231,30 @@ HalMmuMapPage(
|
||||
MdTlbFlushSingle(VirtualBase);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
PT_STATUS
|
||||
HalMmuUnmapPage(MMU_VAS *Vas, UPTR VirtualBase, MMU_PAGESIZE PageSize)
|
||||
{
|
||||
UPTR *PageTable;
|
||||
USIZE PageTableIndex;
|
||||
|
||||
if (Vas == NULL) {
|
||||
return STATUS_INVALID_PARAM;
|
||||
}
|
||||
|
||||
if (!MmuPageSizeValid(PageSize)) {
|
||||
return STATUS_INVALID_PARAM;
|
||||
}
|
||||
|
||||
PageTable = MmuPageMapExtract(Vas, VirtualBase, PAGEMAP_PML1, false);
|
||||
if (PageTable == NULL) {
|
||||
return STATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
PageTableIndex = MmuPageMapIndex(VirtualBase, PAGEMAP_PML1);
|
||||
|
||||
/* Unmap and flush the TLB */
|
||||
PageTable[PageTableIndex] = 0;
|
||||
MdTlbFlushSingle(VirtualBase);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user