mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
* align tcb on 32bit boundary
This commit is contained in:
parent
b1c61e446f
commit
9122445c27
@ -84,7 +84,18 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
|
||||
/* allocate our thread control block at the top of our stackspace */
|
||||
int total_stacksize = stacksize;
|
||||
stacksize -= sizeof(tcb);
|
||||
tcb *cb = (tcb*) (stack + stacksize);
|
||||
|
||||
/* align tcb address on 32bit boundary */
|
||||
unsigned int tcb_address = (unsigned int) stack + stacksize;
|
||||
if ( tcb_address & 1 ) {
|
||||
tcb_address--;
|
||||
stacksize--;
|
||||
}
|
||||
if ( tcb_address & 2 ) {
|
||||
tcb_address-=2;
|
||||
stacksize-=2;
|
||||
}
|
||||
tcb *cb = (tcb*) tcb_address;
|
||||
|
||||
if (priority >= SCHED_PRIO_LEVELS) {
|
||||
return -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user