|
81 | 81 | * x20 primary_entry() .. __primary_switch() CPU boot mode |
82 | 82 | * x21 primary_entry() .. start_kernel() FDT pointer passed at boot in x0 |
83 | 83 | * x22 create_idmap() .. start_kernel() ID map VA of the DT blob |
84 | | - * x23 __primary_switch() physical misalignment/KASLR offset |
85 | 84 | * x25 primary_entry() .. start_kernel() supported VA size |
86 | 85 | * x28 create_idmap() callee preserved temp register |
87 | 86 | */ |
@@ -408,24 +407,6 @@ SYM_FUNC_START_LOCAL(create_idmap) |
408 | 407 | 0: ret x28 |
409 | 408 | SYM_FUNC_END(create_idmap) |
410 | 409 |
|
411 | | -SYM_FUNC_START_LOCAL(create_kernel_mapping) |
412 | | - adrp x0, init_pg_dir |
413 | | - mov_q x5, KIMAGE_VADDR // compile time __va(_text) |
414 | | -#ifdef CONFIG_RELOCATABLE |
415 | | - add x5, x5, x23 // add KASLR displacement |
416 | | -#endif |
417 | | - adrp x6, _end // runtime __pa(_end) |
418 | | - adrp x3, _text // runtime __pa(_text) |
419 | | - sub x6, x6, x3 // _end - _text |
420 | | - add x6, x6, x5 // runtime __va(_end) |
421 | | - mov_q x7, SWAPPER_RW_MMUFLAGS |
422 | | - |
423 | | - map_memory x0, x1, x5, x6, x7, x3, (VA_BITS - PGDIR_SHIFT), x10, x11, x12, x13, x14 |
424 | | - |
425 | | - dsb ishst // sync with page table walker |
426 | | - ret |
427 | | -SYM_FUNC_END(create_kernel_mapping) |
428 | | - |
429 | 410 | /* |
430 | 411 | * Initialize CPU registers with task-specific and cpu-specific context. |
431 | 412 | * |
@@ -752,44 +733,13 @@ SYM_FUNC_START_LOCAL(__primary_switch) |
752 | 733 | adrp x2, init_idmap_pg_dir |
753 | 734 | bl __enable_mmu |
754 | 735 |
|
755 | | - // Clear BSS |
756 | | - adrp x0, __bss_start |
757 | | - mov x1, xzr |
758 | | - adrp x2, init_pg_end |
759 | | - sub x2, x2, x0 |
760 | | - bl __pi_memset |
761 | | - dsb ishst // Make zero page visible to PTW |
762 | | - |
763 | 736 | adrp x1, early_init_stack |
764 | 737 | mov sp, x1 |
765 | 738 | mov x29, xzr |
766 | 739 | mov x0, x20 // pass the full boot status |
767 | 740 | mov x1, x22 // pass the low FDT mapping |
768 | | - bl __pi_init_feature_override // Parse cpu feature overrides |
769 | | - |
770 | | -#ifdef CONFIG_RELOCATABLE |
771 | | - adrp x23, KERNEL_START |
772 | | - and x23, x23, MIN_KIMG_ALIGN - 1 |
773 | | -#ifdef CONFIG_RANDOMIZE_BASE |
774 | | - mov x0, x22 |
775 | | - bl __pi_kaslr_early_init |
776 | | - bic x0, x0, #SZ_2M - 1 |
777 | | - orr x23, x23, x0 // record kernel offset |
778 | | -#endif |
779 | | -#endif |
780 | | - bl create_kernel_mapping |
| 741 | + bl __pi_early_map_kernel // Map and relocate the kernel |
781 | 742 |
|
782 | | - adrp x1, init_pg_dir |
783 | | - load_ttbr1 x1, x1, x2 |
784 | | -#ifdef CONFIG_RELOCATABLE |
785 | | - mov x0, x23 |
786 | | - bl __pi_relocate_kernel |
787 | | -#endif |
788 | | -#ifdef CONFIG_UNWIND_PATCH_PAC_INTO_SCS |
789 | | - ldr x0, =__eh_frame_start |
790 | | - ldr x1, =__eh_frame_end |
791 | | - bl __pi_scs_patch_vmlinux |
792 | | -#endif |
793 | 743 | ldr x8, =__primary_switched |
794 | 744 | adrp x0, KERNEL_START // __pa(KERNEL_START) |
795 | 745 | br x8 |
|
0 commit comments