Files
revng-revng/include/revng/Model/model-schema.yml
2025-07-23 11:38:52 +02:00

1870 lines
50 KiB
YAML

#
# This file is distributed under the MIT License. See LICENSE.md for details.
#
version: 5
root_type: Binary
definitions:
#
# Binary (the model Root)
#
- name: Binary
type: struct
doc: |-
Data structure representing the whole binary.
This is the entry point of the model.
It contains the type system (`TypeDefinitions`),
the list of functions (`Functions`), loading information (`Segments`),
and more.
fields:
- name: Architecture
doc: The architecture for this binary.
type: Architecture
optional: true
- name: EntryPoint
doc: The program entry point, if any.
type: MetaAddress
optional: true
- name: DefaultABI
doc: The default ABI to adopt for analysis purposes.
type: ABI
optional: true
- name: DefaultPrototype
doc: |-
The default function prototype to adopt for functions that do not provide
it explicitly.
type: Type
optional: true
upcastable: true
- name: Configuration
doc: Project-level artifact configuration options
type: Configuration
optional: true
- name: Segments
doc: |-
`Segment`s represent instructions on what part of the raw binary needs to
be loaded at which address.
sequence:
type: SortedVector
elementType: Segment
optional: true
- name: ExtraCodeAddresses
doc: |-
A list of addresses known to contain code.
rev.ng is usually able to discover all the code by itself by recursively
visiting the control-flow graph of functions and the call graph.
However, certain pieces of code cannot be identified through these
techniques.
A prime example are the addresses of `catch` blocks of C++ exception
handlers: no code ever directly jumps there and their address is not
stored in jump tables. Their address can only be obtained by interpreting
metadata in the ELF.
optional: true
sequence:
type: SortedVector
elementType: MetaAddress
- name: ImportedLibraries
doc: |-
The list of imported libraries identified by their file name.
For instance, if the input binary is linked to OpenSSL, this list would
should `libcrypto.so.1.1`.
sequence:
type: SortedVector
elementType: string
optional: true
- name: ImportedDynamicFunctions
doc: List of functions imported from dynamic libraries (`.so`, `.dll`).
sequence:
type: SortedVector
elementType: DynamicFunction
optional: true
- name: Functions
doc: List of the functions present in the binary.
sequence:
type: SortedVector
elementType: Function
optional: true
- name: TypeDefinitions
doc: |-
The set of types used in this binary.
It contains `struct`, `union`, `typedef`, `enum` and function prototypes.
sequence:
type: SortedVector
upcastable: true
elementType: TypeDefinition
optional: true
#
# Type definition system
#
- name: TypeDefinition
type: struct
doc: |-
Base data structure for all the type definitions.
A type definition differs from a `Type` in the fact that it has an identity.
In fact, while two identical instances of `Type` can be considered to be the
same `Type`, two instances of a `TypeDefinition` that only differ from their
`ID` are two distinct types.
A type definition can be a `struct`, a `union`, a `typedef`, an `enum` or a
function prototype.
key:
- ID
- Kind
abstract: true
fields:
- name: ID
doc: |-
A unique numeric identifier for this type.
type: uint64_t
is_guid: true
- name: Kind
doc: |-
Specifies which of the children classes this object is upcastable to.
type: TypeDefinitionKind
- name: Name
doc: A user-chosen identifier for this type.
type: string
optional: true
- name: Comment
doc: |-
A comment attached to the *definition* of this type.
type: string
optional: true
- name: CABIFunctionDefinition
inherits: TypeDefinition
type: struct
doc: |-
The function type described through a C-like prototype plus an ABI.
This is an "high level" representation of the prototype of a function. It is
expressed as list of arguments composed by an index and a type. No
information about the register is embedded. That information is implicit in
the ABI this type is associated to.
In contrast, a `RawFunctionType` is not associated to any ABI and explicitly
describes, among other things, what registers are used to pass arguments and
return values.
fields:
- name: ABI
doc: The C ABI associated to this function type.
type: ABI
- name: ReturnType
doc: The function return type.
type: Type
optional: true
upcastable: true
- name: ReturnValueComment
doc: |-
A comment that will be emitted as part of this function's definiktion
in the `\returns ${COMMENT_TEXT}` shape.
type: string
optional: true
- name: Arguments
doc: The list of formal arguments of the function type.
sequence:
type: SortedVector
elementType: Argument
- name: Argument
type: struct
doc: |-
The argument of a `CABIFunctionType`.
key:
- Index
fields:
- name: Index
doc: The argument index.
type: uint64_t
- name: Type
doc: The type of the argument.
type: Type
upcastable: true
- name: Name
doc: The name of the argument.
type: string
optional: true
- name: Comment
doc: |-
A comment that will be emitted as part of this function's definition
in the `\param ${NAME} ${COMMENT}` shape.
type: string
optional: true
- name: EnumDefinition
inherits: TypeDefinition
type: struct
doc: |-
An `enum` type definition.
fields:
- name: UnderlyingType
doc: |-
The underlying type of the `enum`.
This must only ever be set to a `PrimitiveType` with either
an `Unsigned` or a `Signed` kind.
type: Type
upcastable: true
- name: Entries
doc: |-
The entries of the `enum`.
There can be no two entries associated to the same value.
sequence:
type: SortedVector
elementType: EnumEntry
- name: EnumEntry
type: struct
doc: An entry in an `enum`.
key:
- Value
fields:
- name: Value
doc: |-
The value associated to this `enum` entry.
Has to be unique within the `enum`.
type: uint64_t
- name: Name
doc: |-
A user-chosen identifier for this `enum` entry.
type: string
optional: true
- name: Comment
doc: |-
A comment that will be emitted right before the *definition* of this
`enum` entry.
type: string
optional: true
- name: RawFunctionDefinition
inherits: TypeDefinition
type: struct
doc: |-
The function type described by explicitly listing how arguments and return
values are passed.
This is a "low level" representation of the prototype of a function. Where
the list of registers used to pass arguments and return values is explicitl.
For stack arguments, they are collected in a single `struct`
(`StackArgumentsType`).
In contrast, a `CABIFunctionDefinition` expresses the function type from a
high-level perspective (e.g., a single argument might span multiple registers)
and his associated to a well-known ABI. Given an ABI, it is always possible
to convert a `CABIFunctionDefinition` into a `RawFunctionDefinition`.
fields:
- name: Architecture
doc: The processor architecture of this function type.
type: Architecture
- name: Arguments
doc: |-
The list of registers used to pass arguments.
The registers must belong to the `Architecture`.
optional: true
sequence:
type: SortedVector
elementType: NamedTypedRegister
- name: ReturnValues
doc: |-
The list of registers used to return values.
The registers must belong to the `Architecture`.
optional: true
sequence:
type: SortedVector
elementType: NamedTypedRegister
- name: ReturnValueComment
doc: |-
A comment that will be emitted as part of this function's definition
in the `\returns ${COMMENT}` shape.
type: string
optional: true
- name: PreservedRegisters
doc: |-
The list of registers preserved by functions using this function type.
The registers must belong to `Architecture`.
optional: true
sequence:
type: SortedVector
elementType: Register
- name: FinalStackOffset
doc: |-
The expected difference between the initial and final value of the stack
pointer.
For instance, in the x86-64 SystemV ABI, the difference between the
initial and final value of the stack pointer is 8.
This is due to the fact that `ret` instruction increase the stack pointer
by 8.
type: uint64_t
optional: true
- name: StackArgumentsType
doc: The type of the `struct` representing all of the stack arguments.
type: Type
optional: true
upcastable: true
- name: NamedTypedRegister
type: struct
doc: |-
An argument or a return value in a `RawFunctionDefinition`.
It is basically a pair of a register and a `Type`.
key:
- Location
fields:
- name: Location
doc: The register this argument or return value is created for.
type: Register
- name: Type
doc: The type of this argument or return value.
type: Type
upcastable: true
- name: Name
doc: The name for this argument or return value.
type: string
optional: true
- name: Comment
doc: The comment for this argument or return value.
type: string
optional: true
- name: TypedefDefinition
inherits: TypeDefinition
type: struct
doc: |-
A `typedef` type.
Note, that unlike in C, in our type system two `typedef`s aliasing
the same type are actually distinct types.
fields:
- name: UnderlyingType
doc: The type this `typedef` is aliasing.
type: Type
upcastable: true
- name: StructDefinition
inherits: TypeDefinition
type: struct
doc: |-
A `struct` type.
fields:
- name: Size
doc: The size, in bytes, of the `struct`.
type: uint64_t
- name: CanContainCode
doc: |-
When this field is set to `true` *and* this `struct` is reachable for
a segment's root type without traversing pointer, arrays or other
qualifiers, the padding of the struct is treated at if it contains code.
type: bool
optional: true
- name: Fields
doc: The list of fields of this `struct`.
sequence:
type: SortedVector
elementType: StructField
- name: StructField
type: struct
doc: |-
A field of a `StructDefinition`.
It is composed by the offset of the field and its type.
key:
- Offset
fields:
- name: Offset
doc: The number of bytes in the given struct before this field.
type: uint64_t
- name: Name
doc: The name of this field.
type: string
optional: true
- name: Comment
doc: The comment that will be emitted before this field's *definition*.
type: string
optional: true
- name: Type
doc: The type of the field.
type: Type
upcastable: true
- name: UnionDefinition
inherits: TypeDefinition
type: struct
doc: |-
A `union` type.
fields:
- name: Fields
doc: The list of alternative types in this `union`.
sequence:
type: SortedVector
elementType: UnionField
- name: UnionField
type: struct
doc: |-
Specifies one of the possible types a given `UnionDefinition` can assume.
It is composed by a index and the `Type`.
key:
- Index
fields:
- name: Index
doc: |
A numeric index unique within a given `UnionDefinition`.
Note that indexing is dense, so if a given union has a type with
index 4, it must also have types indexed 0-3.
type: uint64_t
- name: Name
doc: The name of this "field" (union alternative).
type: string
optional: true
- name: Comment
doc: |-
The comment that will be emitted right before the *definition*
of the given "field" (union alternative).
type: string
optional: true
- name: Type
doc: The name of this "field" (union alternative).
type: Type
upcastable: true
#
# Type wrapping system (pointers / arrays / primitives)
#
- name: Type
type: struct
doc: |-
A type such as an array, a pointer, a primitive or a defined type.
abstract: true
fields:
- name: Kind
doc: |-
Specifies which of the children classes this object is upcastable to.
type: TypeKind
- name: IsConst
doc: Specifies whether the type this object denotes is `const` or not.
type: bool
optional: true
- name: PrimitiveType
inherits: Type
type: struct
doc: |-
A Primitive type defined by its kind (signed, float, etc) and size.
fields:
- name: PrimitiveKind
doc: |-
Specifies whether this primitive type is `Signed`, `Float`,
`PointerOrNumber`, and so on.
type: PrimitiveKind
- name: Size
doc: |-
Specifies the size of this primitive type.
As of now, supported sizes include
```
{ 1, 2, 4, 8, 16 }
```
Note that *only* floating point primitives (and `Generic` primitives,
whose kind is not known, so they are assumed to be floating point
compatible) can also have additional sizes:
```
{ 10, 12 }
```
Note that 1-byte floating point primitives are not allowed.
Note that `Void` *must* have size of 0.
type: uint64_t
optional: true
- name: PrimitiveKind
type: enum
doc: |-
The kind of a primitive type.
members:
- name: Void
doc: The `void` type.
- name: Generic
doc: |-
The most generic primitive kind: it can be any of the other primitive
kinds, except for `Void`.
- name: PointerOrNumber
doc: |-
A kind representing either a `Number` kind or a pointer.
This can also be seen as not-a-`Float`.
- name: Number
doc: |-
A two's complement integer number, either `Signed` or `Unsigned`.
- name: Unsigned
doc: |-
An `unsigned` two's complement integer number.
- name: Signed
doc: |-
An `signed` two's complement integer number.
- name: Float
doc: |-
A IEEE 754 floating point number.
- name: PointerType
inherits: Type
type: struct
doc: A pointer type.
fields:
- name: PointerSize
doc: |
The size of the pointer.
As of now, only 4 and 8 byte pointers are supported.
type: uint64_t
- name: PointeeType
doc: The pointee type.
type: Type
upcastable: true
- name: DefinedType
inherits: Type
type: struct
doc: A reference to a `TypeDefinition`.
fields:
- name: Definition
doc: The definition of the type this object represents.
reference:
pointeeType: TypeDefinition
rootType: Binary
- name: ArrayType
inherits: Type
type: struct
doc: |-
An array of `Type`s.
fields:
- name: ElementCount
doc: The number of elements in this array.
type: uint64_t
- name: ElementType
doc: The type of the elements in this array.
type: Type
upcastable: true
#
# Segments and function in the binary
#
- name: Segment
type: struct
doc: |-
A segment contains the information necessary for rev.ng to load the executable
in memory.
key:
- StartAddress
- VirtualSize
fields:
- name: StartAddress
doc: The address at which this segment should be loaded.
type: MetaAddress
- name: VirtualSize
doc: |-
The size of this segment in memory.
If this value is greater than `FileSize`, the discrepancy is considered to
full of `0`s.
type: uint64_t
- name: StartOffset
doc: Start file offset from which the segment will be loaded.
type: uint64_t
- name: FileSize
doc: Number of bytes that will be loaded in memory from the file.
type: uint64_t
- name: IsReadable
doc: Is this segment readable?
type: bool
- name: IsWriteable
doc: Is this segment writable?
type: bool
- name: IsExecutable
doc: Is this segment executable?
type: bool
- name: Name
doc: The name of the segment.
type: string
optional: true
- name: Comment
doc: |-
The comment to emit right before the global variable that will be
created for this segment.
type: string
optional: true
- name: CanonicalRegisterValues
doc: |-
The list of registers that are assumed to have a canonical value set
upon an entry into a function contained within this segment.
optional: true
sequence:
type: SortedVector
elementType: CanonicalRegisterValue
- name: Relocations
doc: |-
A list of locations where the address of this segment should be
placed.
optional: true
sequence:
type: SortedVector
elementType: Relocation
- name: Type
doc: |-
The struct type associated to this segment.
Informally, each field of such a `struct` is a global variable.
type: Type
upcastable: true
optional: true
- name: Function
type: struct
doc: A function defined within this binary.
key:
- Entry
fields:
- name: Entry
doc: |-
The address of the entry point.
Note: this does not necessarily correspond to the address of the basic
block with the lowest address.
type: MetaAddress
- name: Name
doc: The user-provided name for this function.
type: string
optional: true
- name: Comment
doc: The user-provided comment for this function.
type: string
optional: true
- name: StackFrameType
doc: The type of the stack frame.
type: Type
upcastable: true
optional: true
- name: Prototype
doc: The prototype of the function.
type: Type
upcastable: true
optional: true
- name: Attributes
doc: Attributes for *every* call site.
sequence:
type: MutableSet
elementType: FunctionAttribute
optional: true
- name: CallSitePrototypes
doc: |-
Information about specific call sites within this function.
sequence:
type: SortedVector
elementType: CallSitePrototype
optional: true
- name: ExportedNames
doc: |-
The list of names used to make this function available as a dynamic
symbol.
sequence:
type: SortedVector
elementType: string
optional: true
- name: Comments
doc: |-
The list of comments attached to statements (e.g., disassembled
instructions or C statements) within the body of this function.
sequence:
type: SortedVector
elementType: StatementComment
optional: true
- name: LocalVariables
doc: |-
The list of *named* local variables within this function's body.
sequence:
type: SortedVector
elementType: LocalIdentifier
optional: true
- name: GotoLabels
doc: |-
The list of *named* goto labels within this function's body.
sequence:
type: SortedVector
elementType: LocalIdentifier
optional: true
- name: DynamicFunction
type: struct
doc: A function defined in a dynamic library.
key:
- Name
fields:
- name: Name
doc: |-
The name of the symbol for this dynamic function.
Currently, this must not contain `/`s and `\n`s. This restriction will
eventually be lifted, when proper escaping is in place.
type: string
- name: Comment
doc: The user-provided comment for this dynamic function.
type: string
optional: true
- name: Prototype
doc: The prototype of this dynamic function.
type: Type
upcastable: true
optional: true
- name: Attributes
doc: The attributes of this dynamic function.
sequence:
type: MutableSet
elementType: FunctionAttribute
optional: true
- name: Relocations
doc: |-
A list of locations where the address of this dynamic function should
be placed.
sequence:
type: SortedVector
elementType: Relocation
optional: true
- name: LocalIdentifier
type: struct
doc: |-
The common type for attaching metadata (like names) to function-local
identifiers (like variables and labels).
key:
# Using the name as the key might not be the best from the invalidation
# standpoint, as renaming any variable would invalidate the entire set.
#
# On the other hand, this reduces potential duplication friction.
# As well as allows us to avoid an artificial key (like index).
- Name
fields:
- name: Name
doc: The user-provided name for this variable or label.
type: string
- name: Location
doc: |-
The set of `MetaAddress`es of the instructions using this variable (or label).
sequence:
type: SortedVector
elementType: MetaAddress
- name: Relocation
type: struct
doc: |-
A relocation, i.e., a directive to write the address of an object (a
`DynamicFunction` or a `Segment`) at a specific address.
Optionally, the address of the object can be modified with a constant offset.
key:
- Address
- Type
fields:
- name: Address
doc: Where to write the address of the object.
type: MetaAddress
- name: Type
doc: |-
How to write the address of the object (e.g., 32-bit vs 64-bit
integer).
type: RelocationType
- name: Addend
doc: Fixed offset to add when writing the address of the object.
type: uint64_t
- name: RelocationType
type: enum
doc: |-
A enumeration describing how a `Relocation` should be written at the target
address.
members:
- name: WriteAbsoluteAddress32
doc: Write the absolute address of the object as a 32-bit integer.
- name: WriteAbsoluteAddress64
doc: Write the absolute address of the object as a 64-bit integer.
- name: AddAbsoluteAddress32
doc: |-
Add to the 32-bit integer present at the target location the absolute
address of the object.
- name: AddAbsoluteAddress64
doc: |-
Add to the 64-bit integer present at the target location the absolute
address of the object.
- name: WriteRelativeAddress32
doc: |-
Write the address of the object as a 32-bit integer, expressed as a
relative from the target of the relocation.
- name: WriteRelativeAddress64
doc: |-
Write the address of the object as a 64-bit integer, expressed as a
relative from the target of the relocation.
- name: AddRelativeAddress32
doc: |-
Add to the 32-bit integer present at the target location the address of
the object, expressed as a relative from the target of the relocation.
- name: AddRelativeAddress64
doc: |-
Add to the 32-bit integer present at the target location the address of
the object, expressed as a relative from the target of the relocation.
- name: CallSitePrototype
type: struct
doc: Information about the prototype of a specific callsite within a `Function`.
key:
- CallerBlockAddress
fields:
- name: CallerBlockAddress
doc: Address of the basic block of the call.
type: MetaAddress
- name: Prototype
doc: The prototype specific to *this* call site.
type: Type
upcastable: true
- name: IsTailCall
doc: Whether this call site is a tail call or not.
type: bool
optional: true
- name: Attributes
doc: Attributes for this call site.
sequence:
type: MutableSet
elementType: FunctionAttribute
optional: true
- name: FunctionAttribute
type: enum
doc: |-
Attributes for function calls. They can either be applied to specific call
sites, or to *all* the call sites of a specific function.
members:
- name: NoReturn
doc: The function call does not return.
- name: Inline
doc: The function call must be inlined in the caller.
- name: StatementComment
type: struct
doc: |-
A comment that can be attached to a statement in the decompiled code
*if* we have a way to uniquely identify said statement.
key:
- Index
fields:
- name: Index
doc: |-
The index of the comment.
# Note that this is used exclusively to simplify lookup of
# the *existing* comments. This way address set doesn't need to be
# encoded in the location and any emitted comment can be looked up (and,
# consecutively, edited) based on this index alone.
type: uint64_t
- name: Location
doc: |-
The point this comment is attached to, encoded as a set of addresses.
When emitted artifact contains a statement with a set of addresses exactly
matching the set provided here, the comment is emitted before that
statement.
If there's no such statement, one is chosen based on how similar its
address set is to the address set of the comment.
Note that the same comment can be emitted multiple times if there are
multiple statements (that do *not* dominate each other) with the same
address set.
sequence:
type: SortedVector
elementType: MetaAddress
- name: Body
doc: The text of the comment.
type: string
#
# Important enums
#
- name: Architecture
type: enum
doc: |-
An enum listing all the currently supported architectures.
members:
- name: x86
- name: x86_64
- name: arm
- name: aarch64
- name: mips
- name: mipsel
- name: systemz
- name: ABI
type: enum
doc: |-
An enum listing all the currently supported ABIs.
members:
- name: SystemV_x86_64
doc: |-
64-bit SystemV ABI for x86 processor architecture
([reference](https://gitlab.com/x86-psABIs/x86-64-ABI)).
- name: SystemV_x86
doc: |-
32-bit SystemV ABI for x86 processor architecture ([reference][abi1]).
[abi1]: https://gitlab.com/x86-psABIs/i386-ABI/-/tree/hjl/x86/master
- name: SystemV_x86_regparm_3
doc: |-
A GCC specific modification of the 32-bit SystemV ABI for x86 processor
architecture. It allows three first GPR-sized arguments to be passed
using the EAX, EDX, and ECX registers.
See the reference for `regparm` x86 function attribute.
- name: SystemV_x86_regparm_2
doc: |-
A GCC specific modification of the 32-bit SystemV ABI for x86 processor
architecture. It allows two first GPR-sized arguments to be passed
using the EAX, and ECX registers.
See the GCC documentation for `regparm` x86 function attribute.
- name: SystemV_x86_regparm_1
doc: |-
A GCC specific modification of the 32-bit SystemV ABI for x86 processor
architecture. It allows the first GPR-sized argument to be passed
using the EAX register.
See the GCC documentation for `regparm` x86 function attribute.
- name: Microsoft_x86_64
doc: |-
64-bit Microsoft ABI for x86 processor architecture
([reference][abi2]).
[abi2]: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention
- name: Microsoft_x86_64_vectorcall
doc: |-
A modification of 64-bit Microsoft ABI for x86 processor architecture
([reference](https://docs.microsoft.com/en-us/cpp/cpp/vectorcall)).
It allows using extra vector registers for passing function arguments.
- name: Microsoft_x86_cdecl
doc: |-
The default 32-bit Microsoft ABI for x86 processor architecture
([reference](https://docs.microsoft.com/en-us/cpp/cpp/cdecl)).
It was indented to be compatible with `SystemV_x86` but there are slight
differences.
- name: Microsoft_x86_cdecl_gcc
doc: |-
32-bit Microsoft x86 `cdecl` abi as implemented in GCC (subtly different
from the original).
- name: Microsoft_x86_stdcall
doc: |-
A modification of the 32-bit `__cdecl` Microsoft ABI for x86 processor
architecture
([reference](https://docs.microsoft.com/en-us/cpp/cpp/stdcall)).
The main difference is the fact that the callee is responsible for stack
cleanup instead of the caller.
- name: Microsoft_x86_stdcall_gcc
doc: |-
32-bit Microsoft x86 `stdcall` abi as implemented in GCC (subtly different
from the original).
- name: Microsoft_x86_thiscall
doc: |-
A modification of the 32-bit `__stdcall` Microsoft ABI for x86 processor
architecture
([reference](https://docs.microsoft.com/en-us/cpp/cpp/thiscall)).
The main difference is the fact that it allows to pass a
single (the first) function argument using a register. This ABI is only
used for member function call where the first argument is always a `this`
pointer.
- name: Microsoft_x86_fastcall
doc: |-
A modification of the 32-bit `__stdcall` Microsoft ABI for x86 processor
architecture
([reference](https://docs.microsoft.com/en-us/cpp/cpp/fastcall)).
The main difference is the fact that it allows to pass two
first GPR-sized non-aggregate function arguments in registers.
- name: Microsoft_x86_fastcall_gcc
doc: |-
32-bit Microsoft x86 `fastcall` abi as implemented in GCC (subtly
different from the original).
- name: Microsoft_x86_vectorcall
doc: |-
A modification of the 32-bit `__fastcall` Microsoft ABI for x86 processor
architecture
([reference](https://docs.microsoft.com/en-us/cpp/cpp/vectorcall)).
It allows using extra vector registers for passing function arguments.
- name: AAPCS64
doc: |-
Stands for `Arm Architecture Procedure Call Standard (64-bit)`
([reference](https://github.com/ARM-software/abi-aa/releases)).
The official ABI for AArch64 (ARM64) processor architecture.
- name: Microsoft_AAPCS64
doc: |-
Stands for "Arm Architecture Procedure Call Standard (64-bit)".
This represents the version of the ABI used by windows-on-arm.
For differences from the original ABI see the [reference][ab3].
[ab3]: https://learn.microsoft.com/cpp/build/arm64-windows-abi-conventions
- name: Apple_AAPCS64
doc: "Stands for \"Arm Architecture Procedure Call Standard (64-bit)\".\n
This represents the version of the ABI used by the apple products.\n
For differences from the original ABI see the [reference](\
https://developer.apple.com/documentation/xcode/writing-arm64-
code-for-apple-platforms)."
- name: AAPCS
doc: |-
Stands for "Arm Architecture Procedure Call Standard"
([reference](https://github.com/ARM-software/abi-aa/releases)).
The official ABI for ARM processor architecture.
- name: SystemV_MIPS_o32
doc: |-
The ABI for MIPS RISC processor architecture
([reference][abi4]).
[abi4]: http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf
- name: SystemV_MIPSEL_o32
doc: |-
The ABI for little-endian edition of the MIPS RISC processor architecture
([reference][abi5]).
[abi5]: http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf
- name: SystemZ_s390x
doc: |-
The s390x ABI for SystemZ processor architecture
([reference](https://github.com/IBM/s390x-abi)).
- name: CanonicalRegisterValue
type: struct
doc: |-
A [`Segment`](#Segment) can specify a set of *canonical values* for certain
registers.
This can be used to represent concepts such as the global pointer, which in
certain ABIs, is not set by each function, but it's possible to assume it has
a certain value at the entry of the function.
key:
- Register
fields:
- name: Register
doc: The register for which to specify the canonical value.
type: Register
- name: Value
doc: |-
The canonical value that `Register` can be assumed to hold upon
function entry.
type: uint64_t
- name: Register
type: enum
doc: |-
An enum containing the list of all the currently supported registers.
members:
# x86 registers
- name: eax_x86
- name: ebx_x86
- name: ecx_x86
- name: edx_x86
- name: esi_x86
- name: edi_x86
- name: ebp_x86
- name: esp_x86
- name: st0_x86
- name: xmm0_x86
- name: xmm1_x86
- name: xmm2_x86
- name: xmm3_x86
- name: xmm4_x86
- name: xmm5_x86
- name: xmm6_x86
- name: xmm7_x86
# x86-64 registers
- name: rax_x86_64
- name: rbx_x86_64
- name: rcx_x86_64
- name: rdx_x86_64
- name: rbp_x86_64
- name: rsp_x86_64
- name: rsi_x86_64
- name: rdi_x86_64
- name: r8_x86_64
- name: r9_x86_64
- name: r10_x86_64
- name: r11_x86_64
- name: r12_x86_64
- name: r13_x86_64
- name: r14_x86_64
- name: r15_x86_64
- name: xmm0_x86_64
- name: xmm1_x86_64
- name: xmm2_x86_64
- name: xmm3_x86_64
- name: xmm4_x86_64
- name: xmm5_x86_64
- name: xmm6_x86_64
- name: xmm7_x86_64
- name: fs_x86_64
# ARM registers
- name: r0_arm
- name: r1_arm
- name: r2_arm
- name: r3_arm
- name: r4_arm
- name: r5_arm
- name: r6_arm
- name: r7_arm
- name: r8_arm
- name: r9_arm
- name: r10_arm
- name: r11_arm
- name: r12_arm
- name: r13_arm
- name: r14_arm
- name: r15_arm
- name: q0_arm
- name: q1_arm
- name: q2_arm
- name: q3_arm
- name: q4_arm
- name: q5_arm
- name: q6_arm
- name: q7_arm
# AArch64 registers
- name: x0_aarch64
- name: x1_aarch64
- name: x2_aarch64
- name: x3_aarch64
- name: x4_aarch64
- name: x5_aarch64
- name: x6_aarch64
- name: x7_aarch64
- name: x8_aarch64
- name: x9_aarch64
- name: x10_aarch64
- name: x11_aarch64
- name: x12_aarch64
- name: x13_aarch64
- name: x14_aarch64
- name: x15_aarch64
- name: x16_aarch64
- name: x17_aarch64
- name: x18_aarch64
- name: x19_aarch64
- name: x20_aarch64
- name: x21_aarch64
- name: x22_aarch64
- name: x23_aarch64
- name: x24_aarch64
- name: x25_aarch64
- name: x26_aarch64
- name: x27_aarch64
- name: x28_aarch64
- name: x29_aarch64
- name: lr_aarch64
- name: sp_aarch64
- name: v0_aarch64
- name: v1_aarch64
- name: v2_aarch64
- name: v3_aarch64
- name: v4_aarch64
- name: v5_aarch64
- name: v6_aarch64
- name: v7_aarch64
- name: v8_aarch64
- name: v9_aarch64
- name: v10_aarch64
- name: v11_aarch64
- name: v12_aarch64
- name: v13_aarch64
- name: v14_aarch64
- name: v15_aarch64
- name: v16_aarch64
- name: v17_aarch64
- name: v18_aarch64
- name: v19_aarch64
- name: v20_aarch64
- name: v21_aarch64
- name: v22_aarch64
- name: v23_aarch64
- name: v24_aarch64
- name: v25_aarch64
- name: v26_aarch64
- name: v27_aarch64
- name: v28_aarch64
- name: v29_aarch64
- name: v30_aarch64
- name: v31_aarch64
# MIPS registers
- name: v0_mips
- name: v1_mips
- name: a0_mips
- name: a1_mips
- name: a2_mips
- name: a3_mips
- name: s0_mips
- name: s1_mips
- name: s2_mips
- name: s3_mips
- name: s4_mips
- name: s5_mips
- name: s6_mips
- name: s7_mips
- name: t0_mips
- name: t1_mips
- name: t2_mips
- name: t3_mips
- name: t4_mips
- name: t5_mips
- name: t6_mips
- name: t7_mips
- name: t8_mips
- name: t9_mips
- name: gp_mips
- name: sp_mips
- name: fp_mips
- name: ra_mips
- name: f0_mips
- name: f1_mips
- name: f2_mips
- name: f3_mips
- name: f4_mips
- name: f5_mips
- name: f6_mips
- name: f7_mips
- name: f8_mips
- name: f9_mips
- name: f10_mips
- name: f11_mips
- name: f12_mips
- name: f13_mips
- name: f14_mips
- name: f15_mips
- name: f16_mips
- name: f17_mips
- name: f18_mips
- name: f19_mips
- name: f20_mips
- name: f21_mips
- name: f22_mips
- name: f23_mips
- name: f24_mips
- name: f25_mips
- name: f26_mips
- name: f27_mips
- name: f28_mips
- name: f29_mips
- name: f30_mips
- name: f31_mips
# SystemZ registers
- name: r0_systemz
- name: r1_systemz
- name: r2_systemz
- name: r3_systemz
- name: r4_systemz
- name: r5_systemz
- name: r6_systemz
- name: r7_systemz
- name: r8_systemz
- name: r9_systemz
- name: r10_systemz
- name: r11_systemz
- name: r12_systemz
- name: r13_systemz
- name: r14_systemz
- name: r15_systemz
- name: f0_systemz
- name: f1_systemz
- name: f2_systemz
- name: f3_systemz
- name: f4_systemz
- name: f5_systemz
- name: f6_systemz
- name: f7_systemz
- name: f8_systemz
- name: f9_systemz
- name: f10_systemz
- name: f11_systemz
- name: f12_systemz
- name: f13_systemz
- name: f14_systemz
- name: f15_systemz
#
# Configuration
#
- name: Configuration
type: struct
doc: A list of configuration options
# This of this as a temporary place to put the project-local (user-local?)
# configuration before a more comprehensive solution is introduced.
fields:
- name: Disassembly
doc: The options specific to the disassembly artifact.
type: DisassemblyConfiguration
optional: true
- name: Naming
doc: The options specific to the naming conventions
type: NamingConfiguration
optional: true
# Configuration options that don't belong anywhere else find themselves
# under this comment (in this struct).
# As this list grows, they should be split into their own sub-sections.
- name: CommentLineWidth
doc: |-
Sets a recommended comment line width to improve their readability.
The default value is `80`.
Set to `-1` for unlimited line size.
type: uint64_t
optional: true
- name: NamingConfiguration
type: struct
doc: |-
Subset of configuration options dedicated to naming rules, mostly (but not
exclusively) centered around reserved name prefixes.
fields:
- name: UnnamedSegmentPrefix
doc: |-
The prefix for a segment without a name.
The default value is `segment_`.
type: string
optional: true
- name: UnnamedDynamicFunctionPrefix
doc: |-
The prefix for a dynamic function with an invalid name.
The default value is `dynamic_function_`.
type: string
optional: true
- name: UnnamedFunctionPrefix
doc: |-
The prefix for a local function without a name.
The default value is `function_`.
type: string
optional: true
- name: UnnamedTypeDefinitionPrefix
doc: |-
The prefix for a type definition without a name.
The default value is "".
Note that the type kind (like `struct`, or `typedef`) is going to be
inserted automatically after this prefix.
type: string
optional: true
- name: UnnamedEnumEntryPrefix
doc: |-
The prefix for an enum entry without a name.
The default value is `enum_entry_`.
type: string
optional: true
- name: UnnamedStructFieldPrefix
doc: |-
The prefix for a struct field without a name.
The default value is `offset_`.
type: string
optional: true
- name: UnnamedUnionFieldPrefix
doc: |-
The prefix for a union member without a name.
The default value is `member_`.
type: string
optional: true
- name: UnnamedFunctionArgumentPrefix
doc: |-
The prefix for a cabi function argument without a name.
The default value is `argument_`.
type: string
optional: true
- name: UnnamedFunctionRegisterPrefix
doc: |-
The prefix for a raw function register without a name.
The default value is `register_`.
type: string
optional: true
- name: UnnamedLocalVariablePrefix
doc: |-
The prefix for a local variable without a name.
The default value is `var_`.
type: string
optional: true
- name: UnnamedBreakFromLoopVariablePrefix
doc: |-
The prefix for a local variable without a name.
The default value is `break_from_loop_`.
type: string
optional: true
- name: UnnamedGotoLabelPrefix
doc: |-
The prefix for a goto label without a name.
The default value is `label_`.
type: string
optional: true
- name: UndefinedValuePrefix
doc: |-
The prefix for an undefined value.
The default value is `undef_`.
type: string
optional: true
- name: OpaqueCSVValuePrefix
doc: |-
The prefix for accessing an opaque CSV Value.
The default value is `undef_`.
type: string
optional: true
- name: MaximumEnumValuePrefix
doc: |-
The prefix for the maximum enum value.
The default value is `enum_max_value_`.
type: string
optional: true
- name: StackFrameVariableName
doc: |-
The name of the variable representing stack.
The default value is `stack`.
type: string
optional: true
- name: RawStackArgumentName
doc: |-
The name of the variable representing stack.
The default value is `stack_arguments`.
type: string
optional: true
- name: LoopStateVariableName
doc: |-
The name of the variable representing stack.
The default value is `loop_state_var`.
type: string
optional: true
- name: StructPaddingPrefix
doc: |-
The prefix for a padding struct field.
The default value is `padding_at_`.
type: string
optional: true
- name: ArtificialReturnValuePrefix
doc: |-
The prefix for an artificial raw function return value.
The default value is `artificial_struct_returned_by_`.
type: string
optional: true
- name: ReserveNamesStartingWithUnderscore
doc: |-
When this is set to `true`, all the names starting with underscores will
have a \ref ReservedNamePrefix prefix attached.
type: bool
optional: true
- name: DisassemblyConfiguration
type: struct
doc: |-
The subset of configuration options dedicated to the disassembly view.
fields:
- name: DisableEmissionOfInstructionAddress
doc: |-
When set to `true`, the addresses of the instructions are not present
in the disassembly view.
```
400df8: fd 7b bd a9 stp x29, x30, [sp, #-0x30]!
400dfc: fd 03 00 91 mov x29, sp
-----------
^
This part
```
type: bool
optional: true
- name: DisableEmissionOfRawBytes
doc: |-
When set to `true`, the raw bytes of the instructions are not present
in the disassembly view.
```
400df8: fd 7b bd a9 stp x29, x30, [sp, #-0x30]!
400dfc: fd 03 00 91 mov x29, sp
---------------
^
This part
```
type: bool
optional: true
- name: UseX86ATTSyntax
doc: |-
When set to `true`, ATT syntax is used.
`true`:
```
80491a0: 83 c4 10 addl $0x10, %esp
80491a3: 8b 5d fc movl -0x4(%ebp), %ebx
80491a6: c9 leave
80491a7: e9 ec fe ff ff jmp bb_0x8049098
```
`false` (default):
```
80491a0: 83 c4 10 add esp, 0x10
80491a3: 8b 5d fc mov ebx, dword ptr [ebp - 0x4]
80491a6: c9 leave
80491a7: e9 ec fe ff ff jmp bb_0x8049098
```
Note that this option has no effect on non-x86 binaries.
type: bool
optional: true
- name: AddressStyle
doc: |-
This describes the way labels / addresses should be printed in
the disassembly view.
See the related enum for further explanation and examples.
The default value is `Smart`.
type: DisassemblyConfigurationAddressStyle
optional: true
- name: ImmediateStyle
doc: |-
This describes the way immediate values are printed in
the disassembly view.
See the related enum for further explanation and examples.
The default value is `CHexadecimal`.
type: DisassemblyConfigurationImmediateStyle
optional: true
- name: PrintFullMetaAddress
doc: |-
Set this to true to include the full meta-address whenever one is printed.
The default value of `false` omits the address type as long as it matches
that of the binary.
`true`:
```
80491a7_Code_x86: e9 ec fe ff ff jmp bb_0x8049098_Code_x86
```
`false` (default):
```
80491a7: e9 ec fe ff ff jmp bb_0x8049098
```
type: bool
optional: true
- name: BasicBlockPrefix
doc: |-
The prefix attached to the basic block address in the disassembly views.
The default value is `bb_`.
`my_value_`:
```
80491a7: e9 ec fe ff ff jmp my_value_0x8049098
```
default:
```
80491a7: e9 ec fe ff ff jmp bb_0x8049098
```
type: string
optional: true
- name: DisassemblyConfigurationImmediateStyle
type: enum
doc: |-
An enum listing immediate emission style in the disassembly views.
members:
- name: Decimal
doc: Print immediate values as decimal, for example `42`.
- name: CHexadecimal
doc: Print immediate values as c-style hexadecimal, for example `0x2a`.
- name: AsmHexadecimal
doc: Print immediate values as asm-style hexadecimal, for example `02ah`.
- name: DisassemblyConfigurationAddressStyle
type: enum
doc: |-
An enum listing address (as in label) emission style in the disassembly
views.
members:
- name: Smart
doc: |-
Look for the addresses among basic blocks and functions.
When a match is found, replace the addresses with relevant labels.
Otherwise, prints an absolute address instead.
- name: SmartWithPCRelativeFallback
doc: |-
Same as `Smart`, except when unable to single out the target,
print a PC-relative address instead.
- name: Strict
doc: |-
Same as `Smart`, except when unable to single out the target,
print an error token.
- name: Global
doc: |-
Convert PC relative addresses into global representation.
- name: PCRelative
doc: |-
Print all the addresses exactly how disassembler emitted them
in PC-relative mode.