summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-11-18 23:54:35 +0000
committerjstebbins <[email protected]>2011-11-18 23:54:35 +0000
commit3fa8817b961e616366a28a46b149375332be9123 (patch)
tree2e0b610b6cabc38a2de8dd4998bd5e40b8f4c7a7 /libhb
parentd1f9c570e471bec711cc654f441d040bed0a5e08 (diff)
Align stack of all threads created by libhb
This is a preemptive measure to prevent any future crashes in SSE code that requires 16 byte stack alignment. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4358 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/common.h11
-rw-r--r--libhb/ports.c2
2 files changed, 12 insertions, 1 deletions
diff --git a/libhb/common.h b/libhb/common.h
index a657eb2ff..52e1d9630 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -18,6 +18,17 @@
#include <sys/stat.h>
#include <dirent.h>
+/*
+ * It seems WinXP doesn't align the stack of new threads to 16 bytes.
+ * To prevent crashes in SSE functions, we need to force stack alignement
+ * of new threads.
+ */
+#if defined( __GNUC__ ) && (defined( _WIN32 ) || defined( __MINGW32__ ))
+# define attribute_align_thread __attribute__((force_align_arg_pointer))
+#else
+# define attribute_align_thread
+#endif
+
#if defined( __GNUC__ ) && !(defined( _WIN32 ) || defined( __MINGW32__ ))
# define HB_WPRINTF(s,v) __attribute__((format(printf,s,v)))
#else
diff --git a/libhb/ports.c b/libhb/ports.c
index 722134780..bd3564be3 100644
--- a/libhb/ports.c
+++ b/libhb/ports.c
@@ -342,7 +342,7 @@ static uint64_t hb_thread_to_integer( const hb_thread_t* t )
* + Get informed when the thread exits, so we know whether
* hb_thread_close() will block or not.
***********************************************************************/
-static void hb_thread_func( void * _t )
+static void attribute_align_thread hb_thread_func( void * _t )
{
hb_thread_t * t = (hb_thread_t *) _t;