diff --git a/lib/bootargs/bootargs.c b/lib/bootargs/bootargs.c index 91522626..ffffcad4 100644 --- a/lib/bootargs/bootargs.c +++ b/lib/bootargs/bootargs.c @@ -7,12 +7,13 @@ */ #include -#include -#include -#include #include -#include #include +#include +#include +#include +#include +#include #if WITH_KERNEL_VM #include @@ -20,9 +21,6 @@ #define LOCAL_TRACE 0 -/* saved by the main entry point in lk */ -extern ulong lk_boot_args[4]; - static bool boot_args_valid = false; static struct lk_boot_arg *boot_args; diff --git a/platform/jh7110/platform.c b/platform/jh7110/platform.c index db2d579b..77bfe2a4 100644 --- a/platform/jh7110/platform.c +++ b/platform/jh7110/platform.c @@ -7,6 +7,7 @@ */ #include #include +#include #include #include #include @@ -30,8 +31,6 @@ #define LOCAL_TRACE 1 -extern ulong lk_boot_args[4]; - #if WITH_KERNEL_VM #define DEFAULT_MEMORY_SIZE (MEMSIZE) /* try to fetch from the emulator via the fdt */ diff --git a/platform/qemu-virt-riscv/platform.c b/platform/qemu-virt-riscv/platform.c index 53255027..9fbfc371 100644 --- a/platform/qemu-virt-riscv/platform.c +++ b/platform/qemu-virt-riscv/platform.c @@ -7,6 +7,7 @@ */ #include #include +#include #include #include #include @@ -37,8 +38,6 @@ #define LOCAL_TRACE 0 -extern ulong lk_boot_args[4]; - #if WITH_KERNEL_VM #define DEFAULT_MEMORY_SIZE (MEMSIZE) /* try to fetch from the emulator via the fdt */ diff --git a/platform/rosco-m68k/platform.c b/platform/rosco-m68k/platform.c index c5e16fb2..c3f5d568 100644 --- a/platform/rosco-m68k/platform.c +++ b/platform/rosco-m68k/platform.c @@ -6,6 +6,7 @@ * https://opensource.org/licenses/MIT */ #include +#include #include #include #include @@ -44,19 +45,19 @@ struct rosco_system_data_block { }; STATIC_ASSERT(sizeof(struct rosco_system_data_block) == 0x20); -const volatile struct rosco_system_data_block *sdb = (void *)0x400; - void platform_early_init(void) { duart_early_init(); + volatile struct rosco_system_data_block *sdb = (void *)lk_boot_args[0]; + // default to 1MB memory at 0 uint32_t membase = 0x0; uint32_t memsize = 0x100000; // 1MB if (sdb->magic != ROSCO_SDB_MAGIC) { - dprintf(INFO, "ROSCO-M68K: firmware failed magic check\n"); + dprintf(INFO, "ROSCO-M68K: firmware failed magic check at %p\n", sdb); } else { - dprintf(INFO, "ROSCO-M68K: firmware structure at 0x400 - 0x41f:\n"); + dprintf(INFO, "ROSCO-M68K: firmware structure at %p - %p:\n", sdb, sdb + 0x1f); hexdump((void *)sdb, sizeof(*sdb)); printf("cpu family %u speed %u\n", sdb->cpu_info >> 29, sdb->cpu_info & 0x1fffffff); diff --git a/top/include/lk/main.h b/top/include/lk/main.h index d473f61f..6bfc230b 100644 --- a/top/include/lk/main.h +++ b/top/include/lk/main.h @@ -12,6 +12,9 @@ __BEGIN_CDECLS +// Possible boot args passed from various arch's start.S +extern ulong lk_boot_args[4]; + void lk_main(ulong arg0, ulong arg1, ulong arg2, ulong arg3) __NO_RETURN __EXTERNALLY_VISIBLE; void lk_secondary_cpu_entry(void); void lk_init_secondary_cpus(uint secondary_cpu_count);