amd64 build fails within ESXi guest

Matthew Fleming mdf356 at gmail.com
Mon Jan 24 17:55:36 UTC 2011


On Mon, Jan 24, 2011 at 8:25 AM, Eric Crist <ecrist at secure-computing.net> wrote:
> I'm trying to build HEAD within an ESXi guest system, and the build errors while building the boot code.  I've attached the tail end of the log.  The host is a Dell Vostro 230 with CPU: Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz (2659.61-MHz K8-class CPU) and the guest is allocated 256MB of RAM.  This 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/hwpmc_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-assembly-and-pic-mix-well
for this workaround.
	 */
	__asm __volatile("cpuid"
			 : "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (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 */
			 : "=a" (p[0]), "=m" (p[1]), "=c" (p[2]), "=d" (p[3])
			 : "a"(ax)
			 : "cc");
#endif
}

Note that using =r 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


More information about the freebsd-current mailing list