quix86 instruction decoder
Posted: Fri Jul 18, 2014 5:12 am
Hello fellow OSDevers.
I would like to present to your attention an x86 (and x86-64) instruction decoder that I and my colleagues have developed as part of our daytime job at the Institute for System Programming of Russian Academy of Sciences. It is used in a couple of our code analysis projects and we have relicensed it under LGPL3+ to allow others to take advantage of our work.
The decoder is written in C and has no external dependencies whatsoever, it even makes no calls into the C standard library and thus can be easily incorporated into an OS project, in an in-kernel debugger or to facilitate dynamic code patching.
The decoder is pretty fast, I don't have the recent data but back in 2008 the (then closed-source) version outperformed ndisasm 2.02 by 1.7 times, and objdump 2.17.50 by 3.4 times on a 50M corpus of 32-bit code, and we have made significant improvements since then. If there is demand for current numbers, I will conduct a few performance tests.
The downside is that documentation is, well, scarce, only in form of Doxygen comments. Again, if demand for documentation rises, I will invest some time in that as well. There is also currently no support for AVX/XOP instructions, I plan to add support later this summer.
Our decoder had also been incorporated in at least one big open-source project, the V3VEE Palacios virtual machine monitor.
The Makefile may require some tweaking for your target environment, but there's nothing there that an OSDever can't handle. The one prerequisite for building quix86 is awk which you probably already have.
Pull requests and bug reports are very much welcome, hope that quix86 helps someone. I will be happy to answer any questions.
I would like to present to your attention an x86 (and x86-64) instruction decoder that I and my colleagues have developed as part of our daytime job at the Institute for System Programming of Russian Academy of Sciences. It is used in a couple of our code analysis projects and we have relicensed it under LGPL3+ to allow others to take advantage of our work.
The decoder is written in C and has no external dependencies whatsoever, it even makes no calls into the C standard library and thus can be easily incorporated into an OS project, in an in-kernel debugger or to facilitate dynamic code patching.
The decoder is pretty fast, I don't have the recent data but back in 2008 the (then closed-source) version outperformed ndisasm 2.02 by 1.7 times, and objdump 2.17.50 by 3.4 times on a 50M corpus of 32-bit code, and we have made significant improvements since then. If there is demand for current numbers, I will conduct a few performance tests.
The downside is that documentation is, well, scarce, only in form of Doxygen comments. Again, if demand for documentation rises, I will invest some time in that as well. There is also currently no support for AVX/XOP instructions, I plan to add support later this summer.
Our decoder had also been incorporated in at least one big open-source project, the V3VEE Palacios virtual machine monitor.
- Download: https://github.com/ispras/quix86
Code: Select all
$ cd libquix86
$ make amalgamation # builds an all-in-one header/source, quix86.h and quix86.c
... or ...
$ make static # builds a static library archive
... or ...
$ make shared # builds a shared library
Pull requests and bug reports are very much welcome, hope that quix86 helps someone. I will be happy to answer any questions.