From 44beb3b1a0372d5c6e68f2fe49d46401d4bb168b Mon Sep 17 00:00:00 2001 From: iximeow Date: Wed, 15 Jan 2020 23:36:57 -0800 Subject: update readme with no-std information, feature description, and some numbers --- README.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e149b5e..ad2ab99 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,26 @@ x86 decoders implemented as part of the yaxpeax project. `yaxpeax-x86` implements traits provided by `yaxpeax-arch`, which are likely how you want to use this library from Rust. included in the `ffi/` directory is a repackaging of `yaxpeax-x86` suitable for use by non-Rust callers, such as C or C++. -`yaxpeax-x86` decoders provide the option to specify what [instruction set extensions](http://git.iximeow.net/yaxpeax-x86/tree/src/lib.rs#n1309) are eligible when decoding, to support decoding x86 instructions as understood by a particular microarchitecture. the default `yaxpeax_x86::InstDecoder` takes an optimistsic approach to decoding and assumes all feature sets are available, as well as accepting both intel-specific and amd-specific quirks around undefined encodings. +### features -the decoders provided by `yaxpeax-x86` are designed to be usable in a `no_std` setting, and expected to be less than 20kb of code and data together. this, however, does not make for the smallest `x86_64` decoder! [`zydis`](https://github.com/zyantific/zydis) handily beats this out taking only 10kb in an -O3 build for benchmarking. +* `#[no_std]` +* configurable choice of permitted instruction set extensions +* seems to be pretty fast +* pretty small? + +### `#[no_std]` +the decoders provided by `yaxpeax-x86` are designed to be usable in a `no_std` setting, and does so by default. to build `yaxpeax_x86` decoders in `no_std` you'll want to set `default-features = false` as with many other `no_std` Rust crates. serde currently (though it doesn't seem _necessarily_?) relies on `std`, as well as the `colors` feature to render instructions with default (eg terminal-friendly) syntax highlighting. + +### instruction set extensions +`yaxpeax-x86` decoders provide the option to specify what [instruction set extensions](http://git.iximeow.net/yaxpeax-x86/tree/src/long_mode/mod.rs#n1297) are eligible when decoding, to support decoding x86 instructions as understood by a particular microarchitecture. the default `yaxpeax_x86::InstDecoder` takes an optimistsic approach to decoding and assumes all feature sets are available, as well as accepting both intel-specific and amd-specific quirks around undefined encodings. + +### pretty fast +by the in-repo benchmark, `yaxpeax_x86::long_mode` decodes `x86_64` instructions at anywhere between 60 million instructions per second to just shy of 100 million instructions per second, depending on hardware and distribution of instructions being decoded. when hooked up to `disasm-bench`, `yaxpeax_x86::long_mode` has shown roughly 150mb/s decode throughput. + +### pretty small? +`yaxpeax_x86::long_mode` is expected to be around 20kb of code and data. currently a stripped static build of `ffi/` takes a bit more space - around 130kb. instruction rendering is currently non-optional, and is a significant amount of `.text` size. data tables are larger than anticipated, and it's currently an open question if they can be reduced down, or the size target of `yaxpeax_x86::long_mode` should be raised. + +this, however, does not by any means make this library the smallest `x86_64` decoder; [`zydis`](https://github.com/zyantific/zydis) handily beats this out taking only 10kb in an -O3 build for benchmarking. ### mirrors @@ -15,11 +32,9 @@ the canonical copy of `yaxpeax-x86` is at [https://git.iximeow.net/yaxpeax-x86/] `yaxpeax-x86` is also mirrored on GitHub at [https://www.github.com/iximeow/yaxpeax-x86](https://www.github.com/iximeow/yaxpeax-x86). ### ! user beware ! -* while `yaxpeax-x86` is designed to support `no_std` use, it currently does not. it should be a small set of changes to get to `no_std`, however. user beware! -* the `libyaxpeax_x86_ffi.a` artifact resulting from a release build of `ffi/` is _huge_. it's almost 2.5mb. it requires linking against `pthread` and `dl`! this largely appears to be a result of depending on the Rust standard library. user beware! * while the decoder has the option to select instruction set extensions, it is entirely likely that some extensions are not yet properly rejected when the corresponding flag is disabled. user beware! * `yaxpeax-x86` likely has many corners where it does not reject instructions it should. particularly likely is accepting a register operand where the corresponding instruction specifically only allows memory encodings - `lea` is a good example of this. user beware! -* `yaxpeax-x86` will, but does not yet, have decoders for protected-mode and real-mode `x86`. currently, `yaxpeax-x86` assumes that it is decoding long mode `x86_64` instructions. it is strongly recommended to use `yaxpeax_x86::x86_64::Instruction` and similar type aliases, rather than using struct and operand types directly. user beware! +* `yaxpeax-x86` will, but does not yet, have decoders for protected-mode and real-mode `x86`. currently, `yaxpeax-x86` assumes that it is decoding long mode `x86_64` instructions. it is strongly recommended to use `::Instruction` and similar type aliases, rather than using struct and operand types directly. user beware! * avx512 is not yet supported. user beware! * avx256 support is questionable. user beware! * ring-0 instructions have questionable support. user beware! -- cgit v1.1