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

User avatar
adespoton
Forum All-Star
Posts: 4727
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

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

Post by adespoton »

Also, I notice he's still using an external OpenBIOS, which is where the mouse handling would be done. Likely this is the culprit. My OpenBIOS doesn't do this, and neither does the one built in to QEMU 2.7. Remove the -bios ./openbios-ppc flag, and 2.7 should function, as it has a default one built in.
Programmingkid
Apple Corer
Posts: 245
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

I just wanted to let everyone know the progress I have made with the sound problem in QEMU. After replacing all the calls to the floating point instruction fmadds with a c language equivalent in the AppleUSBAudio kernel extension, audio played without that crackling sound. It sound almost perfect. The audio was from an mpeg file. MP3 files probably go thru a decoder that uses floating point instructions, so that's probably why they still play poorly.
User avatar
uyjulian
Apple Corer
Posts: 248
Joined: Fri Aug 27, 2010 1:02 am

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

Post by uyjulian »

Programmingkid wrote:I just wanted to let everyone know the progress I have made with the sound problem in QEMU. After replacing all the calls to the floating point instruction fmadds with a c language equivalent in the AppleUSBAudio kernel extension, audio played without that crackling sound. It sound almost perfect. The audio was from an mpeg file. MP3 files probably go thru a decoder that uses floating point instructions, so that's probably why they still play poorly.
Did the mpeg file have uncompressed audio?

If you have ffmpeg installed, try:
ffprobe /path/to/mpeg/file
mcayland
Mac Mechanic
Posts: 155
Joined: Sun Nov 01, 2015 10:33 pm

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

Post by mcayland »

Programmingkid wrote:I just wanted to let everyone know the progress I have made with the sound problem in QEMU. After replacing all the calls to the floating point instruction fmadds with a c language equivalent in the AppleUSBAudio kernel extension, audio played without that crackling sound. It sound almost perfect. The audio was from an mpeg file. MP3 files probably go thru a decoder that uses floating point instructions, so that's probably why they still play poorly.
This does seem like an extremely long way around the problem, particularly as it would be a huge amount of work on the QEMU side. Why not simply do what Ben did with sungem, i.e. reverse engineer a QEMU sound device from one of the many hardware open source drivers available?
kikyoulinux
Tinkerer
Posts: 92
Joined: Sun Sep 28, 2014 11:53 am

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

Post by kikyoulinux »

I ran a benchmark, just out of curiosity. such poor FPU performance...
Image
User avatar
adespoton
Forum All-Star
Posts: 4727
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

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

Post by adespoton »

That's great news! So if we speed up the floating point emulation code, we should get proper audio as well. Meanwhile, USB audio might work if we just replace the floating point with direct calls.

Does the OS instability also go away with the change?
Programmingkid
Apple Corer
Posts: 245
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

julialy wrote:
Programmingkid wrote:I just wanted to let everyone know the progress I have made with the sound problem in QEMU. After replacing all the calls to the floating point instruction fmadds with a c language equivalent in the AppleUSBAudio kernel extension, audio played without that crackling sound. It sound almost perfect. The audio was from an mpeg file. MP3 files probably go thru a decoder that uses floating point instructions, so that's probably why they still play poorly.
Did the mpeg file have uncompressed audio?

If you have ffmpeg installed, try:
ffprobe /path/to/mpeg/file
Yes, the audio was compressed. The file used the mp2 audio codec.
Programmingkid
Apple Corer
Posts: 245
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

mcayland wrote:
Programmingkid wrote:I just wanted to let everyone know the progress I have made with the sound problem in QEMU. After replacing all the calls to the floating point instruction fmadds with a c language equivalent in the AppleUSBAudio kernel extension, audio played without that crackling sound. It sound almost perfect. The audio was from an mpeg file. MP3 files probably go thru a decoder that uses floating point instructions, so that's probably why they still play poorly.
This does seem like an extremely long way around the problem, particularly as it would be a huge amount of work on the QEMU side. Why not simply do what Ben did with sungem, i.e. reverse engineer a QEMU sound device from one of the many hardware open source drivers available?
The driver will only tell us the interface to the device, it won't tell us what goes on behind the scenes. I tried this with the screamer sound chip used by Apple. It was just too hard to succeed.

