Date: Thu, 17 Feb 2005 13:49:29 -0800 From: Peter Wemm <peter@wemm.org> To: freebsd-amd64@freebsd.org Subject: Re: -mno-sse -mno-sse2 -mno-mmx -mno-3dnow when compiling kernel Message-ID: <200502171349.30085.peter@wemm.org> In-Reply-To: <420F9CA1.4040207@chef-ingenieur.de> References: <420F9CA1.4040207@chef-ingenieur.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 13 February 2005 10:29 am, Thomas Krause -CI- wrote: > Hello, > why are the Switches "-mno-sse -mno-sse2 -mno-mmx -mno-3dnow" are set > when compiling an amd64 kernel? I think, the CPU supports all thease > features. > > Features=0x78bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,P >GE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2> > > I have no CPUTYPE specified in /etc/make.conf, as I could not > find a matching option in /usr/src/share/examples/etc/make.conf. For speed reasons, we restrict the kernel to using integer instructions only. This means we can avoid the considerable expense of saving/restoring floating point context unnecessarily for syscalls, interrupts, etc. On FreeBSD/i386, the compiler generally doesn't generate floating point instructions unless there is a reason to. But on FreeBSD/amd64, the compiler will do it readily because things like MMX, SSE and SSE2 are *known* to exist on this family and are part of the function calling conventions, especially for things like varargs functions. The upshot of this is that we are not in a lot of danger of the i386 compiler accidently generating floating point code for the kernel, but on FreeBSD/amd64, it can and does if you give it the chance. How the code for the kernel is generated has no bearing on the user code environment at all. The floating point/mmx/sse/sse2 context is reserved entirely for the user. Note that we *could* concievably set aside a few xmm registers for faster data copies inside the kernel, but we don't do it yet. I believe linux makes %xmm0 and %xmm1 available in the kernel and saves them with every trap into kernel mode. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502171349.30085.peter>