x86/emul: Adjust handling of CR8_LEGACY

The APM description of the AltMovCR8 feature bit is:

  "LOCK MOV CR0 means MOV CR8"

Adjust the decode logic to behave like this.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
master commit: 7d48ef45b6
master date: 2026-07-10 19:35:49 +0100
This commit is contained in:
Andrew Cooper authored and Jan Beulich committed 2026-08-24 11:46:32 +02:00
1 parent 76bc053ba1
commit 739dd1b824
1 file changed
+3 -3
+3 -3
View File
@@ -780,12 +780,12 @@ decode_twobyte(struct x86_emulate_state *s,
break;
case 0x20: case 0x22: /* mov to/from cr */
if ( s->lock_prefix && vcpu_has_cr8_legacy() )
if ( s->lock_prefix && vcpu_has_cr8_legacy() && s->modrm_reg == 0 )
{
s->modrm_reg += 8;
s->modrm_reg = 8;
s->lock_prefix = false;
}
/* fall through */
fallthrough;
case 0x21: case 0x23: /* mov to/from dr */
ASSERT(s->ea.type == OP_REG); /* Early operand adjustment ensures this. */
generate_exception_if(s->lock_prefix, X86_EXC_UD);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.