diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-07 14:34:39 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-07 14:34:39 +0300 |
| commit | d592abd8ccc4026c51e196777031eb65c4acc4de (patch) | |
| tree | bfcffec608ede13653a21a56a5b731a4178ecda3 /src/main.c | |
| parent | d1c5e2700add7627e22c49a6021f200f03e8a62b (diff) | |
| download | kmi-d592abd8ccc4026c51e196777031eb65c4acc4de.tar.gz kmi-d592abd8ccc4026c51e196777031eb65c4acc4de.zip | |
misc fixes
+ Align kernel to 2MiB boundary in u-boot
+ Optimize alignment functions a little bit, should still have to check
on real hardware but 'feels' more clean
+ Add early boot debugging
+ Put extra cores we aren't ready to account for to sleep if/when they
boot.
+ Make BASE_PAGE_SIZE constant on riscv64/32, helps the compiler with
some alignment checks among other things.
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -61,8 +61,6 @@ __noreturn void kernel(void *fdt, uintptr_t load_addr, struct vmem *d) /* we should be in kernelspace, so use the virtual address of our FDT. */ fdt = __va(fdt); - /* dbg uses direct mapping at this point */ - init_dbg(fdt); /* start up debugging in kernel IO */ setup_io_dbg(d); @@ -105,6 +103,10 @@ __noreturn void main(unsigned long hart, void *fdt, uintptr_t load_addr) * have to get the function signature right */ (void)hart; + /* dbg uses direct mapping at this point, useful for early init asserts + * and so on */ + init_dbg(fdt); + /** @todo some kind of lottery? */ pm_t ram_base = __fdt_ram_base(fdt); pm_t ram_size = __fdt_ram_size(fdt); @@ -114,6 +116,11 @@ __noreturn void main(unsigned long hart, void *fdt, uintptr_t load_addr) init_mem(fdt); + /* we don't have any debug output just yet but still */ + /* also this is I guess more of an architecture limitation, should the + * whole of main() just be moved to arch? */ + assert(is_aligned(load_addr, order_size(MM_O1))); + struct vmem *d = init_mapping(); to_kernelspace(fdt, load_addr, d, ram_base); unreachable(); |
