Commit dc71d0f1 authored by Avi Kivity's avatar Avi Kivity

KVM: x86 emulator: simplify sib decoding

Instead of using sparse switches, use simpler if/else sequences.
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 8684c0af
...@@ -748,24 +748,12 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, ...@@ -748,24 +748,12 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt,
base_reg |= sib & 7; base_reg |= sib & 7;
scale = sib >> 6; scale = sib >> 6;
switch (base_reg) { if ((base_reg & 7) == 5 && c->modrm_mod == 0)
case 5: c->modrm_ea += insn_fetch(s32, 4, c->eip);
case 13: else
if (c->modrm_mod != 0)
c->modrm_ea += c->regs[base_reg];
else
c->modrm_ea +=
insn_fetch(s32, 4, c->eip);
break;
default:
c->modrm_ea += c->regs[base_reg]; c->modrm_ea += c->regs[base_reg];
} if (index_reg != 4)
switch (index_reg) {
case 4:
break;
default:
c->modrm_ea += c->regs[index_reg] << scale; c->modrm_ea += c->regs[index_reg] << scale;
}
break; break;
case 5: case 5:
case 13: case 13:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment