jon.recoil.org

Module X86_ast

Structured representation of Intel assembly language (32 and 64 bit).

type condition =
  1. | L
  2. | GE
  3. | LE
  4. | G
  5. | B
  6. | AE
  7. | BE
  8. | A
  9. | E
  10. | NE
  11. | O
  12. | NO
  13. | S
  14. | NS
  15. | P
  16. | NP
type float_condition =
  1. | EQf
  2. | LTf
  3. | LEf
  4. | UNORDf
  5. | NEQf
  6. | NLTf
  7. | NLEf
  8. | ORDf
type rounding =
  1. | RoundUp
  2. | RoundDown
  3. | RoundNearest
  4. | RoundTruncate
  5. | RoundCurrent
type constant =
  1. | Const of int64
  2. | ConstThis
  3. | ConstLabel of string
  4. | ConstLabelOffset of string * int
  5. | ConstAdd of X86_ast.constant * X86_ast.constant
  6. | ConstSub of X86_ast.constant * X86_ast.constant
type data_type =
  1. | NONE
  2. | REAL4
  3. | REAL8
  4. | BYTE
  5. | WORD
  6. | DWORD
  7. | QWORD
  8. | VEC128
  9. | VEC256
  10. | VEC512
  11. | NEAR
  12. | PROC
type reg64 =
  1. | RAX
  2. | RBX
  3. | RCX
  4. | RDX
  5. | RSP
  6. | RBP
  7. | RSI
  8. | RDI
  9. | R8
  10. | R9
  11. | R10
  12. | R11
  13. | R12
  14. | R13
  15. | R14
  16. | R15
type reg8h =
  1. | AH
  2. | BH
  3. | CH
  4. | DH
type regf =
  1. | XMM of int
  2. | YMM of int
  3. | ZMM of int
type reg_idx =
  1. | Scalar of X86_ast.reg64
  2. | Vector of X86_ast.regf
type arch =
  1. | X64
  2. | X86
type addr = {
  1. arch : X86_ast.arch;
  2. typ : X86_ast.data_type;
  3. idx : X86_ast.reg_idx;
  4. scale : int;
  5. base : X86_ast.reg64 option;
  6. sym : string option;
  7. displ : int;
}

Addressing modes: displ + sym + base + idx * scale (if scale = 0, idx is ignored and base must be None)

type prefetch_temporal_locality_hint =
  1. | Nta
  2. | T1
  3. | T2
  4. | T0
type arg =
  1. | Imm of int64
    (*

    Operand is an immediate constant integer

    *)
  2. | Sym of string
    (*

    Address of a symbol (absolute address except for call/jmp target where it is interpreted as a relative displacement

    *)
  3. | Reg8L of X86_ast.reg64
  4. | Reg8H of X86_ast.reg8h
  5. | Reg16 of X86_ast.reg64
  6. | Reg32 of X86_ast.reg64
  7. | Reg64 of X86_ast.reg64
  8. | Regf of X86_ast.regf
  9. | Mem of X86_ast.addr
  10. | Mem64_RIP of X86_ast.data_type * string * int
type instruction =
  1. | ADD of X86_ast.arg * X86_ast.arg
  2. | ADC of X86_ast.arg * X86_ast.arg
  3. | AND of X86_ast.arg * X86_ast.arg
  4. | BSF of X86_ast.arg * X86_ast.arg
  5. | BSR of X86_ast.arg * X86_ast.arg
  6. | BSWAP of X86_ast.arg
  7. | CALL of X86_ast.arg
  8. | CDQ
  9. | CLDEMOTE of X86_ast.arg
  10. | CMOV of X86_ast.condition * X86_ast.arg * X86_ast.arg
  11. | CMP of X86_ast.arg * X86_ast.arg
  12. | CQO
  13. | DEC of X86_ast.arg
  14. | HLT
  15. | IDIV of X86_ast.arg
  16. | IMUL of X86_ast.arg * X86_ast.arg option
  17. | MUL of X86_ast.arg
  18. | INC of X86_ast.arg
  19. | J of X86_ast.condition * X86_ast.arg
  20. | JMP of X86_ast.arg
  21. | LEA of X86_ast.arg * X86_ast.arg
  22. | LOCK_CMPXCHG of X86_ast.arg * X86_ast.arg
  23. | LOCK_XADD of X86_ast.arg * X86_ast.arg
  24. | LOCK_ADD of X86_ast.arg * X86_ast.arg
  25. | LOCK_SUB of X86_ast.arg * X86_ast.arg
  26. | LOCK_AND of X86_ast.arg * X86_ast.arg
  27. | LOCK_OR of X86_ast.arg * X86_ast.arg
  28. | LOCK_XOR of X86_ast.arg * X86_ast.arg
  29. | LEAVE
  30. | MOV of X86_ast.arg * X86_ast.arg
  31. | MOVSX of X86_ast.arg * X86_ast.arg
  32. | MOVSXD of X86_ast.arg * X86_ast.arg
  33. | MOVZX of X86_ast.arg * X86_ast.arg
  34. | NEG of X86_ast.arg
  35. | NOP
  36. | OR of X86_ast.arg * X86_ast.arg
  37. | PAUSE
  38. | POP of X86_ast.arg
  39. | PREFETCH of bool * X86_ast.prefetch_temporal_locality_hint * X86_ast.arg
  40. | PUSH of X86_ast.arg
  41. | RDTSC
  42. | RDPMC
  43. | LFENCE
  44. | SFENCE
  45. | MFENCE
  46. | RET
  47. | SAL of X86_ast.arg * X86_ast.arg
  48. | SAR of X86_ast.arg * X86_ast.arg
  49. | SET of X86_ast.condition * X86_ast.arg
  50. | SHR of X86_ast.arg * X86_ast.arg
  51. | SUB of X86_ast.arg * X86_ast.arg
  52. | SBB of X86_ast.arg * X86_ast.arg
  53. | TEST of X86_ast.arg * X86_ast.arg
  54. | XCHG of X86_ast.arg * X86_ast.arg
  55. | XOR of X86_ast.arg * X86_ast.arg
  56. | SIMD of Amd64_simd_instrs.instr * X86_ast.arg array
type reloc_type =
  1. | R_X86_64_PLT32
type reloc = {
  1. offset : X86_ast.constant;
  2. name : X86_ast.reloc_type;
  3. expr : X86_ast.constant;
}
type asm_line =
  1. | Ins of X86_ast.instruction
  2. | Directive of Asm_targets.Asm_directives.Directive.t
type asm_program = X86_ast.asm_line list