--- zzzz-none-000/linux-4.4.60/arch/arm64/kernel/head.S 2017-04-08 07:53:53.000000000 +0000 +++ scorpion-7490-727/linux-4.4.60/arch/arm64/kernel/head.S 2021-02-04 17:41:59.000000000 +0000 @@ -423,7 +423,17 @@ str xzr, [x6], #8 // Clear BSS b 1b 2: +#ifdef CONFIG_THREAD_INFO_IN_TASK + adrp x4, init_thread_union + add sp, x4, #THREAD_SIZE + adr_l x5, init_task + msr sp_el0, x5 // Save thread_info +#else adr_l sp, initial_sp, x4 + mov x4, sp + and x4, x4, #~(THREAD_SIZE - 1) + msr sp_el0, x4 // Save thread_info +#endif str_l x21, __fdt_pointer, x5 // Save FDT pointer str_l x24, memstart_addr, x6 // Save PHYS_OFFSET mov x29, #0 @@ -610,8 +620,16 @@ ENDPROC(secondary_startup) ENTRY(__secondary_switched) +#ifdef CONFIG_THREAD_INFO_IN_TASK + ldr x0, [x21, #CPU_BOOT_STACK] // get secondary_data.stack + mov sp, x0 + ldr x0, [x21, #CPU_BOOT_TASK] +#else ldr x0, [x21] // get secondary_data.stack mov sp, x0 + and x0, x0, #~(THREAD_SIZE - 1) +#endif + msr sp_el0, x0 // save thread_info mov x29, #0 b secondary_start_kernel ENDPROC(__secondary_switched)