Subject: Re: Boot code of linuxppc v. netbsd
To: Dan Jacobowitz <youngdrow@geocities.com>
From: Stephen Ma <Stephen.Ma@jtec.com.au>
List: port-powerpc
Date: 01/06/1998 21:46:53
>>>>> "Dan" == Dan Jacobowitz <youngdrow@geocities.com> writes:

Dan> Well, it should be fairly easy to determine - later tonight I'll
Dan> hack my way through the source to coffboot to have it show me the
Dan> values of those parameters.  Unless I'm mistaken, the parameters
Dan> should be in r3, r4, r5, r6, r7; I'll print those values out,
Dan> etc.

Dan> It seems to me that they aren't really needed passed - don't they
Dan> come from boot-file in the firmware?  We could grab them with
Dan> getprop.

The only needed parameter passed to ofwboot's _start() is the open
firmware entry point (3rd argument, in r5). The others are ignorable
(for the moment). Since the Linux boot code also depends on this
parameter being valid, it would seem to suggest that that value is
being passed correctly.

Also, regarding the comments about differences in the number of
arguments to _start() and main(), this doesn't appear to be a problem
- all of the arguments are passed in registers, so a mismatched number
of arguments merely means that some value is placed in a register by
the calling code, and subsequently ignored by the called routine.

Dan> Also, I note that a vmlinux.coff has only a .text, .data, and
Dan> .bss while we have seven or so sections.

ws> This shouldn't matter.

Ummm. Maybe it does. Recall Makoto Fujiwara's reported boot messages:

-- 

0 > boot fd:ofwboot.xcf loading XCOFF
tsize=AD18 dsize=9C0 bsize=16A0 entry=2000C 
SECTIONS:
.text    00020000 00020000 0000AD18 000001EC
.rodata  0002AD18 0002AD18 0000083C 0000AF04
.sdata2  0002B554 0002B554 00000000 00000000
.data    0006B558 0006B558 000009C0 0000B740
.got     0006BF18 0006BF18 00000010 0000C100
.sdata   0006BF28 0006BF28 00000000 00000000
.sbss    0006BF28 0006BF28 0000003C 00000000
.bss     0006BF70 0006BF70 000016A0 00000000
.comment 0006D610 0006D610 000003E8 0000C110
.note    0006D9F8 0006D9F8 00000028 0000C4F8
loading .text, done..
loading .data, done..
clearing .bss, done..
DEFAULT CATCH!, code=FFF00400 at   %SRR0: 9421FFF0   %SRR1: 40003070 

-- 

The boot code only mentions "loading .text", "loading .data", and
"clearing .bss". Are the other sections really loaded?

Also interesting is that the Linux coffboot code goes to much trouble
to move everything into .text, .data and .bss. Perhaps the Mac's open
firmware xcoff loader only bothers with those sections...

- S