Read
(read-bytes-from-memory ptr nbytes x86 acc) → (mv * * x86)
Returns a list of bytes (byte at the smallest address is the first byte of the list).
Function:
(defun read-bytes-from-memory (ptr nbytes x86 acc) (declare (xargs :stobjs (x86))) (declare (type (signed-byte 49) ptr) (type (unsigned-byte 48) nbytes)) (declare (xargs :split-types t :guard (and (integerp nbytes) (<= 0 nbytes) (integerp ptr) (<= (- *2^47*) ptr) (< (+ ptr nbytes) *2^47*) (nat-listp acc)))) (let ((__function__ 'read-bytes-from-memory)) (declare (ignorable __function__)) (if (mbt (and (integerp nbytes) (integerp ptr) (<= (- *2^47*) ptr) (< (+ ptr nbytes) *2^47*))) (if (zp nbytes) (mv nil (reverse acc) x86) (b* (((mv flg (the (unsigned-byte 8) byte) x86) (rml08 ptr :r x86)) ((when flg) (mv flg nil x86))) (read-bytes-from-memory (the (signed-byte 49) (1+ ptr)) (the (unsigned-byte 48) (1- nbytes)) x86 (cons byte acc)))) (mv t (reverse acc) x86))))
Theorem:
(defthm byte-listp-mv-nth-1-read-bytes-from-memory (implies (forced-and (x86p x86) (byte-listp acc)) (byte-listp (mv-nth 1 (read-bytes-from-memory ptr nbytes x86 acc)))) :rule-classes :type-prescription)
Theorem:
(defthm x86p-mv-nth-2-read-bytes-from-memory (implies (x86p x86) (x86p (mv-nth 2 (read-bytes-from-memory ptr nbytes x86 acc)))))