No subject
Mon Jun 16 08:58:23 EST 2008
f0024000 l d kernel.kspace 00000000
f0024000 g O kernel.kspace 00004000 _kernel_space_pagetable
Kernel goes haywire immediately after "switch_to_virt()" in
"init_memory()". It seems to be accessing kernel page tables/page dir
at address 0x8002e000 and 0x8002fc00. It then goes on forever as if
in a loop. Looks like the virtual-physical translation causes it to
loop forever.
I'm using gcc-3.4.4. Below is the code generated by the assembler
Here r1 = 0x80008000 is "phybase" in the function "init_memory", which
is the start of the ram - mentioned in the device specific config.
"
800245ec: ee012f10 mcr 15, 0, r2, cr1, cr0, {0}
800245f0: e261320f rsb r3, r1, #-268435456 ;
0xf0000000 { if r1=0x80008000 then r3 = 0x6FFF8000, which is
"_start"}
800245f4: e08dd003 add sp, sp, r3
800245f8: e08f0003 add r0, pc, r3 {r0 = 0xF001C5F8 =
virtual(pc = 0x800245c) }
800245fc: e1a0f000 mov pc, r0 { pc becomes
physical(0xF001C5F8) = 0x800245c -- which means it'll keep looping
here??? }
80024600: e1a00007 mov r0, r7 { Shouldn't this be the
addr loaded in pc in the above stmt in order to go to the next stmt? }
"
Upon carefully observing the above generated code, I noticed that the
addr loaded in "pc" should be virtual(0x80024600), so that control
goes to the next stmt with MMU enabled. This means that the value
loaded in r3 be 0xF0000000(VIRT_ADDR_RAM) + 4 (1 address word). This
in turn means that in "switch_to_virt()" the value of
"KERNEL_RO_OFFSET" should be (VIRT_ADDR_RAM - *(physbase)) + 4.
Does this logic make sense? Am I missing something? Or the code is
generated incorrectly? Please lemme know.
However, when I tried changing "KERNEL_RO_OFFSET" to "(VIRT_ADDR_RAM
- *(physbase)) + 4", there was no behavior changed observed in the
kernel. The kernel still seems to be going haywire immediately after
"switch_to_virt()" in "init_memory()". It seems to be accessing kernel
page tables/page dir at address 0x8002e000 and 0x8002fc00. It then
goes on forever as if in a loop. Looks like the virtual-physical
translation causes it to loop forever.
Am I missing something? Kindly lemme know.
Any help would be appreciated.
Thanks,
Ashish
More information about the Developer
mailing list