Commit 4f58b399 authored by Andrew Jones's avatar Andrew Jones
Browse files

lib/arm/setup: fix and comment init order



While reading code I noticed we need to call thread_info_init before
mem_init to be correct. In practice it hasn't mattered because cpu0
is calling mem_init, and it's cpu index is 0, which is what a fresh
first boot would have it be anyway. With reset tests (coming soon)
combined with mmu tests (hopefully coming someday) it could be
problematic though, so let's fix it. Additionally comment the order
to make sure we maintain it. The io_init dependency on mem_init is
because io_init calls init functions that make use of heap allocation.
Signed-off-by: Andrew Jones's avatarAndrew Jones <drjones@redhat.com>
parent 24f588e7
......@@ -126,12 +126,17 @@ void setup(const void *fdt)
ret = dt_init(&stacktop);
assert(ret == 0);
mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size));
io_init();
cpu_init();
/* cpu_init must be called before thread_info_init */
thread_info_init(current_thread_info(), 0);
/* thread_info_init must be called before mem_init */
mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size));
/* mem_init must be called before io_init */
io_init();
ret = dt_get_bootargs(&bootargs);
assert(ret == 0);
setup_args_progname(bootargs);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment