Skip to main content

Crate exarmo_aarch32_capi

Crate exarmo_aarch32_capi 

Source
Expand description

The C face of the exarmo-aarch32 disassembler, declared in include/exarmo/aarch32.h.

An instruction is decoded once into an opaque value the caller holds, and then read through functions: what it is, what it does to the flags, its operands as include/exarmo/aarch32.h lays them out, and its text as spans of a buffer the caller owns. Nothing allocates on the caller’s behalf, and no panic crosses the boundary. Each entry point catches one and reports a failure.

A32 and T32 are two decode entry points into one instruction. A T32 decode is told the IT state, since a 16-bit encoding takes its condition from a preceding IT instruction, and a caller that tracks the blocks advances the state through exarmo_aarch32_it_state_after.

Modules§

model
Each type of exarmo_aarch32::operands laid out as include/exarmo/aarch32.h declares it, and the conversion from the Rust one. The header is the authority on layout, and every struct here follows its field order.
tables
The tables the architecture fixes, laid out for C to read directly.

Structs§

Branch
What an instruction does to the flow of control, as C holds it.
CInstruction
Opaque storage for an Instruction, exarmo_aarch32_instruction in C.
CItState
The IT state a T32 decode is told, exarmo_aarch32_it_state.
FlagEffect
What an instruction does with the condition flags, as C holds it.
Str
A string that is not NUL-terminated.
TextSize
How much text and how many tokens an instruction has.
Token
One token of an instruction’s text, a span of the text buffer it was written into.

Enums§

ItKind
Whether a T32 instruction is inside an IT block, exarmo_aarch32_it_kind.
Status
The outcome of a decode, <prefix>_status.

Functions§

exarmo_aarch32_decode_a32⚠
The former name of exarmo_aarch32_decode_a32_word, which the header marks deprecated.
exarmo_aarch32_decode_a32_bytes⚠
Decode the A32 instruction at the start of the len bytes at bytes into out, which is written only on Status::Ok.
exarmo_aarch32_decode_a32_word⚠
Decode the A32 word bits into out, which is written only on Status::Ok.
exarmo_aarch32_decode_t32⚠
The former name of exarmo_aarch32_decode_t32_word, which the header marks deprecated.
exarmo_aarch32_decode_t32_bytes⚠
Decode the T32 instruction at the start of the len bytes at bytes, under the IT state state, into out, which is written only on Status::Ok.
exarmo_aarch32_decode_t32_word⚠
Decode the T32 word bits, its first halfword in the high half, under the IT state state, into out, which is written only on Status::Ok.
exarmo_aarch32_encoding_length
How many bytes an encoding is, or 0 for a value that is no encoding.
exarmo_aarch32_encoding_mnemonic
The mnemonic an encoding is written with. Returns EXARMO_AARCH32_MNEMONIC_COUNT for a value that is no encoding.
exarmo_aarch32_encoding_name
An encoding’s name, or empty for a value that is no encoding.
exarmo_aarch32_instruction_branch⚠
What the instruction does to the flow of control, as it reads at address. Nothing for a null pointer.
exarmo_aarch32_instruction_encoding⚠
Which encoding the instruction is. Returns EXARMO_AARCH32_ENCODING_COUNT for a null pointer.
exarmo_aarch32_instruction_flags⚠
What the instruction does with the condition flags. Nothing for a null pointer.
exarmo_aarch32_instruction_length⚠
How many bytes of the instruction stream the instruction is, 4 for an A32 instruction and 2 or 4 for a T32 one. Returns 0 for a null pointer.
exarmo_aarch32_instruction_mnemonic⚠
The mnemonic the instruction is written with. Returns EXARMO_AARCH32_MNEMONIC_COUNT for a null pointer.
exarmo_aarch32_instruction_operands⚠
Write the instruction’s operands into out, up to capacity. Returns how many the instruction has.
exarmo_aarch32_instruction_size
How many bytes of storage a decode writes, as the library was built.
exarmo_aarch32_instruction_sysreg⚠
Write the system register the instruction accesses into out, and return true. Returns false, leaving out untouched, for an instruction that reaches none or a null pointer.
exarmo_aarch32_instruction_text⚠
Write the instruction’s text into the caller’s buffer. Returns the length of the whole text.
exarmo_aarch32_instruction_tokens⚠
Write the instruction’s text and tokens into the caller’s buffers.
exarmo_aarch32_instruction_unpredictable⚠
Whether the word inst was decoded from is CONSTRAINED UNPREDICTABLE, through its decode’s tests or a bit its diagram writes (0) or (1). Returns false for a null pointer.
exarmo_aarch32_it_state_after⚠
The IT state the instruction after inst is in, on the straight line, given that inst was decoded under state. Returns state itself for a null pointer.
exarmo_aarch32_mnemonic_name
A mnemonic’s text, or empty for a value that is no mnemonic.
exarmo_aarch32_sysreg_name
The name of the register with this key in this space, accessed in this direction, or empty where the architecture names none.
exarmo_aarch32_t32_length
How many bytes the T32 instruction beginning with the halfword hw1 takes, 2 or 4.