123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475(**************************************************************************)(* This file is part of BINSEC. *)(* *)(* Copyright (C) 2016-2026 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)moduleMake(Value:State.VALUE)(State:State.DATAwithtypevalue:=Value.t):sigvaleval:Dba.Expr.t->State.t->Value.tend=structletuope(o:Dba.Unary_op.t):Term.unaryTerm.operator=matchowith|Not->Not|UMinus->Minus|Sextn->Sext(n-Dba.Expr.size_ofe)|Uextn->Uext(n-Dba.Expr.size_ofe)|Restrictinterval->Restrictintervalletbop(op:Dba.Binary_op.t):Term.binaryTerm.operator=matchopwith|Plus->Plus|Minus->Minus|Mult->Mul|DivU->Udiv|DivS->Sdiv|RemU->Urem|RemS->Srem|Eq->Eq|Diff->Diff|LeqU->Ule|LtU->Ult|GeqU->Uge|GtU->Ugt|LeqS->Sle|LtS->Slt|GeqS->Sge|GtS->Sgt|Xor->Xor|And->And|Or->Or|Concat->Concat|LShift->Lsl|RShiftU->Lsr|RShiftS->Asr|LeftRotate->Rol|RightRotate->Rorletreceval(e:Dba.Expr.t)state=matchewith|Cstbv|Var{info=Symbol(_,(lazybv));_}->Value.constantbv|Varvar->State.lookupvarstate|Load(len,dir,addr,None)->fst(State.read~addr:(evaladdrstate)lendirstate)|Load(len,dir,addr,Somename)->fst(State.selectname~addr:(evaladdrstate)lendirstate)|Unary(f,x)->Value.unary(uopxf)(evalxstate)|Binary(f,x,y)->Value.binary(bopf)(evalxstate)(evalystate)|Ite(c,r,e)->Value.ite(evalcstate)(evalrstate)(evalestate)end