From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yg8ox-0006N5-9X for qemu-devel@nongnu.org; Thu, 09 Apr 2015 05:32:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yg8ou-00016G-2V for qemu-devel@nongnu.org; Thu, 09 Apr 2015 05:32:23 -0400 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]:33874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yg8ot-00016B-S9 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 05:32:20 -0400 Received: by pacyx8 with SMTP id yx8so143872819pac.1 for ; Thu, 09 Apr 2015 02:32:18 -0700 (PDT) Date: Thu, 9 Apr 2015 19:32:13 +1000 From: "Edgar E. Iglesias" Message-ID: <20150409093213.GF30629@toto> References: <1428437400-8474-1-git-send-email-peter.maydell@linaro.org> <1428437400-8474-2-git-send-email-peter.maydell@linaro.org> <20150409085537.GA30629@toto> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 01/14] memory: Define API for MemoryRegionOps to take attrs and return status List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Peter Crosthwaite , Patch Tracking , QEMU Developers , Greg Bellows , Paolo Bonzini , Alex =?iso-8859-1?Q?Benn=E9e?= , Richard Henderson On Thu, Apr 09, 2015 at 10:04:39AM +0100, Peter Maydell wrote: > On 9 April 2015 at 09:55, Edgar E. Iglesias wrote: > > Did you consider using a struct here? > > e.g: > > > > typedef struct MemTxAttrs { > > unsigned int secure : 1; > > unsigned int master_id : 10; > > unsigned int etc : 1; > > } MemTxAttrs; > > > > I think you could still pass it by value and my understanding is > > that the compiler will generate similar code. > > We discussed this last time round, I think. Whether structs get > passed in registers depends on the host CPU ABI/calling convention. Ah sorry, I must have missed that response... > > > I find it more readable, you ca go: > > > > attrs.secure = 1; > > attrs.master_id = 0x77; > > if (!attrs.secure) > > > > instead of: > > > > attrs |= MEMTXATTRS_SECURE > > if (!(attrs & MEMTXATTRS_SECURE)) > > > > etc... > > > > Or do you see any disadvantages with this? > > I prefer the traditional integer-and-bitops approach, then you > know what you're getting everywhere... OK :-) Cheers, Edgar