cx_assembler
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 ?
- Add it to the instruction db file (to the
instdb
,prefix_db
andprefix_0fdb
arrays) - Code the encoder in
encoder.hpp
or add it to an existing encoder if applicable. - 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
- Godbolt for prototyping
- Intel x86-64 manual
- Defuse.ca for verifying outputs
- Geek ABC reference
- People who answered my questions about c++20
Changelog
See changelog