开发者

Convert ARM instruction to i386 instruction

开发者_如何学CIs there any ARM instruction to i386 instruction Converter available?


You can use QEMU to emulate ARM instructions on x86.


You could reverse-engineer the ARM code to C, and then simply compile the C code. This company actually produces pretty good code C code from assembler. (I've never used their product, but I am familiar with the research behind that company).


Emulation or static binary translation are the paths I would take, each has its pros and cons.

You need to be more clear about what you are asking. The simple translation of one instruction set to another is one thing, the harder part of making the result useful is what you are addressing. Your ARM's memory and register space will not match the X86, so a straight instruction to instruction (emulated or sbt) will not be enough, you have to add code to replace many of the loads and stores with something that checks the address, determines what it was addressing, and emulate that peripheral (emulated or sbt).


i really doubt. there are too much differences to make it automated.


http://www.libcpu.org/

It's very much in beta, but the idea is to write llvm front-ends for binaries, so that the llvm back-end can then generate code for any supported platform. There is an ARMv6 front end under active development, and I'm sure they would like to have help with it. The goal is to support both emulation and static recompilation between any of the supported architectures.


The easiest way to do this is to use something called "Software Dynamic Translation". You can find some information on the technique here:

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.120.5182&rep=rep1&type=pdf

It works by dynamically translating "basic blocks", where you translate all instructions up to a control point (branch, call, jump) and then replace the code at branch targets with stubs that call back into the translator. It is roughly equivalent to something like "JIT Compilation" in the CLR except that it works at a more granular level (basic blocks instead of methods). It's advantageous over static translation approaches because it doesn't rely on accurate disassembly. Acquiring perfect disassembly is not possible (it's equivalent to the halting problem). Even really good disassemblers, like IDA pro, can have problems identifying things like exception handlers and often confuse code with data.

Software dynamic translation, however, is not subject to any of these limitations. It can even (in theory) handle self modifying code using appropriate memory protection techniques.


microsoft provides the device emulator, which does exactly that. the first version even comes with source code: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=10865

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