Module X86_proc

Definitions shared between the 32 and 64 bit Intel backends.

Helpers for textual emitters

val string_of_reg8l : X86_ast.reg64 -> string
val string_of_reg8h : X86_ast.reg8h -> string
val string_of_reg16 : X86_ast.reg64 -> string
val string_of_reg32 : X86_ast.reg64 -> string
val string_of_reg64 : X86_ast.reg64 -> string
val string_of_registerf : X86_ast.registerf -> string
val string_of_string_literal : string -> string
val string_of_condition : X86_ast.condition -> string
val string_of_float_condition : X86_ast.float_condition -> string
val string_of_symbol : string -> string -> string
val string_of_rounding : X86_ast.rounding -> string
val buf_bytes_directive : Buffer.t -> string -> string -> unit

Buffer of assembly code

val emit : X86_ast.instruction -> unit
val directive : X86_ast.asm_line -> unit
val reset_asm_code : unit -> unit

Code emission

val generate_code : (X86_ast.asm_line list -> unit) option -> unit

Post-process the stream of instructions. Dump it (using the provided syntax emitter) in a file (if provided) and compile it with an internal assembler (if registered through register_internal_assembler).

val assemble_file : string -> string -> int

Generate an object file corresponding to the last call to generate_code. An internal assembler is used if available (and the input file is ignored). Otherwise, the source asm file with an external assembler.

System detection

type system =
  1. | S_macosx
  2. | S_gnu
  3. | S_cygwin
  4. | S_solaris
  5. | S_win32
  6. | S_linux_elf
  7. | S_bsd_elf
  8. | S_beos
  9. | S_mingw
  10. | S_win64
  11. | S_linux
  12. | S_mingw64
  13. | S_freebsd
  14. | S_netbsd
  15. | S_openbsd
  16. | S_unknown
val system : system
val masm : bool
val windows : bool
val use_plt : bool

Whether calls need to go via the PLT.

Support for plumbing a binary code emitter

val register_internal_assembler : (X86_ast.asm_program -> string -> unit) -> unit
val with_internal_assembler : (X86_ast.asm_program -> string -> unit) -> (unit -> 'a) -> 'a