linux-mips-fnet
[Top] [All Lists]

RE: Booting Linux on Vadem Clio

To: "'Bradley D. LaRonde'" <brad@ltc.com>, <linuxce-devel@linuxce.org>, <linux-mips@fnet.fr>
Subject: RE: Booting Linux on Vadem Clio
From: "Mike Klar" <wyldfier@iname.com>
Date: Mon, 19 Jul 1999 01:01:00 -0400
Importance: Normal
In-reply-to: <01d601bed19c$26e381a0$b1119526@tecra.ltc.com>
> Any ideas why it's not jumping to my code in prom_init?

You're probably causing an exception somehow, that is not being properly
handled.  I would guess a TLB miss or cache error.

> 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
...
>     // 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)

Did you cut out the part where it sets up the stack pointer?  If this is the
first place it uses the stack and sp isn't initialized properly, this may do
bad things.

To answer your question about why it saves off ra, you make another
subroutine call further on via jal, which will overwrite ra with the new
return address, so the compiler saves it off to the stack.  The compiler
arranged the instructions that way because it knows the MIPS CPU (at least
R3000 and R4000) can't use a register the instruction after it's been
modified due to pipelining, so it rearranged the code to put at least one
instruction between the 'addiu $sp,$sp,-24' and the 'sw $ra,16($sp)'.

Mike K.

<Prev in Thread] Current Thread [Next in Thread>