I am working on a project where I would like to add some op op codes to x86 and run them in QEMU. I somehow figured out how to change the code generation in QEMU to take assembly instructions with a โfakeโ operation code and do something with it in QEMU.
However, the part I'm having problems with is how I'm actually going to create a binary file with fake instructions. The only way I was thinking about is to add db statements to some operators, and then just write the manual manually. For instance:
xor EAX, EBX db 0xf1,0x32,0x55,0x00 mov EBX, EAX
(suppose db has enough bytes to be the actual instruction). Will it actually compile the binary, where the I bytes defined in the second line are treated as instructions?
Is there an even more elegant approach to this? Since I will modify QEMU to support these changes, I am not tied to the command format - I just need the OP code to be recognized by the QEMU code generator, and I can formulate the rest, but I want to.
source share