[OpenBIOS] QEMU OpenBIOS booting?

Blue Swirl blauwirbel at gmail.com
Sun Apr 19 22:19:09 CEST 2009


[Trimmed qemu-devel from CC-list]

On 4/19/09, Steven Noonan <steven at uplinklabs.net> wrote:
> On Sun, Apr 19, 2009 at 12:23 PM, Blue Swirl <blauwirbel at gmail.com> wrote:
>  > On 4/19/09, Steven Noonan <steven at uplinklabs.net> wrote:
>  >> On Sun, Apr 19, 2009 at 1:24 AM, Laurent Vivier <Laurent at lvivier.info> wrote:
>  >>  > Le dimanche 19 avril 2009 à 00:50 -0700, Steven Noonan a écrit :
>  >>  >> On Tue, Apr 14, 2009 at 10:46 PM, Steven Noonan <steven at uplinklabs.net> wrote:
>  >>  >> > On Sun, Apr 12, 2009 at 1:39 AM, Laurent Vivier <Laurent at lvivier.info> wrote:
>  >>  >> >> OpenBIOS is not able to boot MacOS X.
>  >>  >> >
>  >>  >> > Well, that's a silly limitation. Is there a reason this isn't
>  >>  >> > implemented? I see that the Mac-on-Linux OpenBIOS version has such
>  >>  >> > support, so it seems strange that the QEMU version does not.
>  >>  >>
>  >>  >> I don't know if anyone here is actually interested (this list seems
>  >>  >> -very- quiet), but...
>  >>  >
>  >>  > Hi,
>  >>  >
>  >>  >> I've been hacking at OpenBIOS for a bit, and I got it to properly read
>  >>  >> Mac OS X discs (it kept failing because it would hit an Apple
>  >>  >> Partition Map header instead of an HFS+ filesystem header). I'm
>  >>  >> working on adding an XCOFF loader, too, so it should be able to boot
>  >>  >> Mac OS X soon.
>  >>  >
>  >>  > You can copy it from OpenHackWare.
>  >>  > I made some tests and it seems to have some memory conflicts between
>  >>  > MacOS kernel and OpenBIOS.
>  >>  >
>  >>  > Good Luck.
>  >>  >
>  >>
>  >>
>  >> Two more pre-XCOFF loader commits up:
>  >>  http://github.com/tycho/openbios/commit/e43daa3447b5ce4a2b05b2f32882e49891156200
>  >>  http://github.com/tycho/openbios/commit/7023b78a10f5632fd08d4749615efd3e73ab1036
>  >
>  > These look fine to me.
>  >
>  >>  And I have something (uncommitted) that at least -loads- the
>  >>  CHRP-embedded XCOFF binaries now, but I am not sure what to do to
>  >>  execute the result. With ELF, it seems you can just use the call_elf()
>  >>  function. I don't know PowerPC assembler (nor the XCOFF format) well
>  >>  enough yet to know what would be necessary for a call_xcoff()
>  >>  function. Anyone want to help out with this?
>  >
>  > Well, call_elf should work regardless of the format. The first and
>  > second parameters will be passed verbatim to OS (Linux uses those for
>  > initrd address and size), the third is the start address that should
>  > be available for all formats. There's some more description near the
>  > function call_elf in start.S.
>  >
>  > So I'd just add something like call_elf(0, 0, xcoff_start) somewhere.
>
>
> Ah, that did what it should've. I guess 'call_elf' is a misnomer?
>
>  I'm not committing the XCOFF loader quite yet. I suspect it would be
>  best to do refactor it to use a similar API to what the ELF loader
>  has, and place it so that it could be shared with the other OpenBIOS
>  targets (pearpc, mol, etc)... Would it be preferred to make the XCOFF
>  loader QEMU-specific or should it be a common API like the ELF loader?

I suspect the other PPC targets do not work. Is XCOFF used outside of Mac?

