• 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
            • Reasoning-about-memory-reads-and-writes
              • Las-to-pas
              • Rb
              • Create-canonical-address-list
              • Rb-1
              • Read-from-physical-memory
                • Write-to-physical-memory
                • Wb
                • Wb-1
                • Canonical-address-listp
              • Wml256
              • Rml256
              • Wml512
              • Rml512
              • Rml128
              • Rml80
              • Program-location
              • Rml64
              • Wml128
              • Rml48
              • 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
              • Riml64
              • Wml-size
              • Rml-size
              • Riml32
              • Riml16
              • Riml08
              • Wiml64
              • Wiml32
              • Wiml16
              • Wiml08
              • Wiml-size
              • Generate-xr-over-write-thms
              • Generate-write-fn-over-xw-thms
              • Generate-read-fn-over-xw-thms
              • Riml-size
            • Rflag-specifications
            • Characterizing-undefined-behavior
            • App-view
            • Top-level-memory
            • X86-decoder
            • Physical-memory
            • Decoding-and-spec-utils
            • 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
    • Reasoning-about-memory-reads-and-writes
    • Physical-memory

    Read-from-physical-memory

    Signature
    (read-from-physical-memory p-addrs x86) → value
    Arguments
    p-addrs — Guard (physical-address-listp p-addrs).
    Returns
    value — Type (integerp value).

    Definitions and Theorems

    Function: read-from-physical-memory

    (defun read-from-physical-memory (p-addrs x86)
      (declare (xargs :stobjs (x86)))
      (declare (xargs :guard (physical-address-listp p-addrs)))
      (declare (xargs :guard (not (app-view x86))))
      (let ((__function__ 'read-from-physical-memory))
        (declare (ignorable __function__))
        (if (endp p-addrs)
            0
          (b* ((addr0 (car p-addrs))
               (byte0 (memi addr0 x86))
               (rest-bytes (read-from-physical-memory (cdr p-addrs)
                                                      x86)))
            (logior byte0 (ash rest-bytes 8))))))

    Theorem: integerp-of-read-from-physical-memory

    (defthm integerp-of-read-from-physical-memory
      (b* ((value (read-from-physical-memory p-addrs x86)))
        (integerp value))
      :rule-classes :type-prescription)

    Theorem: size-of-read-from-physical-memory

    (defthm size-of-read-from-physical-memory
     (implies (equal n (ash (len p-addrs) 3))
              (unsigned-byte-p n
                               (read-from-physical-memory p-addrs x86)))
     :rule-classes
     (:rewrite
      (:type-prescription
          :corollary
          (implies (equal n (ash (len p-addrs) 3))
                   (natp (read-from-physical-memory p-addrs x86)))
          :hints
          (("Goal" :in-theory '(unsigned-byte-p integer-range-p natp))))
      (:linear
       :corollary
       (implies (equal n (ash (len p-addrs) 3))
                (and (<= 0
                         (read-from-physical-memory p-addrs x86))
                     (< (read-from-physical-memory p-addrs x86)
                        (expt 2 n))))
       :hints
       (("Goal"
            :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))

    Theorem: read-from-physical-memory-xw-rflags

    (defthm read-from-physical-memory-xw-rflags
     (equal (read-from-physical-memory p-addrs (xw :rflags nil val x86))
            (read-from-physical-memory p-addrs x86)))

    Theorem: read-from-physical-memory-xw-not-mem

    (defthm read-from-physical-memory-xw-not-mem
     (implies
       (not (equal fld :mem))
       (equal (read-from-physical-memory p-addrs (xw fld index val x86))
              (read-from-physical-memory p-addrs x86))))