Interpreter.MakeMake(Machine) makes an interpreter that computes in the given Machine.
type 'a m = 'a Machine.tval halt : Core_kernel.never_returns mhalt halts the machine by raise the Halt exception.
val interrupt : int -> unit minterrupt n interrupts the computation with cpuexn n
val pc : Bap.Std.addr mpc current value of a program counter.
val sub : Bap.Std.sub Bap.Std.term -> unit msub x evaluates the subroutine x.
val blk : Bap.Std.blk Bap.Std.term -> unit mblk x interprets the block x.
val exp : Bap.Std.exp -> value mexp x returns a value of x.
val get : Bap.Std.var -> value mget var reads var
val set : Bap.Std.var -> value -> unit mset var x sets var to x
val assign : Bap.Std.exp -> value -> unit massign lhs rhs assigns rhs to an lvalue lhs, fails if lhs is not an lvalue.
An lvalue is an expression that denotes a program location. An expression is an lvalue, if it is a variable; a load; a conditional expersion with lvalues on both branches, or a cast, extract, concat, from an lvalue.
lvalue ::= Var _
| Load (_,_,_,_)
| Ite (_,<lvalue>,<lvalue>)
| Cast (_,_,<lvalue>)
| Extract (_,_,<lvalue>)
| Concat (_,_,<lvalue>)val binop : Bap.Std.binop -> value -> value -> value mbinop op x y computes a binary operation op on x and y.
If binop op x y will involve the division by zero, then the division by zero trap is signaled. If the division_by_zero_handler is provided, (i.e., is linked) then it will be invoked. If it returns normally, then the result of the binop op x y is undefined. Otherwise, the Division_by_zero machine exception is raised.
val unop : Bap.Std.unop -> value -> value munop op x computes an unary operation op on x
val cast : Bap.Std.cast -> int -> value -> value mcast t n x casts n bits of x using a casting type t
extract ~hi ~lo x extracts bits from lo to hi from x.
val const : Bap.Std.word -> value mconst x computes the constant expression x
val load : value -> Bap.Std.endian -> Bap.Std.size -> value mload a d s computes a load operation, that loads a word of size s using an order specified by the endianness d from address a.
If the address a is not mapped, then a pagefault trap is signaled. If the pagefault_hanlder is provided, then it is invoked and the load operation repeats. Note, the handler either shall not return or ensure that the second attempt would be successful. If no handler is linked, then the segmentation fault machine exception is raised.
val store : value -> value -> Bap.Std.endian -> Bap.Std.size -> unit mstore a x d s computes a store operation, that stores at the address a the word x of size s, using an ordering specified by the endianness d.
If a is not mapped or not writable then the pagefault trap is invoked. If the handler is provided, then it is invoked and the operation is repeated. Otherwise the Segmentation_fault machine exception is raised.
branch cnd yes no if cnd evaluates to zero then yes else no.