package bap-std

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A scheme of image specification.

An attribute is some statement about a program that is true, thus each attribute is a proposition in a logical database of inferred facts.

Note, in comments we use actual field names in the synopsis section of a function, e.g., section addr size means that the section statement has two fields Scheme.addr and Scheme.size.

See the OGRE library for more information.

  • since 1.3
type addr = int64
type size = int64
type off = int64
type value = int64
type 'a region = {
  1. addr : addr;
    (*

    a starting address

    *)
  2. size : size;
    (*

    a size of the segment

    *)
  3. info : 'a;
    (*

    the attached information

    *)
}

a contiguous piece of memory.

val off : off Ogre.field

offset

val size : size Ogre.field

offset

size

val addr : addr Ogre.field

size

address

val name : string Ogre.field

address

name

val root : addr Ogre.field

name

code root

val readable : bool Ogre.field

code root

is readable

val writable : bool Ogre.field

is readable

is_writable

val executable : bool Ogre.field

is_writable

is_executable

val fixup : addr Ogre.field

is_executable

an address of a fixup

val arch : (string, (string -> 'a) -> 'a) Ogre.attribute

arch name a file contains code for the name architecture.

E.g., arm, x86, x86_64

val subarch : (string, (string -> 'a) -> 'a) Ogre.attribute

subarch name the subarchitecture, when applicable, e.g., v7, v8, r2, etc. Should be appended to the arch name to get the full description, e.g., armv7.

  • since 2.2.0
val vendor : (string, (string -> 'a) -> 'a) Ogre.attribute

vendor name the second part of the build triplet, e.g., apple, pc, ibm, unknown. Could be just an empty string.

  • since 2.2.0
val system : (string, (string -> 'a) -> 'a) Ogre.attribute

system name the operating system name, for which the binary is specifically built, e.g., ananas, ios, linux.

  • since 2.2.0
val abi : (string, (string -> 'a) -> 'a) Ogre.attribute

abi name the environment/toolchain/abi under which the binary is expected to be run, e.g., gnu, android, msvc

  • since 2.2.0
val bits : (size, (size -> 'a) -> 'a) Ogre.attribute

bits m is the bitness of the target architecture, e.g., 16, 32, 64.

  • since 2.2.0
val format : (string, (string -> 'a) -> 'a) Ogre.attribute

(format X) defines the file format to be X.

Currently supported formats:

  • "elf";
  • "macho";
  • "coff"
val is_little_endian : (bool, (bool -> 'a) -> 'a) Ogre.attribute

(is-little-endian FLAG)] is set for files with words encoded in the little-endian order.

  • since 2.2.0
val is_executable : (bool, (bool -> 'a) -> 'a) Ogre.attribute

(is-executable FLAG) is set for binaries that executable.

  • since 2.2.0
val bias : (off, (off -> 'a) -> 'a) Ogre.attribute

bias offset the value by which all addresses are biased wrt to the real addresses in the binary.

  • since 2.2.0
val segment : ((bool * bool * bool) region, (addr -> size -> bool -> bool -> bool -> 'a) -> 'a) Ogre.attribute

segment addr size readable writable executable a memory region (addr,size) has the specified permissions.

val section : (unit region, (addr -> size -> 'a) -> 'a) Ogre.attribute

section addr size a memory region is a section

val code_start : (addr, (addr -> 'a) -> 'a) Ogre.attribute

code_start addr an address starts a code sequence

val entry_point : (addr, (addr -> 'a) -> 'a) Ogre.attribute

entry_point addr an address is the program entry point

val symbol_chunk : (addr region, (addr -> size -> addr -> 'a) -> 'a) Ogre.attribute

symbol_chunk addr size root a contiguous piece of a program symbol, that can be a function or some data.

val named_region : (string region, (addr -> size -> string -> 'a) -> 'a) Ogre.attribute

named_region addr size name a region of memory has a name

val named_symbol : (addr * string, (addr -> string -> 'a) -> 'a) Ogre.attribute

named_symbol addr name a symbol that starts at this addr has this name.

val mapped : (off region, (addr -> size -> off -> 'a) -> 'a) Ogre.attribute

mapped addr size off sequence of bytes in a file starting at offset off and has the given size is mapped into memory at the given address addr

val relocation : (int64 * addr, (addr -> addr -> 'a) -> 'a) Ogre.attribute

relocation fixup addr a value referenced at the code that has the fixup address is relocated to the specified address addr.

val external_reference : (addr * string, (addr -> string -> 'a) -> 'a) Ogre.attribute

external_reference addr name a piece of code at the specified address addr references an external symbol with the given name.

val base_address : (addr, (addr -> 'a) -> 'a) Ogre.attribute

base_address addr this is the base address of an image, i.e., an address of a first byte of the image.

val code_region : (addr * size * off, (addr -> size -> off -> 'a) -> 'a) Ogre.attribute

code_region addr size off the memory region in the file with the given offset off and size is code that should be loaded at the specified virtual address addr.

val symbol_value : (addr * value, (addr -> value -> 'a) -> 'a) Ogre.attribute

symbol_value addr value the symbol at address the specified value.

OCaml

Innovation. Community. Security.