From 122374c362ba8bb9082385da3c82e264ab594f15 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 7 Jul 2024 07:00:43 +0300 Subject: smp now seems to work + Had some minor issues with a wraparound of size_t that effectively meant that some regions were allocated twice. Also, booting should be a bit more reliable now, turned out that the previous iteration of the booting was just accidentally working due to the kernel being placed 'close enough' in RAM to where it was linked to. Fixed by allocating a vmem of O1 that maps the kernel to a 2MiB boundary at boot, pretty nifty. --- include/arch/vmem.h | 6 ++---- include/kmi/mem.h | 4 ++-- include/kmi/syscalls.h | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/arch/vmem.h b/include/arch/vmem.h index 3daf232..e62c112 100644 --- a/include/arch/vmem.h +++ b/include/arch/vmem.h @@ -151,7 +151,7 @@ vm_t setup_kernel_io(struct vmem *b, vm_t paddr); * @return The vmem node used to build the address space. Probably statically * allocated. */ -struct vmem *direct_mapping(); +struct vmem *init_mapping(); /** * Create new virtual memory space. @@ -190,11 +190,9 @@ void clone_uvmem(struct vmem * restrict r, struct vmem * restrict b); * @param load_addr Address where kernel was loaded to. * @param direct_mapping Direct mapping vmem. * @param ram_base Physical base address of ram. - * @param dmap \ref VM_DMAP. */ __noreturn void to_kernelspace(void *fdt, uintptr_t load_addr, struct vmem *direct_mapping, - pm_t ram_base, - pm_t dmap); + pm_t ram_base); #endif /* KMI_ARCH_PAGES_H */ diff --git a/include/kmi/mem.h b/include/kmi/mem.h index d3c4da2..bf55c61 100644 --- a/include/kmi/mem.h +++ b/include/kmi/mem.h @@ -92,7 +92,7 @@ * @param x Physical address. * @return Corresponding virtual address. */ -#define __va(x) (void *)(((uintptr_t)(x)) + VM_DMAP - get_ram_base()) +#define __va(x) (void *)(((uintptr_t)(x)) + VM_DMAP) /** * Convert virtual address to physical address in direct mapping. @@ -100,7 +100,7 @@ * @param x Virtual address. * @return Corresponding physical address. */ -#define __pa(x) (void *)(((uintptr_t)(x)) - VM_DMAP + get_ram_base()) +#define __pa(x) (void *)(((uintptr_t)(x)) - VM_DMAP) /** * Get page number of physical address. diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h index a94cdf1..93b99a3 100644 --- a/include/kmi/syscalls.h +++ b/include/kmi/syscalls.h @@ -176,6 +176,10 @@ enum sys_user { /** Thread has been orphaned. */ SYS_USER_ORPHANED, + + /** Core has booted an init thread. Only used during booting, should be + * handled specially. */ + SYS_USER_BOOTED, }; /** Which notifications have arrived. */ -- cgit v1.3