GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

alex195812
Mac Mechanic
Posts: 169
Joined: Mon Aug 29, 2016 3:44 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by alex195812 »

Sorry,no idea.
I though about other aspects concerning screamer and sungem: why do they not work in g3beige?Realtek network device works in g3beige while sungem doesn't (the device is present but "the cable not plugged").Where can be the reason?Sungem code doesn't seem to depend directly on architecture.May the reason be in difference of pci or pic code of g3beige platform?
Audio seems not working in g3beige at all -- neither screamer nor usb while both work in mac99 (though both devices show up in System Preferences with g3beige,no real sound is heard).What may be the reason?Screamer is,by the way,the native g3beige sound device...
Last edited by alex195812 on Wed Feb 15, 2017 2:42 am, edited 2 times in total.
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Programmingkid »

alex195812 wrote:Sorry,no idea.
I though about another aspects concerning screamer and sungem: why do they not work in g3beige?Realek network device works in g3beige while sungem doesn't (the device is present but "the cable not plugged").Where can be the reason?Sungem code doesn't seem to depend directly on architecture.May the reason be in difference of pci or pic code of g3beige platform?
Audio seems not working in g3beige at all -- neither screamer nor usb while both work in mac99 (though both devices show up in System Preferences with g3beige,no real sound is heard).What may be the reason?Screamer is,by the way,the native g3beige sound device...
I haven't paid much attention to the g3beige target in a long time. Maybe the poor audio and g3beige failure of screamer are related.

I remember hearing that Ben H.'s repo fixes the erratic mouse issue in Mac OS 9. This makes me wonder what else has he fixed. Maybe we should try porting screamer to Ben's mac99p target and see what happens.
alex195812
Mac Mechanic
Posts: 169
Joined: Mon Aug 29, 2016 3:44 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by alex195812 »

I thougdt about it at the time I tried to combine the possibilities of Ben's and Mark's repos.But I met some things I wasn't sure how to deal with.
I didn't know how many irq's are aloowed.Don't know why but I seemed that no more than 8 (maybe a superstition?).Adding screamer to ozbenh source makes the number equal to 10 (screamer takes 3) and some values should be changed and I wasn't sure how exactly.
Though I added support for screamer into Ben's openbios version (I didn't post it on the forum).It isn't hard but the resulting version has the same isuue of losing ability to boot OS 9.0.I thought the problem was in regs assigned to screamer in openbios(now I think the regs are onboard registers).
It's also easy to add vga support for OldWorld in Ben's qemu version(I still have such version not processed by Macpack).
I also think it makes sense to port Ben's mac99p patches to a newer qemu version(2.8.0 or 2.9-dev).
And I wonder if adb changes could be separated from PMU and applied to mac99 (or even g3beige?).
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Programmingkid »

alex195812 wrote:I thougdt about it at the time I tried to combine the possibilities of Ben's and Mark's repos.But I met some things I wasn't sure how to deal with.
I didn't know how many irq's are aloowed.Don't know why but I seemed that no more than 8 (maybe a superstition?).Adding screamer to ozbenh source makes the number equal to 10 (screamer takes 3) and some values should be changed and I wasn't sure how exactly.
Though I added support for screamer into Ben's openbios version (I didn't post it on the forum).It isn't hard but the resulting version has the same isuue of losing ability to boot OS 9.0.I thought the problem was in regs assigned to screamer in openbios(now I think the regs are onboard registers).
It's also easy to add vga support for OldWorld in Ben's qemu version(I still have such version not processed by Macpack).
I also think it makes sense to port Ben's mac99p patches to a newer qemu version(2.8.0 or 2.9-dev).
And I wonder if adb changes could be separated from PMU and applied to mac99 (or even g3beige?).
Wow you already ported screamer to Ben's mac99p. Great. You lost 9.0. Is it able to boot 9.1? 9.2? Mac OS X? How does it sound? Any improvements?

https://en.wikipedia.org/wiki/OpenPIC_and_MPIC
I found this source. It says there could be support for 128 interrupts.
alex195812
Mac Mechanic
Posts: 169
Joined: Mon Aug 29, 2016 3:44 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by alex195812 »

