Port-macppc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

ofwboot.xcf problem (port-macppc/44895)

I've finally got around to look into this (now that I have a spare
mini for experiments and figured out the FAT trick, which makes it
trivial to test new ofwboot as you can just cp the new file).

Apparently the problem is not universal.  macallan@ tells me that
ofwboot.xcf works for him on the mac models that he has.

As Christian Groessler noted in


ofwboot.xcf was broken by r1.25 of sys/lib/libsa/loadfile_elf32.c -
however the problem is not that specific change per se, what made that
change break ofwboot.xcf was the extra allocation it does for the
contents of the .shstrtab section.  With r1.24 (working otherwise)
it's enough to add a dummy allocation to break ofwboot.xcf just like
r1.25 does.

That is rather puzzling.  To make a clean comparison I built an ELF
version of ofwboot that is ~identical to ofwboot.xcf (one of the
section is more aligned, otherwise .text and .data are identical).
That tweaked ELF version still works.  The identical XCoff doesn't.
(Details on building that ELF version is in the pr).

The allocation patterns are obviously the same too and /memory has
identical available ranges before we chain to the kernel.  Yet the
kernel loaded by the XCoff version wedges in a call to openfirmware,
so I guess some mapping is messed up or something.  Adding more dummy
allocs I can make the loaded kernel wedge earlier, when reading
/memory ranges.

I tried to look at the xcoff loader forth code, but it's stripped, and
hence useless.

For a test I also switched from the custom ofwboot/alloc.c to libsa
version, compiled with -DHEAP_VARIABLE and provided with a chunk of
memory we OF_claim once (copied from ofwppc's ofwboot).  That version
of ofwboot.xcf works (note - the heap we OF_claim for libsa's alloc.c
is larger than the cumulative allocation we OF_claim in several alloc
with ofwboot/alloc.c).

I don't see anything obviously wrong with ofwboot/alloc.c and also
note that it does work in the ELF version.  We can just switch to
libsa's alloc.c to get a working ofwboox.xcf I guess, but the puzzle
is taunting.  If anyone has any ideas how to debug this properly,
please come forward.


Home | Main Index | Thread Index | Old Index