create_thread_user_stack(): Fix incorrect handling of TLS size
In case a custom stack was given, the TLS size was subtracted from the stack base, not the stack size.
This commit is contained in:
@@ -793,10 +793,8 @@ create_thread_user_stack(Team* team, Thread* thread, void* _stackBase,
|
|||||||
if (stackSize < MIN_USER_STACK_SIZE)
|
if (stackSize < MIN_USER_STACK_SIZE)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
stackBase -= TLS_SIZE;
|
stackSize -= TLS_SIZE;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (stackBase == NULL) {
|
|
||||||
// No user-defined stack -- allocate one. For non-main threads the stack
|
// No user-defined stack -- allocate one. For non-main threads the stack
|
||||||
// will be between USER_STACK_REGION and the main thread stack area. For
|
// will be between USER_STACK_REGION and the main thread stack area. For
|
||||||
// a main thread the position is fixed.
|
// a main thread the position is fixed.
|
||||||
|
|||||||
Reference in New Issue
Block a user