diff options
Diffstat (limited to 'arch/x86/kvm/x86_emulate.c')
-rw-r--r-- | arch/x86/kvm/x86_emulate.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 3721cfddc97..ca7ab2469a4 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c | |||
@@ -748,24 +748,12 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, | |||
748 | base_reg |= sib & 7; | 748 | base_reg |= sib & 7; |
749 | scale = sib >> 6; | 749 | scale = sib >> 6; |
750 | 750 | ||
751 | switch (base_reg) { | 751 | if ((base_reg & 7) == 5 && c->modrm_mod == 0) |
752 | case 5: | 752 | c->modrm_ea += insn_fetch(s32, 4, c->eip); |
753 | case 13: | 753 | else |
754 | if (c->modrm_mod != 0) | ||
755 | c->modrm_ea += c->regs[base_reg]; | ||
756 | else | ||
757 | c->modrm_ea += | ||
758 | insn_fetch(s32, 4, c->eip); | ||
759 | break; | ||
760 | default: | ||
761 | c->modrm_ea += c->regs[base_reg]; | 754 | c->modrm_ea += c->regs[base_reg]; |
762 | } | 755 | if (index_reg != 4) |
763 | switch (index_reg) { | ||
764 | case 4: | ||
765 | break; | ||
766 | default: | ||
767 | c->modrm_ea += c->regs[index_reg] << scale; | 756 | c->modrm_ea += c->regs[index_reg] << scale; |
768 | } | ||
769 | break; | 757 | break; |
770 | case 5: | 758 | case 5: |
771 | case 13: | 759 | case 13: |