aboutsummaryrefslogtreecommitdiff
path: root/common/main.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-05-11 22:55:31 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-05-11 22:55:31 +0300
commit27ffa747f36aee9c1d5bbc61395a078238366070 (patch)
treef37c544aaca6bebd1cc146d1eb002483c7cfd474 /common/main.c
parent3109effe7297232e17c1792e63c3a9c7d129a4eb (diff)
downloadkmi-27ffa747f36aee9c1d5bbc61395a078238366070.tar.gz
kmi-27ffa747f36aee9c1d5bbc61395a078238366070.zip
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?
Diffstat (limited to 'common/main.c')
-rw-r--r--common/main.c10
1 files changed, 8 insertions, 2 deletions
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();