One sound chip that is well documented is the SoundBlaster. There is a Mac OS 9 driver available for it. If someone were to port the SoundBlaster ISA card in QEMU to PCI, it might be possible to make sound play thru it.
Programmingkid
Apple Corer
Posts: 245
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's great news! So if we speed up the floating point emulation code, we should get proper audio as well. Meanwhile, USB audio might work if we just replace the floating point with direct calls.
That is probably true. Just replacing one floating point instruction yielded very good results. Replacing all of them would make things even better.
Does the OS instability also go away with the change?
I didn't really notice any operating system instability with or without the change to the USB Audio driver.

Thank you for setting me on the right path. I would still be writing test cases for all the floating point instructions if you hadn't told us how slow the floating point unit was in QEMU. :smile:
Programmingkid
Apple Corer
Posts: 245
Joined: Sun Jan 31, 2016 6:01 pm

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

Post by Programmingkid »

kikyoulinux wrote:I ran a benchmark, just out of curiosity. such poor FPU performance...
Your FPU score is pretty high compared to mine. What is your host processor?
bumper314
Space Cadet
Posts: 5
Joined: Fri Sep 30, 2016 9:05 am

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

Post by bumper314 »

Sorry, the mouse issues were a red herring. I tried the VM on another machine and it works perfectly, so it's something specific to my 10.9.5 system. I'll report back if I find the source.
kikyoulinux
Tinkerer
Posts: 92
Joined: Sun Sep 28, 2014 11:53 am

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

Post by kikyoulinux »

Programmingkid wrote:
kikyoulinux wrote:I ran a benchmark, just out of curiosity. such poor FPU performance...
Your FPU score is pretty high compared to mine. What is your host processor?
on an i3-3110M(2.4GHz) laptop... Windows 10 rs1 and lxss. qemu built with -march=native.
Arths
Student Driver
Posts: 10
Joined: Wed Jul 06, 2016 11:25 am

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

Post by Arths »

Just ordered a Pi Zero, do you think I might be able to run OS 9/10 on it ? :smile:
Do I just need to compile from the latest sources, and if so, does anybody have a link for them which includes the latest OpenBIOS ?
kataetheweirdo
Master Emulator
Posts: 336
Joined: Sun Feb 01, 2009 4:55 pm

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

Post by kataetheweirdo »

Because I forgot to point this out in the App Compatibility topic, I should point out that I used an Intel Core i7 (some pre-2011 models) and those eked out with slightly worse results than what kikyoulinux is getting. Seems like there's a new problem with the Power 9 vector instructions. Does there need to be ifdefs to make sure the correct execution is going on in G4 mode?

The Pi Zero might run Mac OS 9 slightly less than OK (in comparison to the Power Mac G3/300), though you might have to set the memory to 128 MB at most. OS X might run, but it would be very slow. You can compile from 2.7's branch onward. As for OpenBIOS, can't help you much there.
Arths
Student Driver
Posts: 10
Joined: Wed Jul 06, 2016 11:25 am

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

Post by Arths »

kataetheweirdo wrote: The Pi Zero might run Mac OS 9 slightly less than OK (in comparison to the Power Mac G3/300), though you might have to set the memory to 128 MB at most. OS X might run, but it would be very slow. You can compile from 2.7's branch onward. As for OpenBIOS, can't help you much there.
Thanks for your answer, I'll try that as soon as I can. :smile:
kikyoulinux
Tinkerer
Posts: 92
Joined: Sun Sep 28, 2014 11:53 am

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

Post by kikyoulinux »

Arths wrote:
kataetheweirdo wrote: The Pi Zero might run Mac OS 9 slightly less than OK (in comparison to the Power Mac G3/300), though you might have to set the memory to 128 MB at most. OS X might run, but it would be very slow. You can compile from 2.7's branch onward. As for OpenBIOS, can't help you much there.
Thanks for your answer, I'll try that as soon as I can. :smile:
And I tried Mac OS X Panther on my Android phone(4x Cortex-A53) before... it took 10 minutes to start up and 20 seconds or so to open a menu. So you'd better not.
bumper314
Space Cadet
Posts: 5
Joined: Fri Sep 30, 2016 9:05 am

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

Post by bumper314 »

