[RFC] a little disassembly infrastructure

Hollis Blanchard hollisb at us.ibm.com
Sat Oct 25 03:59:06 EST 2008


Hi, I wrote this patch for KVM [1], but now that I look closer it seems
like there might be some overlapping functionality.

First there's emulate_instruction(), but since that only handles a few
instructions it's just an ordered list of if ((instruction & MASK_A) ==
INST_A) tests, so it doesn't actually parse out opcodes or anything.

I've also found xmon's ppc-opc.c. That parses the opcode and operands,
so could use some shared macros. Of course, the actual lookup isn't
time-sensitive, so that doesn't make sense to share. On the other hand,
if we do come up with something fast *and* robust for KVM, maybe xmon
could use that.

Of course, these macros alone is pretty small, so maybe it's not a big
deal to make a kvm-specific copy of them, leaving the other uses alone.

Comments?

[1] KVM on PowerPC traps when privileged instructions are executed in
the guest context. We must then (quickly!) disassemble them and emulate
their behavior. Right now we do this with a giant switch statement or
two, but are considering more sophisticated techniques in the future.

-- 
Hollis Blanchard
IBM Linux Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc-disassemble.diff
Type: text/x-patch
Size: 3506 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20081024/a141baa8/attachment.bin>


More information about the Linuxppc-dev mailing list