Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2005 22:46:17 -0700
From:      Scott Long <scottl@samsco.org>
To:        Thomas Krause -CI- <freebsd-amd64@chef-ingenieur.de>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: -mno-sse -mno-sse2 -mno-mmx -mno-3dnow when compiling kernel
Message-ID:  <42103B29.8070901@samsco.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
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,PGE,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.
> 
> Kind regards,
> Thomas


Floating point, MMX, SSE, SSE2, and 3dnow, registers are not usable in
the kernel.  By not using these registers, we save the expense of saving
and restoring them on every single syscall.  Using them without saving
them would run the risk of colliding with userland programs that do use
them.

Whether or not the kernel is compiled with instructions that use these
registers has absolutely no bearing on whether userland code can use
them.  It's purely about trading one optimization (using optimized
opcodes in the kernel) for another (not having to save and restore
dozens of registers to the stack on each syscall).  It might be
interesting to experiment with allowing a certain class of instructions
in the kernel and saving and restoring the associated registers, and
seeing if GCC will actually generate code that is better and overcomes
the save/restore expense.  Any takers?

Scott



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42103B29.8070901>