From 27ffa747f36aee9c1d5bbc61395a078238366070 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 11 May 2023 22:55:31 +0300 Subject: arbitrary load address and RAM base detection + Both kind of go hand in hand, made sense to do both at the same time. Some parts feel slightly hacky, the loader works by placing everything on the stack and avoiding global values. Still, seems to work? --- common/pmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/pmem.c') diff --git a/common/pmem.c b/common/pmem.c index 16e6adf..22a1493 100644 --- a/common/pmem.c +++ b/common/pmem.c @@ -609,8 +609,8 @@ void init_pmem(void *fdt) stat_pmem_conf(fdt, &max_order, &base_bits, bits); init_mem(max_order, bits, base_bits); - pm_t ram_size = __get_ramtop(fdt) - RAM_BASE; - pm_t ram_base = (pm_t)__va(RAM_BASE); + pm_t ram_size = __get_ramtop(fdt) - get_ram_base(); + pm_t ram_base = (pm_t)__va(get_ram_base()); pm_t initrd_top = get_initrdtop(fdt); pm_t fdt_top = __get_fdttop(fdt); @@ -629,7 +629,7 @@ void init_pmem(void *fdt) /* mark init stack, this should be unmapped once we get to executing * processes */ - __mark_area_used((pm_t)__va(PM_STACK_BASE), (pm_t)__va(PM_STACK_TOP)); + __mark_area_used(VM_STACK_BASE, VM_STACK_TOP); /* mark kernel */ /* this could be made more explicit, I suppose. */ -- cgit v1.3