stos: hal+amd64: Add helper to unmap single page

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-27 23:53:12 +00:00
parent 5e99093e9f
commit 6f3d273fe9
2 changed files with 31 additions and 0 deletions
+22
View File
@@ -274,3 +274,25 @@ HalMmuMapSingle(MMU_VAS *Vas, UPTR Vma, UPTR Pma, USHORT Flags, MMU_PAGESIZE Pag
MmuInvlpg(Vma); MmuInvlpg(Vma);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
ST_STATUS
HalMmuUnmapSingle(MMU_VAS *Vas, UPTR Vma, MMU_PAGESIZE PageSize)
{
UPTR *PageTable;
USHORT Index;
if (Vas == NULL) {
return STATUS_INVALID_PARAM;
}
PageTable = MmuExtractLevel(Vas, Vma, PAGE_LEVEL_PML1, false);
if (PageTable == NULL) {
return STATUS_NOT_FOUND;
}
/* Unmap the page */
Index = MmuLevelIndex(Vma, PAGE_LEVEL_PML1);
PageTable[Index] = 0;
MmuInvlpg(Vma);
return STATUS_SUCCESS;
}
+9
View File
@@ -63,4 +63,13 @@ ST_STATUS HalMmuMapSingle(
USHORT Flags, MMU_PAGESIZE PageSize USHORT Flags, MMU_PAGESIZE PageSize
); );
/*
* Unmap a single page of memory
*
* @Vas: Virtual address space to unmap within
* @Vma: Virtual address to unmap
* @PageSize: Pagesize to unmap
*/
ST_STATUS HalMmuUnmapSingle(MMU_VAS *Vas, UPTR Vma, MMU_PAGESIZE PageSize);
#endif /* !_HAL_MMU_H_ */ #endif /* !_HAL_MMU_H_ */