(evex-decode-and-execute proc-mode start-rip temp-rip prefixes rex-byte evex-prefixes x86) → x86
Reference: Intel Vol. 2A, Section 2.6: Intel(R) AVX-512 Encoding
Function:
(defun evex-decode-and-execute (proc-mode start-rip temp-rip prefixes rex-byte evex-prefixes x86) (declare (xargs :stobjs (x86))) (declare (type (integer 0 4) proc-mode) (type (signed-byte 48) start-rip) (type (signed-byte 48) temp-rip) (type (unsigned-byte 52) prefixes) (type (unsigned-byte 8) rex-byte) (type (unsigned-byte 32) evex-prefixes)) (declare (xargs :guard (and (evex-prefixes-p evex-prefixes) (prefixes-p prefixes)))) (let ((__function__ 'evex-decode-and-execute)) (declare (ignorable __function__)) (b* ((ctx 'evex-decode-and-execute) ((when (not (equal rex-byte 0))) (!!fault-fresh :ud :evex-prefixes evex-prefixes :rex rex-byte)) ((when (equal (the (unsigned-byte 8) (prefixes->lck prefixes)) 240)) (!!fault-fresh :ud :evex-prefixes evex-prefixes :lock-prefix)) ((when (equal (the (unsigned-byte 8) (prefixes->rep prefixes)) 242)) (!!fault-fresh :ud :evex-prefixes evex-prefixes :f2-prefix)) ((when (equal (the (unsigned-byte 8) (prefixes->rep prefixes)) 243)) (!!fault-fresh :ud :evex-prefixes evex-prefixes :f3-prefix)) ((when (equal (the (unsigned-byte 8) (prefixes->opr prefixes)) 102)) (!!fault-fresh :ud :evex-prefixes evex-prefixes :66-prefix)) (evex-byte1 (evex-prefixes->byte1 evex-prefixes)) ((when (not (equal (evex-byte1->res evex-byte1) 0))) (!!fault-fresh :ud :evex-prefixes evex-prefixes :byte1-reserved-bits)) ((mv evex-0f-map? evex-0f38-map? evex-0f3a-map?) (mv (equal (evex-byte1->mmm evex-byte1) 1) (equal (evex-byte1->mmm evex-byte1) 2) (equal (evex-byte1->mmm evex-byte1) 3))) ((when (not (or evex-0f-map? evex-0f38-map? evex-0f3a-map?))) (!!fault-fresh :ud :evex-prefixes evex-prefixes :mm evex-byte1)) ((mv flg0 (the (unsigned-byte 8) evex-byte2) x86) (rme08 proc-mode temp-rip 1 :x x86)) ((when flg0) (!!ms-fresh :evex-byte2-read-error flg0)) ((mv flg1 temp-rip) (add-to-*ip proc-mode temp-rip 1 x86)) ((when flg1) (!!ms-fresh :increment-error flg1)) (evex-prefixes (!evex-prefixes->byte2 evex-byte2 evex-prefixes)) ((when (not (equal (evex-byte2->res evex-byte2) 1))) (!!fault-fresh :ud :evex-prefixes evex-prefixes :byte2-reserved-bit)) ((mv flg2 (the (unsigned-byte 8) evex-byte3) x86) (rme08 proc-mode temp-rip 1 :x x86)) ((when flg2) (!!ms-fresh :evex-byte3-read-error flg2)) ((mv flg3 temp-rip) (add-to-*ip proc-mode temp-rip 1 x86)) ((when flg3) (!!ms-fresh :increment-error flg3)) ((mv flg4 (the (unsigned-byte 8) opcode) x86) (rme08 proc-mode temp-rip 1 :x x86)) ((when flg4) (!!ms-fresh :opcode-read-error flg4)) ((mv flg5 temp-rip) (add-to-*ip proc-mode temp-rip 1 x86)) ((when flg5) (!!ms-fresh :increment-error flg5)) ((mv flg6 (the (unsigned-byte 8) modr/m) x86) (rme08 proc-mode temp-rip 1 :x x86)) ((when flg6) (!!ms-fresh :modr/m-byte-read-error flg6)) ((mv flg7 temp-rip) (add-to-*ip proc-mode temp-rip 1 x86)) ((when flg7) (!!ms-fresh :increment-error flg7)) (sib? (b* ((p4? (eql 103 (the (unsigned-byte 8) (prefixes->adr prefixes)))) (16-bit-addressp (eql 2 (select-address-size proc-mode p4? x86)))) (x86-decode-sib-p modr/m 16-bit-addressp))) ((mv flg8 (the (unsigned-byte 8) sib) x86) (if sib? (rme08 proc-mode temp-rip 1 :x x86) (mv nil 0 x86))) ((when flg8) (!!ms-fresh :sib-byte-read-error flg8)) ((mv flg9 temp-rip) (if sib? (add-to-*ip proc-mode temp-rip 1 x86) (mv nil temp-rip))) ((when flg9) (!!ms-fresh :increment-error flg9))) (cond (evex-0f-map? (evex-0f-execute proc-mode start-rip temp-rip prefixes rex-byte evex-prefixes opcode modr/m sib x86)) (evex-0f38-map? (evex-0f38-execute proc-mode start-rip temp-rip prefixes rex-byte evex-prefixes opcode modr/m sib x86)) (evex-0f3a-map? (evex-0f3a-execute proc-mode start-rip temp-rip prefixes rex-byte evex-prefixes opcode modr/m sib x86)) (t (!!ms-fresh :illegal-value-of-evex-mm))))))
Theorem:
(defthm x86p-evex-decode-and-execute (implies (x86p x86) (x86p (evex-decode-and-execute proc-mode start-rip temp-rip prefixes rex-byte evex-prefixes x86))))