From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yg8eU-00063O-JW for qemu-devel@nongnu.org; Thu, 09 Apr 2015 05:21:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yg8eT-0007pF-Nc for qemu-devel@nongnu.org; Thu, 09 Apr 2015 05:21:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40623) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yg8eT-0007p9-EV for qemu-devel@nongnu.org; Thu, 09 Apr 2015 05:21:33 -0400 Message-ID: <55264496.70702@redhat.com> Date: Thu, 09 Apr 2015 11:21:26 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1428437400-8474-1-git-send-email-peter.maydell@linaro.org> <1428437400-8474-2-git-send-email-peter.maydell@linaro.org> <20150409085537.GA30629@toto> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 , "Edgar E. Iglesias" Cc: Peter Crosthwaite , Patch Tracking , QEMU Developers , Greg Bellows , =?UTF-8?B?QWxleCBCZW5u?= =?UTF-8?B?w6ll?= , Richard Henderson On 09/04/2015 11:04, Peter Maydell wrote: > We discussed this last time round, I think. Whether structs get > passed in registers depends on the host CPU ABI/calling convention. Because of C++, structs up to pointer size are in practice always passed in registers. 64-bit structs may or may not. The main advantage of structs is that it's impossible to mismatch the parameter order. That even trumps readability in my opinion. I'm ambivalent, but I wouldn't mind at all using structs. Paolo >> > I find it more readable, you ca go: >> > >> > attrs.secure =3D 1; >> > attrs.master_id =3D 0x77; >> > if (!attrs.secure) >> > >> > instead of: >> > >> > attrs |=3D 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...