summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;