From: Tim Deegan Subject: Re: [PATCH 25/45] xen: arm: separate guest user regs from internal guest state. Date: Thu, 14 Feb 2013 13:10:41 +0000 Message-ID: <20130214131041.GR83752@ocelot.phlegethon.org> References: <1358956576.17440.60.camel@zakaz.uk.xensource.com> <1358956611-8432-25-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1358956611-8432-25-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: stefano.stabellini@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org So this ends up with two different layouts for core regs, one public and one private, both of which have the padding/unions to allow 64-bit and 32-bit to coexist. Can we really not re-use them? At 15:56 +0000 on 23 Jan (1358956591), Ian Campbell wrote: > +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) > +# ifdef __aarch64__ > +/* Anonymous union includes both 32- and 64-bit names (e.g., r0/x0). */ > +# define __DECL_REG(n64, n32) union { \ > + uint64_t n64; \ > + uint32_t n32; \ > + } > +# else > +/* > + * Include a 64-bit padding field so that the layout is the same > + * between 32- and 64-bit hypervisors. > + */ > +# define __DECL_REG(n64, n32) union { \ > + uint64_t __pad_##n64; \ > + uint32_t n32; \ > + } > +# endif On x86, a 32-bit toolstack can control 64-bit VMs. We might want to allow that on arm64 as well, so I'm not sureethe __pad prefix is useful. Cheers, Tim. > +#else > +/* Non-gcc sources must always use the proper 64-bit name (e.g., x0). */ > +#define __DECL_REG(n64, n32) uint64_t n64 > +#endif