Skip to contentSkip to conversation

KVM: X86: Avoid explictly fetch instruction in x86_decode_insn()

PATCH New Peter Xu 1 participant 1 message Mar 4, 2020

Subsystems (3)
lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 KVM: X86: Avoid explictly fetch instruction in x86_decode_insn()

insn_fetch() will always implicitly refill instruction buffer properly when the buffer is empty, so we don't need to explicitly fetch it even if insn_len==0 for x86_decode_insn().

---
 arch/x86/kvm/emulate.c | 5 -----
 1 file changed, 5 deletions(-)
arch/x86/kvm/emulate.c +0 -5
index dd19fb3539e0..04f33c1ca926 100644
@@ -5175,11 +5175,6 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
 	ctxt->opcode_len = 1;
 	if (insn_len > 0)
 		memcpy(ctxt->fetch.data, insn, insn_len);
-	else {
-		rc = __do_insn_fetch_bytes(ctxt, 1);
-		if (rc != X86EMUL_CONTINUE)
-			goto done;
-	}
 
 	switch (mode) {
 	case X86EMUL_MODE_REAL:
Signature · 1 line
2.24.1