Page-align stack size in threadCreate

This commit is contained in:
fincs 2017-11-14 01:14:36 +01:00
parent 508a87ea5d
commit 5e0b10db70

View File

@ -8,6 +8,7 @@ extern const u8 __tdata_lma_end[];
extern u8 __tls_start[]; extern u8 __tls_start[];
extern u8 __tls_end[]; extern u8 __tls_end[];
// Thread creation args; keep this struct's size 16-byte aligned
typedef struct { typedef struct {
Thread* t; Thread* t;
ThreadFunc entry; ThreadFunc entry;
@ -34,7 +35,7 @@ Result threadCreate(
Thread* t, ThreadFunc entry, void* arg, size_t stack_sz, int prio, Thread* t, ThreadFunc entry, void* arg, size_t stack_sz, int prio,
int cpuid) int cpuid)
{ {
stack_sz = (stack_sz+0xF) &~ 0xF; stack_sz = (stack_sz+0xFFF) &~ 0xFFF;
Result rc = 0; Result rc = 0;
size_t reent_sz = (sizeof(struct _reent)+0xF) &~ 0xF; size_t reent_sz = (sizeof(struct _reent)+0xF) &~ 0xF;