123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119(**************************************************************************)(* 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). *)(* *)(**************************************************************************)(** Kernel general command-line options. *)includeCli.Options(structletshortname=""(* This is the only one :-) *)letname="Kernel"end)moduleConfig_file=Builder.String_option(structletname="config"letdoc="Use this configuration file"end)moduleDba_config=Builder.String_option(structletname="dba-config"letdoc="Set dba configuration file name"end)moduleDba_file=Builder.String_option(structletname="dba-file"letdoc="Set DBA file "end)moduleDescribe_binary=Builder.False(structletname="describe"letdoc="Display a description of the binary and exits"end)(** Server options *)moduleExperimental=Builder.False(structletname="X"letdoc="Only for developmental purposes"end)moduleExecFile=Builder.String_option(structletname="file"letdoc="Set binary file"end)moduleEntry_point=Builder.String_option(structletname="entrypoint"letdoc="Set entry point"end)moduleDecoder=Builder.String(structletname="decoder"letdefault="unisim-armsec"letdoc="External decoder command"end)moduleVersion=Builder.False(structletname="version"letdoc="Print the version identifier and exit"end)moduleMachine=struct(** Abstract representation of hardware architecture *)includeBuilder.Variant_choice_assoc(structtypet=Machine.isaletname="isa"letdoc=Format.asprintf" Set isa [set by loader]"letassoc_map=[("x86",Machine.x86);("x86-32",Machine.x86);("amd64",Machine.amd64);("x86-64",Machine.amd64);("arm32",Machine.armv7LittleEndian~thumb:False);("armv7",Machine.armv7LittleEndian~thumb:False);("armv7:arm",Machine.armv7LittleEndian~thumb:False);("armv7:thumb",Machine.armv7LittleEndian~thumb:True);("armv7:both",Machine.armv7LittleEndian~thumb:Unknown);("aarch64",Machine.armv8LittleEndian);("armv8",Machine.armv8LittleEndian);("ppc64",Machine.ppc64BigEndian);("riscv",Machine.riscv`x32);("riscv32",Machine.riscv`x32);("riscv64",Machine.riscv`x64);("sparcv8",Machine.sparcv8);("z80",Machine.z80);("unknown",Machine.unknown);]letdefault=Machine.unknownend)letppppf()=Machine.ISA.ppppf(get())letisa=getletendianness()=Machine.ISA.endianness(get())letword_size()=Size.Bit.to_intMachine.(Bitwidth.bitsize(ISA.bits(get())))letbits()=Machine.ISA.bits(get())letstack_register()=Machine.ISA.stack_register(get())end