Skip to main content

Module encoder

Module encoder 

Source
Expand description

x86-64 instruction encoder (REX, ModR/M, SIB, immediate, relocation). x86-64 instruction encoder.

Encodes parsed Instructions into machine-code bytes. Uses a table-driven approach for opcode lookup with manual ModR/M, SIB, REX prefix construction.

Structs§

EncodedInstr
Result of encoding a single instruction.
InstrBytes
Stack-allocated instruction byte buffer — eliminates per-instruction heap allocation on the encoding hot path.
RelaxInfo
Information for branch relaxation — allows the linker to try a shorter encoding.
Relocation
A relocation record for unresolved labels.

Enums§

RelocKind
How the linker should patch the relocation target into the instruction.

Functions§

encode_instruction
Errors
encode_instruction_16
x86-16 (real mode) encoder.