summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/amd64
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 16:21:12 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 16:26:25 -0500
commit21a122bcffcd4863a7f56b9680396919b909d232 (patch)
treeb153a2dcb006b8057264ea6bac1ceffe6b750bb1 /sys/arch/amd64/amd64
parentf621116fcaf15cd5dc0c53dab9a88f53f0effcd8 (diff)
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 <ian@osmora.org>
Diffstat (limited to 'sys/arch/amd64/amd64')
-rw-r--r--sys/arch/amd64/amd64/pmap.c12
1 files changed, 6 insertions, 6 deletions
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