• 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
            • Addr-range
            • Read-from-physical-memory
              • Write-to-physical-memory
              • Rm-low-32
              • Wm-low-32
              • Rm-low-64
              • Create-physical-address-list
              • Wm-low-64
              • Physical-address-listp
              • Physical-address-p
            • 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))))