Live data from Hacker News

Booting a macOS Apple Silicon Kernel in QEMU

worthdoingbadly.com

11–20 of 73 posts

Re: Booting a macOS Apple Silicon Kernel in QEMU

#11
post #5

> macOS uses CPU instructions that aren’t available yet on non-Apple ARM CPUs, so you can’t have hardware accelerated virtualization, Does anyone know what these instructions are? And could you not trap and emulate them if the hypervisor detects an invalid instruction?

Bunch of Apple-specific MSRs, mostly.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#12

Incredible. Emulating AppleSilocon before they even announced it. Does anybody know where one can learn about how these people approach and learn about the inner workings of what is essentially a black box from the outside?

Load the file into a decompiler, run it in QEMU with GDB attached, compare. Also have a general idea of how XNU boots.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#13

> Besides, Hackintoshes are often built when Apple’s own hardware isn’t fast enough; in this case, Apple’s ARM processors are already some of the fastest in the industry. They are also used when one wants more cores than are possible on Apple hardware. If you want a build engine for a medium to large sized compiled language project, Apple has no options that make economic sense, since a Ryzen Threadripper will beat e…

Hackintoshes from my experience are usually built as a low cost hobbyist alternative. Most people earning a living from a Mac will sacrifice speed to have stability and support.

Plenty of people who want MacOS but cannot afford the official Mac will use it instead.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#14

Incredible. Emulating AppleSilocon before they even announced it. Does anybody know where one can learn about how these people approach and learn about the inner workings of what is essentially a black box from the outside?

Load the file into a decompiler, run it in QEMU with GDB attached, compare. Also have a general idea of how XNU boots.

> Also have a general idea of how XNU boots.

I guess Jonathan Levin’s Books should then be mentioned here.

However, that then leads to the question how Levin reversed this black box.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#15
post #5

> macOS uses CPU instructions that aren’t available yet on non-Apple ARM CPUs, so you can’t have hardware accelerated virtualization, Does anyone know what these instructions are? And could you not trap and emulate them if the hypervisor detects an invalid instruction?

So in the future macOS will run on arm64e architecture? Could Linux[1] run on that as well? Any chance of seeing more ARM laptops in the future?

1: https://wiki.debian.org/Arm64Port

Re: Booting a macOS Apple Silicon Kernel in QEMU

#16

> Besides, Hackintoshes are often built when Apple’s own hardware isn’t fast enough; in this case, Apple’s ARM processors are already some of the fastest in the industry. They are also used when one wants more cores than are possible on Apple hardware. If you want a build engine for a medium to large sized compiled language project, Apple has no options that make economic sense, since a Ryzen Threadripper will beat e…

Hackintoshes from my experience are usually built as a low cost hobbyist alternative. Most people earning a living from a Mac will sacrifice speed to have stability and support. Plenty of people who want MacOS but cannot afford the official Mac will use it instead.

I need to build my software for macOS. On my Ryzen Threadripper running Linux, I can run a faster, more powerful KVM/QEMU version of Mojave than I can buy from Apple, while still having cores and RAM left for Linux.

I could afford to buy hardware from Apple, but why would I when the cost/performance ratio for an embarrasingly parallel compute task like compiling is so much worse?

Re: Booting a macOS Apple Silicon Kernel in QEMU

#17

Earlier quoted context omitted.

Load the file into a decompiler, run it in QEMU with GDB attached, compare. Also have a general idea of how XNU boots.

> Also have a general idea of how XNU boots. I guess Jonathan Levin’s Books should then be mentioned here. However, that then leads to the question how Levin reversed this black box.

You don't need his books, but they might be helpful if you're trying to get up to speed quickly.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#18

The fact that he even got that far with emulating what is essentially completely undocumented hardware is a very good sign, adding the rest of the hardware to QEMU might not be as hard as initially thought. This approach will help with none of these Don't underestimate the community -- a lot of Hackintosh (and emulation) stuff is done for the "just because I can" reasons, and getting a fully emulated ARM Mac working…

Not surprised given their attempt to run AIX on QEMU as well. That's slightly more documented but still a pain to do - as it requires specific versions of AIX(7.2 TL3 SP1/7.1 TL5 SP5).

Re: Booting a macOS Apple Silicon Kernel in QEMU

#20

The fact that he even got that far with emulating what is essentially completely undocumented hardware is a very good sign, adding the rest of the hardware to QEMU might not be as hard as initially thought. This approach will help with none of these Don't underestimate the community -- a lot of Hackintosh (and emulation) stuff is done for the "just because I can" reasons, and getting a fully emulated ARM Mac working…

I created a mac in a vm and then I used system migration tool to sort of upload my old macbook pro's consciousness into the cloud.

https://youtu.be/86XqF5dqjYc

pretty cool

I've been thinking about resurrecting my machines with older versions of osx - I'll have to figure out how to boot say 10.11 or 10.12

Post reply on HN