boottime kernel relocation, what I missed?

Becky Bruce becky.bruce at
Tue Jul 17 05:10:38 EST 2007

On Jul 13, 2007, at 5:07 PM, meerkat wrote:

> Figure that out, the bootstrap actually mapped the first 16M from  
> C000000 to
> the physicall address,
> so calling a c routine, as long as it is in the first 16M, is OK

I think you're still not understanding the fact that "bl" is a  
*relative* branch - the branch target in the instruction encoding is  
just an offset from the current address, not an effective address.   
The bl should work correctly whether the code is actually running at  
the link address reported by nm (0xcxxxxxxx in this case), or if it  
has been loaded and executed elsewhere.

Refer to the 32-bit Programming Environments Manual for PowerPC, or  
in the EREF (if you're using a BookE part - e500/e200) for more  
details.  If you're just learning PowerPC assembler, you should  
really give this book a good thourough read.

> meerkat wrote:
>> Good day all,
>> For the first time I begin working on PPC, and on low level, and  
>> right
>> start from boot sequence, one issue puzzled me.
>> After bootstrap code (zImage) uncompressed the kernel vmLinux to  
>> physical
>> memory (say from addr 0),
>> it jumps to the kernel entry point, _start, using physically address.

If you read the book specified above, you will see that branch  
instructions always specify an effective address, not a physical  
address.  You can disable translation or map the address so EA=PA,  
but that's a different issue.


More information about the Linuxppc-embedded mailing list