qemu internals
qemu internals
• Functional simulation
• Simulate what a processor does, not how it does it
• Dynamic binary translation
• Interpreters execute instructions one at a time
• Significant slowdown from constant overhead
• Instead, QEMU converts code as needed:
• translate basic blocks generate native host code
• store translated blocks in translation cache
• Tiny Code Generator (TCG)
• Micro-operations
• (Fixed) Register mapping to reduce load/store instr’s
• Translation blocks
• A TCG "basic block" corresponds to a list of
instructions terminated by a branch instruction
• Block chaining
5 QEMU Architecture and Internals
Dynamic translation + cache
cpu_exec() called in each step of
main loop
Program executes until an
unchained block is encountered
Returns to cpu exec() through
epilogue
[2]
[5]
[3]
[4]
Disk initrd
CPU DMA
kernel
File I/O
Linux (host)
qemu-system-arm
-kernel linux-3.13.2/arch/arm/boot/uImage
-initrd bbrootfs.img.gz
-m 128 -M versatilepb
-no-reboot
-append "console=ttyAMA0 root=/dev/ram panic=5 rootfstype=ext4 rw"
-nographic