(load-file-into-memory filename ptr x86 state) → (mv file-contents x86 state)
Function:
(defun load-file-into-memory (filename ptr x86 state) (declare (xargs :stobjs (x86 state))) (declare (xargs :guard (and (stringp filename) (canonical-address-p ptr)))) (let ((__function__ 'load-file-into-memory)) (declare (ignorable __function__)) (b* (((mv channel state) (open-input-channel filename :byte state)) ((when (not channel)) (mv nil x86 state)) ((mv file-contents state) (read-channel-into-byte-list channel (1- (ash 1 60)) state)) ((unless (canonical-address-p (+ ptr (len file-contents)))) (mv nil x86 state)) ((mv & x86) (write-bytes-to-memory ptr file-contents x86)) (state (close-input-channel channel state))) (mv file-contents x86 state))))
Theorem:
(defthm byte-listp-of-load-file-into-memory.file-contents (implies (and (stringp filename) (canonical-address-p ptr) (state-p1 state)) (b* (((mv ?file-contents ?x86 acl2::?state) (load-file-into-memory filename ptr x86 state))) (byte-listp file-contents))) :rule-classes :rewrite)
Theorem:
(defthm x86p-of-load-file-into-memory.x86 (implies (x86p x86) (b* (((mv ?file-contents ?x86 acl2::?state) (load-file-into-memory filename ptr x86 state))) (x86p x86))) :rule-classes :rewrite)
Theorem:
(defthm state-p1-of-load-file-into-memory.state (implies (and (stringp filename) (state-p1 state)) (b* (((mv ?file-contents ?x86 acl2::?state) (load-file-into-memory filename ptr x86 state))) (state-p1 state))) :rule-classes :rewrite)