]> begriffs open source - freertos/commit
bugfix: correct computation of stack size on Mac Posix port (#816)
authorMichael Fairman <52802839+tegimeki@users.noreply.github.com>
Tue, 3 Oct 2023 06:00:33 +0000 (23:00 -0700)
committerGitHub <noreply@github.com>
Tue, 3 Oct 2023 06:00:33 +0000 (11:30 +0530)
commit57f9eed00d21cbfd58dcd8f03a58f88c45f3cd9d
treee9b58b3aaa62cd1119ee173c6bc1c64fd97bbb0b
parent5a9d7c8388c32ff0bc530cd713f32e15c3e38d52
bugfix: correct computation of stack size on Mac Posix port (#816)

Aligns the stack end to a page boundary before computing its
size, since the size depends on both the start and end.

The original change which introduced stack alignment (#674)
only worked for cases where the round + trunc operation would
wind up within the same area, but would lead to segfaults in
other cases.

Also adds a typecast to the `mach_vm_round_page()` call, as
it is actually a macro which casts to `mach_vm_offset_t` and
the result here is used as a `StackType_t` pointer.

Tested on ARM64 and Intel MacOS, as well as ARM64 and Intel
Linux.  The test code included a single-task case, as well
as a case with two tasks passing queue messages.
portable/ThirdParty/GCC/Posix/port.c