From 21a122bcffcd4863a7f56b9680396919b909d232 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 16:21:12 -0500 Subject: kernel: Require VAS arg in vm + loader refactor This commit adds vas argument to VM mapping functions as well as changing how mapping is done in the loader. This commit also fixes weird error handling and parses needed PHDRs within the loader Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/pmap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index 7b8609a..2760532 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -134,9 +134,8 @@ pmap_extract(uint8_t level, vaddr_t va, uintptr_t *pmap, bool allocate) * TODO: Ensure operations here are serialized. */ static int -pmap_modify_tbl(struct vm_ctx *ctx, vaddr_t va, size_t val) +pmap_modify_tbl(struct vm_ctx *ctx, struct vas vas, vaddr_t va, size_t val) { - struct vas vas = pmap_read_vas(); uintptr_t *pml4 = PHYS_TO_VIRT(vas.top_level); uintptr_t *pdpt, *pd, *tbl; int status = 0; @@ -167,17 +166,18 @@ done: } int -pmap_map(struct vm_ctx *ctx, vaddr_t va, paddr_t pa, vm_prot_t prot) +pmap_map(struct vm_ctx *ctx, struct vas vas, vaddr_t va, paddr_t pa, + vm_prot_t prot) { uint32_t flags = pmap_prot_to_pte(prot); - return pmap_modify_tbl(ctx, va, (pa | flags)); + return pmap_modify_tbl(ctx, vas, va, (pa | flags)); } int -pmap_unmap(struct vm_ctx *ctx, vaddr_t va) +pmap_unmap(struct vm_ctx *ctx, struct vas vas, vaddr_t va) { - return pmap_modify_tbl(ctx, va, 0); + return pmap_modify_tbl(ctx, vas, va, 0); } struct vas -- cgit v1.2.3