Author Topic: MacOS 9.2.2 Emulation with QEMU...we need help!  (Read 52377 times)

Offline gtxaspec

  • Active Member
  • *
  • Posts: 5
  • new to the forums
MacOS 9.2.2 Emulation with QEMU...we need help!
« on: December 11, 2015, 11:27:56 PM »
Hello All!

My name is Alfonso, I have been working with the QEMU project as of late to have MacOS 9.2.2 boot successfully on the emulator.  Most of research and progress has been on the emaculation forums, and on the QEMU-Devel mailing list.  In my research to debug and provide feedback to the developers with the intended goal of QEMU successfully emulating a a real Macintosh from a hardware standpoint, I have found this forum and its users to be a trove of information.

I seek assistance for this project, and invite the anyone here to look at what we have accomplished and provide feedback and input on what we would like to accomplish. 

As it currently stands, QEMU successfully boots MacOS 9.2.1 and 9.2.2 in a limited fashion.  There is no sound, or network support currently on either version.  You are able to boot a full MacOS 9.2.1 system with Open Transport disabled. 

MacOS 9.2.2 functions with a patched System Suitcase (wart resource removed) and Open Transport ASLM libraries removed from the extensions folder. 

What we need help with:

Open Transport seems to crash the system at boot.  If Open Transport ASLM is present in the extensions folder, system crashes.  If the System file has the resource "wart" present, crash, because this references Open Transport calls.  My theory now is that Open Transport's serial subsystem is causing the crashes.  If you are able to debug with macsbug or QEMU, please help!  =D

I have been compiling and hosting disk images with my progress so others may debug and provide feedback.  It’s also pretty cool to actually see MacOS 9.2.2 boot to the desktop on your Windows, Mac, or Linux computer and run some programs!

See this thread on the QEMU-Devel mailing list for the in-depth play by play from the developers of MacOS support in QEMU:

https://lists.nongnu.org/archive/html/qemu-devel/2015-11/msg02688.html

Check progress over at emaculation QEMU forum too for lots of detailed into on the years of trying to make this work. ( not sure if OK to post direct link to other forum so I will omit for now. )

Huge thanks to Cormac O'Brien and Mark Cave-Ayland for the heavy work programming OpenBIOS and QEMU.  Mark has been active lately assisting us with debugging and he is a contributor to both the OpenBIOS and QEMU projects.

regards,
alfonso
« Last Edit: December 12, 2015, 12:03:07 AM by gtxaspec »

Offline gtxaspec

  • Active Member
  • *
  • Posts: 5
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #1 on: December 11, 2015, 11:28:18 PM »
What is QEMU?

A powerful emulator capable of emulating the PowerPC instruction set, as well as specific PowerPC processors including the G3 and G4.  QEMU also provides emulation of Old-World (g3beige) and New-World (mac99) Apple Macintosh architectures.   

QEMU currently works together with OpenBIOS, which provides an open-source OpenFirmware implementation.  QEMU, together with OpenBIOS provides the device tree, device initialization, etc that enables MacOS to boot in QEMU.

For more information on OpenBIOS support for MacOS9, see this:

http://www.openfirmware.info/pipermail/openbios/2015-October/008809.html

This past summer, Cormac O’Brien was one of  QEMU's student developers for Google Summer of Code 2015.  His project goal was to have Mac OS 9 running on both the g3beige and mac99 machines in QEMU by the end of the summer.  He contributed many patches during GSOC, and we have now are able to boot MacOS 9.2.2 to the desktop thanks to Cormac and the other QEMU developers hard work.

For more information see:

http://c-obrien.org/qemu-os9/
https://lists.gnu.org/archive/html/qemu-devel/2015-05/msg02422.html
« Last Edit: December 11, 2015, 11:53:34 PM by gtxaspec »

Offline gtxaspec

  • Active Member
  • *
  • Posts: 5
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #2 on: December 11, 2015, 11:30:34 PM »
Extra Goodies:

QEMU from Mark's repo ( built on osx 10.11 )
http://bebop.gtxent.com/qemu_mark_latest.tar.gz

Resedit, Stuffit, Toast, Disk Copy, utilities in an ISO to mount within QEMU:
http://bebop.gtxent.com/qemu_os9_utilities.iso.zip

MacOS 9.2.2 basic bootable image:
http://bebop.gtxent.com/os922_uni.iso.zip

MacOS 9.2.1 basic bootable image:
http://bebop.gtxent.com/os92_test.iso.zip

MacOS 9.2.1 basic bootable image with macsbug:
http://bebop.gtxent.com/os92_test_macsbug.iso.zip

