KVM: x86 emulator: Clean up INT n/INTO/INT 3(CC/CD/CE)
Call emulate_int() directly to avoid spaghetti goto's. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
1bd5f469b2
commit
5c5df76b8b
|
@ -3769,7 +3769,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
|
||||||
struct decode_cache *c = &ctxt->decode;
|
struct decode_cache *c = &ctxt->decode;
|
||||||
int rc = X86EMUL_CONTINUE;
|
int rc = X86EMUL_CONTINUE;
|
||||||
int saved_dst_type = c->dst.type;
|
int saved_dst_type = c->dst.type;
|
||||||
int irq; /* Used for int 3, int, and into */
|
|
||||||
|
|
||||||
c->mem_read.pos = 0;
|
c->mem_read.pos = 0;
|
||||||
|
|
||||||
|
@ -3963,18 +3962,14 @@ special_insn:
|
||||||
rc = emulate_load_segment(ctxt, VCPU_SREG_DS);
|
rc = emulate_load_segment(ctxt, VCPU_SREG_DS);
|
||||||
break;
|
break;
|
||||||
case 0xcc: /* int3 */
|
case 0xcc: /* int3 */
|
||||||
irq = 3;
|
rc = emulate_int(ctxt, 3);
|
||||||
goto do_interrupt;
|
break;
|
||||||
case 0xcd: /* int n */
|
case 0xcd: /* int n */
|
||||||
irq = c->src.val;
|
rc = emulate_int(ctxt, c->src.val);
|
||||||
do_interrupt:
|
|
||||||
rc = emulate_int(ctxt, irq);
|
|
||||||
break;
|
break;
|
||||||
case 0xce: /* into */
|
case 0xce: /* into */
|
||||||
if (ctxt->eflags & EFLG_OF) {
|
if (ctxt->eflags & EFLG_OF)
|
||||||
irq = 4;
|
rc = emulate_int(ctxt, 4);
|
||||||
goto do_interrupt;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 0xd0 ... 0xd1: /* Grp2 */
|
case 0xd0 ... 0xd1: /* Grp2 */
|
||||||
rc = em_grp2(ctxt);
|
rc = em_grp2(ctxt);
|
||||||
|
|
Loading…
Reference in New Issue