Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write to QEMU guest system registers & memory?

Tags:

qemu

kvm

How do you write to the processor registers and specific memory addresses of a virtual system running in QEMU?

My desire would be to accomplish this from a user space program running outside of QEMU. This would be to induce interrupts and finely control execution of the processor and virtual hardware.

The QEMU Monitor is supposed to read parameters or do simple injects of mouse or keyboard events, but I haven't seen anything about writing.

like image 695
jeremiah Avatar asked Dec 12 '25 01:12

jeremiah


1 Answers

GDB server within QEMU Monitor seems to be the best for your purpose. One of your options is implementing a gdb protocol, another one is driving gdb itself through its command line.

I've tested it a bit: attaching, reading and writing memory seems to work (I read what I write); jumping to another address seems to work too. (If you may call injected code, you can do anything, theoretically). Writing to text-mode video memory doesn't work (I don't even read what I wrote, and nothing changes on display).

like image 54
Anton Kovalenko Avatar answered Dec 15 '25 17:12

Anton Kovalenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!