package bap-std
The interface for custom backends.
This is an OCaml interface for defining custom disassembling backends in pure OCaml. An alternative interface in C++ can be found at disasm.hpp and disasm.h.
The interface is pretty low-level and mimics one-to-one the existing C interface between OCaml and the C/C++ disassemblers backends, which, in turn, are optimized for performance.
The Basic.custom
function wraps the backend interface and enables seamless integration with the existing Basic.t
interface. To make the custom backend
available for your encoding
, use Basic.register encoding
function to register a constructor that uses Basic.custom
, e.g.,
let () = Basic.register encoding @@ fun target ->
let dis = create_custom target in
Ok (Basic.custom ?target encoding backend)
where create_custom
is a user function that creates the custom backend and target
contains the detailed information about the target system.
The Basic.lookup
function could be used then to lazily create the disassembler for the given encoding
, target
pair. The constructor will be called only once for each pair.
val sexp_of_predicate : predicate -> Ppx_sexp_conv_lib.Sexp.t
val predicate_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> predicate
val sexp_of_op : op -> Ppx_sexp_conv_lib.Sexp.t
val op_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> op
module type S = sig ... end
The backend interface.