summaryrefslogtreecommitdiffstats
path: root/libhb/common.h
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/common.h
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/common.h')
-rw-r--r--libhb/common.h11
1 files changed, 11 insertions, 0 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