Our contrib build graph was already expressed in contrib/Makefile, so ASDF wasn't doing anything to determine an execution schedule. The new make-contrib.lisp script can parse '.asd' files more-or-less as-is, removing ASDF from the critical path. With blocklist=sb-simd, this change decreased the time in parallelized make-target-contrib to under 5 seconds for me (down from >10) when run on as many cores as there are contrib dirs. All defsystems are treated as if containing ":serial t", and there are two invented keywords to bind/assign special variables around compilation. We still install '.asd' files in $SBCL_HOME/contrib, and build uiop and asdf so there should be no observable difference to users. |
||
|---|---|---|
| .. | ||
| capstone.lisp | ||
| Makefile | ||
| README.md | ||
| sb-capstone.asd | ||
| tests.lisp | ||
SB-CAPSTONE
Capstone integration for SBCL
Capstone [1] is a lightweight multi-platform, multi-architecture disassembly framework. Capstone is based off the LLVM project, and can target a variety of architectures, including but not limiting to PowerPC, x86 and ARM. Capstone is implemented in C [2], and has several bindings into other languages. A binding into Common Lisp was not previously available.
Binding
We exported constants and routines from Capstone main header file [3] using the sb-alien SBCL package.
Requirements
SB-CAPSTONE requires having the Capstone library installed, as a shared object. See the Capstone file COMPLILE.TXT for instructions, and then install file "libcapstone.so" where the load-shared-object function can find it. You can set up the LD_LIBRARY_PATH environment variable if necessary.
Examples
An example on using the bindings can be found on the tests. We rely on sb-alien heavily for passing system addresses to Capstone (where pointers were used in the C analog)
Example: using Capstone's cs_open to create a handle
(require :sb-capstone)
(defun get-handle ()
(multiple-value-bind (return-code handle) (sb-capstone:cs-open-for-target '(:x86-64 :little-endian))
handle))
[1] http://www.capstone-engine.org [2] https://github.com/aquynh/capstone [3] https://github.com/aquynh/capstone/blob/master/include/capstone.h