Thanks. I tried removing the OpenBIOS flag, but I get the same behavior. As mentioned in another reply, I found the issue seems specific to my 10.9.5 system. Runs great on my 10.8 system.
Arths
Student Driver
Posts: 10
Joined: Wed Jul 06, 2016 11:25 am

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

Post by Arths »

kikyoulinux wrote:
Arths wrote:
kataetheweirdo wrote: The Pi Zero might run Mac OS 9 slightly less than OK (in comparison to the Power Mac G3/300), though you might have to set the memory to 128 MB at most. OS X might run, but it would be very slow. You can compile from 2.7's branch onward. As for OpenBIOS, can't help you much there.
Thanks for your answer, I'll try that as soon as I can. :smile:
And I tried Mac OS X Panther on my Android phone(4x Cortex-A53) before... it took 10 minutes to start up and 20 seconds or so to open a menu. So you'd better not.
Will try 9.2.2 :wink:
gtxaspec
Tinkerer
Posts: 63
Joined: Mon Oct 19, 2015 7:32 pm

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

Post by gtxaspec »

How are you folks gettign SunGEM working in OS9? I'm using BenH's wip tree, and the following command line:

Code: Select all

./qemu-system-ppc -bios ~/qemu/os9/openbios-ppc -boot c -m 512 -cpu G3 -M mac99 -g 800x600x32 -prom-env "auto-boot?=true" -prom-env "boot-args=-v"  -drive file=/home/qemu/os9/os9.img,format=raw,media=disk,cache=writethrough -display gtk  -net nic,model=sungem -net user
But the interface doesn't show up in OS9.2.2, full extensions enabled.

Thanks!
User avatar
adespoton
Forum All-Star
Posts: 4727
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

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

Post by adespoton »

I'm using:

Code: Select all

  
  ./qemu-system-ppc
  -bios "openbios-qemu-wip-13082016.elf" \
  -boot c \
  -drive file="/dev/rdisk$DEVNUM",format=raw,media=disk,cache=writethrough \
  -M mac99 \
  -m 256 \
  -cpu G3 \
  -netdev user,id=vlan0 \
  -device sungem,netdev=vlan0 \
  -prom-env 'auto-boot?=true' \
  -g 1280x720x32 \
  -name "- $osver" & EMUPID=$!
Looks like you're using the old -net flags. Better to switch to the non-deprecated -netdev + -device format.
gtxaspec
Tinkerer
Posts: 63
Joined: Mon Oct 19, 2015 7:32 pm

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

Post by gtxaspec »

Still getting "The previously selected connection, "Ethernet", is not available. The connection has been changed to "PPP".

Code: Select all

./qemu-system-ppc -bios ~/qemu/os9/openbios-ppc -boot c -m 512 -cpu G3 -M mac99 -g 800x600x32 -prom-env "auto-boot?=true" -prom-env "boot-args=-v"  -drive file=/home/qemu/os9/os9.img,format=raw,media=disk,cache=writethrough -display gtk  -netdev user,id=vlan0 -device sungem,netdev=vlan0
User avatar
Cat_7
Expert User
Posts: 6557
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 »

Did you build your own qemu?

Perhaps try the wip executable with sungem support downloaded from the forum.
http://www.emaculation.com/forum/viewto ... =34&t=9028

Best,
Cat_7
gtxaspec
Tinkerer
Posts: 63
Joined: Mon Oct 19, 2015 7:32 pm

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

Post by gtxaspec »

I did, built from BenH's WIP branch, built on linux. trying to see if i can build from source and get networking working.
User avatar
sentient06
Apple Corer
Posts: 250
Joined: Tue Mar 29, 2011 8:57 pm
Location: London, UK

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

Post by sentient06 »

I don't remember if I asked this before but, is there any kind of "save state" functionality in QEMU? If so, is it available to any kind of virtual machine or should work be done depending on the case?
User avatar
Cat_7
Expert User
Posts: 6557
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 »

You can save vm's, but raw format is not supported. QCOW2 and QED are supported.
So if you install on a qcow2 image, in OSX you can use the compat-monitor to create and load states:

Documentation ( http://wiki.qemu.org/download/qemu-doc. ... t_005fmode ) says that these commands are available:
savevm "imagename"
loadvm "imagename"
delvm "imagename"
info snapshots

I tested in OSX with mac os 9.1 running on a qcow2 image and savevm and loadvm worked.

Best,
Cat_7
Post Reply