This implements the required asm functions for sparc64_sysv_elf and
was tested on an OpenBSD/sparc64 system.
Jump_fcontext uses an extra C call frame to store the frame-pointer and
return address. Because of this the code is simply a save (to new reg
window), then forcing a window flush and finally switch stack and restore
from there.
Since jump_fcontext() uses a register window and stack frame, make_fcontext()
reserves two call frames on the stack (one for jump_fcontext() and the other
for the callback function).
OpenBSD/sparc64 uses stackghost which prevents userland from overriding the
return-address on the stack. Because of this make_fcontext() uses an extra
trampoline to implement the _exit(0) call if the callback returns.
All tests pass with this on OpenBSD/sparc64 (also the tests for fiber,
coroutine and coroutine2).
This implements the required asm functions for sparc64_sysv_elf and
was tested on an OpenBSD/sparc64 system.
Jump_fcontext uses an extra C call frame to store the frame-pointer and
return address. Because of this the code is simply a save (to new reg
window), then forcing a window flush and finally switch stack and restore
from there.
Since jump_fcontext() uses a register window and stack frame, make_fcontext()
reserves two call frames on the stack (one for jump_fcontext() and the other
for the callback function).
OpenBSD/sparc64 uses stackghost which prevents userland from overriding the
return-address on the stack. Because of this make_fcontext() uses an extra
trampoline to implement the _exit(0) call if the callback returns.
All tests pass with this on OpenBSD/sparc64 (also the tests for fiber,
coroutine and coroutine2).
BOOST_OS_MACOS is always defined; when we're not compiling
for Mac OS, it's just defined as zero. So, the correct
check is `#if BOOST_OS_MACOS`, because `#ifdef BOOST_OS_MACOS`
is true on any operating system.
Fixes: cc106be672
Reported-by: Ilya Kurdyukov <ilyakurdyukov@altlinux.org>
`in` operator in bjam always returns true if its first
argument has no elements[1]. This means that if `os.platform`
is empty (not detected), the construction introduced
in commit d039c8e4da sets
ABI to `aapcs` on all platforms where `os.platform` is
empty, including, e.g. riscv64, and breaks build there.
This commit refactors the condition to use '=' operator,
to make sure that when `os.platform` is empty we get
the default ABI value, and thus fixes build on riscv64.
[1] https://www.boost.org/doc/libs/1_83_0/tools/build/doc/html/index.html#jam.language.flow_of_control
Fixes: d039c8e4da
SysV ABI requires a stack alignment of 16 bytes. Currently, for i386
with SysV ABI, the trampoline function is entered with an unaligned
stack. This causes problems for the context-function that is jumped to
as its stack is also unaligned. This causes a crash for our use-case
because the context function contains an SSE instruction which reads
from the stack. The SSE instruction requires the correct alignment.
Fix it by changing the 0x2c offset to 0x30, such that the stack remains
aligned.