PyX86
: Description : Emulate in Python a small subset of x86 ISA in order to run a specific piece of code.
: Status : Dormant
Notes
- diStorm3 has a possibly relevant approach:
About diStorm3, currently, I work hard on implementing the instructions' templates of real 80x86 integer instructions. So every 80x86 instruction become a set of Virtual Opcodes. For example: MOV EAX, EBX, is translated into: ASSIGN(REG(0), REG(3)). All these virtual opcodes are actually nodes of expression trees. When this is all done, you will be able to translate a stream of instructions into an expressions tree and do whatever you just wish with this tree, may it be, analyzing, rebuilding, parsing, translation to high level language, etc.
Code
- @@TODO: Upload code.
Links
Potentially useful tools/libraries:
- diStorm64 -- Python disassembler library for AMD64
- PyASM User's Guide V. 0.2 (PyASM announcement)
x86 ISA information:
- x86 Assembly Programming (Was: x86 Assembly Programming)
- 80386 Programmer's Reference Manual
- 80386 Programmer's Reference Manual -- Opcode Jcc
- Intel x86 JUMP quick reference
- 8086 Flags
- Flags Management and Register Renaming
One option I considered was translating x86 assembly to Python bytecode:
- Python Byte Code Instructions
- Ann: Revival of the BytecodeHacks
- BytecodeHacks documentation
- pyasm 0.2 - dynamic x86 assembler for python
Other
- Let's Build a Compiler
- PyEmu -- discovered after the fact, also: Pyemu, PyEmu, PyEmu: A multi-purpose scriptable x86 emulator, PyEmu