From: Keir Fraser Subject: Re: porting xen-detect ASM code into a shared library Date: Thu, 10 Jul 2008 10:28:50 +0100 Message-ID: References: <4875D480.9090805@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4875D480.9090805@inria.fr> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Guillaume Rousse , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 10/7/08 10:21, "Guillaume Rousse" wrote: > I'm trying to port xen-detect.c ASM code into cfengine, which is > currently build as a shared library. However, I'm facing a compilation > error: > misc.c: In function 'Xen_cpuid': > misc.c:1376: error: can't find a register in class 'BREG' while > reloading 'asm' > misc.c:1376: error: 'asm' operand has impossible constraints > > From See tools/libxc/xc_cpuid_x86.c for an example of how to work around this. Essentially you turn the "=b" constraint into "=r". You then push/pop ebx (to save/restore it) and you 'mov %%ebx,%1' to save away ebx's value before restoring its original value. -- Keir