123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899(**************************************************************************)(* 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). *)(* *)(**************************************************************************)moduleIntTbl=Basic_types.Integers.Int.HtblopenBinsec_sse_loader.Disassemblytype'ahook='aBinsec_sse_loader.Disassembly.hook=|Fetch:(Virtual_address.t->Ir.Graph.toption)hook|Decode:(Virtual_address.t->intReader.t->Ir.Graph.toption)hook|Disasm:(Instruction.t->Ir.Graph.toption)hook|Rewrite:(Ir.Graph.t->unit)hook(** Information to be used by optimization. *)type'aknowledge='aBinsec_sse_loader.Disassembly.knowledge=|May_read:Dba_types.Var.Set.toptionknowledge|Must_write:Dba_types.Var.Set.tknowledgemoduleCallback=CallbackmoduleRevision=Revisiontype'aconfig='aCompiler.configtype'acache='aCompiler.cachetypenonrec'afiber=([`All],'a)Types.fibertypenonrec'at={config:'aconfig;fibers:'acache;segment:t}letcreate:Callback.t->decoder:(intReader.t->Virtual_address.t->Instruction.t)->Virtual_address.t->Virtual_address.tReader.t->Z.t->'aconfig->'at=funcallback~decoderbasereadersizeconfig->{config;fibers=IntTbl.create16;segment=createcallback~decoderbasereadersize;}letcreate_small:Callback.t->decoder:(intReader.t->Virtual_address.t->Instruction.t)->Virtual_address.t->intReader.t->int->'aconfig->'at=funcallback~decoderbasereadersizeconfig->{config;fibers=IntTbl.create16;segment=create_smallcallback~decoderbasereadersize;}letapply:'at->Virtual_address.t->(Binsec_sse_loader.Disassembly.t->Virtual_address.t->Ir.View.vertex)->'afiber=fun{config;fibers;segment}addrf->letvertex=fsegmentaddrintryIntTbl.findfibersvertexwithNot_found->letcode=Compiler.createconfig~killset:(killsetsegment)~fibers(graphsegment)inCompiler.getcodevertexletfetch_no_link:'at->Virtual_address.t->'afiber=funenvaddr->applyenvaddrfetch_no_linkletdisassemble_from:'at->Virtual_address.t->'afiber=funenvaddr->applyenvaddrdisassemble_fromletaddress:'at->Virtual_address.t=fun{segment;_}->addresssegmentletgraph:'at->Ir.View.t=fun{segment;_}->graphsegmentletcallback:'at->Callback.t=fun{segment;_}->callbacksegmentletkillset:'at->Ir.Graph.vertex->Dba_types.Var.Set.t=fun{segment;_}vertex->killsetsegmentvertex