summaryrefslogtreecommitdiff
path: root/sys/vm
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/vm
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/vm')
-rw-r--r--sys/vm/vm_map.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index ae93c38..0d27738 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -47,14 +47,14 @@
* be enforced via a panic.
*/
static void
-vm_map_cleanup(struct vm_ctx *ctx, vaddr_t va, size_t bytes_aligned,
- size_t granule)
+vm_map_cleanup(struct vas vas, struct vm_ctx *ctx, vaddr_t va,
+ size_t bytes_aligned, size_t granule)
{
__assert(bytes_aligned != 0);
__assert((bytes_aligned & (granule - 1)) == 0);
for (size_t i = 0; i < bytes_aligned; i += 0x1000) {
- if (pmap_unmap(ctx, va + i) != 0) {
+ if (pmap_unmap(ctx, vas, va + i) != 0) {
/*
* XXX: This shouldn't happen... If it somehow does,
* then this should be handled.
@@ -75,7 +75,7 @@ vm_map_cleanup(struct vm_ctx *ctx, vaddr_t va, size_t bytes_aligned,
* machine's page granule, typically a 4k boundary.
*/
int
-vm_map_create(vaddr_t va, paddr_t pa, vm_prot_t prot, size_t bytes)
+vm_map_create(struct vas vas, vaddr_t va, paddr_t pa, vm_prot_t prot, size_t bytes)
{
size_t granule = vm_get_page_size();
int s;
@@ -95,10 +95,10 @@ vm_map_create(vaddr_t va, paddr_t pa, vm_prot_t prot, size_t bytes)
}
for (uintptr_t i = 0; i < bytes; i += granule) {
- s = pmap_map(ctx, va + i, pa + i, prot);
+ s = pmap_map(ctx, vas, va + i, pa + i, prot);
if (s != 0) {
/* Something went a bit wrong here, cleanup */
- vm_map_cleanup(ctx, va, i, bytes);
+ vm_map_cleanup(vas, ctx, va, i, bytes);
return -1;
}
}
@@ -111,7 +111,7 @@ vm_map_create(vaddr_t va, paddr_t pa, vm_prot_t prot, size_t bytes)
* address space.
*/
int
-vm_map_destroy(vaddr_t va, size_t bytes)
+vm_map_destroy(struct vas vas, vaddr_t va, size_t bytes)
{
struct vm_ctx *ctx = vm_get_ctx();
size_t granule = vm_get_page_size();
@@ -128,7 +128,7 @@ vm_map_destroy(vaddr_t va, size_t bytes)
}
for (uintptr_t i = 0; i < bytes; i += granule) {
- s = pmap_unmap(ctx, va + i);
+ s = pmap_unmap(ctx, vas, va + i);
if (s != 0) {
return -1;
}