qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Interfacing to QEMU


From: David Greene
Subject: [Qemu-devel] Interfacing to QEMU
Date: Tue, 09 Aug 2005 16:38:54 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041208)

Hi all,

I'm very new to QEMU but am interested in using it for a project
I'm working on.

Is there a way to interface to QEMU at the instruction or basic block
level?  In this project I would like to run some code before and/or
after each emulated x86 instruction or basic block.  I realize that
interrupting after every instruction will negate the advantages of the
direct threaded code model used by QEMU but I'm ok with the performance
hit for now.

More interestingly, the ability to interface at the basic block
level means I can keep the performance advantages of dynamnic
translation/threaded code but still do some of the instrumentation
that I want.

Essentially, some outside entity will be sending instruction
addresses to QEMU to point it to some instructions to emulate.
At the end of the instruction (or basic block) QEMU should send
back the next PC it would execute to the controlling entity
along with some information gathered from the instrumentation.
The outside entity will do some processing and then call back
into QEMU for the next instruction or basic block to be emulated.
All x86 machine state should be maintained by QEMU.

This will be running in an emulated OS environment so I don't
need to worry about boosting and running an OS.  That is,
users-space emulation is all that I need.

Looking at the source, the code to emulate x86 instructions
(in op.c) is very well separated from the device drivers,
etc.  I haven't yet looked at the main loops for block
dispatch, dynamic relocation, etc.  I'm just trying to get
an idea if what I want to do is possible and at least not
extraordinarily hard.

I am evaluating QEMU, Bochs and some other systems to do this
and the fast emulation of QEMU is attractive to me.  Plus its
ability to do user-space emulation may mean I don't have to
do as much work.  I'm a little worried that getting the CPU
emulation part out of Bochs and separating it from the device
drivers, etc. might be hairy.

Thanks for your help.

                      -Dave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]