In this article I would like to present the current status of the MIPS Release 6 architecture implemented in upstream QEMU v2.4. This is one of the several major contributions from Imagination Technologies to the open source and QEMU communities in the last year.

Read on to find out how MIPS Release 6 support has been implemented, what is currently supported, and what are our plans for the near future.

MIPS Release 6

Release 6 is the latest version of MIPS architecture, adding new functionality and significantly increasing the space available in the opcode map for future expansion; the list of changes has been described here.

To help developers quickly and easily prototype code for MIPS Release 6 implementations, Imagination has made key contributions to QEMU, enabling early access to an open source MIPS Release 6 virtual platform.

What is QEMU?

QEMU (Quick EMUlator) is an open source machine emulator and virtualizer. It can emulate entire machines including processors and peripherals (i.e. the full-system emulation) like the MIPS Malta evaluation board or the Lemote computer with the MIPS-based Loongson-2E processor. QEMU can also emulate the Linux user mode of a CPU (i.e. the Linux-user emulation), translating guest system calls into host system calls.

CPU emulation is instruction accurate and QEMU uses binary translation technology to efficiently run programs built for different architectures (for instance running MIPS programs on an x86-based system). TCG (the Tiny Code Generator) is the component inside QEMU which is responsible for doing the translation.

When a MIPS virtual machine runs on a compatible MIPS host CPU, then QEMU can take advantage of KVM (Kernel-based Virtual Machine) and execute guest software instructions directly on the host CPU, which is obviously much faster. There are more ways to accelerate the VM, for instance with just one additional option in the command line one can replace the default network adapter on MIPS Malta board with virtio-net – the paravirtualized network adapter – which significantly improves the performance of the network in the guest.

QEMU provides various tools for debugging the guest software, like execution tracing, gdb server as well as the monitor allowing the user to stop and inspect the system at any time. It also contains snapshotting and migration capabilities.

There are more features and all of them make QEMU a convenient virtual platform.

Here is Debian 7 (codenamed Wheezy) running on an emulated MIPS Malta board:


QEMU is also used in the Android emulator, available in the Android SDK and NDK. You can find MIPS there as well:



How MIPS Release 6 has been added to QEMU

The addition of MIPS Release 6 to QEMU was done in multiple steps. The first step was to implement unprivileged architecture changes in order to run MIPS Release 6 Linux programs in Linux-user emulation. These changes consisted mainly of adding the ability to decode and translate new unprivileged MIPS instructions in the MIPS TCG front-end and raising Reserved Instruction Exceptions when executing obsolete instruction on a MIPS Release 6 processor.

At this point, it was possible to run Linux user-mode programs, and compilers could use that feature to verify whether generated code is correct. The next step was to implement the privileged architecture changes, so that guest operating systems like Linux can use new Coprocessor 0 registers in the full-system emulation. One example is BadInstr that captures the most recent instruction which caused an exception. These changes were openly developed as a part of prpl and early available in prpl QEMU repository, eventually, they were merged to mainline QEMU and appeared in version 2.2.0.

A few months later, Imagination contributed microMIPS Release 6 to QEMU. microMIPS provides alternative instruction encoding consisting of 16-bit and 32-bit opcodes. The implementation in QEMU was relatively simple, as it just introduced new encodings in the microMIPS decoder which reuse existing code responsible for translating the MIPS Release 6 instructions. The microMIPS Release 6 was initially done on prpl, patches were sent upstream and the feature appeared in mainline QEMU version 2.4.0. Furthermore, this version of QEMU also introduced support for unaligned memory accesses in MIPS Release 6; the initially proposed implementation was greatly improved thanks to the help from TCG maintainers.

Quite recently the addition of MIPS Release 6 support in the TCG back-end was submitted to the upstream QEMU mailing list, which means that QEMU can now emulate other architectures while running on a host with a MIPS Release 6 processor. Moreover, there is also initial work providing emulation of a Global Interrupt Controller (GIC) containing features like shared timer, interrupt routing and inter-processor interrupts.

Give it a try!

If you’d like to take QEMU for MIPS out for a spin, you can download the latest version from

In addition, GCC and the Linux kernel already support MIPS Release 6. Once we build the MIPS64 Release 6 Linux kernel for Malta board and root filesystem, we can run them on QEMU in full-system emulation:

qemu-system-mips64el -M Malta -cpu MIPS64R6-generic -kernel vmlinux -append "root=/dev/hda console=ttyS0" -hda rfs.img -nographic

Alternatively we can run a Linux user-mode program:

qemu-mips64el -cpu MIPS64R6-generic a.out

Remember that in the linux-user emulation each qemu-* binary is for different syscall ABI. For example, the qemu-mips64 can run only the n64 ABI programs, qemu-mipsn32 the n32 ABI and qemu-mips the o32 ABI.

prpl QEMU

Imagination Technologies, a member of prpl Foundation, contributes new MIPS features to prpl QEMU.

Sometimes it can take significant amount of time before major changes go through the process of upstreaming and get accepted and merged to the mainline. And after that you may need to wait few months until new stable version is released. prpl QEMU provides early availability of the latest MIPS features based on a recent stable version of upstream QEMU.

If you want to try prpl QEMU, head over to the main page.

What’s next?

There is still plenty of exciting work ongoing for QEMU. Now the focus has moved towards implementing the latest Release 6 multi-threading features to replace the existing MIPS MT module. This includes not only the new instructions that disable and enable Virtual Processors, but also the inclusion of our Global Interrupt Controller and other Coherent Processor System components that eventually will allow MIPS64 Release 6 SMP Linux to run on QEMU. Initial implementation of GIC is already available in prpl QEMU and more will come soon.

The ultimate goal is to emulate a multi-core cluster, with each core having of multiple Virtual Processors. If this sounds familiar, it is because this new functionality matches the features of our new 64-bit multi-threaded MIPS I6400 CPU.

Interested in the latest news and updates from Imagination? Make sure to follow us on Twitter (@ImaginationPR, @ImaginationTech, @MIPSguru, @MIPSdev), LinkedIn, Facebook or Google+