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