>: >From what I can tell, prom_init should get called from head.S before jal
>: start_kernel. What am I missing?
>
>Have you tried adding a few lines of assembler in head.S that tweaks
>the LEDs to make sure that it is even getting called?
I just did it. Even if I put it right before the 'jal prom_init' in head.S
it works, but not if I put it inside prom_init.
Any ideas why it's not jumping to my code in prom_init? It's a simple jal
instruction. What else can it do? The linker complains if I '#ifdef 0' out
my function, so it knows where it is. What is it doing? The only thing I
can think of at this point is that the bootloader is not loading my code at
80084d7c.
I've even disassembled the kernel - it's doing exactly what I expected it to
do:
00000000800025e0 <kernel_entry>:
// vmlinux starts executing here
// it does a few simple initialzation steps first
// figure what cpu it is
800025e0: 1000002a b 8000268c <cpu_probe>
800025e4: 00000000 nop
00000000800025e8 <probe_done>:
// clear .bss
800025e8: 3c088009 lui $t0,0x8009
800025ec: 65084e10 daddiu $t0,$t0,19984
800025f0: ad000000 sw $zero,0($t0)
800025f4: 3c09800b lui $t1,0x800b
800025f8: 65298bec daddiu $t1,$t1,-29716
800025fc: 25080004 addiu $t0,$t0,4
80002600: 1509fffe bne $t0,$t1,800025fc <probe_done+14>
80002604: ad000000 sw $zero,0($t0)
// make the LED blink with a 1 second cycle
// this code DOES get executed
80002608: 24020010 li $v0,16
8000260c: 3c01ab00 lui $at,0xab00
80002610: a4220240 sh $v0,576($at)
80002614: 24020010 li $v0,16
80002618: 3c01ab00 lui $at,0xab00
8000261c: a4220242 sh $v0,578($at)
80002620: 24020001 li $v0,1
80002624: 3c01ab00 lui $at,0xab00
80002628: a4220248 sh $v0,584($at)
// jump and link to prom_init
8000262c: 0c02135f jal 80084d7c <prom_init>
80002630: 00000000 nop
...
0000000080084d7c <prom_init>:
// this code apparently DOES NOT get executed
// ok, it thinks that there are parameters on the stack
80084d7c: 27bdffe8 addiu $sp,$sp,-24
// get ready to make the LED blink with a 1/10 second cycle - faster so
I can see the difference
80084d80: 24020001 li $v0,1
// kind of odd how it puts this here out of order
// why is it storing the return address like this?
80084d84: afbf0010 sw $ra,16($sp)
// back to blinking
80084d88: 3c01ab00 lui $at,0xab00
80084d8c: a4220240 sh $v0,576($at)
80084d90: 3c01ab00 lui $at,0xab00
80084d94: a4220242 sh $v0,578($at)
80084d98: 3c01ab00 lui $at,0xab00
// other code in prom_init that I would like executed
80084d9c: 0c01414f jal 8005053c <scr_init>
// finish setting up the blinking
// so odd getting used to this delay slot thing
80084da0: a4220248 sh $v0,584($at)
// do some more stuff
80084da4: 3c048008 lui $a0,0x8008
80084da8: 0c0140e3 jal 8005038c <scr_puts>
80084dac: 24849fc0 addiu $a0,$a0,-24640
80084db0: 3c048008 lui $a0,0x8008
80084db4: 0c0140e3 jal 8005038c <scr_puts>
80084db8: 24849fd4 addiu $a0,$a0,-24620
80084dbc: 8fbf0010 lw $ra,16($sp)
80084dc0: 00001021 move $v0,$zero
// return from prom_init
80084dc4: 03e00008 jr $ra
80084dc8: 27bd0018 addiu $sp,$sp,24
Regards,
Brad
|