No,in fact.I added screamer support to Ben's openbios only.The second part is to add mcayland's patches to qemu itself(and it seems not quite easy to me).
But adding screamer to openbios is enough to break OS 9.0 boot (if vga patch is applied to qemu binary).I didn't try 9.1,but 9.2 works (installed system),though booting installation cd is also problematic.That's why I uploaded two openbios versions(with and without screamer) with the latest (Jan 10) qemu build.
OS X seems not affected at all.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by darthnvader »

Can anyone tell me, or point be to, how to build Openbios, when I build Qemu-PPC??
User avatar
Cat_7
Expert User
Posts: 6121
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

There is an effective tutorial on the openbios site. If you run OSX, you nee to install the fcode utils and use the awos cross compiler linked to: http://www.mediafire.com/download/wy5xg ... pilers.zip

This is my script to build the OpenBIOS binary:
PATH=:/usr/local/ppcelf/ppcelf/bin:/users/hsp/src/fcode-utils-devel/toke:$PATH
export PATH
cd openbios
CROSS_COMPILE=ppc-elf- ./config/scripts/switch-arch ppc
#(remove -Werror from CFLAGS in Makefile.target in top directory)
make

Best,
Cat_7
Last edited by Cat_7 on Wed Feb 15, 2017 10:16 pm, edited 2 times in total.
Reason: EDIT: fixed copied link
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Programmingkid »

alex195812 wrote:No,in fact.
Your saying no sound improvements with mac99p?

It does still play sound?
alex195812 wrote: I added screamer support to Ben's openbios only.The second part is to add mcayland's patches to qemu itself(and it seems not quite easy to me).
But adding screamer to openbios is enough to break OS 9.0 boot (if vga patch is applied to qemu binary).I didn't try 9.1,but 9.2 works (installed system),though booting installation cd is also problematic.That's why I uploaded two openbios versions(with and without screamer) with the latest (Jan 10) qemu build.
OS X seems not affected at all.
Is adding Ben's mac99p code to QEMU something we should do? I know it boots Mac OS 10.5, but what other benefits does it have?
alex195812
Mac Mechanic
Posts: 169
Joined: Mon Aug 29, 2016 3:44 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by alex195812 »

Your saying no sound improvements with mac99p?
I meant that I didn't completely add screamer to mac99p,only in openbios,so I don't know if it would benefit somehow for sound.
Generally,it would be surely fine to add mac99p to qemu,especially for the benefits in adb work(e.g. in OS 9 or 10.5).Though 10.5 may work in mac99 with usb mouse and keyboard.
But the most desirable IMO would be to expand the adb improvements from mac99p to mac99 and g3beige.
Also it seems important to figure out how screamer conflicts with vga during OS 9.0 boot and how to resolve it.
User avatar
Cat_7
Expert User
Posts: 6121
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

Hi,

I think screamer builds never booted OS 9.0.4. That is a regression Mark is planning to look into.

Best,
Cat_7
WizKid
Tinkerer
Posts: 72
Joined: Sun Jul 31, 2016 11:58 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by WizKid »

Cat_7 wrote:If you run OSX, you nee to install the fcode utils and use the awos cross compiler linked to: http://www.mediafire.com/download/wy5xg ... pilers.zip
That Mediafire link gives gives an "Invalid of deleted file" error...
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by adespoton »

Cat_7 wrote:Hi,

I think screamer builds never booted OS 9.0.4. That is a regression Mark is planning to look into.

Best,
Cat_7
Interesting... because according to Alex, it's the OpenBIOS changes that break the booting, not the qemu changes. So maybe Mark doesn't actually have anything to track down on the qemu side?

Or were you saying he was looking into the OpenBIOS side of things?
User avatar
Cat_7
Expert User
Posts: 6121
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

I don't know whether the problem is qemu or openbios related. Screamer requires changes in both.

Best,
Cat_7
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Programmingkid »

WizKid wrote:
Cat_7 wrote:If you run OSX, you nee to install the fcode utils and use the awos cross compiler linked to: http://www.mediafire.com/download/wy5xg ... pilers.zip
That Mediafire link gives gives an "Invalid of deleted file" error...
I was able to download the file when I clicked on the above link. I think trying a different (more up to date?) browser might help.
User avatar
Cat_7
Expert User
Posts: 6121
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Cat_7 »

