From: fincs Date: Sun, 29 Nov 2015 19:45:34 +0000 (+0100) Subject: Fix thread stack alignment X-Git-Tag: v1.0.0~2 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=a7a0613f388f86ac8ee31c865fbf428d2a31b1d8;p=corbenik%2Fctrulib.git Fix thread stack alignment --- diff --git a/libctru/source/thread.c b/libctru/source/thread.c index 1b21c48..8413f52 100644 --- a/libctru/source/thread.c +++ b/libctru/source/thread.c @@ -1,5 +1,6 @@ #include "internal.h" #include +#include #include 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;