From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXxQN-0007pi-TC for qemu-devel@nongnu.org; Tue, 17 Mar 2015 15:45:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXxQK-0006fv-K3 for qemu-devel@nongnu.org; Tue, 17 Mar 2015 15:45:11 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:37218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXxQK-0006fi-F6 for qemu-devel@nongnu.org; Tue, 17 Mar 2015 15:45:08 -0400 Received: by igcqo1 with SMTP id qo1so23211810igc.0 for ; Tue, 17 Mar 2015 12:45:07 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20150317193816.GB23225@cbox> References: <1426620735-2454-1-git-send-email-peter.maydell@linaro.org> <20150317193816.GB23225@cbox> From: Peter Maydell Date: Tue, 17 Mar 2015 19:44:47 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v2] target-arm: Store SPSR_EL1 state in banked_spsr[1] (SPSR_svc) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoffer Dall Cc: "kvmarm@lists.cs.columbia.edu" , Greg Bellows , =?UTF-8?B?QWxleCBCZW5uw6ll?= , QEMU Developers , Patch Tracking On 17 March 2015 at 19:38, Christoffer Dall wrote: > On Tue, Mar 17, 2015 at 07:32:15PM +0000, Peter Maydell wrote: >> The AArch64 SPSR_EL1 register is architecturally mandated to >> be mapped to the AArch32 SPSR_svc register. This means its >> state should live in QEMU's env->banked_spsr[1] field. >> Correct the various places in the code that incorrectly >> put it in banked_spsr[0]. >> >> Signed-off-by: Peter Maydell > > Reviewed-by: Christoffer Dall Thanks. It also occurs to me that we could avoid some of these magic 1/6/7 numbers by defining some constants BANK_USR, BANK_SVC, BANK_ABT, etc for the return values from bank_number (ie the indexes into env->banked_* arrays), and then using them where we need to refer to particular banked_* entries elsewhere. Then for instance this array in aarch64_banked_spsr_index() looks like [1] = BANK_SVC, /* EL1. */ [2] = BANK_HYP, /* EL2. */ [3] = BANK_MON, /* EL3. */ and the mapping between the AArch32 and AArch64 SPSRs is suddenly much more obvious and easy to check. -- PMM