Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running x86 program _on_ llvm

Tags:

x86

llvm

Is it possible to use llvm to run x86 programs? I.e. I want to use llvm as an x86 simulator to run x86 programs and then instrument the x86 program.

Thanks!

like image 658
anon Avatar asked Apr 15 '10 22:04

anon


2 Answers

I think you are looking for LibCPU.

It has an x86 frontend (well, actually only 8086 at the moment, and that is not even complete, but they're working on it), and since it is built on top of LLVM, it obviously also has an x86 backend, thus making it possible to run x86-on-x86 but passing it through LLVM's optimization, instrumentation and analysis stages.

like image 57
Jörg W Mittag Avatar answered Sep 20 '22 15:09

Jörg W Mittag


Also, there was a project to use LLVM in qemu. It is also a way of running x86 code via LLVM.

http://code.google.com/p/llvm-qemu/

It was GSoC project, but there is a code in svn and author have results:

regular qemu     llvm-qemu rle,dse,simple regalloc   llvm-qemu full opts
4m35.349s             5m39.697s                        13m50.697s

llvm-qemu twice-thrice slower than qemu, but it works.

like image 25
osgx Avatar answered Sep 19 '22 15:09

osgx