That is because I fixed the link ;-) See some posts above.

Best,
Cat_7
alex195812
Mac Mechanic
Posts: 169
Joined: Mon Aug 29, 2016 3:44 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by alex195812 »

Cat_7 wrote:Hi,

I think screamer builds never booted OS 9.0.4. That is a regression Mark is planning to look into.

Best,
Cat_7
In fact,Mark's original version(qemu+openbios) does boot 9.04(though with some difficulties).I wrote about it on Jan 06.
Appying Ben's vga patch for qemu to mcayland's version breaks OS 9.0 boot..
Generally,the break appears with combination of screamer-enabled-openbios+vga-enabled-qemu.
For example,if I use a screamer-enabled openbios with Ben's qemu-wip,it appears,too.
Ben's vga patch for openbios (not qemu itself) has been upsteam for several months,by the way.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by darthnvader »

Cat_7 wrote:There is an effective tutorial on the openbios site. If you run OSX, you nee to install the fcode utils and use the awos cross compiler linked to: http://www.mediafire.com/download/wy5xg ... pilers.zip

This is my script to build the OpenBIOS binary:
PATH=:/usr/local/ppcelf/ppcelf/bin:/users/hsp/src/fcode-utils-devel/toke:$PATH
export PATH
cd openbios
CROSS_COMPILE=ppc-elf- ./config/scripts/switch-arch ppc
#(remove -Werror from CFLAGS in Makefile.target in top directory)
make

Best,
Cat_7
Thanks, Cat_7, that worked great.
alex195812
Mac Mechanic
Posts: 169
Joined: Mon Aug 29, 2016 3:44 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by alex195812 »

Themacthing wrote:Pardon me but isn't gsoc over now? And why does OS X dp2 no longer work in qemu, it did before, oh and maybe try using open firmware image taken from a ppc mac and see if that works
DP2 does work(installation OK,installed system rather unstable due to frequent LoginWindow errors).What qemu/openbios versions did you try?Official qemu versions don't work with DP2,so a version from this forum is needed.
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by adespoton »

Themacthing wrote:Pardon me but isn't gsoc over now?
This is actually from the 2010 GSOC; so yes, it's been over for quite some time :D

The result however is that you can dig through this thread to see the entire process of qemu booting OS 9 from "no idea how to make it work, but let's start investigating it at GSOC" to the point it's at today. We should probably end the thread when it finally overcomes the hardware issues and we can boot Mac OS 8.6.
Jose64141
Inquisitive Elf
Posts: 31
Joined: Mon Feb 22, 2016 10:34 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Jose64141 »

sidoh wrote:I'd also like to note that Mac OS X DP3 crashes when trying to boot from it's CD in the latest Windows build. This happened when I was both emulating a G3 and G4.

UPDATE: Spoke too soon. Apparently, I was booting off the wrong partition. Specifying the correct partition allowed DP3 to install fine:

Image

Image
Can you say me what did you do, please?
alex195812
Mac Mechanic
Posts: 169
Joined: Mon Aug 29, 2016 3:44 am

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by alex195812 »

alex195812 wrote:
Cat_7 wrote:Hi,

I think screamer builds never booted OS 9.0.4. That is a regression Mark is planning to look into.

Best,
Cat_7
In fact,Mark's original version(qemu+openbios) does boot 9.04(though with some difficulties).I wrote about it on Jan 06.
Appying Ben's vga patch for qemu to mcayland's version breaks OS 9.0 boot..
Generally,the break appears with combination of screamer-enabled-openbios+vga-enabled-qemu.
For example,if I use a screamer-enabled openbios with Ben's qemu-wip,it appears,too.
Ben's vga patch for openbios (not qemu itself) has been upsteam for several months,by the way.
I think that the root of this bug has something to do with the following.
Screamer is not a "native" device for mac99,it is from g3beige(it's ironic that it currently doesn't work in g3bege).And probably the resources assigned for this device(taken from g3beige dev tree) are unappropriate for mac99.It seems that for mac99 other regs(and/or something else) should be assigned to avoid conflicts.It's surely too abstract yet.
User avatar
Meow_2004
Granny Smith
Posts: 108
Joined: Thu Jan 05, 2017 6:24 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Meow_2004 »

