#assembly #risc-v #jit #x86 #codec

bin+lib asmkit-rs

Portable assembler toolkit: decoding and encoding of various architectures

1 unstable release

0.1.0 Nov 12, 2024

#849 in Encoding

Download history 105/week @ 2024-11-10 21/week @ 2024-11-17

126 downloads per month

MIT/Apache

8.5MB
245K SLoC

asmkit

#![no_std] assembler library.

Features

  • X64, RISC-V, PPC, and ARM (WIP) assemblers
  • Small and portable library.
  • Tiny amount of dependencies:
    • libc, intrusive-collections: for JIT support
    • paste, derive-more: makes our life simpler when declaring arch-specific stuff over and over
    • smallvec: for code generation to not heap allocate often
  • Relocations are provided by CodeBuffer interface and assembler will use them if you use symbols in API.

Goals

  • Auto-generated assemblers for as many as possible platform.
  • Portability: library should built & run on any platform (even if it does not provide assembler for one), and assemblers on its own must not be dependent on platform we built asmkit on.

TODO

  • Add support for ARM64
  • Add support for PPC64
  • Add support for OpenPOWER (POWER9/POWER10)
  • Add support for RW info and implicit operand info for all opcodes
  • Cross-platform helpers to perform calls
  • JSC/SpiderMonkey-like MacroAssembler to help generate assembly without worrying about target architecture
  • Compiler/Builder interface: emit instructions as Inst structure and allow modifying them before emitting, and also possibly to have regalloc pass over them.

Dependencies

~0.8–8MB
~67K SLoC