qemu

QEMU: How to Add Instructions

QEMU is a powerful system emulator with many use cases. One common use case in my experience doing systems-related research is to run code with custom instructions. For example, I used QEMU for experimenting with the functionality of a custom CPU architecture called Capstone. I also coupled custom instructions implemented in QEMU with compiler changes to instrument program execution. In this post, I summarise the minimal changes needed to add a custom instruction to QEMU.