why do we need reloc_offset ??
HongWoo Lee
hongwoo7 at gmail.com
Wed Sep 2 16:33:53 EST 2009
Hi everyone~
In ther linux kernel code, I found the reloc_offset.
{{{
// file : misc.S
/* Returns (address we are running at) - (address we were linked at)
* for use before the text and data are mapped to KERNELBASE.
*/
_GLOBAL(reloc_offset)
}}}
I couldn't understand the comment saying "Returns (address we are running
at) - (address we were linked at)".
For now, I'm studying each instruction.
And below is best comment I can explain for each instruction.
_GLOBAL(reloc_offset)
mflr r0 // move from link register, save the
return address
bl 1f // bl 1f
1: mflr r3 // move from link register, r3 is just
return address pointing itself
LOAD_REG_IMMEDIATE(r4,1b) // get the 1b address, r4 is the
address
subf r3,r4,r3 // r3 = r3 – r4
mtlr r0 // restore return address
blr
After this, I still don't know why "r3-r4" is the offset.
And what does it mean ??
Please explain to me the reason why we need reloc_offset and the code.
Or let me know any helpful reference about this.
Thank in advance.
HongWoo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090902/6a65c6f4/attachment.htm>
More information about the Linuxppc-dev
mailing list