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/main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'common/main.c') diff --git a/common/main.c b/common/main.c index 5248d2a..9eb6414 100644 --- a/common/main.c +++ b/common/main.c @@ -23,11 +23,17 @@ * Sets up all kernel subsystems and jumps into \c init program, does not * return. * - * @param fdt Global FDT pointer. + * @param fdt Global FDT pointer in physical memory. + * @param ram_base RAM base. * @return Should not. */ -void __main main(void *fdt) +void __main main(void *fdt, uintptr_t ram_base) { + set_ram_base(ram_base); + + /* convert physical address to virtual address */ + fdt = __va(fdt); + /* dbg uses direct mapping at this point */ init_dbg(fdt); setup_dmap_dbg(); -- cgit v1.3