From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v3 1/8] ARM: KVM: Initial skeleton to compile KVM support Date: Sun, 05 Jun 2011 19:06:26 +0300 Message-ID: <4DEBA982.7000206@redhat.com> References: <20110603150318.17011.82777.stgit@ubuntu> <4DEB785C.5060906@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: catalin.marinas@arm.com, android-virt@lists.cs.columbia.edu, s.raho@virtualopensystems.com, a.motakis@virtualopensystems.com, kvm@vger.kernel.org, a.costa@virtualopensystems.com To: Christoffer Dall Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36359 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058Ab1FEQGy (ORCPT ); Sun, 5 Jun 2011 12:06:54 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 06/05/2011 07:03 PM, Christoffer Dall wrote: > >> + > >> + /* Banked FIQ registers r8-r12 */ > >> + if (reg_num>= 8&& reg_num<= 12) { > >> + if (mode == MODE_FIQ) { > >> + reg_idx = reg_num - 8; /* 0=r8, ..., 4=r12 */ > >> + return&(regs->fiq_regs[reg_idx]); > >> + } else > >> + return&(regs->usr_regs[reg_num]); > >> + } > > > > You could have a static 2D array indexed by mode and register number, > > returning an offsetof() into the vcpu structure. > > You think it's simpler or faster? I don't quite see the incentive. > It's not going to be called a whole lot given the Virt. Extensions. Yes (those are mostly unpredictable branches), and clearer as well. But I agree it's a rare-enough path that doesn't need optimizing, certainly not prematurely. -- error compiling committee.c: too many arguments to function