Crates.io | yaxpeax-arm |
lib.rs | yaxpeax-arm |
version | 0.3.0 |
source | src |
created_at | 2020-02-06 07:43:15.773816 |
updated_at | 2024-06-25 21:19:05.751465 |
description | arm decoders for the yaxpeax project |
homepage | |
repository | http://git.iximeow.net/yaxpeax-arm/ |
max_upload_size | |
id | 205415 |
size | 1,242,107 |
yaxpeax-arm
provides implementations of decoders for the armv7, v7/thumb, v7/thumb2, and aarch64/a64 instruction sets.
the entrypoint to begin decoding is either armv7::InstDecoder
(ARMv7::Decoder::default()
) or armv8::InstDecoder
(ARMv8::Decoder::default()
). default
for both decoders is to decode in ARM mode. default
will try to decode as permissively as possible, even attempting to produce some kind of instruction for UNPREDICTABLE
patterns, where possible. for armv7 and below, default_thumb
produces a similarly permissive set of rules, but for decoding thumb/thumb2 instructions.
ARMv7 and thumb mode instructions decode to the same structure: armv7::Instruction
. this is not known to introduce ambiguities, and if you must discern thumb vs non-thumb origins, armv7::Instruction::thumb
will reflect the decoder state when decoding the instruction of interest. additionally, armv7::Instruction::w
reports if the instruction was a wide (32-bit) thum instruction.
for all ARMv7 instructions, armv7::Instruction::s()
reports if the instruction will update status flags. if s
is in error, that is a decoder bug, please report it.
#[no_std]
#[no_std]
yaxpeax-arm
supports use in no_std
environments. to build yaxpeax-arm
in no_std
environments, add default-features = false
to the crate's depdency line. this disables the std
feature, and removes the little integration with std
that yaxpeax-arm
optionally provides.
yaxpeax-arm
hasn't been exhaustively benchmarked, but loose tests suggest that it's at least as fast as other high-quality arm
disassemblers, like capstone
or bad64
. more comprehensive benchmarks to come.
similarly to decode speed, the size of a compiled yaxpeax-arm
hasn't been closely profiled, but at minimum it's 20% the size of yaxpeax-x86
, with armv7
and armv8
code being entirely independent - using only one architecture should allow the other's code to be dead-code-eliminated. yaxpeax-arm
compiles in release mode in only a few seconds.
0.1 and 1.0 versions are considered significant indicators of feature-completeness and stability. the specific guidelines by which yaxpeax-arm
will be considered stable are listed below.
NEON
(SIMD before SVE supported in ARMv8!)yaxpeax-arch
so min_length
can be contingent on the mode of InstDecoder
min_length
is always 4, which is incorrect for Thumb
modes.
conversely, selecting "2" would be flagrantly wrong for ARM
modes.SVE
and SVE2
should_is_must
to control how pedantic decoding should beunpredictable
encodings as DecodeError::Unpredictable
if requiredReproduced from infocenter.arm.com:
Name | Maps To | Meaning |
---|---|---|
r0-r15 | r0-r15 | These are the the registers! |
a1-a4 | r0-r3 | Argument, result, or scratch registers |
v1-v8 | r4-r11 | Variable registers |
sb | r9 | Static base register |
fp | r11 | Frame pointer* |
ip | r12 | Intra-procedure call register |
sp | r13 | Stack pointer |
lr | r14 | link register |
pc | r15 | program counter |
* fp
does not appear to be explicitly referenced in ARM documentation, and mapping to r11 looks to be OS (Windows/Linux?) convention.