summaryrefslogtreecommitdiffstats
path: root/cpudetect.c
diff options
context:
space:
mode:
authordiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-02-24 18:09:28 +0000
committerdiego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-02-24 18:09:28 +0000
commit0044fb7a38bed184894c76d4951963c2a5662095 (patch)
tree3a0efc31a75681f50d03810dfd868be3e2dcd919 /cpudetect.c
parentb824af715e1a1b3e048b6e1f55dbfe7b25b04464 (diff)
downloadmpv-0044fb7a38bed184894c76d4951963c2a5662095.tar.bz2
mpv-0044fb7a38bed184894c76d4951963c2a5662095.tar.xz
Enable SSE detection on OS/2.
patch by KO Myung-Hun, komh chollian net git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26093 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'cpudetect.c')
-rw-r--r--cpudetect.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/cpudetect.c b/cpudetect.c
index b3a7d0b277..c3cbe41254 100644
--- a/cpudetect.c
+++ b/cpudetect.c
@@ -33,6 +33,11 @@ CpuCaps gCpuCaps;
#include <windows.h>
#endif
+#ifdef __OS2__
+#define INCL_DOS
+#include <os2.h>
+#endif
+
#ifdef __AMIGAOS4__
#include <proto/exec.h>
#endif
@@ -183,7 +188,8 @@ void GetCpuCaps( CpuCaps *caps)
/* FIXME: Does SSE2 need more OS support, too? */
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
- || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__)
+ || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) \
+ || defined(__OS2__)
if (caps->hasSSE)
check_os_katmai_support();
if (!caps->hasSSE)
@@ -321,6 +327,24 @@ LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
}
#endif /* WIN32 */
+#ifdef __OS2__
+ULONG _System os2_sig_handler_sse( PEXCEPTIONREPORTRECORD p1,
+ PEXCEPTIONREGISTRATIONRECORD p2,
+ PCONTEXTRECORD p3,
+ PVOID p4 )
+{
+ if(p1->ExceptionNum == XCPT_ILLEGAL_INSTRUCTION){
+ mp_msg(MSGT_CPUDETECT, MSGL_V, "SIGILL, ");
+
+ p3->ctx_RegEip += 3;
+ gCpuCaps.hasSSE = 0;
+
+ return XCPT_CONTINUE_EXECUTION;
+ }
+ return XCPT_CONTINUE_SEARCH;
+}
+#endif
+
/* If we're running on a processor that can do SSE, let's see if we
* are allowed to or not. This will catch 2.4.0 or later kernels that
* haven't been configured for a Pentium III but are running on one,
@@ -391,6 +415,16 @@ static void check_os_katmai_support( void )
if ( gCpuCaps.hasSSE ) mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
else mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
}
+#elif defined(__OS2__)
+ EXCEPTIONREGISTRATIONRECORD RegRec = { 0, &os2_sig_handler_sse };
+ if ( gCpuCaps.hasSSE ) {
+ mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+ DosSetExceptionHandler( &RegRec );
+ __asm __volatile ("xorps %xmm0, %xmm0");
+ DosUnsetExceptionHandler( &RegRec );
+ if ( gCpuCaps.hasSSE ) mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
+ else mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+ }
#elif defined(__linux__)
#if defined(_POSIX_SOURCE)
struct sigaction saved_sigill;