[Skiboot] Skiboot on qemu questions

Marty E. Plummer hanetzer at startmail.com
Mon Oct 12 19:48:59 AEDT 2020

On Mon, Oct 12, 2020 at 09:35:10AM +1100, Oliver O'Halloran wrote:
> On Fri, Oct 9, 2020 at 7:36 PM Marty E. Plummer
> <hanetzer-skiboot at use.startmail.com> wrote:
> >
> > On Thu, Oct 08, 2020 at 10:59:37PM -0500, Marty E. Plummer wrote:
> > > 'you in this case' means the firmware (coreboot) I'm running?
> > > I don't recall explicitly enabling MMU but this is all very early work,
> > > so perhaps I did.
> > >
> > > So 0xe40 illegal instructions, got it. Should have RTFM'd a bit more but
> > > I'm pretty excited about current progress and glazed over a bit.
> > Inspection of the hsrr0 and hsrr1 registers at the time of exception
> > leads me to believe an all zero instruction is attempting to be
> > executed.
> > I *think* this may be to do with abi elfv2 toc stuff, since
> > the coreboot flow is basically bootblock calls romstage calls ramstage,
> > which is mostly 'read from boot media to some kind of memory, and jump
> > to it', so its basically executing three elf binaries in a row.
> Is the romstage actually loading an ELF? Parsing the headers, etc is a
> bit more complex than just loading a blob into RAM and jumping into
> it. For skiboot we turn the .elf into a blob at compile time and the
> blob (skiboot.lid) handles initialising the stack, the TOC, and
> re-locating itself. If the romstage is parsing the ELF headers I'd
> double check that the ELF entrypoint is being calculated correctly
> since I've seen that being screwed up by kexec before.
Not exactly an ELF; coreboot uses what they call a SELF, simple elf,
iirc, but yeah.
> > I assume each one should have its own toc & toc pointer set up prior to
> > their equivalent of `int main()`, or at the very least close to it?
> Yep, each loaded image should have its own TOC pointer. I wouldn't
> assume that the compiler inserts anything to initialise the TOC for
> you at boot since we have a bit of ASM in skiboot (and Linux) to
> handle that. The boot time ABIs are generally pretty ad-hoc so
> wouldn't expect anything resembling ABI compliance even if there's a
> full ELF loader in coreboot.
yeah, I'm currently reworking the stage_entry bit into asm to init
the stack and TOC pointers.

More information about the Skiboot mailing list