10

Is there any ARM instruction to i386 instruction Converter available?

3
  • 9
    What are you trying to achieve? Commented May 28, 2010 at 10:04
  • Are you trying to just run some code that you've got (in which case an emulator is good) or are you trying to convert some code that you've inherited from a former developer and where you've not got the source? Commented Jun 3, 2010 at 7:59
  • 2
    While the conversion of instructions from ARM to x86 instructions is technically possible with a custom compiler (ARM to IR to x86), there are other more predominant obstacles, such a completely different operating system and run-time libraries that the application is designed to communicate with which has nothing to do with instruction conversion. It’s easier to recompile the application for the x86 and for the targeted OS.
    – tgiphil
    Commented Jun 3, 2010 at 8:08

7 Answers 7

12
+50

You can use QEMU to emulate ARM instructions on x86.

2

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).

1

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).

0

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

2
  • 1
    They're a lot closer than, say, ANSI C and x86, yet there are lots of programs that automatically do that conversion.
    – Ken
    Commented Jun 3, 2010 at 20:18
  • Not at all. ANSI C is designed to compile to various assembler languages. Many high-level (relatively) concepts in C can be represented in numerous different ways in different assemblers. Between assemblers, however, is a different story.
    – Puppy
    Commented Jun 4, 2010 at 13:41
0

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.

0

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.

0

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

2

Not the answer you're looking for? Browse other questions tagged or ask your own question.