Any good news on Server, and the 4 DP's?
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Programmingkid »

I did more sound tests in QEMU. This time I tried playing audio files in Quicktime player 7 on Windows 2000 in qemu-system-i386. The audio would play well for a while, then just drop. There is something about QEMU that Quicktime has a problem with. If I pause then play after a drop, the audio starts playing again. That might be a buffer running out of data, then filling up enough to start again.

The sound quality when playing is really good. When I run "x/10i $pc" in the monitor to see what instructions are running, I do see a lot more floating point instructions than I see with Microsoft's audio playing software. Microsoft's software does play audio files without a problem.

The sound card I used in all these test is AC97.

Here are my theories:
One or more buggy floating point instructions.
Too slow a floating point unit.
Assumptions Apple made about hardware that are not so in QEMU.
Host CPU too slow.

My CPU is a 7 year old Core 2 Duo. If anyone has recent hardware they could share their audio playing experience with, we could appreciate more data.
User avatar
adespoton
Forum All-Star
Posts: 4208
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by adespoton »

That reflects what I've seen under OS X on a 2015 15" MacBook Pro with discrete AMD Radeon R9 M370X. Processor in that is a quad core 2.8GHz Core i7-4980HQ (Haswell).

Based on that, I don't think the issue is the Host CPU; I'm not getting any performance issues in the emulation or in other software while the emulation is underway. It doesn't even peg a single CPU, and if I renice the process to max out CPU usage, the sound problem persists in the same way. Throttling the CPU also has minimal effect (causes a bit of stuttering in the sound and jerky video, but the "play, then drop" issue stays the same).

So my theories are still:
One or more buggy FP instructions
Too slow FP emulation/passthrough
Assumptions Apple made about hardware that QEMU doesn't emulate in the same way
Programmingkid
Apple Corer
Posts: 243
Joined: Sun Jan 31, 2016 6:01 pm

Re: GSOC qemu Boot Mac OS >= 8.5 on PowerPC system

Post by Programmingkid »

adespoton wrote:That reflects what I've seen under OS X on a 2015 15" MacBook Pro with discrete AMD Radeon R9 M370X. Processor in that is a quad core 2.8GHz Core i7-4980HQ (Haswell).

Based on that, I don't think the issue is the Host CPU; I'm not getting any performance issues in the emulation or in other software while the emulation is underway. It doesn't even peg a single CPU, and if I renice the process to max out CPU usage, the sound problem persists in the same way. Throttling the CPU also has minimal effect (causes a bit of stuttering in the sound and jerky video, but the "play, then drop" issue stays the same).

So my theories are still:
One or more buggy FP instructions
Too slow FP emulation/passthrough
Assumptions Apple made about hardware that QEMU doesn't emulate in the same way
What did you test?
USB-Audio or Screamer:
qemu-system-ppc, qemu-system-i386:
Guest(s) operating system:

Ok for the buggy FPU, I'm think there must be a program somewhere that test it. Any suggestions anyone? If there isn't, one would have to be built. This would probably involve assembly code. I have successfully made x87 and PowerPC floating point assembly code. But since our host computers are x86, I'm thinking testing the qemu-system-i386 system for floating point bugs might be easier. A test program could be made on our host systems, then just ran in qemu-system-i386 to compare results.

The "too slow floating point" theory might be trickier to solve. If this is the case, one way to solve it that comes to mind is to use x87 assembly language in QEMU's source code. Since around 95% (my estimate) of QEMU users are on x86 hosts, this might not be a problem. The remaining users could just stick with the C implementation.

For the last theory about Apple assumptions, I'm not sure what to do. Apple has made a lot of their code open source, but not all of it. Quicktime is what I am wondering about. It is definitely doing something that doesn't work well on QEMU. The only hints I have are the assembly language code I see QEMU running. Does anyone know where to find Quicktime's source code?
Post Reply