Mac OS 9 Discussion > Emulation

Bochs to boot OS X under OS 9

(1/3) > >>

Jubadub:
So, as we were discussing here, we tried booting Intel OS X directly under Virtual PC, only to realize it most likely cannot be (directly) done with existing virtualization solutions available to the original Mac OS, due to no SSE/SSE2 and maybe even SSE3 support, if nothing else.

Until @teroyk let us know that Bochs 2.1.1 is available for Mac OS 9, and that that version does claim to have support for such SIMD emulation (more specifically: MMX, 3DNow!, SSE, SSE2 and apparently even something from SSE3 according to the docs). In fact, it even has, theoretically, support for x86_64! Madness!

Anyway, so I tried setting it up last night... All is good and well... Except that it seems that, rather than having options within the emulator to toggle on/off things like MMX (like Virtual PC), SSE, SSE2 etc., we have to compile Bochs 2.1.1 and tell the compiler we want those (and other) features.

There is a log file that Bochs writes to, "bochsout.txt", and on my side it clearly states that MMX is activated, but SSE2, x64 and so on are not. Meaning we have to recompile it!

Inside the file, it looks like this:


--- Code: ---00000000000i[     ] Bochs x86 Emulator 2.1.1
00000000000i[     ]   February 08, 2004
00000000000i[     ] System configuration
00000000000i[     ]   processors: 1
00000000000i[     ]   A20 line support: yes
00000000000i[     ]   APIC support: no
00000000000i[     ] CPU configuration
00000000000i[     ]   level: 5
00000000000i[     ]   fpu support: yes
00000000000i[     ]   paging support: yes, tlb enabled: yes
00000000000i[     ]   mmx support: yes
00000000000i[     ]   sse support: no
00000000000i[     ]   v8086 mode support: yes
00000000000i[     ]   3dnow! support: no
00000000000i[     ]   PAE support: no
00000000000i[     ]   PGE support: no
00000000000i[     ]   PSE support: no
00000000000i[     ]   x86-64 support: no
00000000000i[     ]   SEP support: no
00000000000i[     ] Optimization configuration
00000000000i[     ]   Guest2HostTLB support: yes
00000000000i[     ]   RepeatSpeedups support: yes
00000000000i[     ]   Icache support: yes
00000000000i[     ]   Host Asm support: yes
00000000000i[MEM0 ] allocated memory at 0x126c2000. after alignment, vector=0x126c2000
00000000000i[MEM0 ] 512.00MB
00000000000i[MEM0 ] rom at 0xf0000/65536 (':bios:BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/32768 (':bios:VGABIOS-elpin-2.40')
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Sat May 21 10:56:05 2022 (time0=3862119365)
00000000000i[DMA  ] channel 4 used by cascade
00000000000i[DMA  ] channel 2 used by Floppy Drive
00000000000i[VGA  ] interval=30000
00000000000i[VGA  ] VBE Bochs Display Extension Enabled
--- End code ---

Now, fortunately, the documentation that comes with Bochs 2.1.1 provides the directions and instructions to compile it for Mac OS 9. It also mentions the flags we need to use to enable SSE2 and so on. It seems very, very doable, and the documentation is not messy nor too complicated to understand.

I'm not sure if I will attempt this myself, but I wanted to let you all know of this, because some of you might want to get involved and do it.

As a "bonus", if anyone of us figures out how to compile Bochs 2.1.1, from the way the documentation words things, we might additionally be able to compile subsequent 2.x versions, as well. Maybe even beyond. There are also some "optimization flags" and other such things that might allow us to make Bochs even faster under OS 9. There's great potential in learning how to compile this.

This is a lot like Mini vMac, in that you toggle on/off a lot of things during compile time, rather than generate one huge binary containing all the options. It has its pros and cons.

Jubadub:
Also, some Bochs 2.1.1 OS 9 usage notes:

- Bochs does use a configuration file for things like specifying the path to your HD image, CD image, which device you want to boot from, how much RAM you want for your VM and so on. By default, it looks for "bochsrc.txt", which doesn't exist in the SIT archive they provide. But what does exist is a sample file, "bochsrc.dlx", which you can copy and rename, then play with. (Incidentally, that sample file is set to boot a tiny, little GNU/Linux system for you. The SIT archive comes with all of that, for your convenience.)

- When you increase RAM in the config file, you also need to, accordingly, increase the amount of memory to be allocated for Bochs itself. As in, "Get Info", then go to "Memory" and type it in.

- To create HD images, there's an accompanying app called "bximage". It tells you exactly what to do to create an image the way you want, up to around 32 GB. Thing is, there are 3 HD image options: flat, sparse and growing. If I select flat, which is the default, the program fails to create the image, for whatever reason. But if Bochs itself is configured to interpret whatever HD image you throw at it as either sparse or growing, it crashes OS 9, but flat is no problem. So you have to create the flat HD image file some other way. (I'm still looking into how.)