example boot args:
Code:
##boot off CD with install iso and utility iso
./qemu-system-ppc -bios ~/MacOS/qemu_master/openbios-qemu.elf \
 -boot d -drive file=~/MacOS/OS\ Images/os922_uni.iso,index=0,media=cdrom  \
 -drive file=~/MacOS/QEMU\ HD\ Images/test.raw,format=raw,index=1,media=disk \
 -drive file=~/MacOS/OS\ Images/macos-922-uni.iso,index=2,media=cdrom  \
 -M mac99 -m 256 -prom-env 'auto-boot?=true' -g 1024x768x32 -cpu G3 -net none

Also,

Here is a zip containing qemu-ppc, and a 2gb disk image file with macos 9.2.1 stock (no system modifications) installed. The system folder was modified to allow it to boot from an unlocked HFS volume. This image has lots of extensions and control panels included and enabled. Once you download qemu_easy.zip, extract it, and run qemu_os9.command (this is just a batch file with argumentsx osx only.  you can use the test.raw with other platforms as outlined above.)

qemu will now load and boot from the disk image to OS9 desktop. The disk image included here is read/write enabled. I have only tried this on OS10.11, your success may vary. MacsBug is included in the root directory, but is not enabled.


http://bebop.gtxent.com/qemu_easy.zip
« Last Edit: December 11, 2015, 11:45:36 PM by gtxaspec »

Offline gtxaspec

  • Active Member
  • *
  • Posts: 5
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #3 on: December 11, 2015, 11:31:16 PM »
Here is a bootable installation of MacOS 9.2.2 with the latest QEMU compiled from QEMU Devel git repo, with a disk image of installed MacOS 9.2.2 extracted from NetBoot9.dmg. Extract contents, then simply run qemu_os9.command to enjoy.

Booting was made possible by patching the System Suitcase to remove some Open Transport code:

Code: [Select]
Removed entire resource "wart" from the System Suitcase,
which upon inspection contained references to Open Transport libraries, without this
resource removed, booting MacOS was
impossible even with all Open Transport extensions and libraries removed.

Some Control Panels and Extensions still needed to be removed to fully boot to the Finder:

Code: [Select]
Control Panels Removed:

Trackpad [ confirmed crash ]

Extensions Removed:

QuickDraw 3D Rave [ confirmed crash ]
Open Transport ASLM [ confirmed crash ]
Quicktime Extensions * firewire enablers [ confirmed crash ]
ATI & NVIDIA Video Drivers [ result in black screen in QEMU ]
Multiprocessing Folder [QEMU hard crash]
Apple Audio Extension [QEMU hard crash]
Multiple Users Extension [ crashes finder ]

This disk image is a full MacOS 9.2.2 installation, with lots of extensions and control panels. Virtual Memory is enabled and seems to work. Various utilities included. Your milage may vary.

Remember, the System Suitcase in this image has been modified. Replacing the Suitcase with a different version may result in a crash at boot. You may attempt modification to your own System Suitcase file, use a resource editor like ResEdit or Resorcerer, and just remove the entire "wart" resource. Save, and boot. Results may vary.

I will complete more research based on Mark's advice and report back with results. While this is not the intended goal of my research ( I hope QEMU to boot a stock OS9 installation with nothing removed or patched ), it is another nice proof of concept that MacOS does have much potential to work with QEMU, and validates the hard work that everyone involved in both the OpenBIOS and QEMU projects have put into making this all possible.

http://bebop.gtxent.com/qemu_easy_02.tar.gz
[extract test.raw disk image from here and you can use on any platform, Windows/Linux/OSX]

regards,
alfonso
« Last Edit: December 11, 2015, 11:45:06 PM by gtxaspec »

Offline MacTron

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2116
  • keep it simple
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #4 on: December 12, 2015, 01:52:38 AM »
Hi Alfonso. Instead of boring with emulators that can't run a shit until x86 achieve the 10 Ghz , why you don't work in to porting Linux G5 motherboard drivers to Mac Os 9 to allow it to run in to a 3.0 Ghz quad core PPC?
That's the point. Not emulators. IMHO.

Anyway good luck.
Please don't PM about things that are not private.

Offline DieHard

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2366
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #5 on: December 12, 2015, 01:27:55 PM »
Yeah... nothing personal, but most of us here are "Anti-emulator"  The "real thing" has proven itself to be best in both the the OS9 arena and in women.

Offline Jakl

  • Gold Member
  • *****
  • Posts: 323
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #6 on: December 12, 2015, 03:12:59 PM »
Yeah... nothing personal, but most of us here are "Anti-emulator"  The "real thing" has proven itself to be best in both the the OS9 arena and in women.

Haha...  ;D

But it would be interesting to see how far this actually does go and if it ports to Macintel.

