Skip to contentSkip to conversation

KVM: x86 emulator: fix handling for unemulated instructions

PATCH Applied Avi Kivity 2 participants 2 messages Jul 25, 2010 – Jul 28, 2010

Subsystems (3)
lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 KVM: x86 emulator: fix handling for unemulated instructions

If an instruction is present in the decode tables but not in the execution switch, it will be emulated as a NOP. An example is IRET (0xcf).

Fix by adding default: labels to the execution switches.

---
 arch/x86/kvm/emulate.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/x86/kvm/emulate.c +4 -0
index b38bd8b..a12512d 100644
@@ -3029,6 +3029,8 @@ special_insn:
 		if (c->modrm_reg == 5)
 			goto jump_far;
 		goto grp45;
+	default:
+		goto cannot_emulate;
 	}
 
 writeback:
@@ -3354,6 +3356,8 @@ twobyte_insn:
 		if (rc != X86EMUL_CONTINUE)
 			goto done;
 		break;
+	default:
+		goto cannot_emulate;
 	}
 	goto writeback;
 
Signature · 1 line
1.7.1
#1 lore raw
Quoted 9 lines · Avi Kivity

If an instruction is present in the decode tables but not in the execution switch, it will be emulated as a NOP. An example is IRET (0xcf).

Fix by adding default: labels to the execution switches.

---
 arch/x86/kvm/emulate.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Applied, thanks.