From 676b4e5d7930aaa22a06113b51440ffa65558279 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Sun, 16 Feb 2014 21:07:50 +0100 Subject: [PATCH] fcontext_t as typedef of void* --- example/Jamfile.v2 | 1 - example/exception.cpp | 17 +--- example/exit.cpp | 20 ++-- example/jump.cpp | 33 +------ example/transfer.cpp | 12 +-- include/boost/context/detail/config.hpp | 11 +++ include/boost/context/detail/fcontext_arm.hpp | 68 -------------- .../boost/context/detail/fcontext_arm_mac.hpp | 70 -------------- .../boost/context/detail/fcontext_arm_win.hpp | 71 -------------- .../boost/context/detail/fcontext_i386.hpp | 59 ------------ .../context/detail/fcontext_i386_win.hpp | 88 ------------------ .../boost/context/detail/fcontext_mips.hpp | 70 -------------- include/boost/context/detail/fcontext_ppc.hpp | 72 --------------- .../boost/context/detail/fcontext_sparc.hpp | 90 ------------------ .../boost/context/detail/fcontext_x86_64.hpp | 68 -------------- .../context/detail/fcontext_x86_64_win.hpp | 77 ---------------- include/boost/context/fcontext.hpp | 55 +---------- performance/fcontext/performance_fcontext.cpp | 6 +- src/asm/jump_x86_64_sysv_elf_gas.S | 92 ++++++++++--------- src/asm/make_x86_64_sysv_elf_gas.S | 61 ++++++------ test/test_context.cpp | 54 ++++------- 21 files changed, 137 insertions(+), 958 deletions(-) delete mode 100644 include/boost/context/detail/fcontext_arm.hpp delete mode 100644 include/boost/context/detail/fcontext_arm_mac.hpp delete mode 100644 include/boost/context/detail/fcontext_arm_win.hpp delete mode 100644 include/boost/context/detail/fcontext_i386.hpp delete mode 100644 include/boost/context/detail/fcontext_i386_win.hpp delete mode 100644 include/boost/context/detail/fcontext_mips.hpp delete mode 100644 include/boost/context/detail/fcontext_ppc.hpp delete mode 100644 include/boost/context/detail/fcontext_sparc.hpp delete mode 100644 include/boost/context/detail/fcontext_x86_64.hpp delete mode 100644 include/boost/context/detail/fcontext_x86_64_win.hpp diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index 62b73d2..da4a94d 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -50,4 +50,3 @@ exe transfer exe exception : exception.cpp ; - diff --git a/example/exception.cpp b/example/exception.cpp index 540ffb7..942b03e 100644 --- a/example/exception.cpp +++ b/example/exception.cpp @@ -5,15 +5,10 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include -#include -#include -#include #include #include -#include #include "simple_stack_allocator.hpp" @@ -25,8 +20,8 @@ typedef ctx::simple_stack_allocator< 8 * 1024 // 8kB > stack_allocator; -ctx::fcontext_t fcm; -ctx::fcontext_t * fc = 0; +ctx::fcontext_t fcm = 0; +ctx::fcontext_t fc = 0; boost::exception_ptr except; void f( intptr_t arg) @@ -35,7 +30,7 @@ void f( intptr_t arg) { throw std::runtime_error( ( char *) arg); } catch ( std::runtime_error const& e) { except = boost::current_exception(); } - ctx::jump_fcontext( fc, & fcm, arg); + ctx::jump_fcontext( & fc, fcm, arg); } int main( int argc, char * argv[]) @@ -43,11 +38,7 @@ int main( int argc, char * argv[]) stack_allocator alloc; void * base = alloc.allocate( stack_allocator::default_stacksize()); - BOOST_ASSERT( base); - fc = ctx::make_fcontext( base, stack_allocator::default_stacksize(), f); - BOOST_ASSERT( fc); - BOOST_ASSERT( base == fc->fc_stack.sp); - BOOST_ASSERT( stack_allocator::default_stacksize() == fc->fc_stack.size); + fc = ctx::make_fcontext( base, f); std::cout << "main: call start_fcontext( & fcm, fc, 0)" << std::endl; const char * what = "hello world"; diff --git a/example/exit.cpp b/example/exit.cpp index f55a79d..a99b537 100644 --- a/example/exit.cpp +++ b/example/exit.cpp @@ -5,9 +5,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include -#include #include -#include #include #include @@ -22,22 +20,23 @@ typedef ctx::simple_stack_allocator< 8 * 1024 // 8kB > stack_allocator; -ctx::fcontext_t * fc1; -ctx::fcontext_t * fc2; +ctx::fcontext_t fcm = 0; +ctx::fcontext_t fc1 = 0; +ctx::fcontext_t fc2 = 0; void f1( intptr_t) { std::cout << "f1: entered" << std::endl; - std::cout << "f1: call jump_fcontext( fc1, fc2, 0)" << std::endl; - ctx::jump_fcontext( fc1, fc2, 0); + std::cout << "f1: call jump_fcontext( & fc1, fc2, 0)" << std::endl; + ctx::jump_fcontext( & fc1, fc2, 0); std::cout << "f1: return" << std::endl; } void f2( intptr_t) { std::cout << "f2: entered" << std::endl; - std::cout << "f2: call jump_fcontext( fc2, fc1, 0)" << std::endl; - ctx::jump_fcontext( fc2, fc1, 0); + std::cout << "f2: call jump_fcontext( & fc2, fc1, 0)" << std::endl; + ctx::jump_fcontext( & fc2, fc1, 0); BOOST_ASSERT( false && ! "f2: never returns"); } @@ -45,14 +44,13 @@ int main( int argc, char * argv[]) { std::cout << "size: 0x" << std::hex << sizeof( ctx::fcontext_t) << std::endl; - ctx::fcontext_t fcm; stack_allocator alloc; void * sp1 = alloc.allocate( stack_allocator::default_stacksize()); - fc1 = ctx::make_fcontext( sp1, stack_allocator::default_stacksize(), f1); + fc1 = ctx::make_fcontext( sp1, f1); void * sp2 = alloc.allocate( stack_allocator::default_stacksize()); - fc2 = ctx::make_fcontext( sp2, stack_allocator::default_stacksize(), f2); + fc2 = ctx::make_fcontext( sp2, f2); std::cout << "main: call start_fcontext( & fcm, fc1, 0)" << std::endl; ctx::jump_fcontext( & fcm, fc1, 0); diff --git a/example/jump.cpp b/example/jump.cpp index d43e1a6..9d76e8c 100644 --- a/example/jump.cpp +++ b/example/jump.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -22,25 +21,14 @@ typedef ctx::simple_stack_allocator< 8 * 1024 // 8kB > stack_allocator; -ctx::fcontext_t fcm; -ctx::fcontext_t * fc1 = 0; -ctx::fcontext_t * fc2 = 0; +ctx::fcontext_t fcm = 0; +ctx::fcontext_t fc1 = 0; +ctx::fcontext_t fc2 = 0; void f1( intptr_t) { std::cout << "f1: entered" << std::endl; - std::cout << "f1: call jump_fcontext( fc1, fc2, 0)" << std::endl; - ctx::jump_fcontext( fc1, fc2, 0); - std::cout << "f1: return" << std::endl; - ctx::jump_fcontext( fc1, & fcm, 0); -} - -void f2( intptr_t) -{ - std::cout << "f2: entered" << std::endl; - std::cout << "f2: call jump_fcontext( fc2, fc1, 0)" << std::endl; - ctx::jump_fcontext( fc2, fc1, 0); - BOOST_ASSERT( false && ! "f2: never returns"); + ctx::jump_fcontext( & fc1, fcm, 0); } int main( int argc, char * argv[]) @@ -48,18 +36,7 @@ int main( int argc, char * argv[]) stack_allocator alloc; void * base1 = alloc.allocate( stack_allocator::default_stacksize()); - BOOST_ASSERT( base1); - fc1 = ctx::make_fcontext( base1, stack_allocator::default_stacksize(), f1); - BOOST_ASSERT( fc1); - BOOST_ASSERT( base1 == fc1->fc_stack.sp); - BOOST_ASSERT( stack_allocator::default_stacksize() == fc1->fc_stack.size); - - void * base2 = alloc.allocate( stack_allocator::default_stacksize()); - BOOST_ASSERT( base2); - fc2 = ctx::make_fcontext( base2, stack_allocator::default_stacksize(), f2); - BOOST_ASSERT( fc2); - BOOST_ASSERT( base2 == fc2->fc_stack.sp); - BOOST_ASSERT( stack_allocator::default_stacksize() == fc2->fc_stack.size); + fc1 = ctx::make_fcontext( base1, f1); std::cout << "main: call start_fcontext( & fcm, fc1, 0)" << std::endl; ctx::jump_fcontext( & fcm, fc1, 0); diff --git a/example/transfer.cpp b/example/transfer.cpp index 5aac4c9..391f8da 100644 --- a/example/transfer.cpp +++ b/example/transfer.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include #include #include @@ -23,8 +21,8 @@ typedef ctx::simple_stack_allocator< 8 * 1024 // 8kB > stack_allocator; -ctx::fcontext_t fcm; -ctx::fcontext_t * fc1; +ctx::fcontext_t fcm = 0; +ctx::fcontext_t fc1 = 0; typedef std::pair< int, int > pair_t; @@ -32,9 +30,9 @@ void f1( intptr_t param) { pair_t * p = ( pair_t *) param; - p = ( pair_t *) ctx::jump_fcontext( fc1, & fcm, ( intptr_t) ( p->first + p->second) ); + p = ( pair_t *) ctx::jump_fcontext( & fc1, fcm, ( intptr_t) ( p->first + p->second) ); - ctx::jump_fcontext( fc1, & fcm, ( intptr_t) ( p->first + p->second) ); + ctx::jump_fcontext( & fc1, fcm, ( intptr_t) ( p->first + p->second) ); } int main( int argc, char * argv[]) @@ -42,7 +40,7 @@ int main( int argc, char * argv[]) stack_allocator alloc; void * sp = alloc.allocate( stack_allocator::default_stacksize() ); - fc1 = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f1); + fc1 = ctx::make_fcontext( sp, f1); pair_t p( std::make_pair( 2, 7) ); int res = ( int) ctx::jump_fcontext( & fcm, fc1, ( intptr_t) & p); diff --git a/include/boost/context/detail/config.hpp b/include/boost/context/detail/config.hpp index 3f59ed0..c30c8f8 100644 --- a/include/boost/context/detail/config.hpp +++ b/include/boost/context/detail/config.hpp @@ -35,4 +35,15 @@ # include #endif +#undef BOOST_CONTEXT_CALLDECL +#if (defined(i386) || defined(__i386__) || defined(__i386) \ + || defined(__i486__) || defined(__i586__) || defined(__i686__) \ + || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \ + || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \ + || defined(_M_IX86) || defined(_I86_)) && defined(BOOST_WINDOWS) +# define BOOST_CONTEXT_CALLDECL __cdecl +#else +# define BOOST_CONTEXT_CALLDECL +#endif + #endif // BOOST_CONTEXT_DETAIL_CONFIG_H diff --git a/include/boost/context/detail/fcontext_arm.hpp b/include/boost/context/detail/fcontext_arm.hpp deleted file mode 100644 index 8b88ccf..0000000 --- a/include/boost/context/detail/fcontext_arm.hpp +++ /dev/null @@ -1,68 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -struct stack_t -{ - void * sp; - std::size_t size; - - stack_t() : - sp( 0), size( 0) - {} -}; - -struct fp_t -{ - boost::uint32_t fc_freg[16]; - - fp_t() : - fc_freg() - {} -}; - -struct fcontext_t -{ - boost::uint32_t fc_greg[11]; - stack_t fc_stack; - fp_t fc_fp; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_fp() - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_H diff --git a/include/boost/context/detail/fcontext_arm_mac.hpp b/include/boost/context/detail/fcontext_arm_mac.hpp deleted file mode 100644 index a8416ef..0000000 --- a/include/boost/context/detail/fcontext_arm_mac.hpp +++ /dev/null @@ -1,70 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -struct stack_t -{ - void * sp; - std::size_t size; - - stack_t() : - sp( 0), size( 0) - {} -}; - -struct fp_t -{ - boost::uint32_t fc_freg[16]; - - fp_t() : - fc_freg() - {} -}; - -struct fcontext_t -{ - boost::uint32_t fc_greg[11]; - stack_t fc_stack; - fp_t fc_fp; - void * fc_unwind_sjlj; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_fp(), - fc_unwind_sjlj( 0) - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H diff --git a/include/boost/context/detail/fcontext_arm_win.hpp b/include/boost/context/detail/fcontext_arm_win.hpp deleted file mode 100644 index 5449ae7..0000000 --- a/include/boost/context/detail/fcontext_arm_win.hpp +++ /dev/null @@ -1,71 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_WIN_H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_WIN_H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -struct stack_t -{ - void * sp; - std::size_t size; - void * limit; - - stack_t() : - sp( 0), size( 0), limit( 0) - {} -}; - -struct fp_t -{ - boost::uint32_t fc_freg[16]; - - fp_t() : - fc_freg() - {} -}; - -struct fcontext_t -{ - boost::uint32_t fc_greg[11]; - stack_t fc_stack; - fp_t fc_fp; - boost::uint32_t fc_dealloc; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_fp(), - fc_dealloc( 0) - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_WIN_H diff --git a/include/boost/context/detail/fcontext_i386.hpp b/include/boost/context/detail/fcontext_i386.hpp deleted file mode 100644 index 2e01323..0000000 --- a/include/boost/context/detail/fcontext_i386.hpp +++ /dev/null @@ -1,59 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_I386H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_I386H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL __attribute__((cdecl)) - -struct stack_t -{ - void * sp; - std::size_t size; - - stack_t() : - sp( 0), size( 0) - {} -}; - -struct fcontext_t -{ - boost::uint32_t fc_greg[6]; - stack_t fc_stack; - boost::uint32_t fc_freg[2]; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_freg() - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_I386_H diff --git a/include/boost/context/detail/fcontext_i386_win.hpp b/include/boost/context/detail/fcontext_i386_win.hpp deleted file mode 100644 index 44c6b0e..0000000 --- a/include/boost/context/detail/fcontext_i386_win.hpp +++ /dev/null @@ -1,88 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_I386H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_I386H - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include - -#include -#include - -#include - -#if defined(BOOST_MSVC) -#pragma warning(push) -#pragma warning(disable:4351) -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL __cdecl - -struct stack_t -{ - void * sp; - std::size_t size; - void * limit; - - stack_t() : - sp( 0), size( 0), limit( 0) - {} -}; - -struct fp_t -{ - boost::uint32_t fc_freg[2]; - - fp_t() : - fc_freg() - {} -}; - -struct fcontext_t -{ - boost::uint32_t fc_greg[6]; - stack_t fc_stack; - void * fc_excpt_lst; - void * fc_local_storage; - fp_t fc_fp; - boost::uint32_t fc_dealloc; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_excpt_lst( 0), - fc_local_storage( 0), - fc_fp(), - fc_dealloc( 0) - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_I386_H diff --git a/include/boost/context/detail/fcontext_mips.hpp b/include/boost/context/detail/fcontext_mips.hpp deleted file mode 100644 index d3cd60d..0000000 --- a/include/boost/context/detail/fcontext_mips.hpp +++ /dev/null @@ -1,70 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -// on MIPS we assume 64bit regsiters - even for 32bit ABIs - -struct stack_t -{ - void * sp; - std::size_t size; - - stack_t() : - sp( 0), size( 0) - {} -}; - -struct fp_t -{ - boost::uint64_t fc_freg[6]; - - fp_t() : - fc_freg() - {} -}; - -struct fcontext_t -{ - boost::uint32_t fc_greg[12]; - stack_t fc_stack; - fp_t fc_fp; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_fp() - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_MIPS_H diff --git a/include/boost/context/detail/fcontext_ppc.hpp b/include/boost/context/detail/fcontext_ppc.hpp deleted file mode 100644 index 6cb019f..0000000 --- a/include/boost/context/detail/fcontext_ppc.hpp +++ /dev/null @@ -1,72 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -struct stack_t -{ - void * sp; - std::size_t size; - - stack_t() : - sp( 0), size( 0) - {} -}; - -struct fp_t -{ - boost::uint64_t fc_freg[19]; - - fp_t() : - fc_freg() - {} -}; - -struct fcontext_t -{ -# if defined(__powerpc64__) - boost::uint64_t fc_greg[23]; -# else - boost::uint32_t fc_greg[23]; -# endif - stack_t fc_stack; - fp_t fc_fp; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_fp() - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H diff --git a/include/boost/context/detail/fcontext_sparc.hpp b/include/boost/context/detail/fcontext_sparc.hpp deleted file mode 100644 index 9264714..0000000 --- a/include/boost/context/detail/fcontext_sparc.hpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright Martin Husemann 2012 -// 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) - -#ifndef BOOST_CTX_DETAIL_FCONTEXT_SPARC_H -#define BOOST_CTX_DETAIL_FCONTEXT_SPARC_H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -// if defined(_LP64) we are compiling for sparc64, otherwise it is 32 bit -// sparc. - - -struct stack_t -{ - void * sp; - std::size_t size; - - stack_t() : - sp( 0), size( 0) - {} -}; - -struct fp_t -{ -#ifdef _LP64 - boost::uint64_t fp_freg[32]; - boost::uint64_t fp_fprs, fp_fsr; -#else - boost::uint64_t fp_freg[16]; - boost::uint32_t fp_fsr; -#endif - - fp_t() : - fp_freg(), -#ifdef _LP64 - fp_fprs(), -#endif - fp_fsr() - {} -} -#ifdef _LP64 - __attribute__((__aligned__(64))) // allow VIS instructions to be used -#endif -; - -struct fcontext_t -{ - fp_t fc_fp; // fpu stuff first, for easier alignement -#ifdef _LP64 - boost::uint64_t -#else - boost::uint32_t -#endif - fc_greg[8]; - stack_t fc_stack; - - fcontext_t() : - fc_fp(), - fc_greg(), - fc_stack() - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CTX_DETAIL_FCONTEXT_SPARC_H diff --git a/include/boost/context/detail/fcontext_x86_64.hpp b/include/boost/context/detail/fcontext_x86_64.hpp deleted file mode 100644 index 6e8d93c..0000000 --- a/include/boost/context/detail/fcontext_x86_64.hpp +++ /dev/null @@ -1,68 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H - -#include - -#include -#include - -#include - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -struct stack_t -{ - void * sp; - std::size_t size; - - stack_t() : - sp( 0), size( 0) - {} -}; - -struct fp_t -{ - boost::uint32_t fc_freg[2]; - - fp_t() : - fc_freg() - {} -}; - -struct fcontext_t -{ - boost::uint64_t fc_greg[8]; - stack_t fc_stack; - fp_t fc_fp; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_fp() - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H diff --git a/include/boost/context/detail/fcontext_x86_64_win.hpp b/include/boost/context/detail/fcontext_x86_64_win.hpp deleted file mode 100644 index 7bcea55..0000000 --- a/include/boost/context/detail/fcontext_x86_64_win.hpp +++ /dev/null @@ -1,77 +0,0 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H -#define BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include - -#include -#include - -#include - -#if defined(BOOST_MSVC) -#pragma warning(push) -#pragma warning(disable:4351) -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace boost { -namespace context { - -extern "C" { - -#define BOOST_CONTEXT_CALLDECL - -struct stack_t -{ - void * sp; - std::size_t size; - void * limit; - - stack_t() : - sp( 0), size( 0), limit( 0) - {} -}; - -struct fcontext_t -{ - boost::uint64_t fc_greg[10]; - stack_t fc_stack; - void * fc_local_storage; - boost::uint64_t fc_fp[24]; - boost::uint64_t fc_dealloc; - - fcontext_t() : - fc_greg(), - fc_stack(), - fc_local_storage( 0), - fc_fp(), - fc_dealloc() - {} -}; - -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - -#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_X86_64_H diff --git a/include/boost/context/fcontext.hpp b/include/boost/context/fcontext.hpp index 26b5ab9..0e257c8 100644 --- a/include/boost/context/fcontext.hpp +++ b/include/boost/context/fcontext.hpp @@ -24,61 +24,16 @@ typedef int intptr_t; # include BOOST_ABI_PREFIX #endif -// x86_64 -// test x86_64 before i386 because icc might -// define __i686__ for x86_64 too -#if defined(__x86_64__) || defined(__x86_64) \ - || defined(__amd64__) || defined(__amd64) \ - || defined(_M_X64) || defined(_M_AMD64) -# if defined(BOOST_WINDOWS) -# include -# else -# include -# endif -// i386 -#elif defined(i386) || defined(__i386__) || defined(__i386) \ - || defined(__i486__) || defined(__i586__) || defined(__i686__) \ - || defined(__X86__) || defined(_X86_) || defined(__THW_INTEL__) \ - || defined(__I86__) || defined(__INTEL__) || defined(__IA32__) \ - || defined(_M_IX86) || defined(_I86_) -# if defined(BOOST_WINDOWS) -# include -# else -# include -# endif -// arm -#elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) \ - || defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) -# if defined(BOOST_WINDOWS) -# include -# elif defined(__MACH__) && defined(__APPLE__) -# include -# else -# include -# endif -// mips -#elif (defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) \ - || defined(_R3000) -# include -// powerpc -#elif defined(__powerpc) || defined(__powerpc__) || defined(__ppc) \ - || defined(__ppc__) || defined(_ARCH_PPC) || defined(__POWERPC__) \ - || defined(__PPCGECKO__) || defined(__PPCBROADWAY) || defined(_XENON) -# include -#elif defined(__sparc__) || defined(__sparc) -// sparc or sparc64 -# include -#else -# error "platform not supported" -#endif - namespace boost { namespace context { +typedef void* fcontext_t; + extern "C" BOOST_CONTEXT_DECL -intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu = true); +intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t nfc, + intptr_t vp, bool preserve_fpu = true); extern "C" BOOST_CONTEXT_DECL -fcontext_t * BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( intptr_t) ); +fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, void (* fn)( intptr_t) ); }} diff --git a/performance/fcontext/performance_fcontext.cpp b/performance/fcontext/performance_fcontext.cpp index 1693793..15a842c 100644 --- a/performance/fcontext/performance_fcontext.cpp +++ b/performance/fcontext/performance_fcontext.cpp @@ -24,10 +24,11 @@ typedef boost::context::simple_stack_allocator< bool preserve_fpu = false; boost::uint64_t jobs = 1000; -boost::context::fcontext_t fcm, * fc; +boost::context::fcontext_t fcm = 0; +boost::context::fcontext_t fc = 0; static void fn( intptr_t) -{ while ( true) boost::context::jump_fcontext( fc, & fcm, 7, preserve_fpu); } +{ while ( true) boost::context::jump_fcontext( & fc, fcm, 7, preserve_fpu); } duration_type measure_time() { @@ -94,7 +95,6 @@ int main( int argc, char * argv[]) stack_allocator stack_alloc; fc = boost::context::make_fcontext( stack_alloc.allocate( stack_allocator::default_stacksize() ), - stack_allocator::default_stacksize(), fn); boost::uint64_t res = measure_time().count(); diff --git a/src/asm/jump_x86_64_sysv_elf_gas.S b/src/asm/jump_x86_64_sysv_elf_gas.S index 01a567a..9dae856 100644 --- a/src/asm/jump_x86_64_sysv_elf_gas.S +++ b/src/asm/jump_x86_64_sysv_elf_gas.S @@ -12,28 +12,14 @@ * ---------------------------------------------------------------------------------- * * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | * * ---------------------------------------------------------------------------------- * - * | RBX | R12 | R13 | R14 | * + * | fc_mxcsr|fc_x87_cw| R12 | R13 | R14 | * * ---------------------------------------------------------------------------------- * * ---------------------------------------------------------------------------------- * * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * * ---------------------------------------------------------------------------------- * * | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | * * ---------------------------------------------------------------------------------- * - * | R15 | RBP | RSP | RIP | * - * ---------------------------------------------------------------------------------- * - * ---------------------------------------------------------------------------------- * - * | 16 | 17 | 18 | 19 | | * - * ---------------------------------------------------------------------------------- * - * | 0x40 | 0x44 | 0x48 | 0x4c | | * - * ---------------------------------------------------------------------------------- * - * | sp | size | | * - * ---------------------------------------------------------------------------------- * - * ---------------------------------------------------------------------------------- * - * | 20 | 21 | | * - * ---------------------------------------------------------------------------------- * - * | 0x50 | 0x54 | | * - * ---------------------------------------------------------------------------------- * - * | fc_mxcsr|fc_x87_cw| | * + * | R15 | RBX | RBP | RIP | * * ---------------------------------------------------------------------------------- * * * * **************************************************************************************/ @@ -43,42 +29,62 @@ .type jump_fcontext,@function .align 16 jump_fcontext: - movq %rbx, (%rdi) /* save RBX */ - movq %r12, 0x8(%rdi) /* save R12 */ - movq %r13, 0x10(%rdi) /* save R13 */ - movq %r14, 0x18(%rdi) /* save R14 */ - movq %r15, 0x20(%rdi) /* save R15 */ - movq %rbp, 0x28(%rdi) /* save RBP */ + pushq %rbp /* save RBP */ + pushq %rbx /* save RBX */ + pushq %r15 /* save R15 */ + pushq %r14 /* save R14 */ + pushq %r13 /* save R13 */ + pushq %r12 /* save R12 */ - cmp $0, %rcx - je 1f + /* prepare stack for FPU */ + leaq -0x8(%rsp), %rsp - stmxcsr 0x50(%rdi) /* save MMX control and status word */ - fnstcw 0x54(%rdi) /* save x87 control word */ + /* test for flag preserve_fpu */ + cmp $0, %rcx + je 1f + + /* save MMX control and status word */ + stmxcsr (%rsp) + /* save x87 control word */ + fnstcw 0x4(%rsp) - ldmxcsr 0x50(%rsi) /* restore MMX control and status word */ - fldcw 0x54(%rsi) /* restore x87 control word */ 1: + /* store RSP pointing to context-data in RDI */ + movq %rsp, (%rdi) - leaq 0x8(%rsp), %rax /* exclude the return address and save as stack pointer */ - movq %rax, 0x30(%rdi) /* save as stack pointer */ - movq (%rsp), %rax /* save return address */ - movq %rax, 0x38(%rdi) /* save return address as RIP */ + /* restore RSP pointing to context-data from RSI */ + movq %rsi, %rsp - movq (%rsi), %rbx /* restore RBX */ - movq 0x8(%rsi), %r12 /* restore R12 */ - movq 0x10(%rsi), %r13 /* restore R13 */ - movq 0x18(%rsi), %r14 /* restore R14 */ - movq 0x20(%rsi), %r15 /* restore R15 */ - movq 0x28(%rsi), %rbp /* restore RBP */ + /* test for flag preserve_fpu */ + cmp $0, %rcx + je 2f - movq 0x30(%rsi), %rsp /* restore RSP */ - movq 0x38(%rsi), %rcx /* fetch the address to return to */ + /* restore MMX control and status word */ + ldmxcsr (%rsp) + /* restore x87 control word */ + fldcw 0x4(%rsp) - movq %rdx, %rax /* use third arg as return value after jump */ - movq %rdx, %rdi /* use third arg as first arg in context function */ +2: + /* prepare stack for FPU */ + leaq 0x8(%rsp), %rsp - jmp *%rcx /* indirect jump to context */ + popq %r12 /* restrore R12 */ + popq %r13 /* restrore R13 */ + popq %r14 /* restrore R14 */ + popq %r15 /* restrore R15 */ + popq %rbx /* restrore RBX */ + popq %rbp /* restrore RBP */ + + /* restore returns address */ + popq %r8 + + /* use third arg as return value after jump */ + movq %rdx, %rax + /* use third arg as first arg in context function */ + movq %rdx, %rdi + + /* indirect jump to context */ + jmp *%r8 .size jump_fcontext,.-jump_fcontext /* Mark that we don't need executable stack. */ diff --git a/src/asm/make_x86_64_sysv_elf_gas.S b/src/asm/make_x86_64_sysv_elf_gas.S index 0a2ff6b..0e61d34 100644 --- a/src/asm/make_x86_64_sysv_elf_gas.S +++ b/src/asm/make_x86_64_sysv_elf_gas.S @@ -12,28 +12,14 @@ * ---------------------------------------------------------------------------------- * * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | * * ---------------------------------------------------------------------------------- * - * | RBX | R12 | R13 | R14 | * + * | fc_mxcsr|fc_x87_cw| R12 | R13 | R14 | * * ---------------------------------------------------------------------------------- * * ---------------------------------------------------------------------------------- * * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * * ---------------------------------------------------------------------------------- * * | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | * * ---------------------------------------------------------------------------------- * - * | R15 | RBP | RSP | RIP | * - * ---------------------------------------------------------------------------------- * - * ---------------------------------------------------------------------------------- * - * | 16 | 17 | 18 | 19 | | * - * ---------------------------------------------------------------------------------- * - * | 0x40 | 0x44 | 0x48 | 0x4c | | * - * ---------------------------------------------------------------------------------- * - * | sp | size | | * - * ---------------------------------------------------------------------------------- * - * ---------------------------------------------------------------------------------- * - * | 20 | 21 | | * - * ---------------------------------------------------------------------------------- * - * | 0x50 | 0x54 | | * - * ---------------------------------------------------------------------------------- * - * | fc_mxcsr|fc_x87_cw| | * + * | R15 | RBX | RBP | RIP | * * ---------------------------------------------------------------------------------- * * * * **************************************************************************************/ @@ -43,34 +29,41 @@ .type make_fcontext,@function .align 16 make_fcontext: - leaq -0x58(%rdi), %rax /* reserve space for fcontext_t at top of context stack */ + /* first arg of make_fcontext() == top of context-stack */ + movq %rdi, %rax /* shift address in RAX to lower 16 byte boundary */ - /* == pointer to fcontext_t and address of context stack */ - andq $-16, %rax + /* == pointer to context-data */ + andq $-16, %rax - movq %rdi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */ - movq %rsi, 0x48(%rax) /* save context stack size in fcontext_t */ - movq %rdx, 0x38(%rax) /* save address of context function in fcontext_t */ + /* reserve space for context-data on context-stack */ + /* size for fc_mxcsr .. RIP + return address for coroutine-function */ + /* address of exit() == return address for coroutine-function */ + leaq -0x48(%rax), %rax - stmxcsr 0x50(%rax) /* save MMX control and status word */ - fnstcw 0x54(%rax) /* save x87 control word */ + /* second arg of make_fcontext() == address of context-function */ + movq %rsi, 0x38(%rax) - leaq -0x8(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */ - movq %rdx, 0x30(%rax) /* save address in RDX as stack pointer for context function */ + /* save MMX control and status word */ + stmxcsr (%rax) + /* save x87 control word */ + fnstcw 0x4(%rax) - leaq finish(%rip), %rcx /* compute abs address of label finish */ - movq %rcx, (%rdx) /* save address of finish as return address for context function */ - /* entered after context function returns */ + /* compute abs address of label finish */ + leaq finish(%rip), %rcx + /* save address of finish as return address for context-function */ + /* entered after context-function returns */ + movq %rcx, 0x40(%rax) - ret /* return pointer to fcontext_t placed on context stack */ + ret /* return pointer to context-data */ finish: - /* RSP points to same address as RSP on entry of context function + 0x8 */ - xorq %rdi, %rdi /* exit code is zero */ - call _exit@PLT /* exit application */ + /* exit code is zero */ + xorq %rdi, %rdi + /* exit application */ + call _exit@PLT hlt .size make_fcontext,.-make_fcontext -/* Mark that we don't need executable stack. */ +/* Mark that we don't need executable stack. */ .section .note.GNU-stack,"",%progbits diff --git a/test/test_context.cpp b/test/test_context.cpp index b09360f..560dc1c 100644 --- a/test/test_context.cpp +++ b/test/test_context.cpp @@ -27,8 +27,8 @@ typedef ctx::simple_stack_allocator< 8 * 1024 // 8kB > stack_allocator; -ctx::fcontext_t fcm; -ctx::fcontext_t * fc = 0; +ctx::fcontext_t fcm = 0; +ctx::fcontext_t fc = 0; int value1 = 0; std::string value2; double value3 = 0.; @@ -36,25 +36,25 @@ double value3 = 0.; void f1( intptr_t) { ++value1; - ctx::jump_fcontext( fc, & fcm, 0); + ctx::jump_fcontext( & fc, fcm, 0); } void f3( intptr_t) { ++value1; - ctx::jump_fcontext( fc, & fcm, 0); + ctx::jump_fcontext( & fc, fcm, 0); ++value1; - ctx::jump_fcontext( fc, & fcm, 0); + ctx::jump_fcontext( & fc, fcm, 0); } void f4( intptr_t) { - ctx::jump_fcontext( fc, & fcm, 7); + ctx::jump_fcontext( & fc, fcm, 7); } void f5( intptr_t arg) { - ctx::jump_fcontext( fc, & fcm, arg); + ctx::jump_fcontext( & fc, fcm, arg); } void f6( intptr_t arg) @@ -62,9 +62,9 @@ void f6( intptr_t arg) std::pair< int, int > data = * ( std::pair< int, int > * ) arg; int res = data.first + data.second; data = * ( std::pair< int, int > *) - ctx::jump_fcontext( fc, & fcm, ( intptr_t) res); + ctx::jump_fcontext( & fc, fcm, ( intptr_t) res); res = data.first + data.second; - ctx::jump_fcontext( fc, & fcm, ( intptr_t) res); + ctx::jump_fcontext( & fc, fcm, ( intptr_t) res); } void f7( intptr_t arg) @@ -73,7 +73,7 @@ void f7( intptr_t arg) { throw std::runtime_error( ( char *) arg); } catch ( std::runtime_error const& e) { value2 = e.what(); } - ctx::jump_fcontext( fc, & fcm, arg); + ctx::jump_fcontext( & fc, fcm, arg); } void f8( intptr_t arg) @@ -81,7 +81,7 @@ void f8( intptr_t arg) double d = * ( double *) arg; d += 3.45; value3 = d; - ctx::jump_fcontext( fc, & fcm, 0); + ctx::jump_fcontext( & fc, fcm, 0); } void test_setup() @@ -89,10 +89,8 @@ void test_setup() stack_allocator alloc; void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f1); + fc = ctx::make_fcontext( sp, f1); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); } void test_start() @@ -102,10 +100,8 @@ void test_start() stack_allocator alloc; void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f1); + fc = ctx::make_fcontext( sp, f1); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); BOOST_CHECK_EQUAL( 0, value1); ctx::jump_fcontext( & fcm, fc, 0); @@ -119,10 +115,8 @@ void test_jump() stack_allocator alloc; void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f3); + fc = ctx::make_fcontext( sp, f3); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); BOOST_CHECK_EQUAL( 0, value1); ctx::jump_fcontext( & fcm, fc, 0); @@ -136,10 +130,8 @@ void test_result() stack_allocator alloc; void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f4); + fc = ctx::make_fcontext( sp, f4); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); int result = ( int) ctx::jump_fcontext( & fcm, fc, 0); BOOST_CHECK_EQUAL( 7, result); @@ -151,10 +143,8 @@ void test_arg() int i = 7; void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f5); + fc = ctx::make_fcontext( sp, f5); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); int result = ( int) ctx::jump_fcontext( & fcm, fc, i); BOOST_CHECK_EQUAL( i, result); @@ -166,10 +156,8 @@ void test_transfer() std::pair< int, int > data = std::make_pair( 3, 7); void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f6); + fc = ctx::make_fcontext( sp, f6); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); int result = ( int) ctx::jump_fcontext( & fcm, fc, ( intptr_t) & data); BOOST_CHECK_EQUAL( 10, result); @@ -184,10 +172,8 @@ void test_exception() const char * what = "hello world"; void * sp = alloc.allocate( stack_allocator::default_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::default_stacksize(), f7); + fc = ctx::make_fcontext( sp, f7); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::default_stacksize(), fc->fc_stack.size); ctx::jump_fcontext( & fcm, fc, ( intptr_t) what); BOOST_CHECK_EQUAL( std::string( what), value2); @@ -199,10 +185,8 @@ void test_fp() double d = 7.13; void * sp = alloc.allocate( stack_allocator::minimum_stacksize() ); - fc = ctx::make_fcontext( sp, stack_allocator::minimum_stacksize(), f8); + fc = ctx::make_fcontext( sp, f8); BOOST_CHECK( fc); - BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp); - BOOST_CHECK_EQUAL( stack_allocator::minimum_stacksize(), fc->fc_stack.size); ctx::jump_fcontext( & fcm, fc, (intptr_t) & d); BOOST_CHECK_EQUAL( 10.58, value3);