<div class="gmail_quote">On Wed, Sep 2, 2009 at 2:32 AM, Geoff Levand <span dir="ltr"><<a href="mailto:geoffrey.levand@am.sony.com">geoffrey.levand@am.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 09/01/2009 03:58 AM, Lee HongWoo wrote:<br>
> __start (in head_64.S)<br>
> ---> __start_initialization_multiplatform (in head_64.S)<br>
> ---> __boot_from_prom (in head_64.S)<br>
> ---> prom_init ( in prom_init.c)<br>
> ---> __start ???<br>
><br>
> And I don't understand where __start is called, because I can find __start<br>
> only in head_64.S.<br>
> If it calls __start in head_64.S, it's a recursive call.<br>
><br>
> Can anybody explain about this precedure ?<br>
<br>
</div>In the general case, __start is the entry point of the kernel.<br>
It is where the bootloader or boot wrapper program jumps to<br>
when it transfers control to the kernel.<br>
<font color="#888888"><br>
-Geoff<br>
<br>
</font></blockquote></div><br>Thanks Geoff, <br><br>I believe __start is the entry point of the kernel in this case. <br>And the entry point is __GLOBAL(__start) in the head_64.S. <br><br>What I asked is where or what __start is called in the prom_init.c __start(hdr, KERNELBASE + offset, 0); <br>
Below is the simple function call flow of linux kernel boot procedure. <br><br>file : head_64.S <br><br>_GLOBAL(__start)<br> /* NOP this out unconditionally */<br>BEGIN_FTR_SECTION<br> b .__start_initialization_multiplatform<br>
END_FTR_SECTION(0, 1)<br><br>.... <br><br>_GLOBAL(__start_initialization_multiplatform)<br> /*<br> * Are we booted from a PROM Of-type client-interface ?<br> */<br> cmpldi cr0,r5,0<br> bne .__boot_from_prom /* yes -> prom */<br>
<br>.... <br><br>_STATIC(__boot_from_prom)<br> /* Save parameters */<br> mr r31,r3<br> mr r30,r4<br> mr r29,r5<br> mr r28,r6<br> mr r27,r7<br><br> /*<br>
* Align the stack to 16-byte boundary<br> * Depending on the size and layout of the ELF sections in the initial<br> * boot binary, the stack pointer will be unalignet on PowerMac<br> */<br>
rldicr r1,r1,0,59<br><br> /* Make sure we are running in 64 bits mode */<br> bl .enable_64b_mode<br><br> /* put a relocation offset into r3 */<br> bl .reloc_offset<br><br> LOAD_REG_IMMEDIATE(r2,__toc_start)<br>
addi r2,r2,0x4000<br> addi r2,r2,0x4000<br><br> /* Relocate the TOC from a virt addr to a real addr */<br> add r2,r2,r3<br><br> /* Restore parameters */<br> mr r3,r31<br>
mr r4,r30<br> mr r5,r29<br> mr r6,r28<br> mr r7,r27<br><br> /* Do all of the interaction with OF client interface */<br> bl .prom_init<br> /* We never return */<br>
trap<br><br><br>file : prom_init.c <br><br>unsigned long __init prom_init(unsigned long r3, unsigned long r4,<br> unsigned long pp,<br> unsigned long r6, unsigned long r7)<br>
{<br> ...<br> ...<br> __start(hdr, KERNELBASE + offset, 0);<br><br> return 0;<br>}<br><br><br>HongWoo. <br><br>