Function:
(defun rb (n addr r-x x86) (declare (xargs :stobjs (x86))) (declare (type (member :r :x) r-x)) (declare (xargs :guard (and (natp n) (integerp addr)))) (declare (xargs :guard (canonical-address-p (+ -1 n addr)))) (let ((__function__ 'rb)) (declare (ignorable __function__)) (if (app-view x86) (rb-1 n addr r-x x86) (b* (((mv flg p-addrs x86) (las-to-pas n addr r-x x86)) ((when flg) (mv flg 0 x86)) (val (read-from-physical-memory p-addrs x86))) (mv nil val x86)))))
Theorem:
(defthm integerp-of-rb.val (b* (((mv ?flg ?val ?new-x86) (rb n addr r-x x86))) (integerp val)) :rule-classes :type-prescription)
Theorem:
(defthm x86p-of-rb.new-x86 (implies (x86p x86) (b* (((mv ?flg ?val ?new-x86) (rb n addr r-x x86))) (x86p new-x86))) :rule-classes :rewrite)
Theorem:
(defthm natp-of-mv-nth-1-rb (b* (((mv ?flg ?val ?new-x86) (rb n addr r-x x86))) (natp val)) :rule-classes :type-prescription)
Theorem:
(defthm rb-no-reads-when-zp-n (b* (((mv ?flg ?val ?new-x86) (rb n addr r-x x86))) (implies (zp n) (equal val 0))))
Theorem:
(defthm rb-is-rb-1-for-app-view (implies (app-view x86) (equal (rb n addr r-x x86) (rb-1 n addr r-x x86))))
Theorem:
(defthm rb-returns-no-error-app-view (implies (and (app-view x86) (canonical-address-p addr) (canonical-address-p (+ -1 n addr))) (equal (mv-nth 0 (rb n addr r-x x86)) nil)))
Theorem:
(defthm rb-returns-x86-app-view (implies (app-view x86) (equal (mv-nth 2 (rb n addr r-x x86)) x86)))
Theorem:
(defthm size-of-rb (implies (and (equal m (ash n 3)) (natp n)) (unsigned-byte-p m (mv-nth 1 (rb n addr r-x x86)))) :rule-classes (:rewrite (:linear :corollary (implies (and (equal m (ash n 3)) (natp n)) (and (<= 0 (mv-nth 1 (rb n addr r-x x86))) (< (mv-nth 1 (rb n addr r-x x86)) (expt 2 m)))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm size-of-rb-in-app-view (implies (and (app-view x86) (natp n)) (unsigned-byte-p (ash n 3) (mv-nth 1 (rb n addr r-x x86)))) :rule-classes (:rewrite (:linear :corollary (implies (and (app-view x86) (natp n)) (and (<= 0 (mv-nth 1 (rb n addr r-x x86))) (< (mv-nth 1 (rb n addr r-x x86)) (expt 2 (ash n 3))))) :hints (("Goal" :in-theory '(unsigned-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm rb-values-and-xw-rflags-in-sys-view (implies (and (equal (rflagsbits->ac (double-rewrite value)) (rflagsbits->ac (rflags x86))) (not (app-view x86)) (x86p x86)) (and (equal (mv-nth 0 (rb n addr r-x (xw :rflags nil value x86))) (mv-nth 0 (rb n addr r-x (double-rewrite x86)))) (equal (mv-nth 1 (rb n addr r-x (xw :rflags nil value x86))) (mv-nth 1 (rb n addr r-x (double-rewrite x86)))))))
Theorem:
(defthm 64-bit-modep-of-rb (equal (64-bit-modep (mv-nth 2 (rb n addr r-x x86))) (64-bit-modep x86)))
Theorem:
(defthm x86-operation-mode-of-rb (equal (x86-operation-mode (mv-nth 2 (rb n addr r-x x86))) (x86-operation-mode x86)))