Construct a PDP table, one entry at a time, each of which map a 1GB page.
(construct-pdp-table entry-number entry-addr page-base-addr acc) → *
A PDP table comprises 512 64-bit entries.
Function:
(defun construct-pdp-table (entry-number entry-addr page-base-addr acc) (declare (type (unsigned-byte 10) entry-number) (type (unsigned-byte 52) entry-addr) (type (unsigned-byte 22) page-base-addr)) (declare (xargs :guard (alistp acc))) (let ((__function__ 'construct-pdp-table)) (declare (ignorable __function__)) (cond ((or (not (integerp entry-number)) (< entry-number 0) (not (unsigned-byte-p 22 (1+ page-base-addr))) (not (unsigned-byte-p 10 (1+ entry-number))) (not (unsigned-byte-p 52 (+ 8 entry-addr)))) acc) ((< entry-number 512) (construct-pdp-table (+ 1 entry-number) (+ 8 entry-addr) (+ 1 page-base-addr) (acons entry-addr (add-pdp-entry page-base-addr) acc))) (t acc))))
Theorem:
(defthm true-listp-construct-pdp-table (implies (true-listp acc) (true-listp (construct-pdp-table entry-number entry-addr page-base-addr acc))))
Theorem:
(defthm consp-construct-pdp-table-helper (implies (and (unsigned-byte-p 52 (+ 8 entry-addr)) (unsigned-byte-p 22 (+ 1 page-base-addr))) (consp (construct-pdp-table 511 entry-addr page-base-addr acc))))
Theorem:
(defthm consp-construct-pdp-table (implies (and (< entry-number 512) (unsigned-byte-p 10 entry-number) (unsigned-byte-p 10 (+ 1 entry-number)) (unsigned-byte-p 52 (+ 8 entry-addr)) (unsigned-byte-p 22 (+ 1 page-base-addr))) (consp (construct-pdp-table entry-number entry-addr page-base-addr acc))) :rule-classes (:type-prescription :rewrite))
Theorem:
(defthm physical-addr-qword-alistp-construct-pdp-table-helper (implies (and (natp entry-addr) (physical-addr-qword-alistp acc) (unsigned-byte-p 22 page-base-addr)) (physical-addr-qword-alistp (construct-pdp-table 511 entry-addr page-base-addr acc))))
Theorem:
(defthm physical-addr-qword-alistp-construct-pdp-table (implies (and (natp entry-addr) (physical-addr-qword-alistp acc) (unsigned-byte-p 22 page-base-addr)) (physical-addr-qword-alistp (construct-pdp-table entry-number entry-addr page-base-addr acc))) :rule-classes (:type-prescription :rewrite))