[FFmpeg-devel] [PATCH] remove SIGILL detection hacks

Reimar Döffinger Reimar.Doeffinger
Tue Oct 2 10:14:53 CEST 2007


Hello,
attached untested patch removes all SIGILL hacks I found.
It shouldn't make a difference for altivec, since a altivec compiled
build will crash on non-altivec anyway (so the whole checks are
pointless currently).
The sparc patch would break on all non-vis2 sparcs, esp. since I
did not find any configure flag for it, but it seems the vis2 test flag
was never used?? So it should only break VIS-enabled builds on non-VIS
machines and nothing more.
Again, even compilation is untested for both.

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavcodec/ppc/dsputil_altivec.c
===================================================================
--- libavcodec/ppc/dsputil_altivec.c	(revision 10636)
+++ libavcodec/ppc/dsputil_altivec.c	(working copy)
@@ -32,23 +32,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__ */
 
 int sad16_x2_altivec(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
@@ -1437,24 +1420,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.
+    return 1;
 #endif /* __AMIGAOS4__ */
 }
 
Index: libavcodec/sparc/dsputil_vis.c
===================================================================
--- libavcodec/sparc/dsputil_vis.c	(revision 10636)
+++ libavcodec/sparc/dsputil_vis.c	(working copy)
@@ -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;
 }
 



More information about the ffmpeg-devel mailing list