From: Lee HongWoo <hongwoo7@gmail.com>
To: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: Question about linux boot procedure (head_64.S)
Date: Wed, 2 Sep 2009 09:25:33 +0900 [thread overview]
Message-ID: <5e2889710909011725t275dcdc8oa8be58b6e32e51f4@mail.gmail.com> (raw)
In-Reply-To: <4A9D5A99.5030101@am.sony.com>
[-- Attachment #1: Type: text/plain, Size: 2834 bytes --]
On Wed, Sep 2, 2009 at 2:32 AM, Geoff Levand <geoffrey.levand@am.sony.com>wrote:
> On 09/01/2009 03:58 AM, Lee HongWoo wrote:
> > __start (in head_64.S)
> > ---> __start_initialization_multiplatform (in head_64.S)
> > ---> __boot_from_prom (in head_64.S)
> > ---> prom_init ( in prom_init.c)
> > ---> __start ???
> >
> > And I don't understand where __start is called, because I can find
> __start
> > only in head_64.S.
> > If it calls __start in head_64.S, it's a recursive call.
> >
> > Can anybody explain about this precedure ?
>
> In the general case, __start is the entry point of the kernel.
> It is where the bootloader or boot wrapper program jumps to
> when it transfers control to the kernel.
>
> -Geoff
>
>
Thanks Geoff,
I believe __start is the entry point of the kernel in this case.
And the entry point is __GLOBAL(__start) in the head_64.S.
What I asked is where or what __start is called in the prom_init.c
__start(hdr, KERNELBASE + offset, 0);
Below is the simple function call flow of linux kernel boot procedure.
file : head_64.S
_GLOBAL(__start)
/* NOP this out unconditionally */
BEGIN_FTR_SECTION
b .__start_initialization_multiplatform
END_FTR_SECTION(0, 1)
....
_GLOBAL(__start_initialization_multiplatform)
/*
* Are we booted from a PROM Of-type client-interface ?
*/
cmpldi cr0,r5,0
bne .__boot_from_prom /* yes -> prom */
....
_STATIC(__boot_from_prom)
/* Save parameters */
mr r31,r3
mr r30,r4
mr r29,r5
mr r28,r6
mr r27,r7
/*
* Align the stack to 16-byte boundary
* Depending on the size and layout of the ELF sections in the
initial
* boot binary, the stack pointer will be unalignet on PowerMac
*/
rldicr r1,r1,0,59
/* Make sure we are running in 64 bits mode */
bl .enable_64b_mode
/* put a relocation offset into r3 */
bl .reloc_offset
LOAD_REG_IMMEDIATE(r2,__toc_start)
addi r2,r2,0x4000
addi r2,r2,0x4000
/* Relocate the TOC from a virt addr to a real addr */
add r2,r2,r3
/* Restore parameters */
mr r3,r31
mr r4,r30
mr r5,r29
mr r6,r28
mr r7,r27
/* Do all of the interaction with OF client interface */
bl .prom_init
/* We never return */
trap
file : prom_init.c
unsigned long __init prom_init(unsigned long r3, unsigned long r4,
unsigned long pp,
unsigned long r6, unsigned long r7)
{
...
...
__start(hdr, KERNELBASE + offset, 0);
return 0;
}
HongWoo.
[-- Attachment #2: Type: text/html, Size: 3540 bytes --]
next prev parent reply other threads:[~2009-09-02 0:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-01 10:58 Question about linux boot procedure (head_64.S) Lee HongWoo
2009-09-01 17:32 ` Geoff Levand
2009-09-02 0:25 ` Lee HongWoo [this message]
2009-09-02 1:19 ` Geoff Levand
2009-09-02 0:47 ` Michael Ellerman
-- strict thread matches above, loose matches on Subject: below --
2009-09-01 11:27 Lee HongWoo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e2889710909011725t275dcdc8oa8be58b6e32e51f4@mail.gmail.com \
--to=hongwoo7@gmail.com \
--cc=geoffrey.levand@am.sony.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).