• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • 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
          • App-view
          • Top-level-memory
          • X86-decoder
          • Physical-memory
          • Decoding-and-spec-utils
            • Read-operands-and-write-results
            • Effective-address-computations
            • Select-operand-size
            • Instruction-pointer-operations
            • Stack-pointer-operations
            • Select-segment-register
            • Prefix-modrm-sib-decoding
              • Modr/m-decoding
              • Mandatory-prefixes-computation
              • Modr/m-detection
              • Legacy-prefixes-decoding
                • Inst-list-prefix-byte-group-code
                  • Inst-prefix-byte-group-code
                  • Get-one-byte-prefix-array-code
                • Compute-mandatory-prefix-for-three-byte-opcode
                • 64-bit-compute-mandatory-prefix-for-0f-3a-three-byte-opcode
                • 64-bit-compute-mandatory-prefix-for-0f-38-three-byte-opcode
                • 32-bit-compute-mandatory-prefix-for-0f-3a-three-byte-opcode
                • 32-bit-compute-mandatory-prefix-for-0f-38-three-byte-opcode
                • 64-bit-compute-mandatory-prefix-for-two-byte-opcode
                • 32-bit-compute-mandatory-prefix-for-two-byte-opcode
                • Instructions-with-mandatory-prefixes
                • Compute-mandatory-prefix-for-0f-3a-three-byte-opcode
                • Compute-mandatory-prefix-for-0f-38-three-byte-opcode
                • Compute-mandatory-prefix-for-two-byte-opcode
              • Select-address-size
              • Rex-byte-from-vex-prefixes
              • Check-instruction-length
              • Error-objects
              • Rip-guard-okp
              • Sib-decoding
            • Instructions
            • 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
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Legacy-prefixes-decoding

    Inst-list-prefix-byte-group-code

    Takes in a list of instructions and returns prefix byte group code for each of the constituent instructions

    Signature
    (inst-list-prefix-byte-group-code first-opcode num-opcodes inst-lst) 
      → 
    *
    Arguments
    first-opcode — Guard (24bits-p first-opcode).
    num-opcodes — Guard (natp num-opcodes).
    inst-lst — Guard (inst-list-p inst-lst).

    Source: Intel Manuals, Vol. 2, Section 2.1.1.

    The value 0 corresponds to "not a prefix" and 1, 2, 3 and 4 correspond to the prefix group of byte.

    Definitions and Theorems

    Function: inst-list-prefix-byte-group-code

    (defun inst-list-prefix-byte-group-code
           (first-opcode num-opcodes inst-lst)
     (declare (xargs :guard (and (24bits-p first-opcode)
                                 (natp num-opcodes)
                                 (inst-list-p inst-lst))))
     (let ((__function__ 'inst-list-prefix-byte-group-code))
      (declare (ignorable __function__))
      (b* (((when (zp num-opcodes)) nil)
           (rest (if (24bits-p (1+ first-opcode))
                     (inst-list-prefix-byte-group-code (1+ first-opcode)
                                                       (1- num-opcodes)
                                                       inst-lst)
                   (er hard? 'inst-list-prefix-byte-group-code
                       "Illegal opcode ~s0.~%"
                       (str::hexify (1+ first-opcode)))))
           (same-opcode-insts (select-insts inst-lst
                                            :opcode first-opcode))
           ((when (equal (len same-opcode-insts) 1))
            (cons (inst-prefix-byte-group-code (car same-opcode-insts))
                  rest)))
        (cons 0 rest))))