|
16 | 16 | #include <asm/asm_pointer_auth.h> |
17 | 17 | #include <asm/assembler.h> |
18 | 18 | #include <asm/boot.h> |
| 19 | +#include <asm/bug.h> |
19 | 20 | #include <asm/ptrace.h> |
20 | 21 | #include <asm/asm-offsets.h> |
21 | 22 | #include <asm/cache.h> |
@@ -393,6 +394,18 @@ SYM_FUNC_START_LOCAL(__create_page_tables) |
393 | 394 | ret x28 |
394 | 395 | SYM_FUNC_END(__create_page_tables) |
395 | 396 |
|
| 397 | + /* |
| 398 | + * Create a final frame record at task_pt_regs(current)->stackframe, so |
| 399 | + * that the unwinder can identify the final frame record of any task by |
| 400 | + * its location in the task stack. We reserve the entire pt_regs space |
| 401 | + * for consistency with user tasks and kthreads. |
| 402 | + */ |
| 403 | + .macro setup_final_frame |
| 404 | + sub sp, sp, #PT_REGS_SIZE |
| 405 | + stp xzr, xzr, [sp, #S_STACKFRAME] |
| 406 | + add x29, sp, #S_STACKFRAME |
| 407 | + .endm |
| 408 | + |
396 | 409 | /* |
397 | 410 | * The following fragment of code is executed with the MMU enabled. |
398 | 411 | * |
@@ -447,9 +460,9 @@ SYM_FUNC_START_LOCAL(__primary_switched) |
447 | 460 | #endif |
448 | 461 | bl switch_to_vhe // Prefer VHE if possible |
449 | 462 | add sp, sp, #16 |
450 | | - mov x29, #0 |
451 | | - mov x30, #0 |
452 | | - b start_kernel |
| 463 | + setup_final_frame |
| 464 | + bl start_kernel |
| 465 | + ASM_BUG() |
453 | 466 | SYM_FUNC_END(__primary_switched) |
454 | 467 |
|
455 | 468 | .pushsection ".rodata", "a" |
@@ -639,14 +652,14 @@ SYM_FUNC_START_LOCAL(__secondary_switched) |
639 | 652 | cbz x2, __secondary_too_slow |
640 | 653 | msr sp_el0, x2 |
641 | 654 | scs_load x2, x3 |
642 | | - mov x29, #0 |
643 | | - mov x30, #0 |
| 655 | + setup_final_frame |
644 | 656 |
|
645 | 657 | #ifdef CONFIG_ARM64_PTR_AUTH |
646 | 658 | ptrauth_keys_init_cpu x2, x3, x4, x5 |
647 | 659 | #endif |
648 | 660 |
|
649 | | - b secondary_start_kernel |
| 661 | + bl secondary_start_kernel |
| 662 | + ASM_BUG() |
650 | 663 | SYM_FUNC_END(__secondary_switched) |
651 | 664 |
|
652 | 665 | SYM_FUNC_START_LOCAL(__secondary_too_slow) |
|
0 commit comments