Index: cpudetect.c =================================================================== --- cpudetect.c (revision 27666) +++ cpudetect.c (working copy) @@ -29,6 +29,11 @@ #include #endif +#ifdef __sun +#include +#include +#endif + #ifdef WIN32 #include #endif @@ -187,7 +192,7 @@ #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \ || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) \ - || defined(__OS2__) + || defined(__OS2__) || defined(__sun) if (caps->hasSSE) check_os_katmai_support(); if (!caps->hasSSE) @@ -293,8 +298,12 @@ #undef CPUID_STEPPING -#if defined(__linux__) && defined(_POSIX_SOURCE) && !defined(ARCH_X86_64) +#if ((defined(__linux__) && defined(_POSIX_SOURCE)) || defined (__sun)) && !defined(ARCH_X86_64) +#ifdef __sun +static void sigill_handler_sse( int signal, siginfo_t *sip, ucontext_t * ucp) +#else static void sigill_handler_sse( int signal, struct sigcontext sc ) +#endif { mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGILL, " ); @@ -308,11 +317,15 @@ * word will be restored at the end of the test, so we don't need * to worry about doing it here. Besides, we may not be able to... */ +#ifdef __sun + ucp->uc_mcontext.gregs[EIP] += 3; +#else sc.eip += 3; +#endif gCpuCaps.hasSSE=0; } -#endif /* __linux__ && _POSIX_SOURCE */ +#endif /* (__linux__ && _POSIX_SOURCE) || __sun */ #ifdef WIN32 LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep) @@ -413,15 +426,24 @@ DosUnsetExceptionHandler( &RegRec ); mp_msg(MSGT_CPUDETECT,MSGL_V, gCpuCaps.hasSSE ? "yes.\n" : "no!\n" ); } -#elif defined(__linux__) -#if defined(_POSIX_SOURCE) +#elif defined(__linux__) || defined(__sun) +#if defined(_POSIX_SOURCE) || defined(__sun) struct sigaction saved_sigill; +#ifdef __sun + struct sigaction sse_sigill; + + sse_sigill.sa_sigaction = (void (*)(int, siginfo_t*, void*))&sigill_handler_sse; + sigemptyset (&sse_sigill.sa_mask); + sse_sigill.sa_flags = SA_SIGINFO; + sigaction( SIGILL, &sse_sigill, &saved_sigill ); +#else /* Save the original signal handlers. */ sigaction( SIGILL, NULL, &saved_sigill ); signal( SIGILL, (void (*)(int))sigill_handler_sse ); +#endif /* Emulate test for OSFXSR in CR4. The OS will set this bit if it * supports the extended FPU save and restore required for SSE. If