Date: Mon, 24 Jan 2011 09:31:56 -0800 From: Matthew Fleming <mdf356@gmail.com> To: Eric Crist <ecrist@secure-computing.net> Cc: freebsd-current@freebsd.org Subject: Re: amd64 build fails within ESXi guest Message-ID: <AANLkTim=NtoMCmkS_gF8ZmUt1rqvbO0_eJ0aAaXRYKaQ@mail.gmail.com> In-Reply-To: <67AF693D-FBF1-4AE6-85E0-88B0C11F2483@secure-computing.net> References: <67AF693D-FBF1-4AE6-85E0-88B0C11F2483@secure-computing.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 24, 2011 at 8:25 AM, Eric Crist <ecrist@secure-computing.net> w= rote: > I'm trying to build HEAD within an ESXi guest system, and the build error= s while building the boot code. =A0I've attached the tail end of the log. = =A0The host is a Dell Vostro 230 with CPU: Intel(R) Core(TM)2 Quad CPU =A0 = =A0Q8400 =A0@ 2.66GHz (2659.61-MHz K8-class CPU) and the guest is allocated= 256MB of RAM. =A0This is ESXi 4.1.0. > Locally we've been building the amd64 kernel with a few different flags and ran into this in our kernel build. Try this definition of do_cpuid instead: static __inline void do_cpuid(u_int ax, u_int *p) { #if 0 /* * Isilon: get a compile error on a new hwpmc file: /data/sb/BR_HAB_BSDMERGE_STABLE7/src/sys/modules/hwpmc/../../dev/hwpmc/hwpm= c_core.c: In function 'pmc_core_initialize': ./machine/cpufunc.h:111: error: can't find a register in class 'BREG' while reloading 'asm' ./machine/cpufunc.h:111: error: 'asm' operand has impossible constraints This presumably has to do with -fPIC. See http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-asse= mbly-and-pic-mix-well for this workaround. */ __asm __volatile("cpuid" : "=3Da" (p[0]), "=3Db" (p[1]), "=3Dc" (p[2]), "=3Dd" (p[3]) : "0" (ax)); #else __asm __volatile("push %%ebx \n\t" /* save %ebx */ "cpuid \n\t" "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ "pop %%ebx \n\t" /* restore the old %ebx */ : "=3Da" (p[0]), "=3Dm" (p[1]), "=3Dc" (p[2]), "=3Dd" (p[3]) : "a"(ax) : "cc"); #endif } Note that using =3Dr for the constraint on p[1] isn't sufficient as once in a while the compiler has chosen %ebx, which then leads to garbage in the register after the pop. Thanks, matthew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim=NtoMCmkS_gF8ZmUt1rqvbO0_eJ0aAaXRYKaQ>