Effective address calculation.
(x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86) → (mv flg i64p-memory-address increment-rip-by x86)
This is a wrapper that calls x86-effective-addr-16 or x86-effective-addr-32/64 based on the address size.
Function:
(defun x86-effective-addr (proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86) (declare (xargs :stobjs (x86))) (declare (type (integer 0 4) proc-mode) (type (signed-byte 48) temp-rip) (type (unsigned-byte 8) rex-byte) (type (unsigned-byte 3) r/m) (type (unsigned-byte 2) mod) (type (unsigned-byte 8) sib) (type (unsigned-byte 3) num-imm-bytes)) (declare (xargs :guard (and (2bits-p mod) (3bits-p r/m) (sib-p sib)))) (let ((__function__ 'x86-effective-addr)) (declare (ignorable __function__)) (if (eql 2 (select-address-size proc-mode (if p4 t nil) x86)) (x86-effective-addr-16 proc-mode temp-rip r/m mod x86) (x86-effective-addr-32/64 proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86))))
Theorem:
(defthm x86p-of-x86-effective-addr.x86 (implies (force (x86p x86)) (b* (((mv ?flg ?i64p-memory-address ?increment-rip-by ?x86) (x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86))) (x86p x86))) :rule-classes :rewrite)
Theorem:
(defthm i64p-mv-nth-1-x86-effective-addr (signed-byte-p 64 (mv-nth 1 (x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86))) :rule-classes (:rewrite (:type-prescription :corollary (integerp (mv-nth 1 (x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86))) :hints (("Goal" :in-theory '(signed-byte-p integer-range-p)))) (:linear :corollary (and (<= -9223372036854775808 (mv-nth 1 (x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86))) (< (mv-nth 1 (x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86)) 9223372036854775808)) :hints (("Goal" :in-theory '(signed-byte-p integer-range-p (:e expt)))))))
Theorem:
(defthm natp-mv-nth-2-x86-effective-addr (natp (mv-nth 2 (x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86))) :rule-classes :type-prescription)
Theorem:
(defthm mv-nth-2-x86-effective-addr-<=-4 (<= (mv-nth 2 (x86-effective-addr proc-mode p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86)) 4) :rule-classes :linear)
Theorem:
(defthm x86-effective-addr-when-64-bit-modep (equal (x86-effective-addr 0 p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86) (x86-effective-addr-32/64 0 p4 temp-rip rex-byte r/m mod sib num-imm-bytes x86)))