• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
      • X86isa
        • Program-execution
        • Introduction
        • X86isa-build-instructions
        • Publications
        • Contributors
        • Machine
          • Syscalls
          • Cpuid
          • X86isa-state
          • Linear-memory
          • Rflag-specifications
          • Characterizing-undefined-behavior
          • Top-level-memory
          • App-view
          • X86-decoder
          • Physical-memory
          • Decoding-and-spec-utils
          • Instructions
          • X86-modes
          • Segmentation
          • Register-readers-and-writers
            • Zmms-reads-and-writes
            • Gprs-reads-and-writes
            • Mmx-registers-reads-and-writes
            • Xmms-reads-and-writes
            • Rflags-reads-and-writes
            • Gpr-indices
              • Reg-index
              • Reg-indexp
          • Other-non-deterministic-computations
          • Environment
          • Paging
        • Implemented-opcodes
        • Proof-utilities
        • To-do
        • Concrete-simulation-examples
        • Model-validation
        • Utils
        • Debugging-code-proofs
      • Execloader
      • Axe
    • Testing-utilities
    • Math
  • Register-readers-and-writers

Gpr-indices

Functions that enable the use of extended GPRs using the rex byte

Definitions and Theorems

Function: reg-indexp

(defun reg-indexp (reg rex-byte)
       (declare (type (unsigned-byte 8) rex-byte))
       (let ((__function__ 'reg-indexp))
            (declare (ignorable __function__))
            (if (eql rex-byte 0)
                (n03p reg)
                (n04p reg))))

Theorem: reg-indexp-for-3-bits

(defthm reg-indexp-for-3-bits
        (implies (and (syntaxp (quotep reg)) (n03p reg))
                 (reg-indexp reg rex)))

Theorem: reg-indexp-logand-7

(defthm reg-indexp-logand-7
        (implies (n08p rex-byte)
                 (reg-indexp (loghead 3 modr/m)
                             rex-byte)))

Function: reg-index$inline

(defun reg-index$inline (reg rex-byte index)
       (declare (type (unsigned-byte 3) reg)
                (type (unsigned-byte 8) rex-byte)
                (type (unsigned-byte 2) index))
       (if (logbitp index rex-byte)
           (logior 8 (mbe :logic (n03 reg) :exec reg))
           (mbe :logic (n03 reg) :exec reg)))

Theorem: reg-indexp-reg-index

(defthm reg-indexp-reg-index
        (reg-indexp (reg-index reg rex-byte name)
                    rex-byte))

Theorem: n04p-reg-index

(defthm
 n04p-reg-index
 (unsigned-byte-p 4 (reg-index reg rex-byte name))
 :rule-classes
 (:rewrite
  (:type-prescription
      :corollary (natp (reg-index reg rex-byte name))
      :hints
      (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
  (:linear
   :corollary (and (<= 0 (reg-index reg rex-byte name))
                   (< (reg-index reg rex-byte name) 16))
   :hints
   (("Goal"
        :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))

Theorem: reg-indexp-forward

(defthm reg-indexp-forward
        (implies (reg-indexp reg rex-byte)
                 (unsigned-byte-p 4 reg))
        :rule-classes :forward-chaining)

Subtopics

Reg-index
Using the REX prefix to access general-purpose registers
Reg-indexp
Valid GPR index recognizer