- The documentation details all the keywords and such you can use in the configuration file.

For the record, I already booted into Windows XP Professional SP3 32-bit and the included GNU/Linux system successfully. It works.

This build of Bochs 2.1.1 has been slower than Virtual PC for me, maybe because Bochs might be more accurate, but it's also possible the optimization build flag was not used, which we could if we rebuild it.

Hope this helps.

Jubadub:
I just looked throughout the entire list of all changelogs of all versions, which is included with the source code of the latest Bochs version, 2.7, from 2021-08-01, and it seems that, although the last version they released binaries for Mac OS (and also Mac OS X) was 2.1.1, support for compiling for both Mac OS and Mac OS X is fully present. The only thing that changed for the worse, that too only recently (Bochs 2.6.10, from 2019-12-01) is this:


--- Code: ---- GUI and display libraries
  [...]
  - Removed legacy guis "macos" and "svga" from display library auto-
    detection (still available using --with-XXX option).
--- End code ---

To emphasize what they say at the end: "still available using --with-XXX option"

So even what was "removed" was not actually removed, and now requires us to specify the compiler option, rather than it being on/enabled by default. No problems there.

Did I mention Bochs, unlike VPC and I suspect also all the others, allows you to change your BIOS ROM? In fact, it seems it was from Bochs that the widely-used, hugely popular, both in real hardware and virtualization, SeaBIOS BIOS originated from.

teroyk:

--- Quote from: Jubadub on May 21, 2022, 02:39:16 AM ---This build of Bochs 2.1.1 has been slower than Virtual PC for me, maybe because Bochs might be more accurate, but it's also possible the optimization build flag was not used, which we could if we rebuild it.

--- End quote ---

I afraid that Bochs code is not optimized at all for PPC or MacOS9. There might be big (even very big) speed boost even with little assembler optimizations in CPU emulation and more direct graphics acceleration emulation.

Jubadub:

--- Quote from: teroyk on May 23, 2022, 12:40:13 PM ---
--- Quote from: Jubadub on May 21, 2022, 02:39:16 AM ---This build of Bochs 2.1.1 has been slower than Virtual PC for me, maybe because Bochs might be more accurate, but it's also possible the optimization build flag was not used, which we could if we rebuild it.

--- End quote ---

I afraid that Bochs code is not optimized at all for PPC or MacOS9. There might be big (even very big) speed boost even with little assembler optimizations in CPU emulation and more direct graphics acceleration emulation.

--- End quote ---

I researched more, and I can confirm both are true:

- Bochs seeks true accuracy like QEMU (and unlike Virtual PC and all others), so it has the potential to do more, but at the cost of speed;

- I also saw on the archive of the website of the original "MacBochs" port, by David Batterham, that, according to him (back in 1999, before Bochs 1.0 was released), assembler programmers for 68k, PPC and x86 were needed for such optimizations.

I suspect parts of Bochs' code were even used for QEMU when QEMU started (and since then, both projects contribute parts back and forth).

By the way, there's a CodeWarrior Pro 3 project file still included in the source code of the latest version, Bochs 2.7, released late in 2021. Bochs 2.1.1's source code has also a CWPro3 project file. In the 1999s, David Batterham was using CWPro1, then I think it was switched to CWPro2 and then finally CWPro3. Latest OS 9 version of CW is CWPro8, although even the final version, CWPro10 for OS X, can still target OS 9.

Navigation

[0] Message Index

[#] Next page

Go to full version