From patchwork Wed Oct 31 09:39:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 1677381 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 901E54005F for ; Wed, 31 Oct 2012 09:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756540Ab2JaJkr (ORCPT ); Wed, 31 Oct 2012 05:40:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52363 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756480Ab2JaJkf (ORCPT ); Wed, 31 Oct 2012 05:40:35 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9V9eSni026136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 31 Oct 2012 05:40:29 -0400 Received: from amt.cnet (vpn1-4-142.gru2.redhat.com [10.97.4.142]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9V9eRvH011875; Wed, 31 Oct 2012 05:40:28 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 3093765228F; Wed, 31 Oct 2012 07:40:11 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id q9V9eBeW025073; Wed, 31 Oct 2012 07:40:11 -0200 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Eduardo Habkost , Marcelo Tosatti Subject: [PATCH 03/28] i386: kvm: kvm_arch_get_supported_cpuid: use 'entry' variable Date: Wed, 31 Oct 2012 07:39:41 -0200 Message-Id: <47111e2cfa1a83a99ac10ed19c7c8b02be4fe973.1351676405.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Eduardo Habkost The reg switch will be moved to a separate function, so store the entry pointer in a variable. No behavior change, just code movement. Signed-off-by: Eduardo Habkost Signed-off-by: Marcelo Tosatti --- target-i386/kvm.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 56addf1..18782e4 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -140,19 +140,20 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, for (i = 0; i < cpuid->nent; ++i) { if (cpuid->entries[i].function == function && cpuid->entries[i].index == index) { + struct kvm_cpuid_entry2 *entry = &cpuid->entries[i]; found = true; switch (reg) { case R_EAX: - ret = cpuid->entries[i].eax; + ret = entry->eax; break; case R_EBX: - ret = cpuid->entries[i].ebx; + ret = entry->ebx; break; case R_ECX: - ret = cpuid->entries[i].ecx; + ret = entry->ecx; break; case R_EDX: - ret = cpuid->entries[i].edx; + ret = entry->edx; break; } }