2 // Copyright Oliver Kowalke 2014.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #include "boost/context/stack_traits.hpp"
13 //#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L
21 #include <boost/assert.hpp>
22 #include <boost/context/detail/config.hpp>
24 #include <boost/context/stack_context.hpp>
27 // test x86_64 before i386 because icc might
28 // define __i686__ for x86_64 too
29 #if defined(__x86_64__) || defined(__x86_64) \
30 || defined(__amd64__) || defined(__amd64) \
31 || defined(_M_X64) || defined(_M_AMD64)
33 // Windows seams not to provide a constant or function
34 // telling the minimal stacksize
35 # define MIN_STACKSIZE 8 * 1024
37 # define MIN_STACKSIZE 4 * 1024
40 #ifdef BOOST_HAS_ABI_HEADERS
41 # include BOOST_ABI_PREFIX
46 std::size_t pagesize() BOOST_NOEXCEPT_OR_NOTHROW
{
49 return static_cast< std::size_t >( si
.dwPageSize
);
57 // Windows seams not to provide a limit for the stacksize
58 // libcoco uses 32k+4k bytes as minimum
61 stack_traits::is_unbounded() BOOST_NOEXCEPT_OR_NOTHROW
{
67 stack_traits::page_size() BOOST_NOEXCEPT_OR_NOTHROW
{
68 static std::size_t size
= pagesize();
74 stack_traits::default_size() BOOST_NOEXCEPT_OR_NOTHROW
{
78 // because Windows seams not to provide a limit for minimum stacksize
81 stack_traits::minimum_size() BOOST_NOEXCEPT_OR_NOTHROW
{
85 // because Windows seams not to provide a limit for maximum stacksize
86 // maximum_size() can never be called (pre-condition ! is_unbounded() )
89 stack_traits::maximum_size() BOOST_NOEXCEPT_OR_NOTHROW
{
90 BOOST_ASSERT( ! is_unbounded() );
91 return 1 * 1024 * 1024 * 1024; // 1GB
96 #ifdef BOOST_HAS_ABI_HEADERS
97 # include BOOST_ABI_SUFFIX