Live data from Hacker News

Booting a macOS Apple Silicon Kernel in QEMU

worthdoingbadly.com

51–60 of 73 posts

Re: Booting a macOS Apple Silicon Kernel in QEMU

#51

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…

[deleted]

Re: Booting a macOS Apple Silicon Kernel in QEMU

#52

> 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…

Let’s wait the Apple Silicon Mac Pro. I think they are all in on this fastest chip race thing, with deep pockets, high paying customers and scale behind them.

I'm actually excited to learn that they're going to build small Mac Pro. That could finally be Mac I would buy, if they wouldn't go crazy with prices.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#54
post #32

Earlier quoted context omitted.

For Linux guests: _If you really need to_, Huawei provides the ExaGear Server translator for Linux at https://www.huaweicloud.com/kunpeng/software/exagear.html , which allows to run x86 and x86_64 apps on an arm64 Linux system, including Docker containers for their customers. That translator works pretty well in most cases. Note however that you need to create a Huawei account to download this. For Windows guests: Ru…

Why use ExaGear, why not just use qemu-user-static? Why would I want to use a (presumably) closed-source solution from Huawei whose documentation is only in Chinese, when I could instead use a well-known open source project with plentiful documentation in English?

Exagear is originally from the Russian company Eltechs and was targeted to running x86 apps on SBCs like the Raspberry Pi. e.g. they provided Ubuntu images with wine to run windows apps on a Pi.

They discontinued the product beginning of 2019 and presumably? got bought by Huawei.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#55
post #54

Earlier quoted context omitted.

Why use ExaGear, why not just use qemu-user-static? Why would I want to use a (presumably) closed-source solution from Huawei whose documentation is only in Chinese, when I could instead use a well-known open source project with plentiful documentation in English?

Exagear is originally from the Russian company Eltechs and was targeted to running x86 apps on SBCs like the Raspberry Pi. e.g. they provided Ubuntu images with wine to run windows apps on a Pi. They discontinued the product beginning of 2019 and presumably? got bought by Huawei.

And since then the product changed a lot. They target Arm 64-bit machines only nowadays and support both x86 32-bit _and_ 64-bit application compatibility.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#56
post #45

Earlier quoted context omitted.

I know you said this sarcastically. The custom GPU is going to be a huge roadblock to get anything graphical to render. Probably never going to happen. Add: actually never say never. Consoles with custom GPUs have been very successfully emulated. So maybe someday.

You don't have to emulate the hardware directly. Since apples kernel is opensource, there's a good chance one could write a kernel driver for another GPU offering a sufficiently compatible interface. Nearly all GPU code will have software rendering fallbacks too, so the driver might just be enough to trigger those fallbacks.

At least with the previous versions of macOS you didn't have to do anything special, the software renderer would just work if you don't have a supported GPU.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#57
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.

And some ML acceleration that was built directly as ISA instructions? Not that these would be used in the boot process and basic apps...

Re: Booting a macOS Apple Silicon Kernel in QEMU

#58

This is some very cool hacking, but I’m more interested in knowing how Apple Silicon will run x86 Windows and Linux stuff. Can virtualization software get help from Rosetta 2? Or is QEMU and similar the best we can hope for?

I'm pretty sure it can, they demoed running x86 Windows on the previous keynote.

Re: Booting a macOS Apple Silicon Kernel in QEMU

#59
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.

Ah OK. Not really instructions then :-)

Re: Booting a macOS Apple Silicon Kernel in QEMU

#60
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?

I noticed he was using -d unimp on the qemu command line so qemu should print unimplemented features when it encounters them. (Of course that only prints them, you'll still need to research / reverse engineer to discover what they are).
Post reply on HN