[SLOF] [PATCH] OF: Add a separate direct kernel loading word

Segher Boessenkool segher at kernel.crashing.org
Thu Jul 14 04:20:02 AEST 2022


On Wed, Jul 13, 2022 at 01:38:03PM +1000, Jordan Niethe wrote:
> Ah ok, it is the first case happening. For example, here the crash
> comes after going to $0000000104002f24
> when it should be going to $0000000004002f24. Like this:
> 
> => 0x4002cd8:    add     r7,r7,r5
> 2: /x $r7 = 0xffff566c

A 64-bit program gets that r7 from a sign-extended load (lwa), which
would have given 0xffffffffffff566c.  A program compiled with -m32 uses
lwz here though (there is no lwa on actual 32-bit implementations, and
on some implementations lwa is slower than lwz as well).

> > "init-program" is supposed to set the MSR state correctly (in ciregs
> > >srr1), based on the ELF headers (and btw the same is true for the LE
> > flag etc).  A little ELF parsing is needed.
> 
> When booting from memory with the -kernel option, qemu has already
> loaded the kernel into memory and tells SLOF where to jump into?
> SLOF is not looking at the ELF at all in this case is it?

But *is* there an ELF loaded, or just a binary blob?  If the info is
there it would be beneficial to use it, raw blobs have more opportunity
to go wrong (and almost no opportunity to report what is wrong).

Thanks,


Segher


More information about the SLOF mailing list