• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Taspi
      • Bitcoin
      • Riscv
      • Des
      • Ethereum
      • X86isa
        • Program-execution
        • Sdm-instruction-set-summary
        • Tlb
        • Running-linux
        • Introduction
        • Asmtest
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
          • X86isa-state
          • Syscalls
          • Cpuid
          • Linear-memory
          • Rflag-specifications
          • Characterizing-undefined-behavior
          • Top-level-memory
          • App-view
          • X86-decoder
          • Physical-memory
          • Decoding-and-spec-utils
          • Instructions
            • Two-byte-opcodes
            • One-byte-opcodes
            • Fp-opcodes
            • Instruction-semantic-functions
              • Sar-spec
              • Shr-spec
              • Sal/shl-spec
              • Rol-spec
              • Ror-spec
              • Rcl-spec
              • Rcr-spec
              • Simd-sub-spec
              • Simd-add-spec
              • Imul-spec
              • Mul-spec
              • Idiv-spec
              • Div-spec
              • Shrd-spec
              • Shld-spec
              • Gpr-arith/logic-spec
              • Shrx-spec
              • Shlx-spec
              • Sarx-spec
              • Floating-point-specifications
            • X86-illegal-instruction
            • Implemented-opcodes
            • Opcode-maps
            • X86-general-protection
            • X86-device-not-available
            • X86-step-unimplemented
            • Privileged-opcodes
            • Three-byte-opcodes
          • Register-readers-and-writers
          • X86-modes
          • Segmentation
          • Other-non-deterministic-computations
          • Environment
          • Paging
        • Implemented-opcodes
        • To-do
        • Proof-utilities
        • Peripherals
        • Model-validation
        • Modelcalls
        • Concrete-simulation-examples
        • Utils
        • Debugging-code-proofs
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Bigmems
      • Builtins
      • Execloader
      • Aleo
      • Solidity
      • Paco
      • Concurrent-programs
      • Bls12-377-curves
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Instructions

Instruction-semantic-functions

Instruction Semantic Functions

The instruction semantic functions have dual roles:

  1. They fetch the instruction's operands, as dictated by the decoded components of the instruction (like the prefixes, SIB byte, etc.) provided as input; these decoded components are provided by our x86 decoder function x86-fetch-decode-execute.
  2. They contain or act as the functional specification of the instructions. For example, the functional specification function of the ADD instruction returns two values: the appropriately truncated sum of the operands and the modified flags. We do not deal with the x86 state in these specifications.

Each semantic function takes, among other arguments, the value start-rip of the instruction pointer at the beginning of the instruction, and the value temp-rip of the instruction pointer after the decoding of the prefixes, REX byte, opcode, ModR/M byte, and SIB byte (some of these bytes may not be present). The semantic function may further increment the instruction pointer beyond temp-rip to read the ending bytes of the instruction, e.g. to read a displacement or an immediate. The semantic function eventually writes the final value of the instruction pointer into RIP.

Subtopics

Sar-spec
Specification for the SAR instruction
Shr-spec
Specification for the SHR instruction
Sal/shl-spec
Specification for the SAL/SHL instruction
Rol-spec
Specification for the ROL instruction
Ror-spec
Specification for the ROR instruction
Rcl-spec
Specification for the RCL instruction
Rcr-spec
Specification for the RCR instruction
Simd-sub-spec
Specification for the SIMD subtraction instructions.
Simd-add-spec
Specification for the SIMD addition instructions.
Imul-spec
Specification for the IMUL (unsigned imultiply) instruction
Mul-spec
Specification for the MUL (unsigned multiply) instruction
Idiv-spec
Specification for the IDIV (unsigned idivide) instruction
Div-spec
Specification for the DIV (unsigned divide) instruction
Shrd-spec
Specification for the SHRD instruction.
Shld-spec
Specification for the SHLD instruction.
Gpr-arith/logic-spec
Semantics of general-purpose arithmetic and logical instructions
Shrx-spec
Specification for the SHRX instruction.
Shlx-spec
Specification for the SHLX instruction.
Sarx-spec
Specification for the SARX instruction.
Floating-point-specifications
Misc. utilities for the specification of floating-point operations