Read memory as a string till a zero is encountered
(read-string-zero-terminated ptr x86) → (mv * * x86)
Function:
(defun read-string-zero-terminated (ptr x86) (declare (xargs :stobjs (x86))) (declare (type (signed-byte 49) ptr)) (declare (xargs :guard (and (integerp ptr) (<= (- *2^47*) ptr) (<= ptr *2^47*)))) (let ((__function__ 'read-string-zero-terminated)) (declare (ignorable __function__)) (b* (((mv flg bytes x86) (read-memory-zero-terminated ptr x86 nil)) ((when flg) (mv flg "nil" x86)) (charlist (bytes-to-charlist bytes))) (mv nil (coerce charlist 'string) x86))))
Theorem:
(defthm stringp-mv-nth-1-read-string-zero-terminated (implies (force (x86p x86)) (stringp (mv-nth 1 (read-string-zero-terminated ptr x86)))) :rule-classes :type-prescription)
Theorem:
(defthm x86p-mv-nth-2-read-string-zero-terminated (implies (x86p x86) (x86p (mv-nth 2 (read-string-zero-terminated ptr x86)))))