Wednesday, August 15, 2012

Arm Linux Bootup + MMU : Assembly Code Walkthrough



PAGE_OFFSET ->> 0xC0000000

reset

x-loader

uboot

Kernel Decompressor ->> Decompresses the Kernel to 0xC0008000

Kernel Starts ->> MMU Off , I-Dont care, D-Cache off , r0 = 0 , r1=machine nr , r2 = atags_pointer
arch/arm/kernel/head.S
Entry Point -> stext

Ensure Supervisor mode
Irqs disabled
lookup_processor_type ->>r5=procinfo , r9=cpuid
/*
* r1 = machine no, r2 = atags or dtb,
* r8 = phys_offset, r9 = cpuid, r10 = procinfo
*/
__vet_atags
__fixup_smp
__create_page_tables
/*
* Setup the initial page tables.  We only setup the barest
* amount which are required to get the kernel running, which
* generally means mapping in the kernel code.
*
* r8 = phys_offset, r9 = cpuid, r10 = procinfo
*
* Returns:
*  r0, r3, r5-r7 corrupted
*  r4 = physical page table address
*/

        /*
* Clear the swapper page table
*/

        /*
* Create identity mapping to cater for __enable_mmu.
* This identity mapping will be removed by paging_init().
*/

        /*
* Now setup the pagetables for our kernel direct
* mapped region.
*/

        /*
* Then map boot params address in r2 or the first 1MB (2MB with LPAE)
* of ram if boot params address is not specified.
*/

        /*
* Map in IO space for serial debugging.
* This allows debug messages to be output
* via a serial console before paging_init.
*/
set R13 = __mmap_switched  -> Function executed after mmu is enabled.
TTBR1 is set to swapper_pg_dir
enable_mmu
__mmap_switched ->> virtual address
start_kernel

No comments:

Post a Comment