cx_assembler icon indicating copy to clipboard operation
cx_assembler copied to clipboard

A c++20 constexpr x86 assembler

cx_assembler

A c++20 constexpr x86 assembler

Purpose

  • Learning x86 assembly encoding in a practical and fun way
  • Having an easy framework to generate assembly instruction at compile time

Practical examples

See examples folder.

Want to add instruction ?

  1. Add it to the instruction db file (to the instdb, prefix_db and prefix_0fdb arrays)
  2. Code the encoder in encoder.hpp or add it to an existing encoder if applicable.
  3. Add a test file =)

Supported instructions ?

No extension set is currently being supported, only a subset of x86 instructions is currently being implemented. SIB (Scale Index Base) byte is not fully implemented yet

Build

Clone the repository and build using CMake. Only tested with clang tool chain, O2 optimization is only necessary if you want to use the inline emitter core::emit()

TODOs ?

  • Continue implementing Mod/RM encoding and related helper functions (ie: dword_ptr(operand, disp))
  • Implement SIB

Credits

Changelog

See changelog