(x86-iret proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib x86) → x86
Function:
(defun x86-iret (proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib 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 8) opcode) (type (unsigned-byte 8) modr/m) (type (unsigned-byte 8) sib)) (declare (ignorable proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib)) (declare (xargs :guard (and (prefixes-p prefixes) (modr/m-p modr/m) (sib-p sib) (rip-guard-okp proc-mode temp-rip)))) (let ((__function__ 'x86-iret)) (declare (ignorable __function__)) (b* ((?ctx 'x86-iret)) (b* (((unless (equal proc-mode *64-bit-mode*)) (!!ms-fresh :iret-not-supported)) ((the (integer 2 8) operand-size) (select-operand-size proc-mode nil rex-byte nil prefixes t t nil x86)) ((unless (equal operand-size 8)) (!!ms-fresh :iret-unsupported-operand-size operand-size)) (rsp (read-*sp proc-mode x86)) ((mv flg new-cs-addr) (add-to-*sp proc-mode rsp 8 x86)) ((when flg) (!!fault-fresh :ss 0 :call flg)) ((mv flg new-rflags-addr) (add-to-*sp proc-mode rsp 16 x86)) ((when flg) (!!fault-fresh :ss 0 :call flg)) ((mv flg new-rsp-addr) (add-to-*sp proc-mode rsp 24 x86)) ((when flg) (!!fault-fresh :ss 0 :call flg)) ((mv flg new-ss-addr) (add-to-*sp proc-mode rsp 32 x86)) ((when flg) (!!fault-fresh :ss 0 :call flg)) (check-alignment? (alignment-checking-enabled-p x86)) ((mv flg new-rip x86) (rime64 proc-mode rsp 2 :r check-alignment? x86)) ((when flg) (!!ms-fresh :rme64 flg)) ((mv flg new-cs x86) (rme16 proc-mode new-cs-addr 2 :r check-alignment? x86)) ((when flg) (!!ms-fresh :rme16 flg)) ((mv flg new-rflags x86) (rme64 proc-mode new-rflags-addr 2 :r check-alignment? x86)) (new-rflags (loghead 32 new-rflags)) ((when flg) (!!ms-fresh :rme64 flg)) ((mv flg new-rsp x86) (rime64 proc-mode new-rsp-addr 2 :r check-alignment? x86)) ((when flg) (!!ms-fresh :rime64 flg)) ((mv flg new-ss x86) (rme16 proc-mode new-ss-addr 2 :r check-alignment? x86)) ((when flg) (!!ms-fresh :rme16 flg)) ((unless (canonical-address-p new-rip)) (!!fault-fresh :gp 0 :non-canonical-iret-rip new-rip)) ((when (equal new-cs 0)) (!!fault-fresh :gp new-cs :null-iret-cs new-cs)) ((mv flg cs-descriptor x86) (get-segment-descriptor 1 new-cs x86)) ((when flg) (if (equal flg t) (!!ms-fresh :get-system-segment-descriptor) (!!fault-fresh (car flg) (cadr flg) (caddr flg)))) ((mv flg ss-descriptor x86) (get-segment-descriptor 2 new-ss x86)) ((when flg) (if (equal flg t) (!!ms-fresh :get-system-segment-descriptor) (!!fault-fresh (car flg) (cadr flg) (caddr flg)))) (x86 (!rflags new-rflags x86)) (x86 (load-segment-reg *ss* new-ss ss-descriptor x86)) (x86 (load-segment-reg *cs* new-cs cs-descriptor x86)) (x86 (write-*ip proc-mode new-rip x86)) (x86 (write-*sp proc-mode new-rsp x86))) x86))))
Theorem:
(defthm x86p-of-x86-iret (implies (x86p x86) (b* ((x86 (x86-iret proc-mode start-rip temp-rip prefixes rex-byte opcode modr/m sib x86))) (x86p x86))) :rule-classes :rewrite)