]> Chaos Git - corbenik/ctrulib.git/commitdiff
Fix thread stack alignment
authorfincs <fincs.alt1@gmail.com>
Sun, 29 Nov 2015 19:45:34 +0000 (20:45 +0100)
committerfincs <fincs.alt1@gmail.com>
Mon, 7 Dec 2015 10:44:36 +0000 (11:44 +0100)
libctru/source/thread.c

index 1b21c48f9eb427042e861a8a24ea545a238b0a07..8413f52cbb58f4c5b13ff3c6f833ead426df3342 100644 (file)
@@ -1,5 +1,6 @@
 #include "internal.h"
 #include <stdlib.h>
+#include <malloc.h>
 #include <string.h>
 
 extern const u8 __tdata_lma[];
@@ -49,7 +50,7 @@ Thread threadCreate(ThreadFunc entrypoint, void* arg, size_t stack_size, int pri
        if ((allocsize-stackoffset) < stack_size) return NULL;
        if ((allocsize+tlssize) < allocsize) return NULL;
 
-       Thread t = (Thread)malloc(allocsize+tlssize);
+       Thread t = (Thread)memalign(8,allocsize+tlssize);
        if (!t) return NULL;
 
        t->ep       = entrypoint;