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

Commit 07cbc6c1 authored by Wei Yongjun's avatar Wei Yongjun Committed by Avi Kivity
Browse files

KVM: x86 emulator: fix cli/sti instruction emulation



If IOPL check fail, the cli/sti emulate GP and then we should
skip writeback since the default write OP is OP_REG.

Signed-off-by: default avatarWei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent b16b2b7b
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2979,17 +2979,19 @@ special_insn:
		c->dst.type = OP_NONE;	/* Disable writeback. */
		break;
	case 0xfa: /* cli */
		if (emulator_bad_iopl(ctxt, ops))
		if (emulator_bad_iopl(ctxt, ops)) {
			emulate_gp(ctxt, 0);
		else {
			goto done;
		} else {
			ctxt->eflags &= ~X86_EFLAGS_IF;
			c->dst.type = OP_NONE;	/* Disable writeback. */
		}
		break;
	case 0xfb: /* sti */
		if (emulator_bad_iopl(ctxt, ops))
		if (emulator_bad_iopl(ctxt, ops)) {
			emulate_gp(ctxt, 0);
		else {
			goto done;
		} else {
			ctxt->interruptibility = KVM_X86_SHADOW_INT_STI;
			ctxt->eflags |= X86_EFLAGS_IF;
			c->dst.type = OP_NONE;	/* Disable writeback. */