From patchwork Sun May 29 13:02:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 827732 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4TD3239011688 for ; Sun, 29 May 2011 13:03:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753811Ab1E2NDA (ORCPT ); Sun, 29 May 2011 09:03:00 -0400 Received: from mail-pw0-f46.google.com ([209.85.160.46]:42445 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818Ab1E2NC7 (ORCPT ); Sun, 29 May 2011 09:02:59 -0400 Received: by pwi15 with SMTP id 15so1326368pwi.19 for ; Sun, 29 May 2011 06:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:x-mailer:mime-version:content-type :content-transfer-encoding; bh=p4VvpWRjJSl9h+oYy8rIsGxkskD4EHZSuA8Et068uBc=; b=BBGw/pd+h0YhRIVI7pQ/Mmu9/60dmJF9IuqdUkY6wXgWbddD2iEPK5RynAoMpscyx1 mljwKx5gnDU/pgOxiO7+trXTUZIIiIl9PT1tsiQZg7vyplMzpqTcRvUFrrqHUVN8k0FO 0EdsxK56t2O4h1JiLy5TttFVq4OUbImLMVEyE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=ErzrX9GJuvZPRue4EB5t8Skc9OcI+VWuD+VfZwkrAa+1QTvxSBEyfcan+rJnLcSBnt rPhnqxoJWVSNYWH7bGNqFCTGA7bXmwUwQYIJi/7W9I1owi94jkDGfxVWP/KGLBbk3IpE oBpSnJN+pda+ntFtWEZXljqFszvXgP/Kl/hJQ= Received: by 10.142.149.18 with SMTP id w18mr620188wfd.23.1306674179264; Sun, 29 May 2011 06:02:59 -0700 (PDT) Received: from amd (x096101.dynamic.ppp.asahi-net.or.jp [122.249.96.101]) by mx.google.com with ESMTPS id d15sm2005782wfl.18.2011.05.29.06.02.57 (version=SSLv3 cipher=OTHER); Sun, 29 May 2011 06:02:58 -0700 (PDT) Date: Sun, 29 May 2011 22:02:55 +0900 From: Takuya Yoshikawa To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp, gleb@redhat.com Subject: [PATCH 08/10] KVM: x86 emulator: Clean up INT n/INTO/INT 3(CC/CD/CE) Message-Id: <20110529220255.55e80541.takuya.yoshikawa@gmail.com> In-Reply-To: <20110529215200.17be7761.takuya.yoshikawa@gmail.com> References: <20110529215200.17be7761.takuya.yoshikawa@gmail.com> X-Mailer: Sylpheed 3.1.0 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sun, 29 May 2011 13:03:03 +0000 (UTC) From: Takuya Yoshikawa Call emulate_int() directly to avoid spaghetti goto's. Signed-off-by: Takuya Yoshikawa --- arch/x86/kvm/emulate.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 7a06fb2..a5d067c 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3753,7 +3753,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) struct decode_cache *c = &ctxt->decode; int rc = X86EMUL_CONTINUE; int saved_dst_type = c->dst.type; - int irq; /* Used for int 3, int, and into */ c->mem_read.pos = 0; @@ -3947,18 +3946,14 @@ special_insn: rc = emulate_load_segment(ctxt, VCPU_SREG_DS); break; case 0xcc: /* int3 */ - irq = 3; - goto do_interrupt; + rc = emulate_int(ctxt, 3); + break; case 0xcd: /* int n */ - irq = c->src.val; - do_interrupt: - rc = emulate_int(ctxt, irq); + rc = emulate_int(ctxt, c->src.val); break; case 0xce: /* into */ - if (ctxt->eflags & EFLG_OF) { - irq = 4; - goto do_interrupt; - } + if (ctxt->eflags & EFLG_OF) + rc = emulate_int(ctxt, 4); break; case 0xd0 ... 0xd1: /* Grp2 */ rc = em_grp2(ctxt);