Offline GaryN

  • Platinum Member
  • *****
  • Posts: 1566
  • active member
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #7 on: December 12, 2015, 04:57:26 PM »
I dunno, boss… it would seem to me that any R & D involving our beloved Mac OS must be a good thing… n'est-ce pas?
You never know where it might lead…

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4439
  • just a number
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #8 on: December 12, 2015, 11:22:36 PM »
stop whining guys, a proper emulation would be more than welcome, so you can at least use the one or other old a app under OSX 10.x.

of course video and audio drivers would be great to have (for users like us), but a missing network functionality is not really a problem.
 
insert arbitrary signature here

Offline gtxaspec

  • Active Member
  • *
  • Posts: 5
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #9 on: December 13, 2015, 12:37:52 AM »
Hi Alfonso. Instead of boring with emulators that can't run a shit until x86 achieve the 10 Ghz , why you don't work in to porting Linux G5 motherboard drivers to Mac Os 9 to allow it to run in to a 3.0 Ghz quad core PPC?
That's the point. Not emulators. IMHO.

Anyway good luck.

In our research we have been looking for people who have experience coding device drivers for MacOS9, extensions namely.  We have been unable to locate anyone. 

Is there anyone on this forum with assembly level knowledge of the MacOS and PPC?  Not only would that person be able to aid to the QEMU project, but also in extending the drivers of MacOS to new hardware!

regards,
alfonso

Offline nanopico

  • Platinum Member
  • *****
  • Posts: 767
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #10 on: December 13, 2015, 07:11:22 AM »
In our research we have been looking for people who have experience coding device drivers for MacOS9, extensions namely.  We have been unable to locate anyone. 

Is there anyone on this forum with assembly level knowledge of the MacOS and PPC?  Not only would that person be able to aid to the QEMU project, but also in extending the drivers of MacOS to new hardware!

regards,
alfonso

I may not be the most experienced developer when it comes to new drivers for OS 9 but I will be working on some updates.

Not sure if you've followed  any of it

Original thread where I brought up the idea.
http://macos9lives.com/smforum/index.php?topic=2727.0

Poll for application development based on input from other users
http://macos9lives.com/smforum/index.php?topic=2891.0

OS Enhancements/Extension based on input from other users.
http://macos9lives.com/smforum/index.php?topic=2890.0

As much as most users here would not see a lot of use with an emulator,  it would provide a more convenient way to debug low level os calls and patches that I will end up working on.
So I for one am interested in this and may look into helping on that project.  My only issue is very limited time and what free time I have I would like to commit to the other projects I've suggested here.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline iMic

  • Enthusiast Member
  • ***
  • Posts: 29
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #11 on: December 16, 2015, 05:33:07 PM »
I've linked this discussion over in the 9.2.2 QEMU thread over on ThinkClassic to help spread the word.

I'm not sure if anyone still actively develops for Mac OS 9 over there (with the exception of ClassicHasClass and the Classilla browser, of course) but it's worth a shot.


Offline Texas_RangerAT

  • Valued Member
  • **
  • Posts: 20
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #12 on: July 14, 2016, 08:23:35 AM »
IS there actually anyone still developing Classilla? My impression was that it had died a quiet death in 2014 at version 9.3.3, which I'm running on my beige G3.

Offline darthnVader

  • Platinum Member
  • *****
  • Posts: 679
  • New Member
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #13 on: February 10, 2018, 03:22:45 PM »
Qemu-PPC has come a long way, so I thought I'd add an update and some new info.

As far as OS 9 support, you can boot OS 9.x with all extensions enabled. The Sungem ethernet device in now in the master and works very well, with no need to install 3rd party drivers for the Mac OS.

There is a branch working on the Screamer audio device, and it is reported to work well with OS 9, and some early versions of OS X, but later versions are still having trouble with it. Hopefully the bugs will get ironed out soon and it will be merged with the master.

As far as the speed of the emulated CPU, on my Ryzen 7 1700 @3.75 Ghz the integer performance is about the same as a 1.27 Ghz G4. However the FPU and Vec units are in desperate need of work, and perform about as well as a 70 Mhz G4.

There is no emulation of the L2 or L3 cache. Cache emulation presents at set of problems that are, as yet, unimplemented. It's very hard to emulate this sort of thing, and have there be any real speed benefit.

I've done some work adding some more PPC CPU's to Openbios and Qemu, but that was done for my benefit so I could use these CPU's under Linux PPC with KVM.

