Check if the length of an instruction exceeds 15 bytes.
(check-instruction-length start-rip temp-rip delta-rip) → badlength?
The maximum length of an instruction is 15 bytes; a longer instruction causes a #GP(0) exception. See AMD manual, Dec'17, Volume 2, Table 8-6. This function is used to check this condition.
The
This function returns
Function:
(defun check-instruction-length$inline (start-rip temp-rip delta-rip) (declare (type (signed-byte 48) start-rip) (type (signed-byte 48) temp-rip) (type (unsigned-byte 3) delta-rip)) (b* ((start-rip (mbe :logic (ifix start-rip) :exec start-rip)) (temp-rip (mbe :logic (ifix temp-rip) :exec temp-rip)) (delta-rip (mbe :logic (nfix delta-rip) :exec delta-rip)) ((the (signed-byte 49) end-rip) (+ (the (signed-byte 48) temp-rip) (the (unsigned-byte 3) delta-rip))) ((the (signed-byte 50) length) (- (the (signed-byte 49) end-rip) (the (signed-byte 48) start-rip)))) (and (> length 15) length)))
Theorem:
(defthm maybe-natp-of-check-instruction-length (b* ((badlength? (check-instruction-length$inline start-rip temp-rip delta-rip))) (acl2::maybe-natp badlength?)) :rule-classes :rewrite)