Subject: Re: netbsd-current and ibook g4: kernel freeze
To: leon zadorin <leonleon77@gmail.com>
From: leon zadorin <leonleon77@gmail.com>
List: port-macppc
Date: 02/02/2007 10:22:02
On 2/2/07, Allen Briggs <briggs@netbsd.org> wrote:

> > But where is openfirmware_entry actually defined/assigned in macppc
> > port?
>
> It's set by the ofwinit() call which is called first thing on entry
> into the kernel (__start in locore.S).
>

hmmm - i think my lack of assembly is hurting me here (by the way
Allen - thank you very much for that lesson on "1f" and "1b" - i
certainly appreciate your time on this...)

from what i can see in macppc/macppc/locore.S is:
/*
 * Startup entry.  Note, this must be the first thing in the text
 * segment!
 */
	.text
	.globl	__start
__start:
	bl	_C_LABEL(ofwinit)	/* init OF */

Having done "grep -R ofwinit ./" in macppc dir, I found no explicit
definition of "ofwinit"... soooo I presumed (probably incorrectly?)
that it is actually defined in:

powerpc/oea/ofw_subr.S as:

/*
 * Called by start to save the initial OFW state so we can restore it
 * when call back to OFW.
 */
ENTRY_NOPROFILE(ofwinit)
#ifdef	FIRMWORKSBUGS
	mfmsr	0
	andi.	0,0,PSL_IR|PSL_DR
	beq	1f

	mflr	30
	bl	_C_LABEL(ofwr_init)
	mtlr	30
1:
#endif
	lis	8,openfirmware_entry@ha
	stw	5,openfirmware_entry@l(8) /* save client interface handler*/


But then (given that "FIRMWORKSBUGS" does not appear to be defined
during my build), is the code:

	lis	8,openfirmware_entry@ha
	stw	5,openfirmware_entry@l(8) /* save client interface handler*/

the one which defines the "openfirmware_entry" (if so how does it
manage to do this???) ? ... or is it done elsewhere? May be I am
missunderstaning the whole "openfirmware_entry" use - is it meant to
be some function/"block of executable code/memory" to which the
execution jumps? Once again, very sorry if I am asking all these
stupid questions - just really wanna get this iBook going :-)

Kind regards
Leon.