diff mbox

KVM: x86 emulator: cleanup and tiny fix of pio emulation

Message ID 20100301225053.0c9669c1.yoshikawa.takuya@oss.ntt.co.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takuya Yoshikawa March 1, 2010, 1:50 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 5b6794a..a27cc3d 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2344,19 +2344,16 @@  special_insn:
 	case 0xef: /* out (e/r)ax,dx */
 		port = c->regs[VCPU_REGS_RDX];
 		io_dir_in = 0;
-	do_io:
-		if (!emulator_io_permited(ctxt, ops, port,
-					  (c->d & ByteOp) ? 1 : c->op_bytes)) {
+	do_io: {
+		int len = (c->d & ByteOp) ? 1 : c->op_bytes;
+		if (!emulator_io_permited(ctxt, ops, port, len)) {
 			kvm_inject_gp(ctxt->vcpu, 0);
 			goto done;
 		}
-		if (kvm_emulate_pio(ctxt->vcpu, io_dir_in,
-				   (c->d & ByteOp) ? 1 : c->op_bytes,
-				   port) != 0) {
-			c->eip = saved_eip;
+		if (kvm_emulate_pio(ctxt->vcpu, io_dir_in, len, port))
 			goto cannot_emulate;
-		}
 		break;
+	}
 	case 0xf4:              /* hlt */
 		ctxt->vcpu->arch.halt_request = 1;
 		break;