From 32f395140a653e5c7e3e114faeb7314e223f0eea Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 24 May 2024 20:35:31 -0400 Subject: kernel: vm: Make pmap_create_vas() return int Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/pmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/arch') 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 -- cgit v1.2.3