Commit Graph

109 Commits

Author SHA1 Message Date
George Koehler
df8fb6b528 Fix ppc32 on Linux musl, NetBSD, OpenBSD; fixes #120
This fixes fcontext on my PowerBook G4 running Void Linux
ppc-musl-20190901, NetBSD/macppc 8.1, or OpenBSD/macppc 6.6-current,
all with g++.  These systems use fcontext for *ppc32_sysv_elf*
(PowerPC 32-bit System V ELF).  The assembly code was wrong for BSD
and crashing on Linux musl.

Linux returns a transfer_t in memory (through a hidden pointer in R3),
but other systems (at least NetBSD and OpenBSD) return a transfer_t in
registers R3:R4.  jump_fcontext() and ontop_fcontext() were always
using the hidden pointer.  Add checks for `#ifdef__linux__`; start
using R3:R4 on other systems.

make_fcontext() was calling _exit(0) through the insecure BSS PLT.
Set R30 to use the secure PLT.  This prevents a crash when musl's
ld.so loads the executable; musl seems to require the secure PLT.

Fix ontop_fcontext() to restore the hidden pointer on Linux.  It was
passing the wrong context's hidden pointer to the ontop-function fn(),
so fn() returned a transfer_t to the wrong stack.  When fn() was
context_exit() in <boost/context/continuation_fcontext.hpp>, it freed
the old stack, then returned `transfer_t{ nullptr, nullptr }` to free
memory.  This crashed on Linux musl.

Now that ontop_fcontext() restores the hidden pointer, it must stop
abusing the same pointer to pass a transfer_t argument to fn().  Add a
new ontop_fcontext_tail() in C++, which takes arguments in registers
and allocates a transfer_t.  The code is in C++ so it can free the
transfer_t argument if fn() throws a C++ exception.

Rearrange the context frame to shrink it from 244 to 240 bytes.  This
fixes the stack alignment: the ABI requires R1 % 16 == 0, and
make_fcontext() respects this, but jump_fcontext() was adding 244 to
R1, so the new context ran with a misaligned stack (244 % 16 == 4).

Remove R13 from the context frame, so new contexts stop loading R13
with garbage.  The ABI uses R13 to point to the executable's small
data, so R13 should have the same value in every context.

Add the backchain to the context frame; make room by moving LR to the
caller's frame.  Order CR, R14 to R31, F14 to F31 at the frame's end,
as is typical for this ABI.  Provide 8-byte alignment for FPSCR and
F14 to F31, to avoid a misalignment penalty.
2019-10-19 14:06:24 -04:00
Naveenaidu
adecfdc88c S390x: Add Support for s390x arch 2019-09-06 20:08:10 +05:30
Oliver Kowalke
0c754f90c5 execution_context removed 2019-08-29 13:42:03 +02:00
Oliver Kowalke
9c772a7830
Revert "S390x Implementation: WIP" 2019-08-03 08:33:17 +02:00
Naveenaidu
cc71b90db6 Jamfile.v2: Fix binary format s390x 2019-08-03 09:27:55 +05:30
Naveenaidu
2d56804025 Jamfile.v2: Add s390x arch 2019-07-22 22:53:43 +05:30
Andreas Schwab
c8fb4a42f3 Add support for RISC-V LP64D 2019-04-09 14:15:31 +02:00
Jiaxun Yang
e3f744a186 Implement mips64 n64 elf
n64 ABI is very different from o32 ABI
2018-11-28 15:13:56 +08:00
Théo DELRIEU
d8830fedff
remove useless lines in Jamfile.v2
The gcc toolset is responsible of building assembly files.
This patch removes what seems to be old remnants.
2018-11-09 13:43:12 +01:00
Peter Dimov
554ed190ae The clang-win toolset (clang-cl.exe) uses masm from the underlying msvc 2018-10-27 15:56:32 +03:00
Brian Kuhl
09584e9f5b
Duplicate alias should be missing GCC alias
Turn duplicate sysv-power-32-elf-clang alias into missing sysv-power-32-elf-gcc alias
2018-09-14 01:16:05 -04:00
Oliver Kowalke
ac99b9bf25 prevent compiling compilation units for non-C++11 compilers 2018-03-12 12:14:50 +01:00
Oliver Kowalke
a0433d1c72 execution_context without depended compilation
- execution_context v1 in namecpase v1
- execution_context v2 in inlined namespace v2
2018-02-05 19:34:35 +01:00
Oliver Kowalke
51ea6b583d re-introduce continuation - fix conflicts 2018-02-05 13:31:35 +01:00
Oliver Kowalke
10d3264f7b implementation of fibers without scheduler according to P0876R0 2018-02-05 13:31:32 +01:00
SSE4
0660558a39 - define asm sources for Clang on Windows 2017-09-03 12:50:02 +07:00
Oliver Kowalke
fa890b1c4d adapt Jamfiles for new properties 2017-06-04 20:27:03 +02:00
Oliver Kowalke
a72f69607f support WinFibers in callcc() 2017-06-04 20:27:03 +02:00
Oliver Kowalke
4b8a730919 support ucontext_t in callcc() 2017-06-01 18:20:02 +02:00
Oliver Kowalke
81f44fc948 rename property: htm { tsx } 2017-04-26 06:34:15 +02:00
Oliver Kowalke
d3f02dbe2f support for TSX
(cherry picked from commit 8f9c379e83a21e7e9aef32dcc41f16846190f799)
2017-04-14 12:39:45 +02:00
oliver Kowalke
cc309abdba rename toolset to 'clang-win' for Windows 2017-02-07 14:23:11 +01:00
oliver Kowalke
b4be67d81f Revert "build: apply defect macro tests"
This reverts commit f8c1f30c92.

