[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setup code
hi,
somebody please help me understanding the following code. since
this code is referenced from setup.c how does the compiler put in
the physical address of the machine descriptor in r5 ? also this address
i dont understand why it is metioned as physical !!!
/*
* Lookup machine architecture in the linker-build list of
architectures.
* Note that we can't use the absolute addresses for the __arch_info
* lists since we aren't running with the MMU on (and therefore, we are
* not in the correct address space). We have to calculate the offset.
*
* r1 = machine architecture number
* Returns:
* r3, r4, r6 corrupted
* r5 = mach_info pointer in physical address space
*/
.type __lookup_machine_type, %function
__lookup_machine_type:
adr r3, 3b
ldmia r3, {r4, r5, r6}
sub r3, r3, r4 @ get offset between
virt&phys
add r5, r5, r3 @ convert virt
addresses to
add r6, r6, r3 @ physical address
space
rsb r3, r5, r6 @ number of machine
types
teq r3, #SIZEOF_MACHINE_DESC @ only one?
ldreq r1, [r5] @ if so do not bother
with r1
beq 2f @ ...and be happy.
1: ldr r3, [r5] @ get machine type
teq r3, r1 @ matches loader
number?
beq 2f @ found
add r5, r5, #SIZEOF_MACHINE_DESC @ next machine_desc
cmp r5, r6
blt 1b
mov r5, #0 @ unknown machine
2: mov pc, lr
TIA
regards
Srinivas Bakki