diff options
author | Ian Moffett <ian@osmora.org> | 2024-05-24 20:35:31 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-05-24 20:35:31 -0400 |
commit | 32f395140a653e5c7e3e114faeb7314e223f0eea (patch) | |
tree | 2a143c01780c88803fdee2f66a6ac59f6dbad88e /sys | |
parent | 157edace4ad3f3703e858e4fdea3d77a0b1832e0 (diff) |
kernel: vm: Make pmap_create_vas() return int
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 10 | ||||
-rw-r--r-- | sys/include/vm/pmap.h | 2 | ||||
-rw-r--r-- | sys/kern/kern_sched.c | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index 6eca948..9071722 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -235,8 +235,8 @@ pmap_unmap(struct vm_ctx *ctx, struct vas vas, vaddr_t va) return pmap_modify_tbl(ctx, vas, va, 0); } -struct vas -pmap_create_vas(struct vm_ctx *ctx) +int +pmap_create_vas(struct vm_ctx *ctx, struct vas *res) { struct vas current_vas = pmap_read_vas(); struct vas new_vas = {0}; @@ -250,8 +250,7 @@ pmap_create_vas(struct vm_ctx *ctx) new_vas.top_level = vm_alloc_pageframe(1); if (new_vas.top_level == 0) { - /* Top level may remain zero to denote failure */ - return new_vas; + return -1; } src = PHYS_TO_VIRT(current_vas.top_level); @@ -269,7 +268,8 @@ pmap_create_vas(struct vm_ctx *ctx) dest[i] = src[i]; } - return new_vas; + *res = new_vas; + return 0; } void diff --git a/sys/include/vm/pmap.h b/sys/include/vm/pmap.h index faad0fb..8c69372 100644 --- a/sys/include/vm/pmap.h +++ b/sys/include/vm/pmap.h @@ -70,7 +70,7 @@ struct vm_ctx { * Create a virtual address space * and return the descriptor. */ -struct vas pmap_create_vas(struct vm_ctx *); +int pmap_create_vas(struct vm_ctx *, struct vas *); /* * Switch the current virtual address space diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 1100f4a..ddc99ca 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -328,7 +328,7 @@ sched_load_init(void) if ((init_bin = initramfs_open("/usr/sbin/init")) == NULL) panic("Could not open /usr/sbin/init\n"); - args.vas = pmap_create_vas(vm_get_ctx()); + pmap_create_vas(vm_get_ctx(), &args.vas); args.argp = argv; args.envp = envp; |