Mercurial > libavcodec.hg
changeset 5757:ace63c809071 libavcodec
Remove uses of SIGILL for CPU extension detection, that method is not acceptable
in a library.
Should not change anything for PPC, the autodetection is currently pointless due
to other code being compiled with -maltivec as well (and detection for OSX and
AmigaOS remains in place).
SPARC binaries built with VIS support can now only run on systems with VIS.
author | reimar |
---|---|
date | Tue, 02 Oct 2007 18:18:35 +0000 |
parents | db5a041fd77c |
children | a73ecbffc421 |
files | ppc/check_altivec.c sparc/dsputil_vis.c |
diffstat | 2 files changed, 3 insertions(+), 80 deletions(-) [+] |
line wrap: on
line diff
--- a/ppc/check_altivec.c Tue Oct 02 14:35:20 2007 +0000 +++ b/ppc/check_altivec.c Tue Oct 02 18:18:35 2007 +0000 @@ -28,23 +28,6 @@ #include <exec/exec.h> #include <interfaces/exec.h> #include <proto/exec.h> -#else -#include <signal.h> -#include <setjmp.h> - -static sigjmp_buf jmpbuf; -static volatile sig_atomic_t canjump = 0; - -static void sigill_handler (int sig) -{ - if (!canjump) { - signal (sig, SIG_DFL); - raise (sig); - } - - canjump = 0; - siglongjmp (jmpbuf, 1); -} #endif /* __APPLE__ */ /** @@ -72,24 +55,9 @@ if (err == 0) return (has_vu != 0); return 0; #else -/* Do it the brute-force way, borrowed from the libmpeg2 library. */ - { - signal (SIGILL, sigill_handler); - if (sigsetjmp (jmpbuf, 1)) { - signal (SIGILL, SIG_DFL); - } else { - canjump = 1; - - asm volatile ("mtspr 256, %0\n\t" - "vand %%v0, %%v0, %%v0" - : - : "r" (-1)); - - signal (SIGILL, SIG_DFL); - return 1; - } - } - return 0; + // since we were compiled for altivec, just assume we have it + // until someone comes up with a proper way (not involving signal hacks). + return 1; #endif /* __AMIGAOS4__ */ }
--- a/sparc/dsputil_vis.c Tue Oct 02 14:35:20 2007 +0000 +++ b/sparc/dsputil_vis.c Tue Oct 02 18:18:35 2007 +0000 @@ -26,8 +26,6 @@ #include "config.h" #include <inttypes.h> -#include <signal.h> -#include <setjmp.h> #include "dsputil.h" @@ -3987,56 +3985,13 @@ /* End of no rounding code */ -static sigjmp_buf jmpbuf; -static volatile sig_atomic_t canjump = 0; - -static void sigill_handler (int sig) -{ - if (!canjump) { - signal (sig, SIG_DFL); - raise (sig); - } - - canjump = 0; - siglongjmp (jmpbuf, 1); -} - #define ACCEL_SPARC_VIS 1 #define ACCEL_SPARC_VIS2 2 static int vis_level () { - int accel = 0; - - signal (SIGILL, sigill_handler); - if (sigsetjmp (jmpbuf, 1)) { - signal (SIGILL, SIG_DFL); - return accel; - } - - canjump = 1; - - /* pdist %f0, %f0, %f0 */ - __asm__ __volatile__(".word\t0x81b007c0"); - - canjump = 0; accel |= ACCEL_SPARC_VIS; - - if (sigsetjmp (jmpbuf, 1)) { - signal (SIGILL, SIG_DFL); - return accel; - } - - canjump = 1; - - /* edge8n %g0, %g0, %g0 */ - __asm__ __volatile__(".word\t0x81b00020"); - - canjump = 0; accel |= ACCEL_SPARC_VIS2; - - signal (SIGILL, SIG_DFL); - return accel; }