Functions to detect and decode ModR/M bytes
Function:
(defun 64-bit-mode-one-byte-opcode-modr/m-p$inline (opcode) (declare (type (unsigned-byte 8) opcode)) (aref1 '64-bit-mode-one-byte-has-modr/m *64-bit-mode-one-byte-has-modr/m-ar* opcode))
Theorem:
(defthm booleanp-of-64-bit-mode-one-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (64-bit-mode-one-byte-opcode-modr/m-p$inline opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun 32-bit-mode-one-byte-opcode-modr/m-p$inline (opcode) (declare (type (unsigned-byte 8) opcode)) (aref1 '32-bit-mode-one-byte-has-modr/m *32-bit-mode-one-byte-has-modr/m-ar* opcode))
Theorem:
(defthm booleanp-of-32-bit-mode-one-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (32-bit-mode-one-byte-opcode-modr/m-p$inline opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun one-byte-opcode-modr/m-p$inline (proc-mode opcode) (declare (type (integer 0 4) proc-mode) (type (unsigned-byte 8) opcode)) (if (equal proc-mode 0) (64-bit-mode-one-byte-opcode-modr/m-p opcode) (32-bit-mode-one-byte-opcode-modr/m-p opcode)))
Theorem:
(defthm booleanp-of-one-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (one-byte-opcode-modr/m-p$inline proc-mode opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun 64-bit-mode-two-byte-opcode-modr/m-p (mandatory-prefix opcode) (declare (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) opcode)) (let ((__function__ '64-bit-mode-two-byte-opcode-modr/m-p)) (declare (ignorable __function__)) (case mandatory-prefix (102 (aref1 '64-bit-mode-two-byte-66-has-modr/m *64-bit-mode-two-byte-66-has-modr/m-ar* opcode)) (243 (aref1 '64-bit-mode-two-byte-f3-has-modr/m *64-bit-mode-two-byte-f3-has-modr/m-ar* opcode)) (242 (aref1 '64-bit-mode-two-byte-f2-has-modr/m *64-bit-mode-two-byte-f2-has-modr/m-ar* opcode)) (t (aref1 '64-bit-mode-two-byte-no-prefix-has-modr/m *64-bit-mode-two-byte-no-prefix-has-modr/m-ar* opcode)))))
Theorem:
(defthm booleanp-of-64-bit-mode-two-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (64-bit-mode-two-byte-opcode-modr/m-p mandatory-prefix opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun 32-bit-mode-two-byte-opcode-modr/m-p (mandatory-prefix opcode) (declare (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) opcode)) (let ((__function__ '32-bit-mode-two-byte-opcode-modr/m-p)) (declare (ignorable __function__)) (case mandatory-prefix (102 (aref1 '32-bit-mode-two-byte-66-has-modr/m *32-bit-mode-two-byte-66-has-modr/m-ar* opcode)) (243 (aref1 '32-bit-mode-two-byte-f3-has-modr/m *32-bit-mode-two-byte-f3-has-modr/m-ar* opcode)) (242 (aref1 '32-bit-mode-two-byte-f2-has-modr/m *32-bit-mode-two-byte-f2-has-modr/m-ar* opcode)) (t (aref1 '32-bit-mode-two-byte-no-prefix-has-modr/m *32-bit-mode-two-byte-no-prefix-has-modr/m-ar* opcode)))))
Theorem:
(defthm booleanp-of-32-bit-mode-two-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (32-bit-mode-two-byte-opcode-modr/m-p mandatory-prefix opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun two-byte-opcode-modr/m-p$inline (proc-mode mandatory-prefix opcode) (declare (type (integer 0 4) proc-mode) (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) opcode)) (cond ((equal proc-mode 0) (64-bit-mode-two-byte-opcode-modr/m-p mandatory-prefix opcode)) (t (32-bit-mode-two-byte-opcode-modr/m-p mandatory-prefix opcode))))
Theorem:
(defthm booleanp-of-two-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (two-byte-opcode-modr/m-p$inline proc-mode mandatory-prefix opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun 64-bit-mode-0f-38-three-byte-opcode-modr/m-p (mandatory-prefix opcode) (declare (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) opcode)) (let ((__function__ '64-bit-mode-0f-38-three-byte-opcode-modr/m-p)) (declare (ignorable __function__)) (case mandatory-prefix (102 (aref1 '64-bit-mode-0f-38-three-byte-66-has-modr/m *64-bit-mode-0f-38-three-byte-66-has-modr/m-ar* opcode)) (243 (aref1 '64-bit-mode-0f-38-three-byte-f3-has-modr/m *64-bit-mode-0f-38-three-byte-f3-has-modr/m-ar* opcode)) (242 (aref1 '64-bit-mode-0f-38-three-byte-f2-has-modr/m *64-bit-mode-0f-38-three-byte-f2-has-modr/m-ar* opcode)) (t (aref1 '64-bit-mode-0f-38-three-byte-no-prefix-has-modr/m *64-bit-mode-0f-38-three-byte-no-prefix-has-modr/m-ar* opcode)))))
Theorem:
(defthm booleanp-of-64-bit-mode-0f-38-three-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (64-bit-mode-0f-38-three-byte-opcode-modr/m-p mandatory-prefix opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun 32-bit-mode-0f-38-three-byte-opcode-modr/m-p (mandatory-prefix opcode) (declare (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) opcode)) (let ((__function__ '32-bit-mode-0f-38-three-byte-opcode-modr/m-p)) (declare (ignorable __function__)) (case mandatory-prefix (102 (aref1 '32-bit-mode-0f-38-three-byte-66-has-modr/m *32-bit-mode-0f-38-three-byte-66-has-modr/m-ar* opcode)) (243 (aref1 '32-bit-mode-0f-38-three-byte-f3-has-modr/m *32-bit-mode-0f-38-three-byte-f3-has-modr/m-ar* opcode)) (242 (aref1 '32-bit-mode-0f-38-three-byte-f2-has-modr/m *32-bit-mode-0f-38-three-byte-f2-has-modr/m-ar* opcode)) (t (aref1 '32-bit-mode-0f-38-three-byte-no-prefix-has-modr/m *32-bit-mode-0f-38-three-byte-no-prefix-has-modr/m-ar* opcode)))))
Theorem:
(defthm booleanp-of-32-bit-mode-0f-38-three-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (32-bit-mode-0f-38-three-byte-opcode-modr/m-p mandatory-prefix opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun 64-bit-mode-0f-3a-three-byte-opcode-modr/m-p (mandatory-prefix opcode) (declare (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) opcode)) (let ((__function__ '64-bit-mode-0f-3a-three-byte-opcode-modr/m-p)) (declare (ignorable __function__)) (case mandatory-prefix (102 (aref1 '64-bit-mode-0f-3a-three-byte-66-has-modr/m *64-bit-mode-0f-3a-three-byte-66-has-modr/m-ar* opcode)) (243 (aref1 '64-bit-mode-0f-3a-three-byte-f3-has-modr/m *64-bit-mode-0f-3a-three-byte-f3-has-modr/m-ar* opcode)) (242 (aref1 '64-bit-mode-0f-3a-three-byte-f2-has-modr/m *64-bit-mode-0f-3a-three-byte-f2-has-modr/m-ar* opcode)) (t (aref1 '64-bit-mode-0f-3a-three-byte-no-prefix-has-modr/m *64-bit-mode-0f-3a-three-byte-no-prefix-has-modr/m-ar* opcode)))))
Theorem:
(defthm booleanp-of-64-bit-mode-0f-3a-three-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (64-bit-mode-0f-3a-three-byte-opcode-modr/m-p mandatory-prefix opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun 32-bit-mode-0f-3a-three-byte-opcode-modr/m-p (mandatory-prefix opcode) (declare (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) opcode)) (let ((__function__ '32-bit-mode-0f-3a-three-byte-opcode-modr/m-p)) (declare (ignorable __function__)) (case mandatory-prefix (102 (aref1 '32-bit-mode-0f-3a-three-byte-66-has-modr/m *32-bit-mode-0f-3a-three-byte-66-has-modr/m-ar* opcode)) (243 (aref1 '32-bit-mode-0f-3a-three-byte-f3-has-modr/m *32-bit-mode-0f-3a-three-byte-f3-has-modr/m-ar* opcode)) (242 (aref1 '32-bit-mode-0f-3a-three-byte-f2-has-modr/m *32-bit-mode-0f-3a-three-byte-f2-has-modr/m-ar* opcode)) (t (aref1 '32-bit-mode-0f-3a-three-byte-no-prefix-has-modr/m *32-bit-mode-0f-3a-three-byte-no-prefix-has-modr/m-ar* opcode)))))
Theorem:
(defthm booleanp-of-32-bit-mode-0f-3a-three-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (32-bit-mode-0f-3a-three-byte-opcode-modr/m-p mandatory-prefix opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun three-byte-opcode-modr/m-p$inline (proc-mode mandatory-prefix escape-byte opcode) (declare (type (integer 0 4) proc-mode) (type (unsigned-byte 8) mandatory-prefix) (type (unsigned-byte 8) escape-byte) (type (unsigned-byte 8) opcode)) (declare (xargs :guard (or (equal escape-byte 56) (equal escape-byte 58)))) (cond ((equal escape-byte 56) (if (equal proc-mode 0) (64-bit-mode-0f-38-three-byte-opcode-modr/m-p mandatory-prefix opcode) (32-bit-mode-0f-38-three-byte-opcode-modr/m-p mandatory-prefix opcode))) (t (if (equal proc-mode 0) (64-bit-mode-0f-3a-three-byte-opcode-modr/m-p mandatory-prefix opcode) (32-bit-mode-0f-3a-three-byte-opcode-modr/m-p mandatory-prefix opcode)))))
Theorem:
(defthm booleanp-of-three-byte-opcode-modr/m-p (implies (n08p opcode) (b* ((bool (three-byte-opcode-modr/m-p$inline proc-mode mandatory-prefix escape-byte opcode))) (booleanp bool))) :rule-classes :rewrite)
Function:
(defun show-no-modr/m-insts (inst-lst) (declare (xargs :guard (inst-list-p inst-lst))) (let ((__function__ 'show-no-modr/m-insts)) (declare (ignorable __function__)) (b* (((when (endp inst-lst)) nil) (inst (car inst-lst)) (rest (show-no-modr/m-insts (cdr inst-lst)))) (if (inst-needs-modr/m-p inst) rest (cons inst rest)))))
Theorem:
(defthm inst-list-p-of-show-no-modr/m-insts (implies (inst-list-p inst-lst) (b* ((no-modr/m-insts (show-no-modr/m-insts inst-lst))) (inst-list-p no-modr/m-insts))) :rule-classes :rewrite)
Function:
(defun vex-opcode-modr/m-p$inline (vex-prefixes opcode) (declare (type (unsigned-byte 24) vex-prefixes) (type (unsigned-byte 8) opcode)) (declare (xargs :guard (vex-prefixes-byte0-p vex-prefixes))) (if (not (equal opcode 119)) t (not (vex-prefixes-map-p 15 vex-prefixes))))
Theorem:
(defthm booleanp-of-vex-opcode-modr/m-p (b* ((bool (vex-opcode-modr/m-p$inline vex-prefixes opcode))) (booleanp bool)) :rule-classes :rewrite)