import "github.com/wdamron/arm"
Package arm
implements an ARMv8 (AArch64) instruction assembler in Go, for runtime or ahead-of-time generation of executable code. SVE/SME instructions are not yet supported.
This library is mostly adapted from the CensoredUsername/dynasm-rs (Rust) project, and is not heavily tested.
The Assembler
type encodes executable instructions to a code buffer.
Some instructions support label offset arguments, which may be resolved by the Assembler
and encoded after all label addresses are assigned.
The following are argument types:
Reg
: integer, SP, SIMD scalar, or SIMD vector register (with optional element index)RegList
: list of sequential registersRef
: memory reference with register base, optionally followed by X register or immediate for post-indexingRefOffset
: memory reference with register base and immediate offsetRefPreIndexed
: pre-indexed memory reference with register base and immediate offsetRefIndexed
: memory index with register base, register index, and optional index modifierImm
: 32-bit immediate integerFloat
: 32-bit immediate floatWide
: 64-bit immediate integerMod
: modifier with optional immediate shift/rotateLabel
: label reference with optional offset from label addressSymbol
: constant identifier