[PATCH 3/3] KVM: x86 emulator: Remove unnecessary goto statements from x86_emulate_insn()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch is the last part of a work which tries to split
x86_emulate_insn() into a few meaningful functions: removes unnecessary
goto statements based on the former two patches.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@xxxxxxxxxxxxx>
---
 arch/x86/kvm/emulate.c |   18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 7aa93df..b5fefcb 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3632,8 +3632,7 @@ cannot_emulate:
 	return X86EMUL_UNHANDLEABLE;
 }
 
-int
-x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
+int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
 {
 	struct x86_emulate_ops *ops = ctxt->ops;
 	struct decode_cache *c = &ctxt->decode;
@@ -3711,9 +3710,10 @@ special_insn:
 	}
 
 	if (c->twobyte)
-		goto twobyte_insn;
+		rc = emulate_twobyte_insn(ctxt, ops, c, &need_writeback);
+	else
+		rc = emulate_onebyte_insn(ctxt, ops, c, &need_writeback);
 
-	rc = emulate_onebyte_insn(ctxt, ops, c, &need_writeback);
 	if (!need_writeback)
 		goto done;
 
@@ -3765,14 +3765,4 @@ done:
 	if (rc == X86EMUL_PROPAGATE_FAULT)
 		ctxt->have_exception = true;
 	return (rc == X86EMUL_UNHANDLEABLE) ? EMULATION_FAILED : EMULATION_OK;
-
-twobyte_insn:
-	rc = emulate_twobyte_insn(ctxt, ops, c, &need_writeback);
-	if (!need_writeback)
-		goto done;
-
-	goto writeback;
-
-cannot_emulate:
-	return -1;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux