mirror of
https://github.com/boostorg/context.git
synced 2026-01-19 04:02:17 +00:00
Trim redundant trailing whitespace
This commit is contained in:
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
@@ -140,7 +140,7 @@ jobs:
|
||||
if [ -n "$PACKAGES_TO_REMOVE" ]; then sudo apt-get purge -y $PACKAGES_TO_REMOVE; fi
|
||||
echo ">>>>> APT: REPO.."
|
||||
for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done
|
||||
|
||||
|
||||
if test -n "${LLVM_OS}" ; then
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
if test -n "${LLVM_VER}" ; then
|
||||
@@ -194,7 +194,7 @@ jobs:
|
||||
./b2 -j 3 libs/context/test toolset=$TOOLSET cxxstd=$CXXSTD
|
||||
|
||||
fi
|
||||
#
|
||||
#
|
||||
# osx:
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
@@ -203,7 +203,7 @@ jobs:
|
||||
#
|
||||
# Github Actions only supports certain Xcode versions
|
||||
# Change (or delete) the Xcode version for this job.
|
||||
#
|
||||
#
|
||||
# - name: "TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1 Job 7"
|
||||
# buildtype: "boost"
|
||||
# packages: ""
|
||||
@@ -219,7 +219,7 @@ jobs:
|
||||
#
|
||||
# Github Actions only supports certain Xcode versions
|
||||
# Change (or delete) the Xcode version for this job.
|
||||
#
|
||||
#
|
||||
# - name: "TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1 Job 8"
|
||||
# buildtype: "boost"
|
||||
# packages: ""
|
||||
@@ -232,19 +232,19 @@ jobs:
|
||||
# toolset: "clang"
|
||||
# compiler: "clang++"
|
||||
# cxxstd: "11,14,1z"
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# runs-on: ${{ matrix.os }}
|
||||
#
|
||||
#
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
#
|
||||
#
|
||||
# - name: Set DEVELOPER_DIR
|
||||
# if: matrix.xcode_version != ''
|
||||
# run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer" >> $GITHUB_ENV
|
||||
# - name: Test DEVELOPER_DIR
|
||||
# run: echo $DEVELOPER_DIR
|
||||
#
|
||||
#
|
||||
# - name: "osx"
|
||||
# shell: bash
|
||||
# env:
|
||||
@@ -274,11 +274,11 @@ jobs:
|
||||
# export USER=$(whoami)
|
||||
# export CC=${CC:-gcc}
|
||||
# export PATH=~/.local/bin:/usr/local/bin:$PATH
|
||||
#
|
||||
#
|
||||
# if [ "$JOB_BUILDTYPE" == "boost" ]; then
|
||||
#
|
||||
#
|
||||
# echo '==================================> INSTALL'
|
||||
#
|
||||
#
|
||||
# BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||
# cd ..
|
||||
# git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
|
||||
@@ -290,10 +290,10 @@ jobs:
|
||||
# python tools/boostdep/depinst/depinst.py context
|
||||
# ./bootstrap.sh
|
||||
# ./b2 headers
|
||||
#
|
||||
#
|
||||
# echo '==================================> SCRIPT'
|
||||
#
|
||||
#
|
||||
# echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
||||
# ./b2 -j 3 libs/context/test toolset=$TOOLSET cxxstd=$CXXSTD
|
||||
#
|
||||
#
|
||||
# fi
|
||||
|
||||
22
README.md
22
README.md
@@ -2,20 +2,20 @@ boost.context
|
||||
=============
|
||||
|
||||
boost.context is a foundational library that provides a sort of cooperative multitasking on a single thread.
|
||||
By providing an abstraction of the current execution state in the current thread, including the stack (with
|
||||
local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context
|
||||
instance represents a specific point in the application's execution path. This is useful for building
|
||||
higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to
|
||||
By providing an abstraction of the current execution state in the current thread, including the stack (with
|
||||
local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context
|
||||
instance represents a specific point in the application's execution path. This is useful for building
|
||||
higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to
|
||||
C# keyword yield in C++.
|
||||
|
||||
A fiber provides the means to suspend the current execution path and to transfer execution control,
|
||||
thereby permitting another fiber to run on the current thread. This state full transfer mechanism
|
||||
enables a fiber to suspend execution from within nested functions and, later, to resume from where it
|
||||
was suspended. While the execution path represented by a fiber only runs on a single thread, it can be
|
||||
A fiber provides the means to suspend the current execution path and to transfer execution control,
|
||||
thereby permitting another fiber to run on the current thread. This state full transfer mechanism
|
||||
enables a fiber to suspend execution from within nested functions and, later, to resume from where it
|
||||
was suspended. While the execution path represented by a fiber only runs on a single thread, it can be
|
||||
migrated to another thread at any given time.
|
||||
|
||||
A context switch between threads requires system calls (involving the OS kernel), which can cost more than
|
||||
thousand CPU cycles on x86 CPUs. By contrast, transferring control among fibers requires only fewer than
|
||||
A context switch between threads requires system calls (involving the OS kernel), which can cost more than
|
||||
thousand CPU cycles on x86 CPUs. By contrast, transferring control among fibers requires only fewer than
|
||||
hundred CPU cycles because it does not involve system calls as it is done within a single thread.
|
||||
|
||||
boost.context requires C++11!
|
||||
boost.context requires C++11!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# (C) Copyright 2008 Oliver Kowalke
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
project context/doc ;
|
||||
|
||||
@@ -19,10 +19,10 @@ void echoSSE( int i) {
|
||||
xmm = _mm_set_epi32( i, i + 1, i + 2, i + 3);
|
||||
uint32_t v32[4];
|
||||
memcpy( & v32, & xmm, 16);
|
||||
std::cout << v32[0];
|
||||
std::cout << v32[1];
|
||||
std::cout << v32[2];
|
||||
std::cout << v32[3];
|
||||
std::cout << v32[0];
|
||||
std::cout << v32[1];
|
||||
std::cout << v32[2];
|
||||
std::cout << v32[3];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ void echoSSE( int i) {
|
||||
xmm = _mm_set_epi32( i, i + 1, i + 2, i + 3);
|
||||
uint32_t v32[4];
|
||||
memcpy( & v32, & xmm, 16);
|
||||
std::cout << v32[0];
|
||||
std::cout << v32[1];
|
||||
std::cout << v32[2];
|
||||
std::cout << v32[3];
|
||||
std::cout << v32[0];
|
||||
std::cout << v32[1];
|
||||
std::cout << v32[2];
|
||||
std::cout << v32[3];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ struct BOOST_CONTEXT_DECL activation_record {
|
||||
activation_record( stack_context sctx_) noexcept :
|
||||
sctx( sctx_ ),
|
||||
main_ctx( false ) {
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~activation_record() {
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
c = boost::context::detail::invoke( fn_, std::move( c) );
|
||||
#else
|
||||
c = std::invoke( fn_, std::move( c) );
|
||||
#endif
|
||||
#endif
|
||||
} catch ( forced_unwind const& ex) {
|
||||
c = Ctx{ ex.from };
|
||||
}
|
||||
@@ -324,7 +324,7 @@ static activation_record * create_context1( StackAlloc && salloc, Fn && fn) {
|
||||
|
||||
template< typename Ctx, typename StackAlloc, typename Fn >
|
||||
static activation_record * create_context2( preallocated palloc, StackAlloc && salloc, Fn && fn) {
|
||||
typedef capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
typedef capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
|
||||
// reserve space for control structure
|
||||
void * storage = reinterpret_cast< void * >(
|
||||
@@ -478,7 +478,7 @@ public:
|
||||
}
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) {
|
||||
@@ -490,7 +490,7 @@ public:
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other);
|
||||
@@ -515,7 +515,7 @@ public:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template<
|
||||
typename Fn,
|
||||
typename = detail::disable_overload< continuation, Fn >
|
||||
|
||||
@@ -87,7 +87,7 @@ struct BOOST_CONTEXT_DECL activation_record {
|
||||
if ( BOOST_UNLIKELY( nullptr == fiber) ) {
|
||||
DWORD err = ::GetLastError();
|
||||
BOOST_ASSERT( ERROR_ALREADY_FIBER == err);
|
||||
fiber = ::GetCurrentFiber();
|
||||
fiber = ::GetCurrentFiber();
|
||||
BOOST_ASSERT( nullptr != fiber);
|
||||
BOOST_ASSERT( reinterpret_cast< LPVOID >( 0x1E00) != fiber);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ struct BOOST_CONTEXT_DECL activation_record {
|
||||
activation_record( stack_context sctx_) noexcept :
|
||||
sctx{ sctx_ },
|
||||
main_ctx{ false } {
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~activation_record() {
|
||||
if ( BOOST_UNLIKELY( main_ctx) ) {
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
c = boost::context::detail::invoke( fn_, std::move( c) );
|
||||
#else
|
||||
c = std::invoke( fn_, std::move( c) );
|
||||
#endif
|
||||
#endif
|
||||
} catch ( forced_unwind const& ex) {
|
||||
c = Ctx{ ex.from };
|
||||
}
|
||||
@@ -261,7 +261,7 @@ static activation_record * create_context1( StackAlloc && salloc, Fn && fn) {
|
||||
|
||||
template< typename Ctx, typename StackAlloc, typename Fn >
|
||||
static activation_record * create_context2( preallocated palloc, StackAlloc && salloc, Fn && fn) {
|
||||
typedef capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
typedef capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
|
||||
BOOST_ASSERT( ( sizeof( capture_t) ) < palloc.size);
|
||||
// reserve space for control structure
|
||||
@@ -387,9 +387,9 @@ public:
|
||||
bool operator<( continuation const& other) const noexcept {
|
||||
return ptr_ < other.ptr_;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) {
|
||||
@@ -401,7 +401,7 @@ public:
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other);
|
||||
@@ -426,7 +426,7 @@ public:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
template<
|
||||
typename Fn,
|
||||
typename = detail::disable_overload< continuation, Fn >
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace detail {
|
||||
|
||||
template< typename Fn, typename Tpl, std::size_t ... I >
|
||||
auto
|
||||
apply_impl( Fn && fn, Tpl && tpl, index_sequence< I ... >)
|
||||
apply_impl( Fn && fn, Tpl && tpl, index_sequence< I ... >)
|
||||
#if defined(BOOST_NO_CXX17_STD_INVOKE)
|
||||
-> decltype( boost::context::detail::invoke( std::forward< Fn >( fn), std::get< I >( std::forward< Tpl >( tpl) ) ... ) )
|
||||
#else
|
||||
@@ -51,7 +51,7 @@ apply_impl( Fn && fn, Tpl && tpl, index_sequence< I ... >)
|
||||
|
||||
template< typename Fn, typename Tpl >
|
||||
auto
|
||||
apply( Fn && fn, Tpl && tpl)
|
||||
apply( Fn && fn, Tpl && tpl)
|
||||
-> decltype( apply_impl( std::forward< Fn >( fn),
|
||||
std::forward< Tpl >( tpl),
|
||||
make_index_sequence< std::tuple_size< typename std::decay< Tpl >::type >::value >{}) )
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
defined(BOOST_NO_CXX11_UNIFIED_INITIALISATION_SYNTAX) || \
|
||||
defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \
|
||||
defined(BOOST_NO_HDR_ATOMIC) || \
|
||||
defined(BOOST_NO_HDR_TUPLE)
|
||||
defined(BOOST_NO_HDR_TUPLE)
|
||||
# define BOOST_CONTEXT_NO_CXX11
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ typename std::enable_if<
|
||||
typename std::result_of< Fn &&( Args && ... ) >::type
|
||||
>::type
|
||||
invoke( Fn && fn, Args && ... args) {
|
||||
return std::mem_fn( fn)( std::forward< Args >( args) ... );
|
||||
return std::mem_fn( fn)( std::forward< Args >( args) ... );
|
||||
}
|
||||
|
||||
template< typename Fn, typename ... Args >
|
||||
|
||||
@@ -359,7 +359,7 @@ public:
|
||||
}
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) {
|
||||
@@ -371,7 +371,7 @@ public:
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other);
|
||||
@@ -396,7 +396,7 @@ public:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
inline
|
||||
void swap( fiber & l, fiber & r) noexcept {
|
||||
l.swap( r);
|
||||
|
||||
@@ -120,7 +120,7 @@ struct BOOST_CONTEXT_DECL fiber_activation_record {
|
||||
fiber_activation_record( stack_context sctx_) noexcept :
|
||||
sctx( sctx_ ),
|
||||
main_ctx( false ) {
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~fiber_activation_record() {
|
||||
#if defined(BOOST_USE_TSAN)
|
||||
@@ -289,7 +289,7 @@ public:
|
||||
c = boost::context::detail::invoke( fn_, std::move( c) );
|
||||
#else
|
||||
c = std::invoke( fn_, std::move( c) );
|
||||
#endif
|
||||
#endif
|
||||
} catch ( forced_unwind const& ex) {
|
||||
c = Ctx{ ex.from };
|
||||
}
|
||||
@@ -357,7 +357,7 @@ static fiber_activation_record * create_fiber1( StackAlloc && salloc, Fn && fn)
|
||||
|
||||
template< typename Ctx, typename StackAlloc, typename Fn >
|
||||
static fiber_activation_record * create_fiber2( preallocated palloc, StackAlloc && salloc, Fn && fn) {
|
||||
typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
|
||||
// reserve space for control structure
|
||||
void * storage = reinterpret_cast< void * >(
|
||||
|
||||
@@ -86,7 +86,7 @@ struct BOOST_CONTEXT_DECL fiber_activation_record {
|
||||
fiber = ::ConvertThreadToFiber( nullptr);
|
||||
if ( BOOST_UNLIKELY( nullptr == fiber) ) {
|
||||
BOOST_ASSERT( ERROR_ALREADY_FIBER == ::GetLastError());
|
||||
fiber = ::GetCurrentFiber();
|
||||
fiber = ::GetCurrentFiber();
|
||||
BOOST_ASSERT( nullptr != fiber);
|
||||
BOOST_ASSERT( reinterpret_cast< LPVOID >( 0x1E00) != fiber);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ struct BOOST_CONTEXT_DECL fiber_activation_record {
|
||||
fiber_activation_record( stack_context sctx_) noexcept :
|
||||
sctx{ sctx_ },
|
||||
main_ctx{ false } {
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~fiber_activation_record() {
|
||||
if ( BOOST_UNLIKELY( main_ctx) ) {
|
||||
@@ -226,7 +226,7 @@ public:
|
||||
c = boost::context::detail::invoke( fn_, std::move( c) );
|
||||
#else
|
||||
c = std::invoke( fn_, std::move( c) );
|
||||
#endif
|
||||
#endif
|
||||
} catch ( forced_unwind const& ex) {
|
||||
c = Ctx{ ex.from };
|
||||
}
|
||||
@@ -260,7 +260,7 @@ static fiber_activation_record * create_fiber1( StackAlloc && salloc, Fn && fn)
|
||||
|
||||
template< typename Ctx, typename StackAlloc, typename Fn >
|
||||
static fiber_activation_record * create_fiber2( preallocated palloc, StackAlloc && salloc, Fn && fn) {
|
||||
typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t;
|
||||
|
||||
BOOST_ASSERT( ( sizeof( capture_t) ) < palloc.size);
|
||||
// reserve space for control structure
|
||||
@@ -390,9 +390,9 @@ public:
|
||||
bool operator<( fiber const& other) const noexcept {
|
||||
return ptr_ < other.ptr_;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) {
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
template< typename charT, class traitsT >
|
||||
friend std::basic_ostream< charT, traitsT > &
|
||||
operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other);
|
||||
|
||||
@@ -7,7 +7,7 @@ Automatic redirection failed, please go to
|
||||
<a href="doc/html/index.html">doc/html/index.html</a>
|
||||
<hr>
|
||||
<p>© Copyright Beman Dawes, 2001</p>
|
||||
<p> Distributed under the Boost Software
|
||||
<p> Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
www.boost.org/LICENSE_1_0.txt</a>)</p>
|
||||
</body>
|
||||
|
||||
@@ -26,7 +26,7 @@ cycle_type cycles()
|
||||
{
|
||||
cycle_type c;
|
||||
__asm {
|
||||
cpuid
|
||||
cpuid
|
||||
rdtsc
|
||||
mov dword ptr [c + 0], eax
|
||||
mov dword ptr [c + 4], edx
|
||||
@@ -52,7 +52,7 @@ cycle_type cycles()
|
||||
::: "%eax", "%ebx", "%ecx", "%edx"
|
||||
);
|
||||
|
||||
return ( cycle_type)hi << 32 | lo;
|
||||
return ( cycle_type)hi << 32 | lo;
|
||||
}
|
||||
#else
|
||||
# error "this compiler is not supported"
|
||||
|
||||
@@ -48,7 +48,7 @@ cycle_type cycles()
|
||||
::: "%rax", "%rbx", "%rcx", "%rdx"
|
||||
);
|
||||
|
||||
return ( cycle_type)hi << 32 | lo;
|
||||
return ( cycle_type)hi << 32 | lo;
|
||||
}
|
||||
#else
|
||||
# error "this compiler is not supported"
|
||||
|
||||
@@ -73,7 +73,7 @@ _jump_fcontext:
|
||||
|
||||
/* firstarg of jump_fcontext() == fcontext to jump to */
|
||||
movl 0x30(%esp), %ecx
|
||||
|
||||
|
||||
/* restore ESP (pointing to context-data) from ECX */
|
||||
movl %ecx, %esp
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ _jump_fcontext:
|
||||
|
||||
/* firstarg of jump_fcontext() == fcontext to jump to */
|
||||
movl 0x30(%esp), %ecx
|
||||
|
||||
|
||||
/* restore ESP (pointing to context-data) from ECX */
|
||||
movl %ecx, %esp
|
||||
|
||||
|
||||
@@ -55,17 +55,17 @@ ENDIF
|
||||
mov eax, [edx]
|
||||
mov [esp+018h], eax
|
||||
|
||||
mov [esp+01ch], edi ; save EDI
|
||||
mov [esp+020h], esi ; save ESI
|
||||
mov [esp+024h], ebx ; save EBX
|
||||
mov [esp+028h], ebp ; save EBP
|
||||
mov [esp+01ch], edi ; save EDI
|
||||
mov [esp+020h], esi ; save ESI
|
||||
mov [esp+024h], ebx ; save EBX
|
||||
mov [esp+028h], ebp ; save EBP
|
||||
|
||||
; store ESP (pointing to context-data) in EAX
|
||||
mov eax, esp
|
||||
|
||||
; firstarg of jump_fcontext() == fcontext to jump to
|
||||
mov ecx, [esp+030h]
|
||||
|
||||
|
||||
; restore ESP (pointing to context-data) from ECX
|
||||
mov esp, ecx
|
||||
|
||||
@@ -98,10 +98,10 @@ ENDIF
|
||||
|
||||
mov ecx, [esp+02ch] ; restore EIP
|
||||
|
||||
mov edi, [esp+01ch] ; restore EDI
|
||||
mov esi, [esp+020h] ; restore ESI
|
||||
mov ebx, [esp+024h] ; restore EBX
|
||||
mov ebp, [esp+028h] ; restore EBP
|
||||
mov edi, [esp+01ch] ; restore EDI
|
||||
mov esi, [esp+020h] ; restore ESI
|
||||
mov ebx, [esp+024h] ; restore EBX
|
||||
mov ebp, [esp+028h] ; restore EBP
|
||||
|
||||
; prepare stack
|
||||
lea esp, [esp+030h]
|
||||
|
||||
@@ -54,8 +54,8 @@ _jump_fcontext:
|
||||
|
||||
/* return parent fcontext_t */
|
||||
movl %ecx, %eax
|
||||
/* returned data is stored in EDX */
|
||||
|
||||
/* returned data is stored in EDX */
|
||||
|
||||
movl 0x18(%esp), %ecx /* restore EIP */
|
||||
|
||||
#if !defined(BOOST_USE_TSX)
|
||||
|
||||
@@ -102,13 +102,13 @@ jump_fcontext:
|
||||
|
||||
# adjust stack
|
||||
addiu $sp, $sp, 96
|
||||
|
||||
|
||||
# return transfer_t from jump
|
||||
sw $a0, ($v0) # fctx of transfer_t
|
||||
sw $a2, 4($v0) # data of transfer_t
|
||||
# pass transfer_t as first arg in context function
|
||||
# A0 == fctx, A1 == data
|
||||
move $a1, $a2
|
||||
move $a1, $a2
|
||||
|
||||
# jump to context
|
||||
jr $t9
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
* ------------------------------------------------- *
|
||||
* | 256 | | *
|
||||
* ------------------------------------------------- *
|
||||
* | DATA| | *
|
||||
* | DATA| | *
|
||||
* ------------------------------------------------- *
|
||||
* *
|
||||
*******************************************************/
|
||||
@@ -193,7 +193,7 @@ _jump_fcontext:
|
||||
; adjust stack
|
||||
addi r1, r1, 244
|
||||
|
||||
; return transfer_t
|
||||
; return transfer_t
|
||||
stw r6, 0(r3)
|
||||
stw r5, 4(r3)
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ _make_fcontext:
|
||||
addl $finish-2b, %ecx
|
||||
/* save address of finish as return-address for context-function */
|
||||
/* will be entered after context-function returns */
|
||||
movl %ecx, 0x14(%eax)
|
||||
movl %ecx, 0x14(%eax)
|
||||
|
||||
ret /* return pointer to context-data */
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
* ------------------------------------------------- *
|
||||
* | 256 | | *
|
||||
* ------------------------------------------------- *
|
||||
* | DATA| | *
|
||||
* | DATA| | *
|
||||
* ------------------------------------------------- *
|
||||
* *
|
||||
*******************************************************/
|
||||
@@ -101,8 +101,8 @@ _make_fcontext:
|
||||
|
||||
; compute address of returned transfer_t
|
||||
addi r0, r3, 252
|
||||
mr r4, r0
|
||||
stw r4, 228(r3)
|
||||
mr r4, r0
|
||||
stw r4, 228(r3)
|
||||
|
||||
; load LR
|
||||
mflr r0
|
||||
|
||||
@@ -151,7 +151,7 @@ make_fcontext:
|
||||
|
||||
trampoline:
|
||||
/* store return address on stack */
|
||||
/* fix stack alignment */
|
||||
/* fix stack alignment */
|
||||
pushq %rbp
|
||||
/* jump to context-function */
|
||||
jmp *%rbx
|
||||
|
||||
@@ -151,7 +151,7 @@ make_fcontext:
|
||||
|
||||
trampoline:
|
||||
/* store return address on stack */
|
||||
/* fix stack alignment */
|
||||
/* fix stack alignment */
|
||||
pushq %rbp
|
||||
/* jump to context-function */
|
||||
jmp *%rbx
|
||||
|
||||
@@ -141,7 +141,7 @@ make_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
|
||||
; compute abs address of label finish
|
||||
lea rcx, finish
|
||||
; save address of finish as return-address for context-function in RBP
|
||||
; will be entered after context-function returns
|
||||
; will be entered after context-function returns
|
||||
mov [rax+0108h], rcx
|
||||
|
||||
ret ; return pointer to context-data
|
||||
|
||||
@@ -55,10 +55,10 @@ ENDIF
|
||||
mov eax, [edx]
|
||||
mov [esp+018h], eax
|
||||
|
||||
mov [esp+01ch], edi ; save EDI
|
||||
mov [esp+020h], esi ; save ESI
|
||||
mov [esp+024h], ebx ; save EBX
|
||||
mov [esp+028h], ebp ; save EBP
|
||||
mov [esp+01ch], edi ; save EDI
|
||||
mov [esp+020h], esi ; save ESI
|
||||
mov [esp+024h], ebx ; save EBX
|
||||
mov [esp+028h], ebp ; save EBP
|
||||
|
||||
; store ESP (pointing to context-data) in ECX
|
||||
mov ecx, esp
|
||||
@@ -77,7 +77,7 @@ ENDIF
|
||||
|
||||
; third arg of ontop_fcontext() == ontop-function
|
||||
mov ecx, [esp+038h]
|
||||
|
||||
|
||||
; restore ESP (pointing to context-data) from EAX
|
||||
mov esp, eax
|
||||
|
||||
@@ -108,10 +108,10 @@ ENDIF
|
||||
mov eax, [esp+018h]
|
||||
mov [edx], eax
|
||||
|
||||
mov edi, [esp+01ch] ; restore EDI
|
||||
mov esi, [esp+020h] ; restore ESI
|
||||
mov ebx, [esp+024h] ; restore EBX
|
||||
mov ebp, [esp+028h] ; restore EBP
|
||||
mov edi, [esp+01ch] ; restore EDI
|
||||
mov esi, [esp+020h] ; restore ESI
|
||||
mov ebx, [esp+024h] ; restore EBX
|
||||
mov ebp, [esp+028h] ; restore EBP
|
||||
|
||||
; prepare stack
|
||||
lea esp, [esp+02ch]
|
||||
|
||||
@@ -102,13 +102,13 @@ ontop_fcontext:
|
||||
|
||||
# adjust stack
|
||||
addiu $sp, $sp, 96
|
||||
|
||||
|
||||
# return transfer_t from jump
|
||||
sw $a0, ($v0) # fctx of transfer_t
|
||||
sw $a2, 4($v0) # data of transfer_t
|
||||
# pass transfer_t as first arg in context function
|
||||
# A0 == hidden, A1 == fctx, A2 == data
|
||||
move $a1, $a0
|
||||
move $a1, $a0
|
||||
move $a0, $v0
|
||||
|
||||
# jump to context
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
* ------------------------------------------------- *
|
||||
* | 256 | | *
|
||||
* ------------------------------------------------- *
|
||||
* | DATA| | *
|
||||
* | DATA| | *
|
||||
* ------------------------------------------------- *
|
||||
* *
|
||||
*******************************************************/
|
||||
|
||||
@@ -197,7 +197,7 @@ ENDIF
|
||||
|
||||
; transport_t as 1.arg of context-function
|
||||
; RCX contains address of returned (hidden) transfer_t
|
||||
mov rcx, rax
|
||||
mov rcx, rax
|
||||
; RDX contains address of passed transfer_t
|
||||
mov rdx, rax
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ void test_ontop_exception() {
|
||||
c = c.resume();
|
||||
} catch ( my_exception & ex) {
|
||||
value2 = ex.what();
|
||||
return std::move( ex.c);
|
||||
return std::move( ex.c);
|
||||
}
|
||||
}
|
||||
return std::move( c);
|
||||
@@ -478,7 +478,7 @@ void test_badcatch() {
|
||||
BOOST_CHECK_EQUAL( 3, value1);
|
||||
BOOST_CHECK_EQUAL( 3., value3);
|
||||
// the destruction of ctx here will cause a forced_unwind to be thrown that is not caught
|
||||
// in fn19. That will trigger the "not caught" assertion in ~forced_unwind. Getting that
|
||||
// in fn19. That will trigger the "not caught" assertion in ~forced_unwind. Getting that
|
||||
// assertion to propogate bak here cleanly is non-trivial, and there seems to not be a good
|
||||
// way to hook directly into the assertion when it happens on an alternate stack.
|
||||
std::move( c);
|
||||
|
||||
Reference in New Issue
Block a user