From patchwork Sat Jan 4 19:58:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22893 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 52E68218E5 for ; Sat, 4 Jan 2014 19:59:03 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id o15sf2423577qap.10 for ; Sat, 04 Jan 2014 11:59:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :from:date:message-id:subject:to:cc:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=fXmOl//thMimnEkCtyoJ6rEJcx/jadDFFthjPY6zCfo=; b=Tm5cSFE/4xNsZavx4HsV8pa6LW5d/H2b3EnCQvRwdd5bpe9PeyLE/TzfHzILVqhb++ XwJZ6xXZMg/lZm1HTtpdMYBiL7Mti7odkYcNxMi9vgNvrKiWKIVHh1vNw7YNN/7VhS21 u3LoVaaL1NSpLVFUDP/WaY0Du+LFGiQdIPnKm5gHTB9CdC01Q/AYRKDdajw8rAHpf6oB uBK7ENoSuhaU6fA6G9tw5TRg7cQDFTwx2I2gljx+oHZmpTb5HpS4/sf9js2G4JGFey1m ekTcEuSN49n53ezUb9i9zpKaNnA8Ll39O1FI9M6lOOt/N58hszwt7Z8XIdLGjK3Sk3Q5 f10g== X-Gm-Message-State: ALoCoQk54Zm8D2iHAllqdo8WbHlSItNy7NsKODbJDQox9KmUPb76H5EHtIl/AEqfbwBawdq8of8m X-Received: by 10.224.38.206 with SMTP id c14mr39335958qae.4.1388865542163; Sat, 04 Jan 2014 11:59:02 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.10 with SMTP id q10ls5237280qen.0.gmail; Sat, 04 Jan 2014 11:59:02 -0800 (PST) X-Received: by 10.58.208.130 with SMTP id me2mr60537347vec.13.1388865542007; Sat, 04 Jan 2014 11:59:02 -0800 (PST) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id tj7si27584774vdc.59.2014.01.04.11.59.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 Jan 2014 11:59:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu19so8453534vcb.0 for ; Sat, 04 Jan 2014 11:59:01 -0800 (PST) X-Received: by 10.52.157.68 with SMTP id wk4mr36919vdb.19.1388865541683; Sat, 04 Jan 2014 11:59:01 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp17474ved; Sat, 4 Jan 2014 11:59:01 -0800 (PST) X-Received: by 10.152.116.46 with SMTP id jt14mr1480858lab.31.1388865540072; Sat, 04 Jan 2014 11:59:00 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com [209.85.215.54]) by mx.google.com with ESMTPS id bj6si33089078lbc.47.2014.01.04.11.58.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 Jan 2014 11:59:00 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.54 is neither permitted nor denied by best guess record for domain of peter.maydell@linaro.org) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id b8so9070005lan.27 for ; Sat, 04 Jan 2014 11:58:59 -0800 (PST) X-Received: by 10.112.141.166 with SMTP id rp6mr1707938lbb.39.1388865539452; Sat, 04 Jan 2014 11:58:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.112.125.3 with HTTP; Sat, 4 Jan 2014 11:58:38 -0800 (PST) In-Reply-To: References: <1387752607-23755-1-git-send-email-peter.maydell@linaro.org> <1387752607-23755-13-git-send-email-peter.maydell@linaro.org> From: Peter Maydell Date: Sat, 4 Jan 2014 19:58:38 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH v2 12/25] target-arm: Update generic cpreg code for AArch64 To: Peter Crosthwaite Cc: "qemu-devel@nongnu.org Developers" , Patch Tracking , Michael Matz , Alexander Graf , Claudio Fontana , Dirk Mueller , Will Newton , Laurent Desnogues , =?UTF-8?B?QWxleCBCZW5uw6ll?= , "kvmarm@lists.cs.columbia.edu" , Christoffer Dall , Richard Henderson X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 2 January 2014 01:51, Peter Crosthwaite wrote: > On Mon, Dec 23, 2013 at 8:49 AM, Peter Maydell wrote: >> +#define ARM_CP_STATE_AA32 0 >> +#define ARM_CP_STATE_AA64 1 >> +#define ARM_CP_STATE_BOTH 2 > > You iterator below depends on this specific encoding ordering, so > maybe this should be enumified. Delta from this to my fixed version: ===endit=== Personally I think the change to enum is less useful than the comment saying "the values matter", but I don't particularly object to enums. thanks -- PMM ===begin=== diff --git a/target-arm/cpu.h b/target-arm/cpu.h index b082bca..9430464 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -672,10 +672,14 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) * If the reginfo is declared to be visible in both states then a second * reginfo is synthesised for the AArch32 view of the AArch64 register, * such that the AArch32 view is the lower 32 bits of the AArch64 one. + * Note that we rely on the values of these enums as we iterate through + * the various states in some places. */ -#define ARM_CP_STATE_AA32 0 -#define ARM_CP_STATE_AA64 1 -#define ARM_CP_STATE_BOTH 2 +enum { + ARM_CP_STATE_AA32 = 0, + ARM_CP_STATE_AA64 = 1, + ARM_CP_STATE_BOTH = 2, +}; /* Return true if cptype is a valid type field. This is used to try to * catch errors where the sentinel has been accidentally left off the end