Skip to content
/ arm Public

ARMv8 (AArch64) instruction assembler implemented in Go

License

Notifications You must be signed in to change notification settings

wdamron/arm

Repository files navigation

package arm

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.

Brief Overview

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 registers
  • Ref: memory reference with register base, optionally followed by X register or immediate for post-indexing
  • RefOffset: memory reference with register base and immediate offset
  • RefPreIndexed: pre-indexed memory reference with register base and immediate offset
  • RefIndexed: memory index with register base, register index, and optional index modifier
  • Imm: 32-bit immediate integer
  • Float: 32-bit immediate float
  • Wide: 64-bit immediate integer
  • Mod: modifier with optional immediate shift/rotate
  • Label: label reference with optional offset from label address
  • Symbol: constant identifier

Additional References