From: David D. <da...@XF...> - 2001-06-06 14:29:23
|
On Tue, Jun 05, 2001 at 09:56:44AM -0600, Brian Paul wrote: >"Marcelo E. Magallon" wrote: >> >> >> Brian Paul <br...@va...> writes: >> >> > If anyone knows a solution to this I'd like to hear it. >> >> Sometime ago I submitted a patch for this (#403332). The comment >> reads: >> >> | If the use of KATMAI instructions is enabled, on linux it's necessary >> | to have recent kernel headers installed (these are coupled to the C >> | library, so suggesting to place/change a link in /usr/src/ is not >> | advisable). There are two options for it's detection at compile time, >> | one is using LINUX_KERNEL_VERSION, what this patch does, the other is >> | checking for X86_FXSR_MAGIC to be defined. I'm sure Gareth can make a >> | recommendation as to which is better. With either of them, I think >> | it's important to provide the user with an error that at least >> | suggests a course of action (the current one goes along the lines of >> | "magic is not a member of structure sigcontext", IIRC) >> >> | The patch uses 2.4.0 as a reference point, I'm not really sure when >> | the SSE support was introduced in the kernel, but it's not on the >> | 2.2.18 I looked at. >> >> The patch, which is not on SF (weird) is basically: >> >> Index: extras/Mesa/src/X86/common_x86.c >> =================================================================== >> RCS file: /cvsroot/dri/xc/xc/extras/Mesa/src/X86/common_x86.c,v >> retrieving revision 1.10 >> diff -u -r1.10 common_x86.c >> --- extras/Mesa/src/X86/common_x86.c 2001/02/12 20:42:42 1.10 >> +++ extras/Mesa/src/X86/common_x86.c 2001/06/05 15:22:50 >> @@ -88,6 +88,11 @@ >> extern void gl_test_os_katmai_exception_support( void ); >> >> #if defined(__linux__) && defined(_POSIX_SOURCE) >> +#include <linux/version.h> >> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) >> +#error "linux headers older than 2.4.0 don't provide support for SSE." >> +#endif >> + >> static void sigill_handler( int signal, struct sigcontext sc ) >> { >> message( "SIGILL, " ); >> >> Granted, it's not the best solution, but it's at least an useful error. >> Some conditionals on the configuration files would do it, too. >> (HAVE_LINUX_2_4_HEADERS, Imakefile style). The point is, you need 2.4 >> kernel headers to compile this. > > >I'd like to see a solution that doesn't interupt compilation. That >is, if we can't use SSE at compile time, it should just be disabled, >perhaps with a warning. > >The trick is there was a patch to Linux 2.2.x that added SSE so just >testing for kernel >= 2.4.0 isn't enough. Does the presense of >X86_FXSR_MAGIC ensure that the _fpstate.magic field exists? For builds within XFree86, linux.cf already has the kernel version check: #ifndef HasKatmaiSupport # ifdef i386Architecture # if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion >= 4) # define HasKatmaiSupport YES # else # define HasKatmaiSupport NO # endif # else # define HasKatmaiSupport NO # endif #endif It assumes that the kernel headers will be found for the build though. David -- David Dawes Email: da...@XF... Founder/President, The XFree86 Project, Inc Phone: +1 510 687 6857 http://www.xfree86.org/ |