Problem with OF entry point

Segher Boessenkool segher at kernel.crashing.org
Wed Mar 10 02:12:10 EST 2004


> I finally found out that OF is fairly unhappy that we clobber SPRG2
> in enter_prom() (entry.S). We do that to save our stack pointer which
> is supposed to be "clobbered" by OF. We were also "restoring" more
> registers than necessary in that code.
>
> I made the assumption that since we are running in OF runtime env.,
> our stack pointer is already a 32 bits value, so we don't bother
> if it's top 32 bits are clobbered (cleared actually) by OF. So this
> saving/restoring of SP looks completely useless to me. If this was
> wrong, then we would be broken anyway since we pass to OF pointers
> to things on the stack...

The client interface is required to not change _either_ SPRG2 or R1.
It is allowed to modify only LR, CTR, XER, CR[01567], and R3-R12.
(And, when running in virtual mode, some of the stuff related to
MMU functions, of course).

So normally you don't need any special save/restore, as the normal
calling conventions will handle it Just Fine(tm).

Unfortunately, Apple's 64-bit OF only has a 32-bit Client Interface,
and seems to be a bit buggy as well, as you found out ;-)

Your changes look sane to me, though.  But why do we need assembler
code for this anyway?  Except for fixing up buggy firmware...

It might make a lot of sense to run the kernel-side client-interface
code (i.e., prom.c) in 32-bit mode, if there's only a 32-bit
client interface available?


Segher


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list