boost.context must still build for boost.coroutine
2016-09-19 09:32:41 +02:00
oliver Kowalke
f8c1f30c92 build: apply defect macro tests 2016-09-15 08:54:13 +02:00
Oliver Kowalke
29bf77b057 build with Intel C++ compiler for MacOS
- fixes #12242
2016-05-31 21:23:09 +02:00
Kohei Takahashi
469dc955cb Don't use Boost.Config build-time configure target.
In some cases it doesn't respect config macros.
2016-03-25 18:03:51 +09:00
Oliver Kowalke
9f2584ea81 experimental X32 support 2016-02-26 17:08:15 +01:00
Oliver Kowalke
5fbefd55cc specialize Jamfile for clang on Windows
- specialization lets use clangs assembler tool
2016-02-17 16:54:15 +01:00
Kohei Takahashi
01d3c901e4 Don't link boost.thread if <mutex> is available.
Linking boost.thread is unnecessary if the std library supports
std::call_once.
2016-02-05 10:48:09 +09:00
Oliver Kowalke
8710b4f928 introduction of property context-switch
- property context-switch is used to determine if captured_context
  or execution_context is used
2016-01-04 17:43:47 +01:00
Oliver Kowalke
ba357205a9 class captured_context added 2016-01-01 22:03:18 +01:00
Oliver Kowalke
f2ef6326b6 remove files related SPARC
- asm for SPARC architecture not working
2015-10-28 14:24:18 +01:00
Oliver Kowalke
df2012d99d add support for CYGWIN 2015-10-11 08:58:18 +02:00
Oliver Kowalke
6431d27506 fix #11604: Assembler Error A1010 with Intel Compiler 16.0 (win7 64bit) 2015-08-31 21:20:41 +02:00
Oliver Kowalke
b48f92384e define BOOST_DISABLE_ASSERTS in Jamfile
- for variant=release or optimization=speed define BOOST_DISABLE_ASSERTS
2015-06-13 08:00:39 +02:00
Oliver Kowalke
fcb2283c76 first guess for support of MinGW 2015-06-05 15:00:36 +02:00
Inseok Lee
4818164601 Do not export symbols for static build on PE builds.
Symbols incorrectly marked for export on static libraries exported on final executable. This change make symbols not to be marked as export on static builds.
2015-04-25 11:30:24 +09:00
Oliver Kowalke
39ccd9687e Lift architecture detection 2015-03-08 17:42:48 +01:00
Oliver Kowalke
8481d3ccfc add support for ARM64/ELF 2015-02-23 16:23:11 +01:00
Oliver Kowalke
1a119ca612 add support for Valgrind 2015-01-29 19:11:44 +01:00
Oliver Kowalke
fa078765cb me stack-allocators/some fixes 2015-01-23 22:02:20 +01:00
Oliver Kowalke
d0ab46ad5c use std::call_once + lambda in stack_traits init
- stack_traits uses std::call_once for static initialization
2015-01-15 18:31:45 +01:00
Oliver Kowalke
de60227a90 remove untested.cpp for ARM64/MACH-O 2014-12-30 21:08:50 +01:00
Oliver Kowalke
a917cd01b1 fix linker issue 2014-12-18 19:53:35 +01:00
Oliver Kowalke
c5292fea24 make ARM64 unsupported 2014-11-21 20:21:22 +01:00
Oliver Kowalke
cbcd605a24 add support fro ARM64/MACH-O 2014-11-12 19:46:42 +01:00
Axel Ismirlian
ada351d11a Fixed assembly support for PowerPC 32-bit XCOFF on AIX and added assembly support for PowerPC 64-bit XCOFF on AIX 2014-08-01 13:33:43 -05:00
Oliver Kowalke
7bf60bd05c enable support for PowerPC 32bit XCOFF on AIX 2014-07-02 19:14:20 +02:00
Oliver Kowalke
e8f58a00a6 fix typo in Jamfile.v2 reagdring to MacOSX 2014-06-11 20:49:45 +02:00
Oliver Kowalke
9d68bc3e7f enable universal and combined for PPC on MacOS X 2014-06-01 10:20:08 +02:00