Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can't. The term "virtualize" is generally used to mean running an OS via hardware virtualization, where your host CPU natively runs its code but forwards all I/O to a hypervisor. You can only do that with an OS built for the same CPU architecture as your host system.

For everything else, like running ARM software on x86 (and vice versa), you'll have to resort to emulation, which involves either interpreting the code or dynamically recompiling it. By definition, you can emulate anything on anything else (someone recently booted Linux for MIPS on an Intel 4004, the first ever microprocessor), but the performance might be a problem.



TL;DR: emulating any ARM binaries on x86_64 via QEMU is so slow that it is unusable for any general use.

This is also less of a QEMU problem and more just that ARM does not emulate well on x86_64 due to their designs.


I have tried emulating ARM Windows on x86 with QEMU. It is fast enough to see whether something works and not much more (imagine Windows 11 on a 400MHz equivalent processor to understand what the performance was like --- and the host was a fairly recent Intel i7.)

ARM Linux is close to usable, however.


It feels like it's just not possible in general to emulate the full instruction set of any CPU with an MMU with an acceptable performance to run modern software. QEMU running Windows for x86 on an M1 isn't very fast either.

Only emulating the portion of the instruction set available from the userspace is another story though. At least the way Apple does it with Rosetta and Microsoft with whatever their thing is called, you don't even notice that an app is running under emulation. The only giveaway is that it takes a noticeable time to start for the first time while the code is being translated. It's truly impressive.


> QEMU running Windows for x86 on an M1 isn't very fast either.

It seems the main obstacle is in paging where x86 4KB clashes with Apple 16KB (ARM/64 supports multiple sizes), so, 2-level paging canʼt aid and an emulator has to shadow-paging which is, definitely, much slower.

> Apple does it with Rosetta and Microsoft with whatever their thing is called, you don't even notice that an app is running under emulation.

But they still use a vendor-specific TSO support in hardware.


Curious, does QEMU use some kind of ahead-of-time translating scheme? Or do they rewrite instructions as they see them?


Latter.


Sounds like a huge opportunity for improvements.

A simple approach would identify basic blocks in the code and translate them to an IR for an optimizing compiler back-end like LLVM.

Of course, you have to be careful with self-modifying code.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: