Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab8557b2 authored by Gleb Natapov's avatar Gleb Natapov Committed by Avi Kivity
Browse files

KVM: x86 emulator: 0f (20|21|22|23) ignore mod bits.



Resent spec says that for 0f (20|21|22|23) the 2 bits in the mod field
are ignored. Interestingly enough older spec says that 11 is only valid
encoding.

Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 6e1e5ffe
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -2520,28 +2520,20 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
		c->dst.type = OP_NONE;
		c->dst.type = OP_NONE;
		break;
		break;
	case 0x20: /* mov cr, reg */
	case 0x20: /* mov cr, reg */
		if (c->modrm_mod != 3)
			goto cannot_emulate;
		c->regs[c->modrm_rm] = ops->get_cr(c->modrm_reg, ctxt->vcpu);
		c->regs[c->modrm_rm] = ops->get_cr(c->modrm_reg, ctxt->vcpu);
		c->dst.type = OP_NONE;	/* no writeback */
		c->dst.type = OP_NONE;	/* no writeback */
		break;
		break;
	case 0x21: /* mov from dr to reg */
	case 0x21: /* mov from dr to reg */
		if (c->modrm_mod != 3)
			goto cannot_emulate;
		if (emulator_get_dr(ctxt, c->modrm_reg, &c->regs[c->modrm_rm]))
		if (emulator_get_dr(ctxt, c->modrm_reg, &c->regs[c->modrm_rm]))
			goto cannot_emulate;
			goto cannot_emulate;
		rc = X86EMUL_CONTINUE;
		rc = X86EMUL_CONTINUE;
		c->dst.type = OP_NONE;	/* no writeback */
		c->dst.type = OP_NONE;	/* no writeback */
		break;
		break;
	case 0x22: /* mov reg, cr */
	case 0x22: /* mov reg, cr */
		if (c->modrm_mod != 3)
			goto cannot_emulate;
		ops->set_cr(c->modrm_reg, c->modrm_val, ctxt->vcpu);
		ops->set_cr(c->modrm_reg, c->modrm_val, ctxt->vcpu);
		c->dst.type = OP_NONE;
		c->dst.type = OP_NONE;
		break;
		break;
	case 0x23: /* mov from reg to dr */
	case 0x23: /* mov from reg to dr */
		if (c->modrm_mod != 3)
			goto cannot_emulate;
		if (emulator_set_dr(ctxt, c->modrm_reg, c->regs[c->modrm_rm]))
		if (emulator_set_dr(ctxt, c->modrm_reg, c->regs[c->modrm_rm]))
			goto cannot_emulate;
			goto cannot_emulate;
		rc = X86EMUL_CONTINUE;
		rc = X86EMUL_CONTINUE;