>  So here's what I get when I try Mac OS X 10.4 (I've enabled a ton of
>  debug output):
>
>
>  Alcarin:qemu steven$ ppc-softmmu/qemu-system-ppc -L pc-bios -cdrom
>  ~/Development/MacOSX-10.4.iso -boot d -M mac99 -nographic
>
>  >> =============================================================
>  >> OpenBIOS 1.0 [Apr 19 2009 19:39]
>  >> Configuration device id QEMU version 1 machine id 1
>  >> CPUs: 1
>  >> Memory: 128M
>  >> UUID: 00000000-0000-0000-0000-000000000000
>  >> CPU type PowerPC,G4
>  Welcome to OpenBIOS v1.0 built on Apr 19 2009 19:39
>
>  >> YABOOT - yaboot_startup: Entering boot, no path
>  >> CHRP - try_chrp_script: Trying cd:0,ppc\bootinfo.txt
>  >> MAC-PARTS: macparts_probe 4552 ?= 4552
>  >> MAC-PARTS: macparts_open 0
>  >> MAC-PARTS: macparts_get_info 0 2832209920
>  >> MAC-PARTS: macparts_block_size = 200
>  >> volume_read_wrapper: got sig 482b
>  >> volume_read_wrapper: got sig 482b
>  >> ELF - try_chrp_script: Can't open cd:0,ppc\bootinfo.txt
>  >> CHRP - try_chrp_script: Trying cd:0,System\Library\CoreServices\BootX
>  >> MAC-PARTS: macparts_probe 4552 ?= 4552
>  >> MAC-PARTS: macparts_open 0
>  >> MAC-PARTS: macparts_get_info 0 2832209920
>  >> MAC-PARTS: macparts_block_size = 200
>  >> volume_read_wrapper: got sig 482b
>  >> volume_read_wrapper: got sig 482b
>  >> CHRP - try_chrp_script: got bootscript
>
> >> load-base
>  >> begin
>  >>  dup 6 " &lt;/CHRP" $= if
>  >>   6 + dup 6 " -BOOT&gt;" $= if
>  >>    8 + true
>  >>   else
>  >>    false
>  >>   then
>  >>  else
>  >>   1+ false
>  >>  then
>  >> until
>  >> ( xcoff-base )
>  >> load-size over load-base - -
>  >> ( xcoff-base xcoff-size )
>  >> load-base swap move
>  >> init-program go
>
>
> >> ELF - encode_bootpath: bootpath cd:0,<NULL>\ bootargs <NULL>
>  $=:>> XCOFF - load_xcoff: Loading 'System\Library\CoreServices\BootX'
>  >> XCOFF - load_xcoff: XCOFF file with 3 sections entry:fff0a22c

If this is the entry, it's much too high, it's where OpenBIOS ROM is
located. Or the loader should also add the virtual memory mappings to
cover these addresses. IIRC the DSI/ISI handler in ofmem.c also makes
some assumptions about virtual memory layout.

>  >> XCOFF - load_xcoff: Read next header (5c)
>  >> XCOFF - load_xcoff: Load '.text' section from 5c d4 to 5600000 (28000)
>  >> XCOFF - load_xcoff: Read next header (84)
>  >> XCOFF - load_xcoff: Load '.data' section from 84 280d4 to 5628000 (2000)
>  >> XCOFF - load_xcoff: Read next header (ac)
>  >> XCOFF - load_xcoff: Erase '.bss' section at 562a000 size: 3a000
>  >> ELF - transfer_control_to_elf: Starting ELF boot loader
>  invalid/unsupported opcode: 02 - 0e - 0c (0b717b1c) 05616ed8 1

I guess the execution starts at somewhere near 0x5600000 but the
loaded file may assume that the program counter is closer to
0xfff0a22c so while PC-relative accesses work, absolute addresses
won't.

>  invalid/unsupported opcode: 00 - 14 - 13 (000064e8) 000094d0 0
>  Alcarin:qemu steven$
>
>
>  So at least with my patches, we're getting what people with QEMU 0.8.0
>  were getting: http://tinyurl.com/qemu080
>
>  So now what's left is resolving -why- that 'invalid/unsupported
>  opcode' issue crops up.

That message comes from QEMU.



More information about the OpenBIOS mailing list