MMU initilization memory layout on arm64 - MarekBykowski/readme GitHub Wiki

locatioon counter determines the _text position/addr

arch/arm64/kernel/vmlinux.lds.S
. = KIMAGE_VADDR + TEXT_OFFSET;
                           
.head.text : {             
        _text = .;         
        HEAD_TEXT          
}                          
  • KIMAGE_VADDR - the virtual address of the start of the kernel image (arch/arm64/include/asm/memory.h). KIMAGE_VADDR is calculated "hard" to infer, is multiple factors but more less KASAN_SHADOW_END and PAGE_END. PAGE_END is computed from a number of virtual bits available, for A53 - 48 bits. KIMAGE_VADDR is 0xffff_8000_1000_0000
  • TEXT_OFFSET := 0x00080000 if no randomizer (ramdiomizing that offset) - The byte offset of the kernel image in RAM from the start of RAM (arch/arm64/Makefile)
  • __PHYS_OFFSET (KERNEL_START - TEXT_OFFSET) - the physical address of the start of memory (arch/arm64/kernel/head.S). __PHYS_OFFSET is from memstart_addr. memstart_addr from memory banks (arch/arm64/mm/init.c)
  • KERNEL_START _text
  • KERNEL_END _end

http://embeddedvenkatpari.blogspot.com/2016/08/mmu-initialization-on-arm.html - not the greatest but can do