mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
Rename osStackLow -> osStackLimit
This is in accordance with ARM's naming convention. "Low" is confusing, because it could refer to either the cold end of the stack as an abstract data type, or a low address. These are different places, because the stack grows down through the address space.
This commit is contained in:
parent
fb450de20e
commit
907b0a371a
1 changed files with 7 additions and 6 deletions
|
@ -86,12 +86,13 @@ void fixupBoehmStackPointer(void ** sp_ptr, void * _pthread_id)
|
||||||
auto pthread_id = reinterpret_cast<pthread_t>(_pthread_id);
|
auto pthread_id = reinterpret_cast<pthread_t>(_pthread_id);
|
||||||
pthread_attr_t pattr;
|
pthread_attr_t pattr;
|
||||||
size_t osStackSize;
|
size_t osStackSize;
|
||||||
void * osStackLow;
|
// The low address of the stack, which grows down.
|
||||||
|
void * osStackLimit;
|
||||||
void * osStackBase;
|
void * osStackBase;
|
||||||
|
|
||||||
# ifdef __APPLE__
|
# ifdef __APPLE__
|
||||||
osStackSize = pthread_get_stacksize_np(pthread_id);
|
osStackSize = pthread_get_stacksize_np(pthread_id);
|
||||||
osStackLow = pthread_get_stackaddr_np(pthread_id);
|
osStackLimit = pthread_get_stackaddr_np(pthread_id);
|
||||||
# else
|
# else
|
||||||
if (pthread_attr_init(&pattr)) {
|
if (pthread_attr_init(&pattr)) {
|
||||||
throw Error("fixupBoehmStackPointer: pthread_attr_init failed");
|
throw Error("fixupBoehmStackPointer: pthread_attr_init failed");
|
||||||
|
@ -110,18 +111,18 @@ void fixupBoehmStackPointer(void ** sp_ptr, void * _pthread_id)
|
||||||
# else
|
# else
|
||||||
# error "Need one of `pthread_attr_get_np` or `pthread_getattr_np`"
|
# error "Need one of `pthread_attr_get_np` or `pthread_getattr_np`"
|
||||||
# endif
|
# endif
|
||||||
if (pthread_attr_getstack(&pattr, &osStackLow, &osStackSize)) {
|
if (pthread_attr_getstack(&pattr, &osStackLimit, &osStackSize)) {
|
||||||
throw Error("fixupBoehmStackPointer: pthread_attr_getstack failed");
|
throw Error("fixupBoehmStackPointer: pthread_attr_getstack failed");
|
||||||
}
|
}
|
||||||
if (pthread_attr_destroy(&pattr)) {
|
if (pthread_attr_destroy(&pattr)) {
|
||||||
throw Error("fixupBoehmStackPointer: pthread_attr_destroy failed");
|
throw Error("fixupBoehmStackPointer: pthread_attr_destroy failed");
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
osStackBase = (char *) osStackLow + osStackSize;
|
osStackBase = (char *) osStackLimit + osStackSize;
|
||||||
// NOTE: We assume the stack grows down, as it does on all architectures we support.
|
// NOTE: We assume the stack grows down, as it does on all architectures we support.
|
||||||
// Architectures that grow the stack up are rare.
|
// Architectures that grow the stack up are rare.
|
||||||
if (sp >= osStackBase || sp < osStackLow) { // lo is outside the os stack
|
if (sp >= osStackBase || sp < osStackLimit) { // lo is outside the os stack
|
||||||
sp = osStackLow;
|
sp = osStackLimit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue