This is still the header! Main site

QEMU is awesome

2021/10/15

This is post no. 36 for Kev Quirk's #100DaysToOffload challenge. The point is to write many things, not to write good ones. Please adjust quality expectations accordingly :)

I was compiling QEMU recently. (There might be some blogposts later about the actual reasons.) It's already somewhat satisfying to fill all the cores with gcc processes... but many things can do that: GUI libs, ugly web browsers, and so on. Just watching the source file names fly by made me realize something interesting here though:

this thing is an accurate description of basically any computer anyone could realistically be using today.

Like...


  --target-list=LIST       set target list (default: build all non-deprecated)
                           Available targets: aarch64-softmmu alpha-softmmu
                           arm-softmmu avr-softmmu cris-softmmu hppa-softmmu
                           i386-softmmu m68k-softmmu microblaze-softmmu
                           microblazeel-softmmu mips-softmmu mips64-softmmu
                           mips64el-softmmu mipsel-softmmu nios2-softmmu
                           or1k-softmmu ppc-softmmu ppc64-softmmu
                           riscv32-softmmu riscv64-softmmu rx-softmmu
                           s390x-softmmu sh4-softmmu sh4eb-softmmu
                           sparc-softmmu sparc64-softmmu tricore-softmmu
                           x86_64-softmmu xtensa-softmmu xtensaeb-softmmu
                           aarch64-linux-user aarch64_be-linux-user
                           alpha-linux-user arm-linux-user armeb-linux-user
                           cris-linux-user hexagon-linux-user hppa-linux-user
                           i386-linux-user m68k-linux-user
                           microblaze-linux-user microblazeel-linux-user
                           mips-linux-user mips64-linux-user
                           mips64el-linux-user mipsel-linux-user
                           mipsn32-linux-user mipsn32el-linux-user
                           nios2-linux-user or1k-linux-user ppc-linux-user
                           ppc64-linux-user ppc64le-linux-user
                           riscv32-linux-user riscv64-linux-user
                           s390x-linux-user sh4-linux-user sh4eb-linux-user
                           sparc-linux-user sparc32plus-linux-user
                           sparc64-linux-user x86_64-linux-user
                           xtensa-linux-user xtensaeb-linux-user
                           Deprecated targets: ppc64abi32-linux-user
        

It knows about i386 and x86_64 (of course it does). It does remember SPARC and MIPS, the fancy workstation CPUs of olden days. It can also emulate ARM cores for phones, but... the list doesn't end there. It can handle RISC-V. It even has support for some Xtensa CPUs (... which might be familiar from ESP8266 and ESP32... those two aren't quite supported, but still).

And by "knows about"... I mean it knows pretty much everything that is to be known about these from a software point of view. Instructions, registers, protection models, everything. It can emulate these accurately; for some of them, it even has some hardware virtualization support. So... if you imagine a thick copy of the same i386 processor manual that Linus Torvalds started out with... that knowledge is in there somewhere. And that was just one kind of CPU.

It also has fairly good models of many kinds of hardware: sound cards, network adapters, displays. (It has to be accurate; otherwise, things just wouldn't work.) But... in case you would want to keep your current OS: it can also run e.g. your x86 binaries on ARM (... or vice versa), pretty much seamlessly.

So... essentially... you do get this giant bucket of every kind of computer around, complete with various peripherials, to play around with. For free.

How is this not awesome?

... comments welcome, either in email or on the (eventual) Mastodon post on Fosstodon.