Tuesday, July 27, 2010

Entering the kernel

http://lxr.linux.no/#linux+v2.6.34.1/arch/arm/kernel/head.S

Ensure svc mode and IRQ disabled
Read Proc ID from c0,c0 to R9 (=0x411FC083)
Call
__lookup_processor_type:
Found in arch/arm/kernel/head-common.S
Get pointers to __proc_info structures. This structure is formed during compile time.
The addresses held in these structures are VA while we are executing from PA (MMU OFF). 
Hence, we find the offset between virt&phys, which results in = 0xC0000000
With physical addresses, we can dereference table correctly and check for proc matching.
 
Switch back to head.S
Similarly, check machine ID match using __lookup_machine_type table
Next, determine validity of ATAGS by jumping to __vet_atags, again found in head-common.S
/* Determine validity of the r2 atags pointer.  The heuristic requires
 239 * that the pointer be aligned, in the first 16k of physical RAM and
 240 * that the ATAG_CORE marker is first and present.  Future revisions
 241 * of this function may be more lenient with the physical address and
 242 * may also be able to move the ATAGS block if necessary.
 243 *
 244 * r8  = machinfo
 245 *
 246 * Returns:
 247 *  r2 either valid atags pointer, or zero
 248 *  r5, r6 corrupted
 249 */
R2=@0x80000100
Verify ATAG_CORE marker, and return
Next, we call __create_page_tables
Fig: Snapshot just before jumping to __create_page_tables

No comments:

Post a Comment