diff --git a/usr/src/sp1/amd64/cpu/cpu_mmu.c b/usr/src/sp1/amd64/cpu/cpu_mmu.c index 79d5e54..6ce54c4 100644 --- a/usr/src/sp1/amd64/cpu/cpu_mmu.c +++ b/usr/src/sp1/amd64/cpu/cpu_mmu.c @@ -267,3 +267,24 @@ mu_mmu_map(struct mmu_vfr *vfr, uintptr_t vma, uintptr_t pma, md_tlb_flush(vma); return STATUS_SUCCESS; } + +status_t +mu_mmu_unmap(struct mmu_vfr *vfr, uintptr_t vma, pagesize_t ps) +{ + uintptr_t *tbl; + size_t index; + + if (vfr == NULL) { + return STATUS_INVALID_PARAM; + } + + tbl = mmu_extract_level(vfr, vma, PAGELVL_PML1, false); + if (tbl == NULL) { + return STATUS_NOT_FOUND; + } + + index = mmu_extract_index(vma, PAGELVL_PML1); + tbl[index] = 0; + md_tlb_flush(vma); + return STATUS_SUCCESS; +} diff --git a/usr/src/sp1/head/mu/mmu.h b/usr/src/sp1/head/mu/mmu.h index bad2a49..4c07945 100644 --- a/usr/src/sp1/head/mu/mmu.h +++ b/usr/src/sp1/head/mu/mmu.h @@ -62,6 +62,19 @@ status_t mu_mmu_map( pagesize_t ps ); +/* + * Destroy a virtual memory mapping in the virtual + * fuck region + * + * @vfr: Virtual fuck region to unmap within + * @vma: Virtual memory address to unmap + * @ps: Pagesize of address to unmap + */ +status_t mu_mmu_unmap( + struct mmu_vfr *vfr, uintptr_t vma, + pagesize_t ps +); + /* * Fork a VFR and clear out the lower half *