first commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
|
||||
// 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_ALL_H
|
||||
#define BOOST_CONTEXT_ALL_H
|
||||
|
||||
#include <boost/context/fcontext.hpp>
|
||||
|
||||
#endif // BOOST_CONTEXT_ALL_H
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
// 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_CONFIG_H
|
||||
#define BOOST_CONTEXT_DETAIL_CONFIG_H
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifdef BOOST_CONTEXT_DECL
|
||||
# undef BOOST_CONTEXT_DECL
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_DECLSPEC)
|
||||
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
|
||||
# if ! defined(BOOST_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
# endif
|
||||
# if defined(BOOST_CONTEXT_SOURCE)
|
||||
# define BOOST_CONTEXT_DECL BOOST_SYMBOL_EXPORT
|
||||
# else
|
||||
# define BOOST_CONTEXT_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if ! defined(BOOST_CONTEXT_DECL)
|
||||
# define BOOST_CONTEXT_DECL
|
||||
#endif
|
||||
|
||||
#if ! defined(BOOST_CONTEXT_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_CONTEXT_NO_LIB)
|
||||
# define BOOST_LIB_NAME boost_context
|
||||
# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTEXT_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
# endif
|
||||
# include <boost/config/auto_link.hpp>
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONTEXT_DETAIL_CONFIG_H
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
// 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 <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
// 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 <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,86 @@
|
||||
|
||||
// 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 <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#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;
|
||||
|
||||
fcontext_t() :
|
||||
fc_greg(),
|
||||
fc_stack(),
|
||||
fc_excpt_lst( 0),
|
||||
fc_local_storage( 0),
|
||||
fc_fp()
|
||||
{}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,70 @@
|
||||
|
||||
// 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 <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,72 @@
|
||||
|
||||
// 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 <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,68 @@
|
||||
|
||||
// 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 <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
// 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 <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#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];
|
||||
|
||||
fcontext_t() :
|
||||
fc_greg(),
|
||||
fc_stack(),
|
||||
fc_local_storage( 0),
|
||||
fc_fp()
|
||||
{}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
// 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_FCONTEXT_H
|
||||
#define BOOST_CONTEXT_FCONTEXT_H
|
||||
|
||||
#if defined(__PGI)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
typedef int intptr_t;
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# 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 <boost/context/detail/fcontext_x86_64_win.hpp>
|
||||
# else
|
||||
# include <boost/context/detail/fcontext_x86_64.hpp>
|
||||
# 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 <boost/context/detail/fcontext_i386_win.hpp>
|
||||
# else
|
||||
# include <boost/context/detail/fcontext_i386.hpp>
|
||||
# endif
|
||||
// arm
|
||||
#elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) \
|
||||
|| defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM)
|
||||
# include <boost/context/detail/fcontext_arm.hpp>
|
||||
// mips
|
||||
#elif (defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) \
|
||||
|| defined(_R3000)
|
||||
# include <boost/context/detail/fcontext_mips.hpp>
|
||||
// powerpc
|
||||
#elif defined(__powerpc) || defined(__powerpc__) || defined(__ppc) \
|
||||
|| defined(__ppc__) || defined(_ARCH_PPC) || defined(__POWERPC__) \
|
||||
|| defined(__PPCGECKO__) || defined(__PPCBROADWAY) || defined(_XENON)
|
||||
# include <boost/context/detail/fcontext_ppc.hpp>
|
||||
#else
|
||||
# error "platform not supported"
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace context {
|
||||
|
||||
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);
|
||||
extern "C" BOOST_CONTEXT_DECL
|
||||
fcontext_t * BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( intptr_t) );
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONTEXT_FCONTEXT_H
|
||||
|
||||
Reference in New Issue
Block a user