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/include/sys/loader.h | 4 +++- sys/include/vm/map.h | 6 ++++-- sys/include/vm/pmap.h | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'sys/include') diff --git a/sys/include/sys/loader.h b/sys/include/sys/loader.h index 6107da2..c1aa426 100644 --- a/sys/include/sys/loader.h +++ b/sys/include/sys/loader.h @@ -31,6 +31,7 @@ #define _SYS_LOADER_H_ #include +#include #define AT_NULL 0 #define AT_IGNORE 1 @@ -54,7 +55,8 @@ struct auxval { #if defined(_KERNEL) -int loader_load(const void *dataptr, struct auxval *auxv); +int loader_load(struct vas vas, const void *dataptr, struct auxval *auxv, + size_t load_base, char **ld_path); #endif /* defined(_KERNEL) */ #endif /* !_SYS_LOADER_H_ */ diff --git a/sys/include/vm/map.h b/sys/include/vm/map.h index 1cce8b8..078a5e8 100644 --- a/sys/include/vm/map.h +++ b/sys/include/vm/map.h @@ -34,7 +34,9 @@ #include #include -int vm_map_create(vaddr_t va, paddr_t pa, vm_prot_t prot, size_t bytes); -int vm_map_destroy(vaddr_t va, size_t bytes); +int vm_map_create(struct vas vas, vaddr_t va, paddr_t pa, vm_prot_t prot, + size_t bytes); + +int vm_map_destroy(struct vas vas, vaddr_t va, size_t bytes); #endif /* !_VM_MMAP_H_ */ diff --git a/sys/include/vm/pmap.h b/sys/include/vm/pmap.h index 85c6753..ebabd32 100644 --- a/sys/include/vm/pmap.h +++ b/sys/include/vm/pmap.h @@ -87,10 +87,10 @@ struct vas pmap_read_vas(void); /* * Map a physical address to a virtual address. */ -int pmap_map(struct vm_ctx *, vaddr_t, paddr_t, vm_prot_t); +int pmap_map(struct vm_ctx *, struct vas, vaddr_t, paddr_t, vm_prot_t); /* * Unmap a page. */ -int pmap_unmap(struct vm_ctx *, vaddr_t); +int pmap_unmap(struct vm_ctx *, struct vas, vaddr_t); #endif /* _VM_PMAP_H_ */ -- cgit v1.2.3