OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 10:56 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: quix86 instruction decoder
PostPosted: Fri Jul 18, 2014 5:12 am 
Offline
Member
Member

Joined: Wed Jan 08, 2014 8:41 am
Posts: 100
Location: Moscow, Russia
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 build process is straightforward:

Code:
$ 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


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.


Top
 Profile  
 
 Post subject: Re: quix86 instruction decoder
PostPosted: Sat Jul 19, 2014 3:21 am 
Icee wrote:
I would like to present to your attention an x86 (and x86-64) instruction decoder

Please, can you clarify a bit - is it just another disassembler?


Top
  
 
 Post subject: Re: quix86 instruction decoder
PostPosted: Sat Jul 19, 2014 5:32 am 
Offline
Member
Member

Joined: Tue Nov 08, 2011 11:35 am
Posts: 453
embryo wrote:
Please, can you clarify a bit - is it just another disassembler?
There is some difference between disassemler tools (~work with files, produce human-readable output) and instruction decoders (fast decoding of single instruction, it's usefull for trap-and-emulate functions, decoding of execution traces, etc; work with structures instead of text).
There are many libraries that can be used for instruction decoding but they all have their pros and cons.
One can also note that quix86 development started many years ago and at that time there were ~no well-known library with required features and suitable license.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 104 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group