diff --git a/arch/arm64/src/common/arm64_cpustart.c b/arch/arm64/src/common/arm64_cpustart.c index 25a25eaa1924c..c3fc0d2de6abe 100644 --- a/arch/arm64/src/common/arm64_cpustart.c +++ b/arch/arm64/src/common/arm64_cpustart.c @@ -217,12 +217,6 @@ int up_cpu_start(int cpu) void arm64_boot_secondary_c_routine(void) { - struct tcb_s *tcb = current_task(this_cpu()); - - /* Init idle task to percpu reg */ - - up_update_task(tcb); - #ifdef CONFIG_ARCH_HAVE_MPU arm64_mpu_init(false); #endif @@ -231,6 +225,15 @@ void arm64_boot_secondary_c_routine(void) arm64_mmu_init(false); #endif + /* We need to confirm that current_task has been initialized. */ + + while (!current_task(this_cpu())); + + /* Init idle task to percpu reg */ + + up_update_task(current_task(this_cpu())); + + arm64_gic_secondary_init(); arm64_smp_init_top();