Write an operand to memory or a general-purpose register.
(x86-operand-to-reg/mem proc-mode operand-size inst-ac? memory-ptr? operand seg-reg addr rex-byte r/m mod x86) → (mv * x86)
Based on the ModR/M byte, the operand is written to either a register or memory. The address argument of this function is often the effective address calculated and returned by x86-operand-from-modr/m-and-sib-bytes.
Function:
(defun x86-operand-to-reg/mem (proc-mode operand-size inst-ac? memory-ptr? operand seg-reg addr rex-byte r/m mod x86) (declare (xargs :stobjs (x86))) (declare (type (integer 0 4) proc-mode) (type (member 1 2 4 6 8 10 16) operand-size) (type (integer 0 *) operand) (type (signed-byte 64) addr) (type (unsigned-byte 8) rex-byte) (type (unsigned-byte 3) r/m) (type (unsigned-byte 2) mod)) (declare (xargs :guard (and (booleanp inst-ac?) (booleanp memory-ptr?) (integer-range-p 0 *segment-register-names-len* seg-reg)))) (declare (xargs :guard (and (unsigned-byte-p (ash operand-size 3) operand) (if (equal mod 3) (member operand-size '(member 1 2 4 8)) (member operand-size '(member 1 2 4 6 8 10 16)))))) (let ((__function__ 'x86-operand-to-reg/mem)) (declare (ignorable __function__)) (b* (((when (equal mod 3)) (let* ((x86 (!rgfi-size operand-size (reg-index r/m rex-byte 0) operand rex-byte x86))) (mv nil x86))) (check-alignment? (and inst-ac? (alignment-checking-enabled-p x86))) ((mv flg x86) (wme-size proc-mode operand-size addr seg-reg operand check-alignment? x86 :mem-ptr? memory-ptr?))) (mv flg x86))))
Theorem:
(defthm x86p-x86-operand-to-reg/mem (implies (force (x86p x86)) (x86p (mv-nth 1 (x86-operand-to-reg/mem proc-mode operand-size inst-ac? memory-ptr? operand addr seg-reg rex-byte r/m mod x86)))))