• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Debugging
    • Projects
    • 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
            • Reasoning-about-memory-reads-and-writes
            • Rml128
            • Rml80
            • Program-location
            • Rml64
            • Rml48
            • Wml128
            • Rml32
            • Rml08
              • Rml16
              • Wml80
              • Wml64
              • Wml08
              • Byte-listp
              • Wml48
              • Parametric-memory-reads-and-writes
              • Combine-n-bytes
              • Wml32
              • Program-at
              • Wml16
              • Combine-bytes
              • Write-canonical-address-to-memory-user-exec
              • Write-canonical-address-to-memory
              • Wml-size
              • Riml64
              • Riml32
              • Riml16
              • Riml08
              • Rml-size
              • Wiml64
              • Wiml32
              • Wiml16
              • Wiml08
              • Wiml-size
              • Riml-size
              • Generate-xr-over-write-thms
              • Generate-write-fn-over-xw-thms
              • Generate-read-fn-over-xw-thms
            • 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
            • 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
    • Linear-memory

    Rml08

    Signature
    (rml08 lin-addr r-x x86) → (mv * * x86)

    Definitions and Theorems

    Function: rml08

    (defun
      rml08 (lin-addr r-x x86)
      (declare (xargs :stobjs (x86)))
      (declare (type (signed-byte 48) lin-addr)
               (type (member :r :x) r-x))
      (declare (xargs :guard (canonical-address-p lin-addr)))
      (let ((__function__ 'rml08))
           (declare (ignorable __function__))
           (mbe :logic (rb 1 lin-addr r-x x86)
                :exec (if (app-view x86)
                          (rvm08 lin-addr x86)
                          (b* (((mv flag (the (unsigned-byte 52) p-addr)
                                    x86)
                                (la-to-pa lin-addr r-x x86))
                               ((when flag) (mv flag 0 x86))
                               (byte (the (unsigned-byte 8)
                                          (memi p-addr x86))))
                              (mv nil byte x86))))))

    Theorem: n08p-mv-nth-1-rml08

    (defthm
     n08p-mv-nth-1-rml08
     (unsigned-byte-p 8 (mv-nth 1 (rml08 lin-addr r-x x86)))
     :rule-classes
     (:rewrite
      (:type-prescription
          :corollary (natp (mv-nth 1 (rml08 lin-addr r-x x86)))
          :hints
          (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
      (:linear
           :corollary (and (<= 0 (mv-nth 1 (rml08 lin-addr r-x x86)))
                           (< (mv-nth 1 (rml08 lin-addr r-x x86))
                              256))
           :hints (("Goal" :in-theory (e/d (unsigned-byte-p) nil))))))

    Theorem: x86p-rml08

    (defthm x86p-rml08
            (implies (force (x86p x86))
                     (x86p (mv-nth 2 (rml08 lin-addr r-x x86)))))

    Theorem: rml08-value-when-error

    (defthm rml08-value-when-error
            (implies (mv-nth 0 (rml08 addr r-x x86))
                     (equal (mv-nth 1 (rml08 addr r-x x86))
                            0)))

    Theorem: rml08-does-not-affect-state-in-app-view

    (defthm rml08-does-not-affect-state-in-app-view
            (implies (app-view x86)
                     (equal (mv-nth 2 (rml08 start-rip r-x x86))
                            x86)))

    Theorem: app-view-rml08-no-error

    (defthm app-view-rml08-no-error
            (implies (and (app-view x86)
                          (canonical-address-p addr)
                          (x86p x86))
                     (and (equal (mv-nth 0 (rml08 addr r-x x86))
                                 nil)
                          (equal (mv-nth 1 (rml08 addr :x x86))
                                 (memi (loghead 48 addr) x86))
                          (equal (mv-nth 2 (rml08 addr r-x x86))
                                 x86))))

    Theorem: xr-rml08-state-in-app-view

    (defthm xr-rml08-state-in-app-view
            (implies (app-view x86)
                     (equal (xr fld
                                index (mv-nth 2 (rml08 addr r-x x86)))
                            (xr fld index x86))))

    Theorem: xr-rml08-state-in-sys-view

    (defthm xr-rml08-state-in-sys-view
            (implies (and (not (app-view x86))
                          (not (equal fld :mem))
                          (not (equal fld :fault)))
                     (equal (xr fld
                                index (mv-nth 2 (rml08 addr r-x x86)))
                            (xr fld index x86))))

    Theorem: rml08-xw-app-view

    (defthm
     rml08-xw-app-view
     (implies
          (and (app-view x86)
               (not (equal fld :mem))
               (not (equal fld :app-view)))
          (and (equal (mv-nth 0
                              (rml08 addr r-x (xw fld index value x86)))
                      (mv-nth 0 (rml08 addr r-x x86)))
               (equal (mv-nth 1
                              (rml08 addr r-x (xw fld index value x86)))
                      (mv-nth 1 (rml08 addr r-x x86))))))

    Theorem: rml08-xw-system-mode

    (defthm
     rml08-xw-system-mode
     (implies
          (and (not (app-view x86))
               (not (equal fld :fault))
               (not (equal fld :seg-visible))
               (not (equal fld :mem))
               (not (equal fld :ctr))
               (not (equal fld :msr))
               (not (equal fld :rflags))
               (not (equal fld :app-view))
               (not (equal fld :marking-view)))
          (and (equal (mv-nth 0
                              (rml08 addr r-x (xw fld index value x86)))
                      (mv-nth 0 (rml08 addr r-x x86)))
               (equal (mv-nth 1
                              (rml08 addr r-x (xw fld index value x86)))
                      (mv-nth 1 (rml08 addr r-x x86)))
               (equal (mv-nth 2
                              (rml08 addr r-x (xw fld index value x86)))
                      (xw fld index value
                          (mv-nth 2 (rml08 addr r-x x86)))))))

    Theorem: rml08-xw-system-mode-rflags-not-ac

    (defthm
     rml08-xw-system-mode-rflags-not-ac
     (implies
        (and (not (app-view x86))
             (equal (rflagsbits->ac value)
                    (rflagsbits->ac (rflags x86))))
        (and (equal (mv-nth 0
                            (rml08 addr r-x (xw :rflags nil value x86)))
                    (mv-nth 0 (rml08 addr r-x x86)))
             (equal (mv-nth 1
                            (rml08 addr r-x (xw :rflags nil value x86)))
                    (mv-nth 1 (rml08 addr r-x x86)))
             (equal (mv-nth 2
                            (rml08 addr r-x (xw :rflags nil value x86)))
                    (xw :rflags nil value
                        (mv-nth 2 (rml08 addr r-x x86)))))))

    Theorem: mv-nth-2-rml08-in-system-level-non-marking-view

    (defthm mv-nth-2-rml08-in-system-level-non-marking-view
            (implies (and (not (marking-view x86))
                          (not (mv-nth 0 (rml08 lin-addr r-x x86))))
                     (equal (mv-nth 2 (rml08 lin-addr r-x x86))
                            x86)))

    Theorem: 64-bit-modep-of-rml08

    (defthm 64-bit-modep-of-rml08
            (equal (64-bit-modep (mv-nth 2 (rml08 li-addr r-x x86)))
                   (64-bit-modep x86)))

    Theorem: x86-operation-mode-of-rml08

    (defthm
         x86-operation-mode-of-rml08
         (equal (x86-operation-mode (mv-nth 2 (rml08 li-addr r-x x86)))
                (x86-operation-mode x86)))