The state of KVM on the G4 is very poor and buggy. With the 7447a ( PVR 80030105 ) You'll need to patch qemu-system-ppc and OpenBios to support it, but for some reason OS X's mach_kernel tries to read the state of the L3CR to make sure the register returns 0x00000000, and if it doesn't then it tries to write that value to the register. This is very odd, and perplexing, as the 7447a does not have, nor support an L3 cache, nor would that register be writable.

I implemented the L3CR register with a patch to qemu-system-ppc, but KVM will not allow a read there, so the kernel just hangs. Some more work to patch KVM is needed, but I haven't figured a correct patch.

You can boot OS X with --enable-kvm -cpu 7410, 7400, G3, 604. On the 7447a and you will get KVM acceleration but it's buggy at best. Seem to have a lot of trouble with disk access.

The state of KVM on the 7455 is even worse, I'm pretty sure KVM is conflicting with disk access. Oddly, OS X doesn't care that there is no L3CR on a CPU that has an L3 cache. KVM does not seem to pass the cache, and Openbios has no support of it.

OS 9 with KVM on the 4747a is a no go, the Mac OS Rom does something KVM doesn't like.

OS 9 with KVM on the 7455 is also a no go, Openbios says it can't find a valid state or init program when trying to boot the 9.2.2 Retail install CD. Odd, because without KVM it boots just fine, tho I haven't looked into tracking down the issue yet.

For those that are anti-emulator, all I can say is OS 9 booting hardware is getting more and more rare every day. People are just trashing these things as the cost of shipping exceeds  the sale price, and even if you get one that works, the hardware is:

A. Never going to get any faster.
B. Not going to last forever.

Qemu-system-ppc will continue to get faster, not only as we work to better code the emulator, but as the host cpu's get faster. The DTC module that is in the master is good for a 10% increase across the board for the CPU.

Also, if anyone ever wants to get the G5 to native boot OS 9, it just far easier to debug an emulator than it is the bare metal, and you won't fry your logicboard. :P


Offline Naiw

  • Veteran Member
  • ****
  • Posts: 126
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #14 on: February 11, 2018, 10:01:23 AM »
L2 and L3 cache isn’t something you can emulate.

It’s transparent to the software. So the only thing you can do is emulate the registers as you say- but they won’t have any practical use.

As for KVM, if you use KVM-PR it should be able to pose as the CPU you determine.
The problem with KVM-PR on at least the G5 it doesn’t seem feature complete- I guess it lacks BAT emulation or something cause MacOS 9 will crash early on when you try to boot it on that processor.

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #15 on: February 11, 2018, 10:50:48 AM »
I am pretty sure that MacOS 9 cannot run on G5s at all, at least without massive changes. G5s are 64 bit. MacOS 9 is 32 bit.

Offline DieHard

  • Global Moderator
  • Platinum Member
  • *****
  • Posts: 2366
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #16 on: February 11, 2018, 03:36:55 PM »
Is there a Step by Step Guide from Install to Setup (including good hints) QEMU for setup on an Intel Mac running ML thru El cap ?

I'm Gonna try this out...
https://www.emaculation.com/doku.php/ppc-osx-on-qemu-for-osx

macStuff

  • Guest
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #17 on: February 11, 2018, 06:56:05 PM »
wow 18000 views on this thread?  :o

Offline darthnVader

  • Platinum Member
  • *****
  • Posts: 679
  • New Member
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #18 on: February 12, 2018, 01:15:14 AM »
I am pretty sure that MacOS 9 cannot run on G5s at all, at least without massive changes. G5s are 64 bit. MacOS 9 is 32 bit.


G5's aren't 64bit only, they run 32bit code just fine.

It's not the CPU, it the other hardware on the logic board. OS 9 just has no drivers for it.

Qemu-system-ppc64 has a mac99u machine, that is basically a Sawthooth with a G5. It shouldn't be that hard to get OS 9 to run on that. OS X would just panic, finding a G5, and expecting to find the other hardware that goes with it, but that could be fixed with a custom mach_kernel.

 

Offline Naiw

  • Veteran Member
  • ****
  • Posts: 126
  • new to the forums
Re: MacOS 9.2.2 Emulation with QEMU...we need help!
« Reply #19 on: February 12, 2018, 09:59:37 AM »
You are correct that G5s run 32 bit code ”just fine”.

But at the same time it’s not really a proper PowerPC, it does not implement all things defined in the PowerPC architecture. It doesn’t even have all instructions, so some have to be implemented and emulated at OS level (an application wouldn’t notice though).
But MacOS 9 is not an application; and it uses a lot of the constructs that the G5 lacks (BAT registers for example. And emulating the BATs with PTEs would probably require quite some hacks in the nanokernel.

Drivers are an issue too of course but shouldn’t be necessary to get the system up and running, open firmware drivers will still work although at a severe performance penalty.