Skip to content

Instantly share code, notes, and snippets.

@MilkyDeveloper
Created December 8, 2020 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MilkyDeveloper/ab9df3d3df1e74b26751ee790a943a63 to your computer and use it in GitHub Desktop.
Save MilkyDeveloper/ab9df3d3df1e74b26751ee790a943a63 to your computer and use it in GitHub Desktop.
s3kr1t file

Fuselage for Mac

ˢᶜʳᵒˡˡ ᵗᵒ ᵗʰᵉ ᵇᵒᵗᵗᵒᵐ ᶠᵒʳ ᵗʰᵉ ᵗˡᵈʳ

As the title suggests, Fuselage for Apple Silicon virtualizes Windows 10 using QEMU.

If you know anything about Linux, or just virtualization in general, you know that proccessors have virtualization extensions. For example, most Intel cpu's have VT-x and AMD cpu's have AMD-V. You can hop in an x86_64 computer's bios and observe the extensions above.

However, what about ARM? Well, ARM is usually used for phones and tablets, which never use, nor need, accelerated virtualization. But take the Raspberry Pi for example. It has virtualization. However, Snapdragon cpu's have some limitations, along with the absence of HYP Mode / EL2.

However, take the Raspberry Pi for example. It has full support of KVM (it has an ARM virtualization extension, namely secure virtualization) and I can run full fledged Windows 10 on there. Alledgely it's not very fast (What do you expect out of a 50$ computer?) but it has full, Windows 10 on ARM running on an ARM EFI Bios.

Here's a link of Fuselage Running on the Pi 4

But what does the Mac have to do with this? Well, it can go 2 ways. Either Apple has somehow preserved HVF (Hardware Virtualization Framework, basically KVM except for MacOS.) in the new Apple Silicon Macs, and Windows 10 runs blazingly fast! The other way, however, is that it uses TCG, or the Tiny Code Generator. Now get it, TCG is no slouch, but is abysmal compared to VT-d or AMD-V. TCG can run different architectures, while KVM can't. Think about an unoptimized (Note: QEMU is very optimized and so is TCG, Rosetta is just made by a trillion-dollar company) Rosetta 2.

If we have TCG, no biggie. Considering the ARM Macs are blasingly fast, Windows 10 on ARM will still be pretty fast! I once tried TCG on a Raspberry Pi 4 to run full, x86_64 Windows 10 on the little Pi's. This actually worked but was too slow for me to continue, however note 2 things: This was a different architecture and the Raspberry Pi isn't very fast.

But TCG for the same, host architecture isn't slow. I tried this on an HP Chromebook with an i3 8130u and 8 gigs of ram, and it's better than you'd think! Windows was definetly acceptable, and this is surprising on an already low-end i3 low power (u).

Chances are Apple won't maintain HVF, rather will continue building on their Virtualization.Framework(?), however this isn't ready for development as confirmed by an Apple Engineer.

No worries! Now to install QEMU. How will we do this? Well, it's easier than you think. BSD has deep links with Linux (for example Bash is available on both) and Brew. However, most people don't have their hands on a shiny, new, Apple Silicon Mac. Judging by the comments Brew is definetly possible, just won't be supported until a few months.

But, that's still fine! Just, build Qemu from source! There's so many little nooks and cranies for the dependencies of QEMU that I can't cover.

And, besides, given the fact that porting lot's of programs to a new architecture takes lot's of time, we still have Rosetta 2! It's confirmed that HVF won't be nested for Rosetta 2, so TCG will still be fine. Geekbench 5 on Rosetta 2 with Apple Silicon still beats the 2018 Macbook Pro (max spec), so we're good! Rosetta performance on the Mac is about equal to an i7, so TCG on that will be pretty good! Note that if running through Rosetta 2 it will run full, x86_64 Windows, however curb your expectations if this is the case.

All of this ties up into one thing. Protyping, Testing, and Deploying. Fuselage is already done with some of the Prototyping. I've experimented with TCG, KVM, VT-x, HyperV and all these awesome virtualization tech and have practiced it out on a Pi 4. Now I just need to get QEMU running and make a stable, easy-to-use UI for the Apple Silicon Macs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment