From bccb4fec8a3ad8a46e08124c9adf1aa54a87c9cb Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 17 Sep 2025 17:45:24 -0400 Subject: kern/amd64: mmu: Add mmu_free_vas() to cleanup VAS Introduce a new resource deallocation function that destroys a specified virtual address space. Signed-off-by: Ian Moffett --- src/sys/arch/amd64/cpu/mmu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/sys/arch/amd64/cpu/mmu.c') diff --git a/src/sys/arch/amd64/cpu/mmu.c b/src/sys/arch/amd64/cpu/mmu.c index face548..2b98d78 100644 --- a/src/sys/arch/amd64/cpu/mmu.c +++ b/src/sys/arch/amd64/cpu/mmu.c @@ -393,6 +393,17 @@ mmu_write_vas(struct vm_vas *vas) return 0; } +/* + * Allocate the frame used for a VAS + */ +int +mmu_free_vas(struct vm_vas *vas) +{ + vm_free_frame(vas->cr3, 1); + vas->cr3 = 0; + return 0; +} + /* * Verify that we are in a known state */ -- cgit v1.2.3