Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r80572 - in branches/release/libs/context: . build doc example performance src src/asm test
From: oliver.kowalke_at_[hidden]
Date: 2012-09-18 05:06:52


Author: olli
Date: 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
New Revision: 80572
URL: http://svn.boost.org/trac/boost/changeset/80572

Log:
context: merge of 80553 (impl)

Added:
   branches/release/libs/context/src/asm/jump_arm_aapcs_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_arm_aapcs_elf_gas.S
   branches/release/libs/context/src/asm/jump_i386_ms_pe_masm.asm
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_i386_ms_pe_masm.asm
   branches/release/libs/context/src/asm/jump_i386_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_i386_sysv_elf_gas.S
   branches/release/libs/context/src/asm/jump_i386_sysv_macho_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_i386_sysv_macho_gas.S
   branches/release/libs/context/src/asm/jump_mips32_o32_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_mips32_o32_elf_gas.S
   branches/release/libs/context/src/asm/jump_ppc32_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_ppc32_sysv_elf_gas.S
   branches/release/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S
   branches/release/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm
   branches/release/libs/context/src/asm/jump_x86_64_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_x86_64_sysv_elf_gas.S
   branches/release/libs/context/src/asm/jump_x86_64_sysv_macho_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/jump_x86_64_sysv_macho_gas.S
   branches/release/libs/context/src/asm/make_arm_aapcs_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_arm_aapcs_elf_gas.S
   branches/release/libs/context/src/asm/make_i386_ms_pe_masm.asm
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_i386_ms_pe_masm.asm
   branches/release/libs/context/src/asm/make_i386_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_i386_sysv_elf_gas.S
   branches/release/libs/context/src/asm/make_i386_sysv_macho_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_i386_sysv_macho_gas.S
   branches/release/libs/context/src/asm/make_mips32_o32_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_mips32_o32_elf_gas.S
   branches/release/libs/context/src/asm/make_ppc32_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_ppc32_sysv_elf_gas.S
   branches/release/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
   branches/release/libs/context/src/asm/make_x86_64_ms_pe_masm.asm
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_x86_64_ms_pe_masm.asm
   branches/release/libs/context/src/asm/make_x86_64_sysv_elf_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_x86_64_sysv_elf_gas.S
   branches/release/libs/context/src/asm/make_x86_64_sysv_macho_gas.S
      - copied unchanged from r80549, /trunk/libs/context/src/asm/make_x86_64_sysv_macho_gas.S
   branches/release/libs/context/src/guarded_stack_allocator_posix.cpp
      - copied, changed from r80507, /trunk/libs/context/src/guarded_stack_allocator_posix.cpp
   branches/release/libs/context/src/guarded_stack_allocator_windows.cpp
      - copied, changed from r80507, /trunk/libs/context/src/guarded_stack_allocator_windows.cpp
   branches/release/libs/context/src/utils_posix.cpp
      - copied, changed from r80507, /trunk/libs/context/src/utils_posix.cpp
   branches/release/libs/context/src/utils_windows.cpp
      - copied, changed from r80507, /trunk/libs/context/src/utils_windows.cpp
Removed:
   branches/release/libs/context/doc/config.qbk
   branches/release/libs/context/doc/tested.qbk
   branches/release/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S
   branches/release/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm
   branches/release/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S
   branches/release/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S
   branches/release/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S
   branches/release/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S
   branches/release/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S
   branches/release/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm
   branches/release/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S
   branches/release/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S
   branches/release/libs/context/src/stack_allocator_posix.cpp
   branches/release/libs/context/src/stack_allocator_windows.cpp
   branches/release/libs/context/src/stack_utils_posix.cpp
   branches/release/libs/context/src/stack_utils_windows.cpp
Properties modified:
   branches/release/libs/context/ (props changed)
Text files modified:
   branches/release/libs/context/build/Jamfile.v2 | 173 ++++++++++++++++++++++++++++++---------
   branches/release/libs/context/doc/context.qbk | 4
   branches/release/libs/context/doc/fcontext.qbk | 115 ++++++++++++-------------
   branches/release/libs/context/doc/overview.qbk | 4
   branches/release/libs/context/doc/performance.qbk | 11 +
   branches/release/libs/context/doc/rationale.qbk | 10 +
   branches/release/libs/context/doc/requirements.qbk | 8 +
   branches/release/libs/context/doc/stack.qbk | 157 +++++++++++++++++++++++++++--------
   branches/release/libs/context/doc/todo.qbk | 2
   branches/release/libs/context/example/Jamfile.v2 | 12 +-
   branches/release/libs/context/example/exit.cpp | 33 +++----
   branches/release/libs/context/example/jump.cpp | 44 +++++----
   branches/release/libs/context/example/transfer.cpp | 22 ++--
   branches/release/libs/context/performance/performance.cpp | 136 +++++++++++++++----------------
   branches/release/libs/context/src/fcontext.cpp | 2
   branches/release/libs/context/src/guarded_stack_allocator_posix.cpp | 13 +-
   branches/release/libs/context/src/guarded_stack_allocator_windows.cpp | 4
   branches/release/libs/context/src/seh.cpp | 9 ++
   branches/release/libs/context/src/utils_posix.cpp | 2
   branches/release/libs/context/src/utils_windows.cpp | 2
   branches/release/libs/context/test/test_context.cpp | 140 +++++++++++++++++++++-----------
   21 files changed, 564 insertions(+), 339 deletions(-)

Modified: branches/release/libs/context/build/Jamfile.v2
==============================================================================
--- branches/release/libs/context/build/Jamfile.v2 (original)
+++ branches/release/libs/context/build/Jamfile.v2 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -83,20 +83,21 @@
 {
     local result ;
 
- if ( ! ( <toolset>gcc in $(properties)
- || <toolset>intel in $(properties)
- || <toolset>msvc in $(properties) ) )
- {
- result = <build>no ;
- ECHO "toolset not supported" ;
- }
+# if ( ! ( <toolset>gcc in $(properties)
+# || <toolset>intel in $(properties)
+# || <toolset>msvc in $(properties) ) )
+# {
+# result = <build>no ;
+# ECHO "toolset not supported" ;
+# }
 
     return $(result) ;
 }
 
 # ARM
 alias asm_context_sources
- : asm/fcontext_arm_aapcs_elf_gas.S
+ : asm/make_arm_aapcs_elf_gas.S
+ asm/jump_arm_aapcs_elf_gas.S
    : <abi>aapcs
      <architecture>arm
      <binary-format>elf
@@ -104,7 +105,17 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_arm_aapcs_elf_gas.o : asm/fcontext_arm_aapcs_elf_gas.S : @gas ]
+ : asm/make_arm_aapcs_elf_gas.S
+ asm/jump_arm_aapcs_elf_gas.S
+ : <abi>aapcs
+ <architecture>arm
+ <binary-format>elf
+ <toolset>qcc
+ ;
+
+alias asm_context_sources
+ : [ make asm/make_arm_aapcs_elf_gas.o : asm/make_arm_aapcs_elf_gas.S : @gas ]
+ [ make asm/jump_arm_aapcs_elf_gas.o : asm/jump_arm_aapcs_elf_gas.S : @gas ]
    : <abi>aapcs
      <architecture>arm
      <binary-format>elf
@@ -112,7 +123,8 @@
 
 # MIPS 32bit
 alias asm_context_sources
- : asm/fcontext_mips32_o32_elf_gas.S
+ : asm/make_mips32_o32_elf_gas.S
+ asm/jump_mips32_o32_elf_gas.S
    : <abi>o32
      <architecture>mips1
      <binary-format>elf
@@ -120,7 +132,17 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_mips32_o32_elf_gas.o : asm/fcontext_mips32_o32_elf_gas.S : @gas ]
+ : asm/make_mips32_o32_elf_gas.S
+ asm/jump_mips32_o32_elf_gas.S
+ : <abi>o32
+ <architecture>mips1
+ <binary-format>elf
+ <toolset>qcc
+ ;
+
+alias asm_context_sources
+ : [ make asm/make_mips32_o32_elf_gas.o : asm/make_mips32_o32_elf_gas.S : @gas ]
+ [ make asm/jump_mips32_o32_elf_gas.o : asm/jump_mips32_o32_elf_gas.S : @gas ]
    : <abi>o32
      <architecture>mips1
      <binary-format>elf
@@ -128,7 +150,8 @@
 
 # POWERPC 32bit
 alias asm_context_sources
- : asm/fcontext_ppc32_sysv_elf_gas.S
+ : asm/make_ppc32_sysv_elf_gas.S
+ asm/jump_ppc32_sysv_elf_gas.S
    : <abi>sysv
      <address-model>32
      <architecture>power
@@ -137,7 +160,18 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_ppc32_sysv_elf_gas.o : asm/fcontext_ppc32_sysv_elf_gas.S : @gas ]
+ : asm/make_ppc32_sysv_elf_gas.S
+ asm/jump_ppc32_sysv_elf_gas.S
+ : <abi>sysv
+ <address-model>32
+ <architecture>power
+ <binary-format>elf
+ <toolset>qcc
+ ;
+
+alias asm_context_sources
+ : [ make asm/make_ppc32_sysv_elf_gas.o : asm/make_ppc32_sysv_elf_gas.S : @gas ]
+ [ make asm/jump_ppc32_sysv_elf_gas.o : asm/jump_ppc32_sysv_elf_gas.S : @gas ]
    : <abi>sysv
      <address-model>32
      <architecture>power
@@ -146,7 +180,8 @@
 
 # POWERPC 64bit
 alias asm_context_sources
- : asm/fcontext_ppc64_sysv_elf_gas.S
+ : asm/make_ppc64_sysv_elf_gas.S
+ asm/jump_ppc64_sysv_elf_gas.S
    : <abi>sysv
      <address-model>64
      <architecture>power
@@ -155,7 +190,18 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_ppc64_sysv_elf_gas.o : asm/fcontext_ppc64_sysv_elf_gas.S : @gas ]
+ : asm/make_ppc64_sysv_elf_gas.S
+ asm/jump_ppc64_sysv_elf_gas.S
+ : <abi>sysv
+ <address-model>64
+ <architecture>power
+ <binary-format>elf
+ <toolset>qcc
+ ;
+
+alias asm_context_sources
+ : [ make asm/make_ppc64_sysv_elf_gas.o : asm/make_ppc64_sysv_elf_gas.S : @gas ]
+ [ make asm/jump_ppc64_sysv_elf_gas.o : asm/jump_ppc64_sysv_elf_gas.S : @gas ]
    : <abi>sysv
      <address-model>64
      <architecture>power
@@ -164,7 +210,8 @@
 
 # I386
 alias asm_context_sources
- : asm/fcontext_i386_sysv_elf_gas.S
+ : asm/make_i386_sysv_elf_gas.S
+ asm/jump_i386_sysv_elf_gas.S
    : <abi>sysv
      <address-model>32
      <architecture>x86
@@ -173,7 +220,18 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_i386_sysv_elf_gas.S
+ : asm/make_i386_sysv_elf_gas.S
+ asm/jump_i386_sysv_elf_gas.S
+ : <abi>sysv
+ <address-model>32
+ <architecture>x86
+ <binary-format>elf
+ <toolset>qcc
+ ;
+
+alias asm_context_sources
+ : asm/make_i386_sysv_elf_gas.S
+ asm/jump_i386_sysv_elf_gas.S
    : <abi>sysv
      <address-model>32
      <architecture>x86
@@ -182,7 +240,8 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_i386_sysv_elf_gas.o : asm/fcontext_i386_sysv_elf_gas.S : @gas ]
+ : [ make asm/make_i386_sysv_elf_gas.o : asm/make_i386_sysv_elf_gas.S : @gas ]
+ [ make asm/jump_i386_sysv_elf_gas.o : asm/jump_i386_sysv_elf_gas.S : @gas ]
    : <abi>sysv
      <address-model>32
      <architecture>x86
@@ -190,7 +249,8 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_i386_sysv_macho_gas.S
+ : asm/make_i386_sysv_macho_gas.S
+ asm/jump_i386_sysv_macho_gas.S
    : <abi>sysv
      <address-model>32
      <architecture>x86
@@ -200,7 +260,19 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_i386_sysv_macho_gas.S
+ : asm/make_i386_sysv_macho_gas.S
+ asm/jump_i386_sysv_macho_gas.S
+ : <abi>sysv
+ <address-model>32
+ <architecture>x86
+ <binary-format>mach-o
+ <target-os>darwin
+ <toolset>qcc
+ ;
+
+alias asm_context_sources
+ : asm/make_i386_sysv_macho_gas.S
+ asm/jumjumpysv_macho_gas.S
    : <abi>sysv
      <address-model>32
      <architecture>x86
@@ -210,7 +282,8 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_i386_sysv_macho_gas.o : asm/fcontext_i386_sysv_macho_gas.S : @gas ]
+ : [ make asm/make_i386_sysv_macho_gas.o : asm/make_i386_sysv_macho_gas.S : @gas ]
+ [ make asm/jump_i386_sysv_macho_gas.o : asm/jump_i386_sysv_macho_gas.S : @gas ]
    : <abi>sysv
      <address-model>32
      <architecture>x86
@@ -219,7 +292,8 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_i386_ms_pe_masm.asm
+ : asm/make_i386_ms_pe_masm.asm
+ asm/jump_i386_ms_pe_masm.asm
    : <abi>ms
      <address-model>32
      <architecture>x86
@@ -229,7 +303,8 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_i386_ms_pe_masm.asm
+ : asm/make_i386_ms_pe_masm.asm
+ asm/jump_i386_ms_pe_masm.asm
    : <abi>ms
      <address-model>32
      <architecture>x86
@@ -239,19 +314,19 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_i386_ms_pe_masm.o : asm/fcontext_i386_ms_pe_masm.asm : @masm ]
+ : [ make asm/make_i386_ms_pe_masm.o : asm/make_i386_ms_pe_masm.asm : @masm ]
+ [ make asm/jump_i386_ms_pe_masm.o : asm/jump_i386_ms_pe_masm.asm : @masm ]
    : <abi>ms
      <address-model>32
      <architecture>x86
      <binary-format>pe
      <target-os>windows
- <toolset>gcc
    ;
 
-
 # X86_64
 alias asm_context_sources
- : asm/fcontext_x86_64_sysv_elf_gas.S
+ : asm/make_x86_64_sysv_elf_gas.S
+ asm/jump_x86_64_sysv_elf_gas.S
    : <abi>sysv
      <address-model>64
      <architecture>x86
@@ -260,25 +335,37 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_x86_64_sysv_elf_gas.S
+ : asm/make_x86_64_sysv_elf_gas.S
+ asm/jump_x86_64_sysv_elf_gas.S
    : <abi>sysv
      <address-model>64
      <architecture>x86
      <binary-format>elf
- <toolset>intel
+ <toolset>qcc
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_x86_64_sysv_elf_gas.o : asm/fcontext_x86_64_sysv_elf_gas.S : @gas ]
+ : asm/make_x86_64_sysv_elf_gas.S
+ asm/jump_x86_64_sysv_elf_gas.S
    : <abi>sysv
      <address-model>64
      <architecture>x86
      <binary-format>elf
+ <toolset>intel
    ;
 
+alias asm_context_sources
+ : [ make asm/make_x86_64_sysv_elf_gas.o : asm/make_x86_64_sysv_elf_gas.S : @gas ]
+ [ make asm/jump_x86_64_sysv_elf_gas.o : asm/jump_x86_64_sysv_elf_gas.S : @gas ]
+ : <abi>sysv
+ <address-model>64
+ <architecture>x86
+ <binary-format>elf
+ ;
 
 alias asm_context_sources
- : asm/fcontext_x86_64_sysv_macho_gas.S
+ : asm/make_x86_64_sysv_macho_gas.S
+ asm/jump_x86_64_sysv_macho_gas.S
    : <abi>sysv
      <address-model>64
      <architecture>x86
@@ -288,7 +375,8 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_x86_64_sysv_macho_gas.S
+ : asm/make_x86_64_sysv_macho_gas.S
+ asm/jump_x86_64_sysv_macho_gas.S
    : <abi>sysv
      <address-model>64
      <architecture>x86
@@ -298,7 +386,8 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_x86_64_sysv_macho_gas.o : asm/fcontext_x86_64_sysv_macho_gas.S : @gas ]
+ : [ make asm/make_x86_64_sysv_macho_gas.o : asm/make_x86_64_sysv_macho_gas.S : @gas ]
+ [ make asm/jump_x86_64_sysv_macho_gas.o : asm/jump_x86_64_sysv_macho_gas.S : @gas ]
    : <abi>sysv
      <address-model>64
      <architecture>x86
@@ -307,7 +396,8 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_x86_64_ms_pe_masm.asm
+ : asm/make_x86_64_ms_pe_masm.asm
+ asm/jump_x86_64_ms_pe_masm.asm
    : <abi>ms
      <address-model>64
      <architecture>x86
@@ -317,7 +407,8 @@
    ;
 
 alias asm_context_sources
- : asm/fcontext_x86_64_ms_pe_masm.asm
+ : asm/make_x86_64_ms_pe_masm.asm
+ asm/jump_x86_64_ms_pe_masm.asm
    : <abi>ms
      <address-model>64
      <architecture>x86
@@ -327,13 +418,13 @@
    ;
 
 alias asm_context_sources
- : [ make asm/fcontext_x86_64_ms_pe_masm.o : asm/fcontext_x86_64_ms_pe_masm.asm : @masm64 ]
+ : [ make asm/make_x86_64_ms_pe_masm.o : asm/make_x86_64_ms_pe_masm.asm : @masm64 ]
+ [ make asm/jump_x86_64_ms_pe_masm.o : asm/jump_x86_64_ms_pe_masm.asm : @masm64 ]
    : <abi>ms
      <address-model>64
      <architecture>x86
      <binary-format>pe
      <target-os>windows
- <toolset>gcc
    ;
 
 explicit asm_context_sources ;
@@ -349,15 +440,15 @@
 alias context_sources
    : fcontext.cpp
      seh.cpp
- stack_allocator_windows.cpp
- stack_utils_windows.cpp
+ guarded_stack_allocator_windows.cpp
+ utils_windows.cpp
    : <target-os>windows
    ;
 
 alias context_sources
    : fcontext.cpp
- stack_allocator_posix.cpp
- stack_utils_posix.cpp
+ guarded_stack_allocator_posix.cpp
+ utils_posix.cpp
    ;
 
 explicit context_sources ;

Deleted: branches/release/libs/context/doc/config.qbk
==============================================================================
--- branches/release/libs/context/doc/config.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,60 +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
-]
-
-[section:installtion How to build and install]
-
-__boost_context__ must be built for the particular compiler(s) and CPU architecture(s)s
-being targeted. __boost_context__ includes assembly code and, therefore, requires
-GNU AS for supported POSIX systems, and MASM for Windows systems.
-
-[note The architecture, instruction set, and address model are optional __boost_build__
-properties that must be given on the bjam command line, as shown in the table below.]
-
-[table
- [[][]]
- [
- [ARM, UNIX, aapcs, elf]
- [bjam toolset = gcc architecture = arm]
- ]
- [
- [MIPS (32bit), UNIX, o32, elf]
- [bjam toolset = gcc architecture = mips1]
- ]
- [
- [I386, UNIX, sysv, elf]
- [bjam toolset = gcc architecture = x86 instruction-set = i686 address-model = 32]
- ]
- [
- [I386, UNIX, sysv, elf]
- [bjam toolset = intel architecture = x86 instruction-set = i686 address-model = 32]
- ]
- [
- [I386, Windows, ms, pe]
- [bjam toolset = msvc-9.0 architecture = x86 instruction-set = i686 address-model = 32]
- ]
- [
- [PowerPc (32bit), UNIX, sysv, elf]
- [bjam toolset = gcc architecture = power address-model = 32]
- ]
- [
- [PowerPc (64bit), UNIX, sysv, elf]
- [bjam toolset = gcc architecture = power address-model = 64]
- ]
- [
- [X86_64, UNIX, sysv, elf]
- [bjam toolset = gcc architecture = x86 instruction-set = yorksfield address-model = 64]
- ]
- [
- [X86_64, UNIX, sysv, elf]
- [bjam toolset = intel architecture = x86 instruction-set = yorksfield address-model = 64]
- ]
- [
- [X86_64, Windows, ms, pe]
- [bjam toolset = msvc-10.0 architecture = x86 instruction-set = yorksfield address-model = 64]
- ]
-]
-[endsect]

Modified: branches/release/libs/context/doc/context.qbk
==============================================================================
--- branches/release/libs/context/doc/context.qbk (original)
+++ branches/release/libs/context/doc/context.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -51,7 +51,6 @@
 
 [def __bad_alloc__ ['std::bad_alloc]]
 [def __fc_base__ ['fc_base]]
-[def __fc_limit__ ['fc_limit]]
 [def __fc_link__ ['fc_link]]
 [def __jump_fcontext__ ['jump_fcontext()]]
 [def __make_fcontext__ ['make_fcontext()]]
@@ -61,14 +60,13 @@
 [def __stack_helper__ ['stack_helper]]
 [def __yield__ ['yield]]
 
-[def __context_ns__ ['boost::ctx]]
+[def __context_ns__ ['boost::context]]
 
 [include overview.qbk]
 [include requirements.qbk]
 [include fcontext.qbk]
 [include stack.qbk]
 [include performance.qbk]
-[include tested.qbk]
 [include rationale.qbk]
 [include reference.qbk]
 [include todo.qbk]

Modified: branches/release/libs/context/doc/fcontext.qbk
==============================================================================
--- branches/release/libs/context/doc/fcontext.qbk (original)
+++ branches/release/libs/context/doc/fcontext.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -11,38 +11,38 @@
 space). Together with its related functions __jump_fcontext__ and
 __make_fcontext__ it provides a execution control transfer mechanism similar
 interface like
-[@http://www.kernel.org/doc/man-pages/online/pages/man2/getcontext.2.html ucontext_t].
+[@http://www.kernel.org/doc/man-pages/online/pages/man2/getcontext.2.html
+ucontext_t].
 __fcontext__ and its functions are located in __context_ns__ and the functions
 are declared as extern "C".
 
-[warning If __fcontext__ is used in a multithreaded application, it can migrated
+[warning If __fcontext__ is used in a multi threaded application, it can migrated
 between threads, but must not reference __tls__.]
 
+[important The low level API is the part to port to new platforms.]
+
 [note If __fls__ is used on Windows, the user is responsible for calling
 __fls_alloc__, __fls_free__.]
 
-[important The low level API is the part to port to new platforms.]
-
 
 [heading Executing a context]
 
 A new context supposed to execute a __context_fn__ (returning void and accepting
-intptr_t as argument) must be initialized by function __make_fcontext__.
+intptr_t as argument) will be created on top of the stack (at 16 byte boundary)
+by function __make_fcontext__.
 
             // context-function
             void f( intptr);
 
             // creates and manages a protected stack (with guard page)
- ctx::stack_allocator alloc;
- fc.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
- fc.fc_stack.limit =
- static_cast< char * >( fc.fc_stack.base) - ctx::minimum_stacksize();
+ ctx::guarded_stack_allocator alloc;
+ void * sp( alloc.allocate(ctx::minimum_stacksize()));
+ std::size_t size( ctx::guarded_stack_allocator::minimum_stacksize());
 
             // context fc uses f() as context function
- make_fcontext( & fc, f);
-
-__fcontext__ requires a pointer to the top of the stack (__fc_base__) as well
-as a pointer to the lower bound of the stack (__fc_limit__).
+ // fcontext_t is placed on top of context stack
+ // a pointer to fcontext_t is returned
+ fcontext_t * fc( make_fcontext( sp, size, f));
 
 Calling __jump_fcontext__ invokes the __context_fn__ in a newly created context
 complete with registers, flags, stack and instruction pointers. When control
@@ -52,43 +52,38 @@
 __jump_fcontext__ again resumes execution in the second context after saving the
 new state of the original context.
 
- namespace ctx = boost::ctx;
+ namespace ctx = boost::context;
 
- ctx::fcontext_t fcm, fc1, fc2;
+ ctx::fcontext_t fcm, * fc1, * fc2;
 
         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;
- ctx::jump_fcontext( & fc1, & fcm, 0);
+ 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);
+ std::cout << "f2: call jump_fcontext( fc2, fc1, 0)" << std::endl;
+ ctx::jump_fcontext( fc2, fc1, 0);
                 BOOST_ASSERT( false && ! "f2: never returns");
         }
 
         int main( int argc, char * argv[])
         {
- ctx::stack_allocator alloc1, alloc2;
+ ctx::guarded_stack_allocator alloc;
+ void * sp1( alloc.allocate(ctx::minimum_stacksize()));
+ std::size_t size( ctx::guarded_stack_allocator::minimum_stacksize());
 
- fc1.fc_stack.base = alloc1.allocate(ctx::minimum_stacksize());
- fc1.fc_stack.limit =
- static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f1);
-
- fc2.fc_stack.base = alloc2.allocate(ctx::minimum_stacksize());
- fc2.fc_stack.limit =
- static_cast< char * >( fc2.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc2, f2);
+ fc1 = ctx::make_fcontext( sp1, size, f1);
+ fc2 = ctx::make_fcontext( sp2, size, f2);
 
- std::cout << "main: call jump_fcontext( & fcm, & fc1, 0)" << std::endl;
- ctx::jump_fcontext( & fcm, & fc1, 0);
+ std::cout << "main: call jump_fcontext( & fcm, fc1, 0)" << std::endl;
+ ctx::jump_fcontext( & fcm, fc1, 0);
 
                 std::cout << "main: done" << std::endl;
 
@@ -113,6 +108,8 @@
 [warning Calling __jump_fcontext__ to the same context from inside the same
 context results in undefined behaviour.]
 
+[important The size of the stack is required to be larger than the size of fcontext_t.]
+
 [note In contrast to threads, which are preemtive, __fcontext__ switches are
 cooperative (programmer controls when switch will happen). The kernel is not
 involved in the context switches.]
@@ -127,37 +124,35 @@
 __jump_fcontext__, in one context, is returned by __jump_fcontext__ in the
 other context.
 
- namespace ctx = boost::ctx;
+ namespace ctx = boost::context;
 
- ctx::fcontext_t fc1, fcm;
+ ctx::fcontext_t fcm, * fc;
 
         typedef std::pair< int, int > pair_t;
 
- void f1( intptr_t param)
+ void f( 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( fc, & fcm, ( intptr_t) ( p->first + p->second) );
 
- ctx::jump_fcontext( & fc1, & fcm, ( intptr_t) ( p->first + p->second) );
+ ctx::jump_fcontext( fc, & fcm, ( intptr_t) ( p->first + p->second) );
         }
 
         int main( int argc, char * argv[])
         {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
+ void * sp( alloc.allocate(ctx::minimum_stacksize()));
+ std::size_t size( ctx::guarded_stack_allocator::minimum_stacksize());
 
- fc1.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
- fc1.fc_stack.limit =
- static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- fc1.fc_link = & fcm;
             pair_t p( std::make_pair( 2, 7) );
- ctx::make_fcontext( & fc1, f1);
+ fc = ctx::make_fcontext( sp, size, f);
 
- int res = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & p);
+ int res = ( int) ctx::jump_fcontext( & fcm, fc, ( intptr_t) & p);
             std::cout << p.first << " + " << p.second << " == " << res << std::endl;
 
             p = std::make_pair( 5, 6);
- res = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & p);
+ res = ( int) ctx::jump_fcontext( & fcm, fc, ( intptr_t) & p);
             std::cout << p.first << " + " << p.second << " == " << res << std::endl;
 
             std::cout << "main: done" << std::endl;
@@ -183,7 +178,7 @@
 The foruth argument of __jump_fcontext__ controls if fpu registers should be
 preserved by the context jump.
 
-[important The use of the fpu controling argument of __jump_fcontext__ must
+[important The use of the fpu controlling argument of __jump_fcontext__ must
 be consistent in the application. Otherwise the behaviour is undefined.]
 
 
@@ -198,8 +193,8 @@
 
         struct stack_t
         {
- void * base;
- void * limit;
+ void * sp;
+ std::size_t size;
         };
 
         struct fcontext_t
@@ -209,17 +204,18 @@
             stack_t fc_stack;
         };
 
- intptr_t jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp);
- void make_fcontext( fcontext_t * fc, void(* fn)(intptr_t) );
+ intptr_t jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu = true);
+ fcontext_t * make_fcontext( void * sp, std::size_t size, void(* fn)(intptr_t) );
 
-[heading `base`]
+[heading `sp`]
 [variablelist
-[[Member:] [Pointer to the top of the stack.]]
+[[Member:] [Pointer to the beginning of the stack (depending of the architecture the stack grows
+downwards or upwards).]]
 ]
 
-[heading `limit`]
+[heading `size`]
 [variablelist
-[[Member:] [Pointer to the bottom of the stack.]]
+[[Member:] [Size of the stack in bytes.]]
 ]
 
 [heading `fc_stack`]
@@ -227,7 +223,7 @@
 [[Member:] [Tracks the memory for the context's stack.]]
 ]
 
-[heading `intptr_t jump_fcontext( fcontext_t * ofc, fcontext_t * nfc, intptr_t p, bool preserve_fpu)`]
+[heading `intptr_t jump_fcontext( fcontext_t * ofc, fcontext_t * nfc, intptr_t p, bool preserve_fpu = true)`]
 [variablelist
 [[Effects:] [Stores the current context data (stack pointer, instruction
 pointer, and CPU registers) to `*ofc` and restores the context data from `*nfc`,
@@ -239,11 +235,12 @@
 `jump_fcontext()`, if any.]]
 ]
 
-[heading `void make_fcontext( fcontext_t * fc, void(*fn)(intptr_t))`]
+[heading `fcontext_t * make_fcontext( void * sp, std::size_t size, void(*fn)(intptr_t))`]
 [variablelist
-[[Precondition:] [A stack is applied to `*fc` before `make_fcontext()` is called.]]
-[[Effects:] [Modifies `*fc` in order to execute `fn` when the context is
-activated next.]]
+[[Precondition:] [Stack `sp` function pointer `fn` are valid and `size` > 0.]]
+[[Effects:] [Creates an fcontext_t at the beginning of the stack and prepares the stack
+to execute the __context_fn__ `fn`.]]
+[[Returns:][Returns a pointer to fcontext_t which is placed on the stack.]]
 ]
 
 [endsect]

Modified: branches/release/libs/context/doc/overview.qbk
==============================================================================
--- branches/release/libs/context/doc/overview.qbk (original)
+++ branches/release/libs/context/doc/overview.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -13,13 +13,13 @@
 variables) and stack pointer, all registers and CPU flags, and the instruction
 pointer, a __fcontext__ instance represents a specific point in the application's
 execution path. This is useful for building higher-level abstractions, like
-__coroutines__, __coop_threads__ or an aquivalent to
+__coroutines__, __coop_threads__ or an equivalent to
 [@http://msdn.microsoft.com/en-us/library/9k7k7cf0%28v=vs.80%29.aspx C# keyword __yield__]
 in C++.
 
 A __fcontext__ provides the means to suspend the current execution path and to
 transfer execution control, thereby permitting another __fcontext__ to run on the
-current thread. This stateful transfer mechanism enables a __fcontext__ to
+current thread. This state full transfer mechanism enables a __fcontext__ to
 suspend execution from within nested functions and, later, to resume from where
 it was suspended. While the execution path represented by a __fcontext__ only
 runs on a single thread, it can be migrated to another thread at any given time.

Modified: branches/release/libs/context/doc/performance.qbk
==============================================================================
--- branches/release/libs/context/doc/performance.qbk (original)
+++ branches/release/libs/context/doc/performance.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -14,24 +14,27 @@
 to a single CPU. The code was compiled using the build options,
 'variant = release cxxflags = -DBOOST_DISABLE_ASSERTS'.
 
+Applying `-DBOOST_USE_UCONTEXT` to cxxflags the performance of `ucontext` will
+be measured too.
+
 The numbers in the table are the number of cycles per iteration, based upon an
 average computed over 10 iterations.
 
-[table Perfomance of context switch
+[table Performance of context switch
     [[Platform] [ucontext_t] [fcontext_t with fpu] [fcontext_t without fpu] [boost::function]]
     [
         [AMD Athlon 64 DualCore 4400+ (32bit Linux)]
         [846 cycles]
         [65 cycles]
- [46 cycles]
         [43 cycles]
+ [15 cycles]
     ]
     [
         [Intel Core2 Q6700 (64bit Linux)]
- [1472 cycles]
+ [1481 cycles]
         [172 cycles]
         [63 cycles]
- [60 cycles]
+ [25 cycles]
     ]
 ]
 

Modified: branches/release/libs/context/doc/rationale.qbk
==============================================================================
--- branches/release/libs/context/doc/rationale.qbk (original)
+++ branches/release/libs/context/doc/rationale.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -13,6 +13,8 @@
 support inline assembler.
 [footnote [@http://msdn.microsoft.com/en-us/library/4ks26t93.aspx MSDN article
 'Inline Assembler']].
+Inlined assembler generates code bloating which his not welcome on embedded
+systems.
 
 
 [heading fcontext_t]
@@ -26,7 +28,7 @@
 Because the assembler code uses the byte layout of __fcontext__ to access
 its members __fcontext__ must be a POD. This requires that __fcontext__ has only a
 default constructor, no visibility keywords (e.g. private, public, protected), no
-virtual methods and all members and base clases are PODs too.
+virtual methods and all members and base classes are PODs too.
 
 
 [heading Protecting the stack]
@@ -64,10 +66,10 @@
 [footnote ISO/IEC 9899:1999, 2005, J.2].
 
 The arguments in the var-arg list are required to be integers, passing pointers
-in var-arg list is not guarantied to work, especially it will fail for
+in var-arg list is not guaranteed to work, especially it will fail for
 architectures where pointers are larger than integers.
 
-`ucontext_t` preserves signal mask between context switches which involes system
+`ucontext_t` preserves signal mask between context switches which involves system
 calls consuming a lot of CPU cycles (ucontext_t is slower by
 perfomance_link[factor 13x] relative to `fcontext_t`).
 
@@ -110,7 +112,7 @@
 
 [heading Windows]
 
-MxCsr - "A callee that modifies any of the nonvolatile fields within MxCsr must restore
+MxCsr - "A callee that modifies any of the non-volatile fields within MxCsr must restore
 them before returning to its caller. Furthermore, a caller that has modified any
 of these fields must restore them to their standard values before invoking a callee ..."
 [footnote [@http://http://msdn.microsoft.com/en-us/library/yxty7t75.aspx MSDN article

Modified: branches/release/libs/context/doc/requirements.qbk
==============================================================================
--- branches/release/libs/context/doc/requirements.qbk (original)
+++ branches/release/libs/context/doc/requirements.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -12,7 +12,11 @@
 therefore, requires GNU AS for supported POSIX systems, and MASM for Windows
 systems.
 
-[important Please note that address-model=64 must be given to bjam command line
-on 64bit Windows (boost-build issue).]
+[important Please note that `address-model=64` must be given to bjam command line
+on 64bit Windows for 64bit build; otherwise 32bit code will be generated.]
+
+[important For cross-compiling the lib you must specify certain additional
+properties at bjam command line: `target-os`, `abi`, `binary-format`,
+`architecture` and `address-model`.]
 
 [endsect]

Modified: branches/release/libs/context/doc/stack.qbk
==============================================================================
--- branches/release/libs/context/doc/stack.qbk (original)
+++ branches/release/libs/context/doc/stack.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -9,11 +9,8 @@
 
 A __fcontext__ requires a stack which will be allocated/deallocated
 by a __stack_allocator__.
-__boost_context__ uses `stack_allocator` by default but a
-customized `stack allocator` can be passed to the context constructor
-instead.
-If a context is constructed it invokes __stack_alloc__ function and by its
-destruction the stack gets released by __stack_dealloc__.
+__boost_context__ provides the default implementation `stack_allocator` but a
+customized __stack_allocator__ can be used instead.
 
 [heading __stack_allocator_concept__]
 A __stack_allocator__ must satisfy the __stack_allocator_concept__ requirements
@@ -45,72 +42,156 @@
 [note The stack is not required to be aligned; alignment takes place inside
 `make_fcontext()`.]
 
+[note Depending on the architecture `allocate()` returns an address from the
+top of the stack (growing downwards) or the bottom of the stack (growing
+upwards).]
 
-[section:stack_allocator Class `stack_allocator`]
 
-__boost_context__ provides a __stack_allocator__ `stack_allocator` which models
+[section:guarded_stack_allocator Class `guarded_stack_allocator`]
+
+__boost_context__ provides the class `guarded_stack_allocator` which models
 the __stack_allocator_concept__ concept.
-It appends a __guard_page__ to protect against exceeding the stack. If the guard
-page is accessed (read or write operation) a segmentation fault/access violation
-is generated by the operating system.
+It appends a __guard_page__ at the end of each stack to protect against exceeding
+the stack. If the guard page is accessed (read or write operation) a
+segmentation fault/access violation is generated by the operating system.
+
+[note The appended `guard page` is [*not] mapped to physical memory, only
+virtual addresses are used.]
+
+ class guarded_stack_allocator
+ {
+ static bool is_stack_unbound();
+
+ static std::size_t maximum_stacksize();
+
+ static std::size_t default_stacksize();
+
+ static std::size_t minimum_stacksize();
+
+ void * allocate( std::size_t size);
+
+ void deallocate( void * sp, std::size_t size);
+ }
+
+[heading `static bool is_stack_unbound()`]
+[variablelist
+[[Returns:] [Returns `true` if the environment defines no limit for the size of a stack.]]
+]
+
+[heading `static std::size_t maximum_stacksize()`]
+[variablelist
+[[Preconditions:] [`is_stack_unbound()` returns `false`.]]
+[[Returns:] [Returns the maximum size in bytes of stack defined by the environment.]]
+]
+
+[heading `static std::size_t default_stacksize()`]
+[variablelist
+[[Returns:] [Returns a default stack size, which may be platform specific.
+If the stack is unbound then the present implementation returns the maximum of
+`64 kB` and `minimum_stacksize()`.]]
+]
+
+[heading `static std::size_t minimum_stacksize()`]
+[variablelist
+[[Returns:] [Returns the minimum size in bytes of stack defined by the
+environment (Win32 4kB/Win64 8kB, defined by rlimit on POSIX).]]
+]
+
+[heading `void * allocate( std::size_t size)`]
+[variablelist
+[[Preconditions:] [`minimum_stacksize() > size` and
+`! is_stack_unbound() && ( maximum_stacksize() < size)`.]]
+[[Effects:] [Allocates memory of `size` Bytes and appends one guard page at the
+end of the allocated memory.]]
+[[Returns:] [Returns pointer to the start address of the new stack. Depending
+on the architecture the stack grows downwards/upwards the returned address is
+the highest/lowest address of the stack.]]
+]
+
+[heading `void deallocate( void * sp, std::size_t size)`]
+[variablelist
+[[Preconditions:] [`sp` is valid, `minimum_stacksize() > size` and
+`! is_stack_unbound() && ( maximum_stacksize() < size)`.]]
+[[Effects:] [Deallocates the stack space.]]
+]
 
 [endsect]
 
 
-[section:stack_helper Helper functions]
+[section:simple_stack_allocator Template `simple_stack_allocator< size_t, size_t, size_t >`]
 
-__boost_context__ provides easy access to the stack related limits defined by
-the environment.
+__boost_context__ provides the class `simple_stack_allocator` which models
+the __stack_allocator_concept__ concept. The template arguments define the
+limits for the stack size.
+The class simply allocates memory on the heap via `calloc()` - in contrast to
+`guarded_stack_allocator` no guard page is appended.
 
- std::size_t default_stacksize();
+[important The user is responsible for valid stack limits (e.g. maximum, minimum
+and default stacksize.]
 
- std::size_t minimum_stacksize();
+ template< size_t Max, size_t Default, size_t Min >
+ class simple_stack_allocator
+ {
+ static std::size_t maximum_stacksize();
 
- std::size_t maximum_stacksize();
+ static std::size_t default_stacksize();
 
- bool is_stack_unbound();
+ static std::size_t minimum_stacksize();
 
- std::size_t pagesize();
+ void * allocate( std::size_t size);
 
- std::size_t page_count( std::size_t stacksize);
+ void deallocate( void * sp, std::size_t size);
+ }
 
-[heading `std::size_t default_stacksize()`]
+[heading `static std::size_t maximum_stacksize()`]
 [variablelist
-[[Returns:] [Returns a default stack size, which may be platform specific.
-The present implementation returns a value of 256 kB.]]
+[[Returns:] [Returns the maximum size in bytes of stack defined by the first
+tempalte argument.]]
 ]
 
-[heading `std::size_t minimum_stacksize()`]
+[heading `static std::size_t default_stacksize()`]
 [variablelist
-[[Returns:] [Returns the minimum size in bytes of stack defined by the environment.]]
-[[Throws:] [Nothing.]]
+[[Returns:] [Returns a default stack size in bytes defined by the second
+template argument.]]
 ]
 
-[heading `std::size_t maximum_stacksize()`]
+[heading `static std::size_t minimum_stacksize()`]
 [variablelist
-[[Preconditions:] [`is_stack_unbound()` returns `false`.]]
-[[Returns:] [Returns the maximum size in bytes of stack defined by the environment.]]
-[[Throws:] [Nothing.]]
+[[Returns:] [Returns the minimum size in bytes of stack defined by the
+third template argument.]]
 ]
 
-[heading `bool is_stack_unbound()`]
+[heading `void * allocate( std::size_t size)`]
 [variablelist
-[[Returns:] [Returns `true` if the environment defines no limit for the size of a stack.]]
-[[Throws:] [Nothing.]]
+[[Preconditions:] [`minimum_stacksize() > size` and
+`maximum_stacksize() < size`.]]
+[[Effects:] [Allocates memory of `size` bytes (memory is set to NULL).]]
+[[Returns:] [Returns pointer to the start address of the new stack. Depending
+on the architecture the stack grows downwards/upwards the returned address is
+the highest/lowest address of the stack.]]
 ]
 
-[heading `std::size_t pagesize()`]
+[heading `void deallocate( void * sp, std::size_t size)`]
 [variablelist
-[[Returns:] [Returns how many bytes the operating system allocates for one page.]]
-[[Throws:] [Nothing.]]
+[[Preconditions:] [`sp` is valid, `minimum_stacksize() > size` and
+`maximum_stacksize() < size`.]]
+[[Effects:] [Deallocates the stack space.]]
 ]
 
-[heading `std::size_t page_count( std::size_t stacksize)`]
+[endsect]
+
+
+[section:pagesize Free function `pagesize()`]
+
+ std::size_t pagesize();
+
+[heading `std::size_t pagesize()`]
 [variablelist
-[[Returns:] [Returns how many pages have to be allocated for a stack of `stacksize` bytes.]]
-[[Throws:] [Nothing.]]
+[[Returns:] [Returns the size of a page in bytes.]]
 ]
 
+This function
+
 [endsect]
 
 [endsect]

Deleted: branches/release/libs/context/doc/tested.qbk
==============================================================================
--- branches/release/libs/context/doc/tested.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,74 +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
-]
-
-[section:tested Tested Platforms]
-
-[table
- [[Platform] [OS] [Compiler] [ABI]]
- [
- [ARM (ARM926EJ-S)]
- [Debian GNU/Linux (Lenny)]
- [GCC 4.4.4]
- [ARM APCS (Linux)]
- ]
- [
- [MIPS (MIPS 24K)]
- [Debian GNU/Linux (Lenny)]
- [GCC 4.3.2]
- [O32]
- ]
- [
- [MIPS (O2 / MIPS R5000)]
- [Debian GNU/Linux (Lenny)]
- [GCC 4.3.2]
- [O32]
- ]
- [
- [PowerPC (7400)]
- [Debian GNU/Linux (Lenny)]
- [GCC 4.3.2]
- [SYSV]
- ]
- [
- [X86_64 (Intel Core2 Quad)]
- [Ubuntu GNU/Linux (Lucid Lynx)]
- [GCC 4.4.3]
- [SYSV]
- ]
- [
- [X86_64]
- [Windows 7]
- [MS VC 10.0]
- [PE]
- ]
- [
- [I386]
- [Debian GNU/Linux (Lenny)]
- [GCC 4.4.3]
- [SYSV]
- ]
- [
- [I386]
- [FreeBSD 8.0]
- [GCC 4.2.1]
- [SYSV]
- ]
- [
- [I386]
- [OpenSolaris 2009.06]
- [GCC 4.3.2]
- [SYSV]
- ]
- [
- [I386]
- [Windows XP]
- [MSVC 9.0]
- [PE]
- ]
-]
-
-[endsect]

Modified: branches/release/libs/context/doc/todo.qbk
==============================================================================
--- branches/release/libs/context/doc/todo.qbk (original)
+++ branches/release/libs/context/doc/todo.qbk 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -7,7 +7,7 @@
 
 [section:todo Todo]
 
-* provide support for SPARC
+* provide support for SPARC, SuperH (SH4), S/390
 * support split-stack feature from gcc/gold linker
 
 [endsect]

Modified: branches/release/libs/context/example/Jamfile.v2
==============================================================================
--- branches/release/libs/context/example/Jamfile.v2 (original)
+++ branches/release/libs/context/example/Jamfile.v2 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -37,13 +37,13 @@
     ;
 
 exe jump
- : jump.cpp
- ;
+ : jump.cpp
+ ;
 
 exe exit
- : exit.cpp
- ;
+ : exit.cpp
+ ;
 
 exe transfer
- : transfer.cpp
- ;
+ : transfer.cpp
+ ;

Modified: branches/release/libs/context/example/exit.cpp
==============================================================================
--- branches/release/libs/context/example/exit.cpp (original)
+++ branches/release/libs/context/example/exit.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -12,43 +12,40 @@
 #include <boost/assert.hpp>
 #include <boost/context/all.hpp>
 
-namespace ctx = boost::ctx;
+namespace ctx = boost::context;
 
-ctx::fcontext_t fc1, fc2;
+ctx::fcontext_t * fc1;
+ctx::fcontext_t * fc2;
 
 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");
 }
 
 int main( int argc, char * argv[])
 {
         ctx::fcontext_t fcm;
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
- fc1.fc_stack.limit =
- static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f1);
-
- fc2.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
- fc2.fc_stack.limit =
- static_cast< char * >( fc2.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc2, f2);
+ void * sp1 = alloc.allocate(ctx::guarded_stack_allocator::default_stacksize());
+ fc1 = ctx::make_fcontext( sp1, ctx::guarded_stack_allocator::default_stacksize(), f1);
 
- std::cout << "main: call start_fcontext( & fcm, & fc1, 0)" << std::endl;
- ctx::jump_fcontext( & fcm, & fc1, 0);
+ void * sp2 = alloc.allocate(ctx::guarded_stack_allocator::default_stacksize());
+ fc2 = ctx::make_fcontext( sp2, ctx::guarded_stack_allocator::default_stacksize(), f2);
+
+ std::cout << "main: call start_fcontext( & fcm, fc1, 0)" << std::endl;
+ ctx::jump_fcontext( & fcm, fc1, 0);
 
         std::cout << "main: done" << std::endl;
         BOOST_ASSERT( false && ! "main: never returns");

Modified: branches/release/libs/context/example/jump.cpp
==============================================================================
--- branches/release/libs/context/example/jump.cpp (original)
+++ branches/release/libs/context/example/jump.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -12,43 +12,49 @@
 #include <boost/assert.hpp>
 #include <boost/context/all.hpp>
 
-namespace ctx = boost::ctx;
+namespace ctx = boost::context;
 
-ctx::fcontext_t fcm, fc1, fc2;
+ctx::fcontext_t fcm;
+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;
- ctx::jump_fcontext( & fc1, & fcm, 0);
+ 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);
+ std::cout << "f2: call jump_fcontext( fc2, fc1, 0)" << std::endl;
+ ctx::jump_fcontext( fc2, fc1, 0);
         BOOST_ASSERT( false && ! "f2: never returns");
 }
 
 int main( int argc, char * argv[])
 {
- ctx::stack_allocator alloc1, alloc2;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc1.allocate(ctx::minimum_stacksize());
- fc1.fc_stack.limit =
- static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f1);
-
- fc2.fc_stack.base = alloc2.allocate(ctx::minimum_stacksize());
- fc2.fc_stack.limit =
- static_cast< char * >( fc2.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc2, f2);
+ void * base1 = alloc.allocate(ctx::guarded_stack_allocator::default_stacksize());
+ BOOST_ASSERT( base1);
+ fc1 = ctx::make_fcontext( base1, ctx::guarded_stack_allocator::default_stacksize(), f1);
+ BOOST_ASSERT( fc1);
+ BOOST_ASSERT( base1 == fc1->fc_stack.sp);
+ BOOST_ASSERT( ctx::guarded_stack_allocator::default_stacksize() == fc1->fc_stack.size);
+
+ void * base2 = alloc.allocate(ctx::guarded_stack_allocator::default_stacksize());
+ BOOST_ASSERT( base2);
+ fc2 = ctx::make_fcontext( base2, ctx::guarded_stack_allocator::default_stacksize(), f2);
+ BOOST_ASSERT( fc2);
+ BOOST_ASSERT( base2 == fc2->fc_stack.sp);
+ BOOST_ASSERT( ctx::guarded_stack_allocator::default_stacksize() == fc2->fc_stack.size);
 
- std::cout << "main: call start_fcontext( & fcm, & fc1, 0)" << std::endl;
- ctx::jump_fcontext( & fcm, & fc1, 0);
+ std::cout << "main: call start_fcontext( & fcm, fc1, 0)" << std::endl;
+ ctx::jump_fcontext( & fcm, fc1, 0);
 
         std::cout << "main: done" << std::endl;
 

Modified: branches/release/libs/context/example/transfer.cpp
==============================================================================
--- branches/release/libs/context/example/transfer.cpp (original)
+++ branches/release/libs/context/example/transfer.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -13,9 +13,10 @@
 #include <boost/assert.hpp>
 #include <boost/context/all.hpp>
 
-namespace ctx = boost::ctx;
+namespace ctx = boost::context;
 
-ctx::fcontext_t fc1, fcm;
+ctx::fcontext_t fcm;
+ctx::fcontext_t * fc1;
 
 typedef std::pair< int, int > pair_t;
 
@@ -23,26 +24,25 @@
 {
     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[])
 {
- ctx::stack_allocator alloc;
+ typedef ctx::simple_stack_allocator< 256 * 1024, 64 * 1024, 8 * 1024 > alloc_t;
+ alloc_t alloc;
 
- fc1.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
- fc1.fc_stack.limit =
- static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f1);
+ void * sp = alloc.allocate(alloc_t::default_stacksize());
+ fc1 = ctx::make_fcontext( sp, alloc_t::default_stacksize(), f1);
 
     pair_t p( std::make_pair( 2, 7) );
- int res = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & p);
+ int res = ( int) ctx::jump_fcontext( & fcm, fc1, ( intptr_t) & p);
     std::cout << p.first << " + " << p.second << " == " << res << std::endl;
 
     p = std::make_pair( 5, 6);
- res = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & p);
+ res = ( int) ctx::jump_fcontext( & fcm, fc1, ( intptr_t) & p);
     std::cout << p.first << " + " << p.second << " == " << res << std::endl;
 
     std::cout << "main: done" << std::endl;

Modified: branches/release/libs/context/performance/performance.cpp
==============================================================================
--- branches/release/libs/context/performance/performance.cpp (original)
+++ branches/release/libs/context/performance/performance.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -19,7 +19,7 @@
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/program_options.hpp>
 
-#ifndef BOOST_WINDOWS
+#ifdef BOOST_USE_UCONTEXT
 #include <ucontext.h>
 #endif
 
@@ -30,50 +30,54 @@
 #include "zeit.hpp"
 #endif
 
-namespace ctx = boost::ctx;
+namespace ctx = boost::context;
 
-bool preserve_fpu = false;
+bool pres_fpu = false;
 
-#define CALL_FUNCTION(z,n,unused) \
- fn();
+#define CALL_FCONTEXT(z,n,unused) ctx::jump_fcontext( & fcm, fc, 7, pres_fpu);
 
-#define CALL_UCONTEXT(z,n,unused) \
- ::swapcontext( & ucm, & uc);
+#ifdef BOOST_USE_UCONTEXT
+# define CALL_UCONTEXT(z,n,unused) ::swapcontext( & ucm, & uc);
+#endif
+
+#define CALL_FUNCTION(z,n,unused) fn();
 
-#define CALL_FCONTEXT(z,n,unused) \
- ctx::jump_fcontext( & fcm, & fc, 7, preserve_fpu);
 
-#ifndef BOOST_WINDOWS
+ctx::fcontext_t fcm, * fc;
+
+#ifdef BOOST_USE_UCONTEXT
 ucontext_t uc, ucm;
 #endif
-ctx::fcontext_t fc, fcm;
 
-static void f3()
-{ }
 
-#ifndef BOOST_WINDOWS
+static void f1( intptr_t)
+{ while ( true) ctx::jump_fcontext( fc, & fcm, 7, pres_fpu); }
+
+#ifdef BOOST_USE_UCONTEXT
 static void f2()
-{
- while ( true)
- ::swapcontext( & uc, & ucm);
-}
+{ while ( true) ::swapcontext( & uc, & ucm); }
 #endif
 
-static void f1( intptr_t)
-{
- while ( true)
- ctx::jump_fcontext( & fc, & fcm, 7, preserve_fpu);
-}
+static void f3()
+{}
+
 
 #ifdef BOOST_CONTEXT_CYCLE
-cycle_t test_function_cycle( cycle_t ov)
+cycle_t test_fcontext_cycle( cycle_t ov)
 {
- boost::function< void() > fn( boost::bind( f3) );
+ ctx::guarded_stack_allocator alloc;
+ fc = ctx::make_fcontext(
+ alloc.allocate(ctx::guarded_stack_allocator::default_stacksize()),
+ ctx::guarded_stack_allocator::default_stacksize(),
+ f1);
+
+ ctx::jump_fcontext( & fcm, fc, 7, pres_fpu);
+
     // cache warum-up
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
 
     cycle_t start( cycles() );
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
     cycle_t total( cycles() - start);
 
     // we have two jumps and two measuremt-overheads
@@ -84,16 +88,14 @@
     return total;
 }
 
-#ifndef BOOST_WINDOWS
+# ifdef BOOST_USE_UCONTEXT
 cycle_t test_ucontext_cycle( cycle_t ov)
 {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
     ::getcontext( & uc);
- uc.uc_stack.ss_sp =
- static_cast< char * >( alloc.allocate(ctx::default_stacksize() ) )
- - ctx::default_stacksize();
- uc.uc_stack.ss_size = ctx::default_stacksize();
+ uc.uc_stack.ss_sp = alloc.allocate(ctx::guarded_stack_allocator_stacksize());
+ uc.uc_stack.ss_size = ctx::guarded_stack_allocator_stacksize();
     ::makecontext( & uc, f2, 7);
 
     // cache warum-up
@@ -110,23 +112,16 @@
 
     return total;
 }
-#endif
+# endif
 
-cycle_t test_fcontext_cycle( cycle_t ov)
+cycle_t test_function_cycle( cycle_t ov)
 {
- ctx::stack_allocator alloc;
- fc.fc_stack.base = alloc.allocate(ctx::default_stacksize());
- fc.fc_stack.limit =
- static_cast< char * >( fc.fc_stack.base) - ctx::default_stacksize();
- ctx::make_fcontext( & fc, f1);
-
- ctx::jump_fcontext( & fcm, & fc, 7, preserve_fpu);
-
+ boost::function< void() > fn( boost::bind( f3) );
     // cache warum-up
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
 
     cycle_t start( cycles() );
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
     cycle_t total( cycles() - start);
 
     // we have two jumps and two measuremt-overheads
@@ -138,15 +133,23 @@
 }
 #endif
 
+
 #if _POSIX_C_SOURCE >= 199309L
-zeit_t test_function_zeit( zeit_t ov)
+zeit_t test_fcontext_zeit( zeit_t ov)
 {
- boost::function< void() > fn( boost::bind( f3) );
+ ctx::guarded_stack_allocator alloc;
+ fc = ctx::make_fcontext(
+ alloc.allocate(ctx::guarded_stack_allocator::default_stacksize()),
+ ctx::guarded_stack_allocator::default_stacksize(),
+ f1);
+
+ ctx::jump_fcontext( & fcm, fc, 7, pres_fpu);
+
     // cache warum-up
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
 
     zeit_t start( zeit() );
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
     zeit_t total( zeit() - start);
 
     // we have two jumps and two measuremt-overheads
@@ -157,16 +160,14 @@
     return total;
 }
 
-#ifndef BOOST_WINDOWS
+# ifdef BOOST_USE_UCONTEXT
 zeit_t test_ucontext_zeit( zeit_t ov)
 {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
     ::getcontext( & uc);
- uc.uc_stack.ss_sp =
- static_cast< char * >( alloc.allocate(ctx::default_stacksize() ) )
- - ctx::default_stacksize();
- uc.uc_stack.ss_size = ctx::default_stacksize();
+ uc.uc_stack.ss_sp = alloc.allocate(ctx::guarded_stack_allocator_stacksize());
+ uc.uc_stack.ss_size = ctx::guarded_stack_allocator_stacksize();
     ::makecontext( & uc, f2, 7);
 
     // cache warum-up
@@ -183,23 +184,16 @@
 
     return total;
 }
-#endif
+# endif
 
-zeit_t test_fcontext_zeit( zeit_t ov)
+zeit_t test_function_zeit( zeit_t ov)
 {
- ctx::stack_allocator alloc;
- fc.fc_stack.base = alloc.allocate(ctx::default_stacksize());
- fc.fc_stack.limit =
- static_cast< char * >( fc.fc_stack.base) - ctx::default_stacksize();
- ctx::make_fcontext( & fc, f1);
-
- ctx::jump_fcontext( & fcm, & fc, 7, preserve_fpu);
-
+ boost::function< void() > fn( boost::bind( f3) );
     // cache warum-up
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
 
     zeit_t start( zeit() );
-BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FCONTEXT, ~)
+BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_FUNCTION, ~)
     zeit_t total( zeit() - start);
 
     // we have two jumps and two measuremt-overheads
@@ -224,10 +218,10 @@
 
             unsigned int res = test_fcontext_cycle( ov);
             std::cout << "fcontext: average of " << res << " cycles per switch" << std::endl;
-#ifndef BOOST_WINDOWS
+# ifdef BOOST_USE_UCONTEXT
             res = test_ucontext_cycle( ov);
             std::cout << "ucontext: average of " << res << " cycles per switch" << std::endl;
-#endif
+# endif
             res = test_function_cycle( ov);
             std::cout << "boost::function: average of " << res << " cycles per switch" << std::endl;
         }
@@ -240,10 +234,10 @@
 
             unsigned int res = test_fcontext_zeit( ov);
             std::cout << "fcontext: average of " << res << " ns per switch" << std::endl;
-#ifndef BOOST_WINDOWS
+# ifdef BOOST_USE_UCONTEXT
             res = test_ucontext_zeit( ov);
             std::cout << "ucontext: average of " << res << " ns per switch" << std::endl;
-#endif
+# endif
             res = test_function_zeit( ov);
             std::cout << "boost::function: average of " << res << " ns per switch" << std::endl;
         }

Deleted: branches/release/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,101 +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)
-*/
-
-/*******************************************************************
- * *
- * ------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
- * ------------------------------------------------------------- *
- * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| 0x20| 0x24| *
- * ------------------------------------------------------------- *
- * | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | sp | lr | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 10 | | *
- * ------------------------------------------------------------- *
- * | 0x28| | *
- * ------------------------------------------------------------- *
- * | pc | | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 11 | 12 | | *
- * ------------------------------------------------------------- *
- * | 0x2c| 0x30| | *
- * ------------------------------------------------------------- *
- * |sbase|slimit| | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | *
- * ------------------------------------------------------------- *
- * | 0x34| 0x38|0x3c| 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58 | *
- * ------------------------------------------------------------- *
- * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | s24 | s25 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 23 | 24 | 25 | 26 | 27 | 28 | | *
- * ------------------------------------------------------------- *
- * | 0x5c| 0x60| 0x64| 0x68| 0x6c| 0x70| | *
- * ------------------------------------------------------------- *
- * | s26 | s27 | s28 | s29 | s30 | s31 | | *
- * ------------------------------------------------------------- *
- * *
- * *****************************************************************/
-
-.text
-.globl jump_fcontext
-.align 2
-.type jump_fcontext,%function
-jump_fcontext:
- stmia a1, {v1-v8,sp-lr} @ save V1-V8,SP-LR
- str lr, [a1,#40] @ save LR as PC
-
-#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
- cmp a4, #0 @ test if fpu env should be preserved
- beq 1f
-
- mov a4, a1
- add a4, #52
- fstmiax a4, {d8-d15} @ save S16-S31
-
- mov a4, a2
- add a4, #52
- fldmiax a4, {d8-d15} @ restore S16-S31
-1:
-#endif
-
- mov a1, a3 @ use third arg as return value after jump
- @ and as first arg in context function
- ldmia a2, {v1-v8,sp-pc} @ restore v1-V8,SP-PC
-.size jump_fcontext,.-jump_fcontext
-
-.text
-.globl make_fcontext
-.align 2
-.type make_fcontext,%function
-make_fcontext:
- str a1, [a1,#0] @ save the address of passed context
- str a2, [a1,#40] @ save address of the context function
- ldr a2, [a1,#44] @ load the stack base
-
- push {a1,lr} @ save pointer to fcontext_t
- mov a1, a2 @ stack pointer as arg for align_stack
- bl align_stack_at_PLT @ align stack
- mov a2, a1 @ begin of aligned stack
- pop {a1,lr} @ restore pointer to fcontext_t
-
- str a2, [a1,#32] @ save the aligned stack base
-
- adr a2, finish @ address of finish; called after context function returns
- str a2, [a1,#36]
-
- mov a1, #0
- bx lr
-
-finish:
- mov a1, #0 @ exit code is zero
- bl _exit_at_PLT @ exit application
-.size make_fcontext,.-make_fcontext

Deleted: branches/release/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,151 +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)
-
-; --------------------------------------------------------------
-; | 0 | 1 | 2 | 3 | 4 | 5 |
-; --------------------------------------------------------------
-; | 0h | 04h | 08h | 0ch | 010h | 014h |
-; --------------------------------------------------------------
-; | EDI | ESI | EBX | EBP | ESP | EIP |
-; --------------------------------------------------------------
-; --------------------------------------------------------------
-; | 6 | 7 | |
-; --------------------------------------------------------------
-; | 018h | 01ch | |
-; --------------------------------------------------------------
-; | ss_base | ss_limit| |
-; --------------------------------------------------------------
-; --------------------------------------------------------------
-; | 8 | |
-; --------------------------------------------------------------
-; | 020h | |
-; --------------------------------------------------------------
-; |fc_execpt| |
-; --------------------------------------------------------------
-; --------------------------------------------------------------
-; | 9 | |
-; --------------------------------------------------------------
-; | 024h | |
-; --------------------------------------------------------------
-; |fc_strage| |
-; --------------------------------------------------------------
-; --------------------------------------------------------------
-; | 10 | 11 | |
-; --------------------------------------------------------------
-; | 028h | 02ch | |
-; --------------------------------------------------------------
-; | fc_mxcsr|fc_x87_cw| |
-; --------------------------------------------------------------
-
-.386
-.XMM
-.model flat, c
-_exit PROTO, value:SDWORD
-align_stack PROTO, vp:DWORD
-seh_fcontext PROTO, except:DWORD, frame:DWORD, context:DWORD, dispatch:DWORD
-.code
-
-jump_fcontext PROC EXPORT
- mov ecx, [esp+04h] ; load address of the first fcontext_t arg
- mov [ecx], edi ; save EDI
- mov [ecx+04h], esi ; save ESI
- mov [ecx+08h], ebx ; save EBX
- mov [ecx+0ch], ebp ; save EBP
-
- assume fs:nothing
- mov edx, fs:[018h] ; load NT_TIB
- assume fs:error
- mov eax, [edx] ; load current SEH exception list
- mov [ecx+020h], eax ; save current exception list
- mov eax, [edx+04h] ; load current stack base
- mov [ecx+018h], eax ; save current stack base
- mov eax, [edx+08h] ; load current stack limit
- mov [ecx+01ch], eax ; save current stack limit
- mov eax, [edx+010h] ; load fiber local storage
- mov [ecx+024h], eax ; save fiber local storage
-
- lea eax, [esp+04h] ; exclude the return address
- mov [ecx+010h], eax ; save as stack pointer
- mov eax, [esp] ; load return address
- mov [ecx+014h], eax ; save return address
-
- mov edx, [esp+08h] ; load address of the second fcontext_t arg
- mov edi, [edx] ; restore EDI
- mov esi, [edx+04h] ; restore ESI
- mov ebx, [edx+08h] ; restore EBX
- mov ebp, [edx+0ch] ; restore EBP
-
- mov eax, [esp+010h] ; check if fpu enve preserving was requested
- test eax, eax
- je nxt
-
- stmxcsr [ecx+028h] ; save MMX control word
- fnstcw [ecx+02ch] ; save x87 control word
- ldmxcsr [edx+028h] ; restore MMX control word
- fldcw [edx+02ch] ; restore x87 control word
-nxt:
- mov ecx, edx
- assume fs:nothing
- mov edx, fs:[018h] ; load NT_TIB
- assume fs:error
- mov eax, [ecx+020h] ; load SEH exception list
- mov [edx], eax ; restore next SEH item
- mov eax, [ecx+018h] ; load stack base
- mov [edx+04h], eax ; restore stack base
- mov eax, [ecx+01ch] ; load stack limit
- mov [edx+08h], eax ; restore stack limit
- mov eax, [ecx+024h] ; load fiber local storage
- mov [edx+010h], eax ; restore fiber local storage
-
- mov eax, [esp+0ch] ; use third arg as return value after jump
-
- mov esp, [ecx+010h] ; restore ESP
- mov [esp+04h], eax ; use third arg as first arg in context function
- mov ecx, [ecx+014h] ; fetch the address to return to
-
- jmp ecx ; indirect jump to context
-jump_fcontext ENDP
-
-make_fcontext PROC EXPORT
- mov eax, [esp+04h] ; load address of the fcontext_t arg0
- mov [eax], eax ; save the address of passed context
- mov ecx, [esp+08h] ; load the address of the context function
- mov [eax+014h], ecx ; save the address of the context function
- mov edx, [eax+018h] ; load the stack base
-
- push eax ; save pointer to fcontext_t
- push edx ; stack pointer as arg for align_stack
- call align_stack ; align stack
- mov edx, eax ; begin of aligned stack
- pop eax ; remove arg for align_stack
- pop eax ; restore pointer to fcontext_t
-
- lea edx, [edx-014h] ; reserve space for last frame on stack, (ESP + 4) & 15 == 0
- mov [eax+010h], edx ; save the aligned stack
-
- mov ecx, seh_fcontext ; set ECX to exception-handler
- mov [edx+0ch], ecx ; save ECX as SEH handler
- mov ecx, 0ffffffffh ; set ECX to -1
- mov [edx+08h], ecx ; save ECX as next SEH item
- lea ecx, [edx+08h] ; load address of next SEH item
- mov [eax+02ch], ecx ; save next SEH
-
- stmxcsr [eax+028h] ; save MMX control word
- fnstcw [eax+02ch] ; save x87 control word
-
- mov ecx, finish ; address of finish
- mov [edx], ecx
-
- xor eax, eax
- ret
-
-finish:
- xor eax, eax
- push eax ; exit code is zero
- call _exit ; exit application
- hlt
-make_fcontext ENDP
-END

Deleted: branches/release/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,122 +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)
-*/
-
-/********************************************************************
- * *
- * -------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | *
- * -------------------------------------------------------------- *
- * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | *
- * -------------------------------------------------------------- *
- * | EDI | ESI | EBX | EBP | ESP | EIP | *
- * -------------------------------------------------------------- *
- * -------------------------------------------------------------- *
- * | 6 | 7 | | *
- * -------------------------------------------------------------- *
- * | 0x18 | 0x1c | | *
- * -------------------------------------------------------------- *
- * | sbase | slimit | | *
- * -------------------------------------------------------------- *
- * -------------------------------------------------------------- *
- * | 8 | 9 | | *
- * -------------------------------------------------------------- *
- * | 0x20 | 0x24 | | *
- * -------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
- * -------------------------------------------------------------- *
- * *
- * *****************************************************************/
-
-.text
-.globl jump_fcontext
-.align 2
-.type jump_fcontext,@function
-jump_fcontext:
- movl 0x4(%esp), %ecx /* load address of the first fcontext_t arg */
- movl %edi, (%ecx) /* save EDI */
- movl %esi, 0x4(%ecx) /* save ESI */
- movl %ebx, 0x8(%ecx) /* save EBX */
- movl %ebp, 0xc(%ecx) /* save EBP */
-
- leal 0x4(%esp), %eax /* exclude the return address */
- movl %eax, 0x10(%ecx) /* save as stack pointer */
- movl (%esp), %eax /* load return address */
- movl %eax, 0x14(%ecx) /* save return address */
-
- movl 0x8(%esp), %edx /* load address of the second fcontext_t arg */
- movl (%edx), %edi /* restore EDI */
- movl 0x4(%edx), %esi /* restore ESI */
- movl 0x8(%edx), %ebx /* restore EBX */
- movl 0xc(%edx), %ebp /* restore EBP */
-
- movl 0x10(%esp), %eax /* check if fpu enve preserving was requested */
- test %eax, %eax
- je 1f
-
- stmxcsr 0x20(%ecx) /* save MMX control and status word */
- fnstcw 0x24(%ecx) /* save x87 control word */
- ldmxcsr 0x20(%edx) /* restore MMX control and status word */
- fldcw 0x24(%edx) /* restore x87 control word */
-1:
- movl 0xc(%esp), %eax /* use third arg as return value after jump */
-
- movl 0x10(%edx), %esp /* restore ESP */
- movl %eax, 0x4(%esp) /* use third arg as first arg in context function */
- movl 0x14(%edx), %edx /* fetch the address to return to */
-
- jmp *%edx /* indirect jump to context */
-.size jump_fcontext,.-jump_fcontext
-
-.text
-.globl make_fcontext
-.align 2
-.type make_fcontext,@function
-make_fcontext:
- movl 0x4(%esp), %eax /* load address of the fcontext_t */
- movl %eax, (%eax) /* save the address of current context */
- movl 0x8(%esp), %ecx /* load the address of the context function */
- movl %ecx, 0x14(%eax) /* save the address of the context function */
- movl 0x18(%eax), %edx /* load the stack base */
-
- pushl %eax /* save pointer to fcontext_t */
- pushl %ebx /* save EBX */
- pushl %edx /* stack pointer as arg for align_stack */
- call 1f
-1: popl %ebx /* address of label 1 */
- addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx /* compute address of GOT and store it in EBX */
- call align_stack_at_PLT /* align stack */
- movl %eax, %edx /* begin of aligned stack */
- popl %eax /* remove arg for align_stack */
- popl %ebx /* restore EBX */
- popl %eax /* restore pointer to fcontext_t */
-
- leal -0x14(%edx), %edx /* reserve space for the last frame on stack, (ESP + 4) % 16 == 0 */
- movl %edx, 0x10(%eax) /* save the aligned stack base */
-
- stmxcsr 0x20(%eax) /* save MMX control and status word */
- fnstcw 0x24(%eax) /* save x87 control word */
-
- call 2f
-2: popl %ecx /* address of label 2 */
- addl $finish-2b, %ecx /* helper code executed after context function returns */
- movl %ecx, (%edx)
-
- xorl %eax, %eax
- ret
-
-finish:
- leal -0xc(%esp), %esp
-
- call 3f
-3: popl %ebx /* address of label 3 */
- addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx /* compute address of GOT and store it in EBX */
-
- xorl %eax, %eax
- pushl %eax /* exit code is zero */
- call _exit_at_PLT /* exit application */
- hlt
-.size make_fcontext,.-make_fcontext

Deleted: branches/release/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,118 +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)
-*/
-
-/********************************************************************
- * *
- * -------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | *
- * -------------------------------------------------------------- *
- * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | *
- * -------------------------------------------------------------- *
- * | EDI | ESI | EBX | EBP | ESP | EIP | *
- * -------------------------------------------------------------- *
- * -------------------------------------------------------------- *
- * | 6 | 7 | | *
- * -------------------------------------------------------------- *
- * | 0x18 | 0x1c | | *
- * -------------------------------------------------------------- *
- * | sbase | slimit | | *
- * -------------------------------------------------------------- *
- * -------------------------------------------------------------- *
- * | 8 | 9 | | *
- * -------------------------------------------------------------- *
- * | 0x20 | 0x24 | | *
- * -------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
- * -------------------------------------------------------------- *
- * *
- * *****************************************************************/
-
-.text
-.globl _jump_fcontext
-.align 2
-_jump_fcontext:
- movl 0x4(%esp), %ecx /* load address of the first fcontext_t arg */
- movl %edi, (%ecx) /* save EDI */
- movl %esi, 0x4(%ecx) /* save ESI */
- movl %ebx, 0x8(%ecx) /* save EBX */
- movl %ebp, 0xc(%ecx) /* save EBP */
-
- leal 0x4(%esp), %eax /* exclude the return address */
- movl %eax, 0x10(%ecx) /* save as stack pointer */
- movl (%esp), %eax /* load return address */
- movl %eax, 0x14(%ecx) /* save return address */
-
- movl 0x8(%esp), %edx /* load address of the second fcontext_t arg */
- movl (%edx), %edi /* restore EDI */
- movl 0x4(%edx), %esi /* restore ESI */
- movl 0x8(%edx), %ebx /* restore EBX */
- movl 0xc(%edx), %ebp /* restore EBP */
-
- movl 0x10(%esp), %eax /* check if fpu enve preserving was requested */
- test %eax, %eax
- je 1f
-
- stmxcsr 0x20(%ecx) /* save MMX control and status word */
- fnstcw 0x24(%ecx) /* save x87 control word */
- ldmxcsr 0x20(%edx) /* restore MMX control and status word */
- fldcw 0x24(%edx) /* restore x87 control word */
-1:
- movl 0xc(%esp), %eax /* use third arg as return value after jump */
-
- movl 0x10(%edx), %esp /* restore ESP */
- movl %eax, 0x4(%esp) /* use third arg as first arg in context function */
- movl 0x14(%edx), %edx /* fetch the address to return to */
-
- jmp *%edx /* indirect jump to context */
-
-.text
-.globl _make_fcontext
-.align 2
-_make_fcontext:
- movl 0x4(%esp), %eax /* load address of the fcontext_t */
- movl %eax, (%eax) /* save the address of current context */
- movl 0x8(%esp), %ecx /* load the address of the context function */
- movl %ecx, 0x14(%eax) /* save the address of the context function */
- movl 0x18(%eax), %edx /* load the stack base */
-
- pushl %eax /* save pointer to fcontext_t */
- pushl %ebx /* save EBX */
- pushl %edx /* stack pointer as arg for align_stack */
- call 1f
-1: popl %ebx /* address of label 1 */
- addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx /* compute address of GOT and store it in EBX */
- call align_stack_at_PLT /* align stack */
- movl %eax, %edx /* begin of aligned stack */
- popl %eax /* remove arg for align_stack */
- popl %ebx /* restore EBX */
- popl %eax /* restore pointer to fcontext_t */
-
- leal -0x14(%edx), %edx /* reserve space for the last frame on stack, (ESP + 4) % 16 == 0 */
- movl %edx, 0x10(%eax) /* save the aligned stack base */
-
- stmxcsr 0x20(%eax) /* save MMX control and status word */
- fnstcw 0x24(%eax) /* save x87 control word */
-
- call 2f
-2: popl %ecx /* address of label 2 */
- addl $finish-2b, %ecx /* helper code executed after context function returns */
- movl %ecx, (%edx)
-
- xorl %eax, %eax
- ret
-
-finish:
- leal -0xc(%esp), %esp
-
- call 3f
-3: popl %ebx /* address of label 3 */
- addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx /* compute address of GOT and store it in EBX */
-
- xorl %eax, %eax
- pushl %eax /* exit code is zero */
- call _exit_at_PLT /* exit application */
- hlt

Deleted: branches/release/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,144 +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)
-*/
-
-/*******************************************************************
- * *
- * ------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
- * ------------------------------------------------------------- *
- * | 0 | 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | 72 | *
- * ------------------------------------------------------------- *
- * | S0 | S1 | S2 | S3 | S4 | S5 | S6 | S7 | GP | SP | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 10 | 11 | 12 | | *
- * ------------------------------------------------------------- *
- * | 80 | 88 | 96 | | *
- * ------------------------------------------------------------- *
- * | S8 | RA | PC | | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 13 | 14 | | *
- * ------------------------------------------------------------- *
- * | 104 | 112 | | *
- * ------------------------------------------------------------- *
- * |sbase|slimt| | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 15 | 16 | 17 | 18 | 19 | 20 | | *
- * ------------------------------------------------------------- *
- * | 120 | 128 | 136 | 144 | 152 | 160 | | *
- * ------------------------------------------------------------- *
- * | F20 | F22 | F24 | F26 | F28 | F30 | | *
- * ------------------------------------------------------------- *
- * *
- * *****************************************************************/
-
-.text
-.globl jump_fcontext
-.align 2
-.type jump_fcontext,@function
-.ent jump_fcontext
-jump_fcontext:
- sw $s0, ($a0) # save S0
- sw $s1, 8($a0) # save S1
- sw $s2, 16($a0) # save S2
- sw $s3, 24($a0) # save S3
- sw $s4, 32($a0) # save S4
- sw $s5, 40($a0) # save S5
- sw $s6, 48($a0) # save S6
- sw $s7, 56($a0) # save S7
- sw $gp, 64($a0) # save GP
- sw $sp, 72($a0) # save SP
- sw $s8, 80($a0) # save S8
- sw $ra, 88($a0) # save RA
- sw $ra, 96($a0) # save RA as PC
-
-#if defined(__mips_hard_float)
- beqz $a3, 1f # test if fpu env should be preserved
- s.d $f20, 120($a0) # save F20
- s.d $f22, 128($a0) # save F22
- s.d $f24, 136($a0) # save F24
- s.d $f26, 144($a0) # save F26
- s.d $f28, 152($a0) # save F28
- s.d $f30, 160($a0) # save F30
-
- l.d $f20, 120($a1) # restore F20
- l.d $f22, 128($a1) # restore F22
- l.d $f24, 136($a1) # restore F24
- l.d $f26, 144($a1) # restore F26
- l.d $f28, 152($a1) # restore F28
- l.d $f30, 160($a1) # restore F30
-1:
-#endif
-
- lw $s0, ($a1) # restore S0
- lw $s1, 8($a1) # restore S1
- lw $s2, 16($a1) # restore S2
- lw $s3, 24($a1) # restore S3
- lw $s4, 32($a1) # restore S4
- lw $s5, 40($a1) # restore S5
- lw $s6, 48($a1) # restore S6
- lw $s7, 56($a1) # restore S7
- lw $gp, 64($a1) # restore GP
- lw $sp, 72($a1) # restore SP
- lw $s8, 80($a1) # restore S8
- lw $ra, 88($a1) # restore RA
- move $a0, $s2 # restore void pointer as argument
-
- move $v0, $a2 # use third arg as return value after jump
- move $a0, $a2 # use third arg as first arg in context function
-
- lw $t9, 96($a1) # load PC
- jr $t9 # jump to context
-.end jump_fcontext
-.size jump_fcontext, .-jump_fcontext
-
-.text
-.globl make_fcontext
-.align 2
-.type make_fcontext,@function
-.ent make_fcontext
-make_fcontext:
-#ifdef __PIC__
-.set noreorder
-.cpload $t9
-.set reorder
-#endif
- sw $a0, ($a0) # save the current context
- sw $gp, 24($a0) # save global pointer
- sw $a1, 96($a0) # save the address of the context function
- lw $t0, 104($a0) # load the stack base
-
- sub $sp, $sp, 28
- sw $ra, 24($sp)
- sw $a0, 20($sp)
- move $a0, $t0 # stack pointer as arg for align_stack
- lw $t9, %call16(align_stack)($gp) # align stack
- jalr $t9
- nop
- move $t0, $v0 # begin of aligned stack
- lw $ra, 24($sp)
- lw $a0, 20($sp)
- addi $sp, $sp, 28
-
- sub $t0, $t0, 16 # reserve 16 byte of argument space
- sw $t0, 72($a0) # save the algned stack base
-
- la $t9, finish # helper code executed after context function returns
- sw $t9, 88($a0)
-
- move $v0, $zero
- jr $ra
-
-finish:
- move $gp, $s3 # restore GP (global pointer)
- move $a0, $zero # exit code is zero
- lw $t9, %call16(_exit)($gp) # exit application
- jalr $t9
-.end make_fcontext
-.size make_fcontext, .-make_fcontext

Deleted: branches/release/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,222 +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)
-*/
-
-/*******************************************************************
- * *
- * ------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
- * ------------------------------------------------------------- *
- * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
- * ------------------------------------------------------------- *
- * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
- * ------------------------------------------------------------- *
- * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
- * ------------------------------------------------------------- *
- * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | SP | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 20 | 21 | 22 | | *
- * ------------------------------------------------------------- *
- * | 80 | 84 | 88 | | *
- * ------------------------------------------------------------- *
- * | CR | LR | PC | | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 23 | 24 | | *
- * ------------------------------------------------------------- *
- * | 92 | 96 | | *
- * ------------------------------------------------------------- *
- * |sbase|slimt| | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | *
- * ------------------------------------------------------------- *
- * | 100 | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | *
- * ------------------------------------------------------------- *
- * | F14 | F15 | F16 | F17 | F18 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | *
- * ------------------------------------------------------------- *
- * | 140 | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | *
- * ------------------------------------------------------------- *
- * | F19 | F20 | F21 | F22 | F23 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
- * ------------------------------------------------------------- *
- * | 180 | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | *
- * ------------------------------------------------------------- *
- * | F24 | F25 | F26 | F27 | F28 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | | *
- * ------------------------------------------------------------- *
- * | 220 | 224 | 228 | 232 | 236 | 240 | 244 | 248 | | *
- * ------------------------------------------------------------- *
- * | F29 | F30 | F31 | fpscr | | *
- * ------------------------------------------------------------- *
- * *
- * *****************************************************************/
-
-.text
-.globl jump_fcontext
-.align 2
-.type jump_fcontext,@function
-jump_fcontext:
- stw %r13, 0(%r3) # save R13
- stw %r14, 4(%r3) # save R14
- stw %r15, 8(%r3) # save R15
- stw %r16, 12(%r3) # save R16
- stw %r17, 16(%r3) # save R17
- stw %r18, 20(%r3) # save R18
- stw %r19, 24(%r3) # save R19
- stw %r20, 28(%r3) # save R20
- stw %r21, 32(%r3) # save R21
- stw %r22, 36(%r3) # save R22
- stw %r23, 40(%r3) # save R23
- stw %r24, 44(%r3) # save R24
- stw %r25, 48(%r3) # save R25
- stw %r26, 52(%r3) # save R26
- stw %r27, 56(%r3) # save R27
- stw %r28, 60(%r3) # save R28
- stw %r29, 64(%r3) # save R29
- stw %r30, 68(%r3) # save R30
- stw %r31, 72(%r3) # save R31
- stw %r1, 76(%r3) # save SP
-
- mfcr %r0 # load CR
- stw %r0, 80(%r3) # save CR
- mflr %r0 # load LR
- stw %r0, 84(%r3) # save LR
- stw %r0, 88(%r3) # save LR as PC
-
- cmpwi cr7, %r6, 0 # test if fpu env should be preserved
- beq cr7, 1f
-
- stfd %f14, 100(%r3) # save F14
- stfd %f15, 108(%r3) # save F15
- stfd %f16, 116(%r3) # save F16
- stfd %f17, 124(%r3) # save F17
- stfd %f18, 132(%r3) # save F18
- stfd %f19, 140(%r3) # save F19
- stfd %f20, 148(%r3) # save F20
- stfd %f21, 156(%r3) # save F21
- stfd %f22, 164(%r3) # save F22
- stfd %f23, 172(%r3) # save F23
- stfd %f24, 180(%r3) # save F24
- stfd %f25, 188(%r3) # save F25
- stfd %f26, 196(%r3) # save F26
- stfd %f27, 204(%r3) # save F27
- stfd %f28, 212(%r3) # save F28
- stfd %f29, 220(%r3) # save F29
- stfd %f30, 228(%r3) # save F30
- stfd %f31, 236(%r3) # save F31
- mffs %f0 # load FPSCR
- stfd %f0, 244(%r3) # save FPSCR
-
- lfd %f14, 100(%r4) # restore F14
- lfd %f15, 108(%r4) # restore F15
- lfd %f16, 116(%r4) # restore F16
- lfd %f17, 124(%r4) # restore F17
- lfd %f18, 132(%r4) # restore F18
- lfd %f19, 140(%r4) # restore F19
- lfd %f20, 148(%r4) # restore F20
- lfd %f21, 156(%r4) # restore F21
- lfd %f22, 164(%r4) # restore F22
- lfd %f23, 172(%r4) # restore F23
- lfd %f24, 180(%r4) # restore F24
- lfd %f25, 188(%r4) # restore F25
- lfd %f26, 196(%r4) # restore F26
- lfd %f27, 204(%r4) # restore F27
- lfd %f28, 212(%r4) # restore F28
- lfd %f29, 220(%r4) # restore F29
- lfd %f30, 228(%r4) # restore F30
- lfd %f31, 236(%r4) # restore F31
- lfd %f0, 244(%r4) # load FPSCR
- mtfsf 0xff, %f0 # restore FPSCR
-1:
-
- lwz %r13, 0(%r4) # restore R13
- lwz %r14, 4(%r4) # restore R14
- lwz %r15, 8(%r4) # restore R15
- lwz %r16, 12(%r4) # restore R16
- lwz %r17, 16(%r4) # restore R17
- lwz %r18, 20(%r4) # restore R18
- lwz %r19, 24(%r4) # restore R19
- lwz %r20, 28(%r4) # restore R20
- lwz %r21, 32(%r4) # restore R21
- lwz %r22, 36(%r4) # restore R22
- lwz %r23, 40(%r4) # restore R23
- lwz %r24, 44(%r4) # restore R24
- lwz %r25, 48(%r4) # restore R25
- lwz %r26, 52(%r4) # restore R26
- lwz %r27, 56(%r4) # restore R27
- lwz %r28, 60(%r4) # restore R28
- lwz %r29, 64(%r4) # restore R29
- lwz %r30, 68(%r4) # restore R30
- lwz %r31, 72(%r4) # restore R31
- lwz %r1, 76(%r4) # restore SP
-
- lwz %r0, 80(%r4) # load CR
- mtcr %r0 # restore CR
- lwz %r0, 84(%r4) # load LR
- mtlr %r0 # restore LR
-
- mr. %r3, %r5 # use third arg as return value after jump
- # and as first arg in context function
-
- lwz %r0, 88(%r4) # load PC
- mtctr %r0 # restore CTR
-
- bctr # jump to context
-.size jump_fcontext, .-jump_fcontext
-
-.text
-.globl make_fcontext
-.align 2
-.type make_fcontext,@function
-make_fcontext:
- stw %r3, 0(%r3) # save the current context
- stw %r4, 88(%r3) # save the address of the context function
- lwz %r0, 92(%r3) # load the stack base
-
- li %r4, 28
- subf %r1, %r4, %r1 # reserve space on stack
- stw %r3, 24(%r1) # store pointer to fcontext_t on stack
- mflr %r4 # load LR
- stw %r4, 20(%r1) # store LR on stack
- mr. %r3, %r0 # context stack as arg to align_stack
- bl align_stack_at_plt # call align_stack
- mr. %r0, %r3 # load result into R0
- lwz %r4, 20(%r1) # pop LR from stack
- mtlr %r4 # restore LR
- lwz %r3, 24(%r1) # pop pointer to fcontext_t from stack
- addi %r1, %r1, 28 # release space on stack
-
- li %r4, 32
- subf %r0, %r4, %r0 # 32 bytes on stack for parameter area(== 8 registers)
- stw %r0, 76(%r3) # save the aligned stack base
-
- mflr %r0 # load LR
- bl 1f # jump to label 1
-1:
- mflr %r4 # load LR
- addi %r4, %r4, finish - 1b # address of finish; called after context function returns
- mtlr %r0 # restore LR
- stw %r4, 84(%r3)
-
- li %r3, 0
- blr
-
-finish:
- li %r3, 0 # exit code is zero
- bl _exit_at_plt # exit application
-.size make_fcontext, .-make_fcontext

Deleted: branches/release/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,250 +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)
-*/
-
-/*******************************************************************
- * *
- * ------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
- * ------------------------------------------------------------- *
- * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
- * ------------------------------------------------------------- *
- * | R13 | R14 | R15 | R16 | R17 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
- * ------------------------------------------------------------- *
- * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
- * ------------------------------------------------------------- *
- * | R18 | R19 | R20 | R21 | R22 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *
- * ------------------------------------------------------------- *
- * | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | *
- * ------------------------------------------------------------- *
- * | R23 | R24 | R25 | R26 | R27 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
- * ------------------------------------------------------------- *
- * | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
- * ------------------------------------------------------------- *
- * | R28 | R29 | R30 | R31 | SP | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 40 | 41 | 42 | 43 | 44 | 45 | | *
- * ------------------------------------------------------------- *
- * | 160 | 164 | 168 | 172 | 176 | 180 | | *
- * ------------------------------------------------------------- *
- * | CR | LR | PC | | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 46 | 47 | 48 | 49 | | *
- * ------------------------------------------------------------- *
- * | 184 | 188 | 192 | 196 | | *
- * ------------------------------------------------------------- *
- * | sbase | slimt | | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
- * ------------------------------------------------------------- *
- * | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | *
- * ------------------------------------------------------------- *
- * | F14 | F15 | F16 | F17 | F18 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | *
- * ------------------------------------------------------------- *
- * | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | *
- * ------------------------------------------------------------- *
- * | F19 | F20 | F21 | F22 | F23 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | *
- * ------------------------------------------------------------- *
- * | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | *
- * ------------------------------------------------------------- *
- * | F24 | F25 | F26 | F27 | F28 | *
- * ------------------------------------------------------------- *
- * ------------------------------------------------------------- *
- * | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | | *
- * ------------------------------------------------------------- *
- * | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 | | *
- * ------------------------------------------------------------- *
- * | F29 | F30 | F31 | fpscr | | *
- * ------------------------------------------------------------- *
- * *
- * *****************************************************************/
-
-.section ".text"
-.align 2
-.globl jump_fcontext
-.section ".opd","aw"
-.align 3
-jump_fcontext:
-.quad .jump_fcontext,.TOC._at_tocbase,0
-.previous
-.size jump_fcontext,24
-.type .jump_fcontext,@function
-.globl .jump_fcontext
-.jump_fcontext:
- std %r13, 0(%r3) # save R13
- std %r14, 8(%r3) # save R14
- std %r15, 16(%r3) # save R15
- std %r16, 24(%r3) # save R16
- std %r17, 32(%r3) # save R17
- std %r18, 40(%r3) # save R18
- std %r19, 48(%r3) # save R19
- std %r20, 56(%r3) # save R20
- std %r21, 64(%r3) # save R21
- std %r22, 72(%r3) # save R22
- std %r23, 80(%r3) # save R23
- std %r24, 88(%r3) # save R24
- std %r25, 96(%r3) # save R25
- std %r26, 104(%r3) # save R26
- std %r27, 112(%r3) # save R27
- std %r28, 120(%r3) # save R28
- std %r29, 128(%r3) # save R29
- std %r30, 136(%r3) # save R30
- std %r31, 144(%r3) # save R31
- std %r1, 152(%r3) # save SP
-
- mfcr %r0 # load CR
- std %r0, 160(%r3) # save CR
- mflr %r0 # load LR
- std %r0, 168(%r3) # save LR
- std %r0, 176(%r3) # save LR as PC
-
- cmpwi cr7, %r6, 0 # test if fpu env should be preserved
- beq cr7, 1f
-
- stfd %f14, 200(%r3) # save F14
- stfd %f15, 208(%r3) # save F15
- stfd %f16, 216(%r3) # save F16
- stfd %f17, 224(%r3) # save F17
- stfd %f18, 232(%r3) # save F18
- stfd %f19, 240(%r3) # save F19
- stfd %f20, 248(%r3) # save F20
- stfd %f21, 256(%r3) # save F21
- stfd %f22, 264(%r3) # save F22
- stfd %f23, 272(%r3) # save F23
- stfd %f24, 280(%r3) # save F24
- stfd %f25, 288(%r3) # save F25
- stfd %f26, 296(%r3) # save F26
- stfd %f27, 304(%r3) # save F27
- stfd %f28, 312(%r3) # save F28
- stfd %f29, 320(%r3) # save F29
- stfd %f30, 328(%r3) # save F30
- stfd %f31, 336(%r3) # save F31
- mffs %f0 # load FPSCR
- stfd %f0, 344(%r3) # save FPSCR
-
- lfd %f14, 200(%r4) # restore F14
- lfd %f15, 208(%r4) # restore F15
- lfd %f16, 216(%r4) # restore F16
- lfd %f17, 224(%r4) # restore F17
- lfd %f18, 232(%r4) # restore F18
- lfd %f19, 240(%r4) # restore F19
- lfd %f20, 248(%r4) # restore F20
- lfd %f21, 256(%r4) # restore F21
- lfd %f22, 264(%r4) # restore F22
- lfd %f23, 272(%r4) # restore F23
- lfd %f24, 280(%r4) # restore F24
- lfd %f25, 288(%r4) # restore F25
- lfd %f26, 296(%r4) # restore F26
- lfd %f27, 304(%r4) # restore F27
- lfd %f28, 312(%r4) # restore F28
- lfd %f29, 320(%r4) # restore F29
- lfd %f30, 328(%r4) # restore F30
- lfd %f31, 336(%r4) # restore F31
- lfd %f0, 344(%r4) # load FPSCR
- mtfsf 0xff, %f0 # restore FPSCR
-1:
-
- ld %r13, 0(%r4) # restore R13
- ld %r14, 8(%r4) # restore R14
- ld %r15, 16(%r4) # restore R15
- ld %r16, 24(%r4) # restore R16
- ld %r17, 32(%r4) # restore R17
- ld %r18, 40(%r4) # restore R18
- ld %r19, 48(%r4) # restore R19
- ld %r20, 56(%r4) # restore R20
- ld %r21, 64(%r4) # restore R21
- ld %r22, 72(%r4) # restore R22
- ld %r23, 80(%r4) # restore R23
- ld %r24, 88(%r4) # restore R24
- ld %r25, 96(%r4) # restore R25
- ld %r26, 104(%r4) # restore R26
- ld %r27, 112(%r4) # restore R27
- ld %r28, 120(%r4) # restore R28
- ld %r29, 128(%r4) # restore R29
- ld %r30, 136(%r4) # restore r30
- ld %r31, 144(%r4) # restore r31
- ld %r1, 152(%r4) # restore SP
-
- ld %r0, 160(%r4) # load CR
- mtcr %r0 # restore CR
- ld %r0, 168(%r4) # load LR
- mtlr %r0 # restore LR
-
- mr. %r3, %r5 # use third arg as return value after jump
- # and as first arg in context function
-
- ld %r0, 176(%r4) # load PC
- mtctr %r0 # restore CTR
-
- bctr # jump to context
-.size .jump_fcontext, .-.jump_fcontext
-
-.section ".text"
-.align 2
-.globl make_fcontext
-.section ".opd","aw"
-.align 3
-make_fcontext:
-.quad .make_fcontext,.TOC._at_tocbase,0
-.previous
-.size make_fcontext,24
-.type .make_fcontext,@function
-.globl .make_fcontext
-.make_fcontext:
- std %r3, 0(%r3) # save the current context
- std %r4, 176(%r3) # save the address of the function supposed to be run
- ld %r0, 184(%r3) # load the stack base
-
- li %r4, 56
- subf %r1, %r4, %r1 # reserve space on stack
- stw %r3, 48(%r1) # store pointer to fcontext_t on stack
- mflr %r4 # load LR
- stw %r4, 40(%r1) # store LR on stack
- mr. %r3, %r0 # context stack as arg to align_stack
- bl align_stack_at_plt # call align_stack
- mr. %r0, %r3 # load result into R0
- lwz %r4, 40(%r1) # pop LR from stack
- mtlr %r4 # restore LR
- lwz %r3, 48(%r1) # pop pointer to fcontext_t from stack
- addi %r1, %r1, 56 # release space on stack
-
- li %r4, 64
- subf %r0, %r4, %r0 # 64 bytes on stack for parameter area (== 8 registers)
- std %r0, 152(%r3) # save the stack base
-
- mflr %r0 # load LR
- bl 1f # jump to label 1
-1:
- mflr %r4 # load LR
- addi %r4, %r4, finish - 1b # calulate absolute address of finish
- mtlr %r0 # restore LR
- std %r4, 168(%r3) # save address of finish
-
- li %r3, 0 # set return value to zero
- blr
-
-finish:
- li %r3, 0 # set return value to zero
- bl _exit_at_plt # exit application
-.size .make_fcontext, .-.make_fcontext

Deleted: branches/release/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,207 +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)
-
-; ----------------------------------------------------------------------------------
-; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
-; ----------------------------------------------------------------------------------
-; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
-; ----------------------------------------------------------------------------------
-; | R12 | R13 | R14 | R15 |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
-; ----------------------------------------------------------------------------------
-; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
-; ----------------------------------------------------------------------------------
-; | RDI | RSI | RBX | RBP |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 16 | 17 | 18 | 19 | |
-; ----------------------------------------------------------------------------------
-; | 0x40 | 0x44 | 0x48 | 0x4c | |
-; ----------------------------------------------------------------------------------
-; | RSP | RIP | |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 20 | 21 | 22 | 23 | |
-; ----------------------------------------------------------------------------------
-; | 0x50 | 0x54 | 0x58 | 0x5c | |
-; ----------------------------------------------------------------------------------
-; | sbase | slimit | |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 24 | 25 | |
-; ----------------------------------------------------------------------------------
-; | 0x60 | 0x64 | |
-; ----------------------------------------------------------------------------------
-; | fbr_strg | |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 26 | 27 | 28 | 29 | |
-; ----------------------------------------------------------------------------------
-; | 0x68 | 0x6c | 0x70 | 0x74 | |
-; ----------------------------------------------------------------------------------
-; | fc_mxcsr|fc_x87_cw| fc_xmm | |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
-; ----------------------------------------------------------------------------------
-; | 0x78 | 0x7c | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 |
-; ----------------------------------------------------------------------------------
-; | XMM6 | XMM7 |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
-; ----------------------------------------------------------------------------------
-; | 0x98 | 0x9c | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 |
-; ----------------------------------------------------------------------------------
-; | XMM8 | XMM9 |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
-; ----------------------------------------------------------------------------------
-; | 0x118 | 0x11c | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 |
-; ----------------------------------------------------------------------------------
-; | XMM10 | XMM11 |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
-; ----------------------------------------------------------------------------------
-; | 0x138 | 0x13c | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 |
-; ----------------------------------------------------------------------------------
-; | XMM12 | XMM13 |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
-; ----------------------------------------------------------------------------------
-; | 0x158 | 0x15c | 0x160 | 0x164 | 0x168 | 0x16c | 0x170 | 0x174 |
-; ----------------------------------------------------------------------------------
-; | XMM14 | XMM15 |
-; ----------------------------------------------------------------------------------
-
-EXTERN _exit:PROC ; standard C library function
-EXTERN align_stack:PROC ; stack alignment
-EXTERN seh_fcontext:PROC ; exception handler
-.code
-
-jump_fcontext PROC EXPORT FRAME:seh_fcontext
- .endprolog
-
- mov [rcx], r12 ; save R12
- mov [rcx+08h], r13 ; save R13
- mov [rcx+010h], r14 ; save R14
- mov [rcx+018h], r15 ; save R15
- mov [rcx+020h], rdi ; save RDI
- mov [rcx+028h], rsi ; save RSI
- mov [rcx+030h], rbx ; save RBX
- mov [rcx+038h], rbp ; save RBP
-
- mov r10, gs:[030h] ; load NT_TIB
- mov rax, [r10+08h] ; load current stack base
- mov [rcx+050h], rax ; save current stack base
- mov rax, [r10+010h] ; load current stack limit
- mov [rcx+058h], rax ; save current stack limit
- mov rax, [r10+018h] ; load fiber local storage
- mov [rcx+060h], rax ; save fiber local storage
-
- test r9, r9
- je nxt
-
- stmxcsr [rcx+068h] ; save MMX control and status word
- fnstcw [rcx+06ch] ; save x87 control word
- mov r10, [rcx+070h] ; address of aligned XMM storage
- movaps [r10], xmm6
- movaps [r10+010h], xmm7
- movaps [r10+020h], xmm8
- movaps [r10+030h], xmm9
- movaps [r10+040h], xmm10
- movaps [r10+050h], xmm11
- movaps [r10+060h], xmm12
- movaps [r10+070h], xmm13
- movaps [r10+080h], xmm14
- movaps [r10+090h], xmm15
-
- ldmxcsr [rdx+068h] ; restore MMX control and status word
- fldcw [rdx+06ch] ; restore x87 control word
- mov r10, [rdx+070h] ; address of aligned XMM storage
- movaps xmm6, [r10]
- movaps xmm7, [r10+010h]
- movaps xmm8, [r10+020h]
- movaps xmm9, [r10+030h]
- movaps xmm10, [r10+040h]
- movaps xmm11, [r10+050h]
- movaps xmm12, [r10+060h]
- movaps xmm13, [r10+070h]
- movaps xmm14, [r10+080h]
- movaps xmm15, [r10+090h]
-nxt:
-
- lea rax, [rsp+08h] ; exclude the return address
- mov [rcx+040h], rax ; save as stack pointer
- mov rax, [rsp] ; load return address
- mov [rcx+048h], rax ; save return address
-
- mov r12, [rdx] ; restore R12
- mov r13, [rdx+08h] ; restore R13
- mov r14, [rdx+010h] ; restore R14
- mov r15, [rdx+018h] ; restore R15
- mov rdi, [rdx+020h] ; restore RDI
- mov rsi, [rdx+028h] ; restore RSI
- mov rbx, [rdx+030h] ; restore RBX
- mov rbp, [rdx+038h] ; restore RBP
-
- mov r10, gs:[030h] ; load NT_TIB
- mov rax, [rdx+050h] ; load stack base
- mov [r10+08h], rax ; restore stack base
- mov rax, [rdx+058h] ; load stack limit
- mov [r10+010h], rax ; restore stack limit
- mov rax, [rdx+060h] ; load fiber local storage
- mov [r10+018h], rax ; restore fiber local storage
-
- mov rsp, [rdx+040h] ; restore RSP
- mov r10, [rdx+048h] ; fetch the address to returned to
-
- mov rax, r8 ; use third arg as return value after jump
- mov rcx, r8 ; use third arg as first arg in context function
-
- jmp r10 ; indirect jump to caller
-jump_fcontext ENDP
-
-make_fcontext PROC EXPORT FRAME ; generate function table entry in .pdata and unwind information in E
- .endprolog ; .xdata for a function's structured exception handling unwind behavior
-
- mov [rcx], rcx ; store the address of current context
- mov [rcx+048h], rdx ; save the address of the function supposed to run
- mov rdx, [rcx+050h] ; load the address where the context stack beginns
-
- push rcx ; save pointer to fcontext_t
- sub rsp, 028h ; reserve shadow space for align_stack
- mov rcx, rdx ; stack pointer as arg for align_stack
- mov [rsp+8], rcx
- call align_stack ; align stack
- mov rdx, rax ; begin of aligned stack
- add rsp, 028h
- pop rcx ; restore pointer to fcontext_t
-
- lea rdx, [rdx-028h] ; reserve 32byte shadow space + return address on stack, (RSP + 8) % 16 == 0
- mov [rcx+040h], rdx ; save the address where the context stack beginns
-
- stmxcsr [rcx+068h] ; save MMX control and status word
- fnstcw [rcx+06ch] ; save x87 control word
-
- lea rax, finish ; helper code executed after fn() returns
- mov [rdx], rax ; store address off the helper function as return address
-
- xor rax, rax ; set RAX to zero
- ret
-
-finish:
- xor rcx, rcx
- mov [rsp+08h], rcx
- call _exit ; exit application
- hlt
-make_fcontext ENDP
-END

Deleted: branches/release/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,116 +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)
-*/
-
-/****************************************************************************************
- * *
- * ---------------------------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
- * ---------------------------------------------------------------------------------- *
- * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
- * ---------------------------------------------------------------------------------- *
- * | RBX | 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 | | *
- * ---------------------------------------------------------------------------------- *
- * | sbase | slimit | | *
- * ---------------------------------------------------------------------------------- *
- * ---------------------------------------------------------------------------------- *
- * | 20 | 21 | | *
- * ---------------------------------------------------------------------------------- *
- * | 0x50 | 0x54 | | *
- * ---------------------------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
- * ---------------------------------------------------------------------------------- *
- * *
- * **************************************************************************************/
-
-.text
-.globl jump_fcontext
-.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 */
-
- cmp $0, %rcx
- je 1f
-
- stmxcsr 0x50(%rdi) /* save MMX control and status word */
- fnstcw 0x54(%rdi) /* save x87 control word */
-
- ldmxcsr 0x50(%rsi) /* restore MMX control and status word */
- fldcw 0x54(%rsi) /* restore x87 control word */
-1:
-
- 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 */
-
- 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 */
-
- movq 0x30(%rsi), %rsp /* restore RSP */
- movq 0x38(%rsi), %rcx /* fetch the address to return to */
-
- movq %rdx, %rax /* use third arg as return value after jump */
- movq %rdx, %rdi /* use third arg as first arg in context function */
-
- jmp *%rcx /* indirect jump to context */
-.size jump_fcontext,.-jump_fcontext
-
-.text
-.globl make_fcontext
-.type make_fcontext,@function
-.align 16
-make_fcontext:
- movq %rdi, (%rdi) /* save the address of passed context */
- movq %rsi, 0x38(%rdi) /* save the address of the context function */
- movq 0x40(%rdi), %rdx /* load the stack base */
-
- pushq %rdi /* save pointer to fcontext_t */
- movq %rdx, %rdi /* stack pointer as arg for align_stack */
- call align_stack_at_PLT /* align stack */
- movq %rax, %rdx /* begin of aligned stack */
- popq %rdi /* restore pointer to fcontext_t */
-
- leaq -0x8(%rdx), %rdx /* reserve space for the last frame on stack, (RSP + 8) & 15 == 0 */
- movq %rdx, 0x30(%rdi) /* save the algined stack base */
-
- stmxcsr 0x50(%rdi) /* save MMX control and status word */
- fnstcw 0x54(%rdi) /* save x87 control word */
-
- leaq finish(%rip), %rcx /* address of finish; called after context function returns */
- movq %rcx, (%rdx)
-
- xorq %rax, %rax
- ret
-
-finish:
- xorq %rdi, %rdi /* exit code is zero */
- call _exit_at_PLT /* exit application */
- hlt
-.size make_fcontext,.-make_fcontext
-

Deleted: branches/release/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,111 +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)
-*/
-
-/****************************************************************************************
- * *
- * ---------------------------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
- * ---------------------------------------------------------------------------------- *
- * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
- * ---------------------------------------------------------------------------------- *
- * | RBX | 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 | | *
- * ---------------------------------------------------------------------------------- *
- * | sbase | slimit | | *
- * ---------------------------------------------------------------------------------- *
- * ---------------------------------------------------------------------------------- *
- * | 20 | 21 | | *
- * ---------------------------------------------------------------------------------- *
- * | 0x50 | 0x54 | | *
- * ---------------------------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
- * ---------------------------------------------------------------------------------- *
- * *
- * **************************************************************************************/
-
-.text
-.globl _jump_fcontext
-.align 8
-_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 */
-
- cmp $0, %rcx
- je 1f
-
- stmxcsr 0x50(%rdi) /* save MMX control and status word */
- fnstcw 0x54(%rdi) /* save x87 control word */
-
- ldmxcsr 0x50(%rsi) /* restore MMX control and status word */
- fldcw 0x54(%rsi) /* restore x87 control word */
-1:
-
- 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 */
-
- 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 */
-
- movq 0x30(%rsi), %rsp /* restore RSP */
- movq 0x38(%rsi), %rcx /* fetch the address to return to */
-
- movq %rdx, %rax /* use third arg as return value after jump */
- movq %rdx, %rdi /* use third arg as first arg in context function */
-
- jmp *%rcx /* indirect jump to context */
-
-.text
-.globl _make_fcontext
-.align 8
-_make_fcontext:
- movq %rdi, (%rdi) /* save the address of current context */
- movq %rsi, 0x38(%rdi) /* save the address of the function supposed to run */
- movq 0x40(%rdi), %rdx /* load the stack base */
-
- pushq %rdi /* save pointer to fcontext_t */
- movq %rdx, %rdi /* stack pointer as arg for align_stack */
- call _align_stack /* align stack */
- movq %rax, %rdx /* begin of aligned stack */
- popq %rdi /* restore pointer to fcontext_t */
-
- leaq -0x8(%rdx), %rdx /* reserve space for the last frame on stack, (RSP + 8) % 16 == 0 */
- movq %rdx, 0x30(%rdi) /* save the address */
-
- stmxcsr 0x50(%rdi) /* save MMX control and status word */
- fnstcw 0x54(%rdi) /* save x87 control word */
-
- leaq finish(%rip), %rcx /* helper code executed after context function returns */
- movq %rcx, (%rdx)
-
- xorq %rax, %rax /* set RAX to zero */
- ret
-
-finish:
- xorq %rdi, %rdi /* exit code is zero */
- call _exit /* exit application */
- hlt

Modified: branches/release/libs/context/src/fcontext.cpp
==============================================================================
--- branches/release/libs/context/src/fcontext.cpp (original)
+++ branches/release/libs/context/src/fcontext.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -15,7 +15,7 @@
 #endif
 
 namespace boost {
-namespace ctx {
+namespace context {
 namespace detail {
 
 extern "C" BOOST_CONTEXT_DECL

Copied: branches/release/libs/context/src/guarded_stack_allocator_posix.cpp (from r80507, /trunk/libs/context/src/guarded_stack_allocator_posix.cpp)
==============================================================================
--- /trunk/libs/context/src/guarded_stack_allocator_posix.cpp (original)
+++ branches/release/libs/context/src/guarded_stack_allocator_posix.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -61,13 +61,13 @@
 {
     return static_cast< std::size_t >(
         std::ceil(
- static_cast< float >( stacksize) / boost::ctx::pagesize() ) );
+ static_cast< float >( stacksize) / boost::context::pagesize() ) );
 }
 
 }
 
 namespace boost {
-namespace ctx {
+namespace context {
 
 bool
 guarded_stack_allocator::is_stack_unbound()
@@ -87,13 +87,12 @@
 std::size_t
 guarded_stack_allocator::default_stacksize()
 {
- std::size_t size = 64 * 1024; // 64 kB
- if ( is_stack_unbound() )
- return std::max( size, minimum_stacksize() );
+ std::size_t size = 8 * minimum_stacksize();
+ if ( is_stack_unbound() ) return size;
     
     BOOST_ASSERT( maximum_stacksize() >= minimum_stacksize() );
- return maximum_stacksize() == minimum_stacksize()
- ? minimum_stacksize()
+ return maximum_stacksize() == size
+ ? size
         : std::min( size, maximum_stacksize() );
 }
 

Copied: branches/release/libs/context/src/guarded_stack_allocator_windows.cpp (from r80507, /trunk/libs/context/src/guarded_stack_allocator_windows.cpp)
==============================================================================
--- /trunk/libs/context/src/guarded_stack_allocator_windows.cpp (original)
+++ branches/release/libs/context/src/guarded_stack_allocator_windows.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -67,13 +67,13 @@
 {
     return static_cast< std::size_t >(
         std::ceil(
- static_cast< float >( stacksize) / boost::ctx::pagesize() ) );
+ static_cast< float >( stacksize) / boost::context::pagesize() ) );
 }
 
 }
 
 namespace boost {
-namespace ctx {
+namespace context {
 
 // Windows seams not to provide a limit for the stacksize
 bool

Modified: branches/release/libs/context/src/seh.cpp
==============================================================================
--- branches/release/libs/context/src/seh.cpp (original)
+++ branches/release/libs/context/src/seh.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -21,6 +21,11 @@
 # define SNPRINTF snprintf
 #endif
 
+#if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable:4996)
+# endif
+
 static const char * exception_description(
     _EXCEPTION_RECORD const* record, char * description, size_t len)
 {
@@ -80,4 +85,8 @@
     return ExceptionContinueSearch; // never reached
 }
 
+# if defined(BOOST_MSVC)
+# pragma warning(pop)
+# endif
+
 }

Deleted: branches/release/libs/context/src/stack_allocator_posix.cpp
==============================================================================
--- branches/release/libs/context/src/stack_allocator_posix.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,84 +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)
-
-#define BOOST_CONTEXT_SOURCE
-
-#include <boost/context/stack_allocator.hpp>
-
-extern "C" {
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-}
-
-#include <stdexcept>
-
-#include <boost/config.hpp>
-#include <boost/assert.hpp>
-#include <boost/format.hpp>
-
-#include <boost/context/stack_utils.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace ctx {
-
-void *
-stack_allocator::allocate( std::size_t size) const
-{
- if ( minimum_stacksize() > size)
- throw std::invalid_argument(
- boost::str( boost::format("invalid stack size: must be at least %d bytes")
- % minimum_stacksize() ) );
-
- if ( ! is_stack_unbound() && ( maximum_stacksize() < size) )
- throw std::invalid_argument(
- boost::str( boost::format("invalid stack size: must not be larger than %d bytes")
- % maximum_stacksize() ) );
-
- const std::size_t pages( page_count( size) + 1); // add +1 for guard page
- std::size_t size_ = pages * pagesize();
-
- const int fd( ::open("/dev/zero", O_RDONLY) );
- BOOST_ASSERT( -1 != fd);
- void * limit =
-# if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
- ::mmap( 0, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-# else
- ::mmap( 0, size_, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
-# endif
- ::close( fd);
- if ( ! limit) throw std::bad_alloc();
-
- const int result( ::mprotect( limit, pagesize(), PROT_NONE) );
- BOOST_ASSERT( 0 == result);
-
- return static_cast< char * >( limit) + size_;
-}
-
-void
-stack_allocator::deallocate( void * vp, std::size_t size) const
-{
- if ( vp)
- {
- const std::size_t pages( page_count( size) + 1); // add +1 for guard page
- std::size_t size_ = pages * pagesize();
- BOOST_ASSERT( 0 < size && 0 < size_);
- void * limit = static_cast< char * >( vp) - size_;
- ::munmap( limit, size_);
- }
-}
-
-}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif

Deleted: branches/release/libs/context/src/stack_allocator_windows.cpp
==============================================================================
--- branches/release/libs/context/src/stack_allocator_windows.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,86 +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)
-
-#define BOOST_CONTEXT_SOURCE
-
-#include <boost/context/stack_allocator.hpp>
-
-extern "C" {
-#include <windows.h>
-}
-
-#include <stdexcept>
-
-#include <boost/config.hpp>
-#include <boost/assert.hpp>
-#include <boost/cstdint.hpp>
-#include <boost/format.hpp>
-
-#include <boost/context/stack_utils.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-# if defined(BOOST_MSVC)
-# pragma warning(push)
-# pragma warning(disable:4244 4267)
-# endif
-
-namespace boost {
-namespace ctx {
-
-void *
-stack_allocator::allocate( std::size_t size) const
-{
- if ( minimum_stacksize() > size)
- throw std::invalid_argument(
- boost::str( boost::format("invalid stack size: must be at least %d bytes")
- % minimum_stacksize() ) );
-
- if ( ! is_stack_unbound() && ( maximum_stacksize() < size) )
- throw std::invalid_argument(
- boost::str( boost::format("invalid stack size: must not be larger than %d bytes")
- % maximum_stacksize() ) );
-
- const std::size_t pages( page_count( size) + 1); // add +1 for guard page
- std::size_t size_ = pages * pagesize();
-
-#ifndef BOOST_CONTEXT_FIBER
- void * limit = ::VirtualAlloc( 0, size_, MEM_COMMIT, PAGE_READWRITE);
- if ( ! limit) throw std::bad_alloc();
-
- DWORD old_options;
- const BOOL result = ::VirtualProtect(
- limit, pagesize(), PAGE_READWRITE | PAGE_GUARD /*PAGE_NOACCESS*/, & old_options);
- BOOST_ASSERT( FALSE != result);
-
- return static_cast< char * >( limit) + size_;
-#endif
-}
-
-void
-stack_allocator::deallocate( void * vp, std::size_t size) const
-{
- if ( vp)
- {
- const std::size_t pages( page_count( size) + 1); // add +1 for guard page
- std::size_t size_ = pages * pagesize();
- BOOST_ASSERT( 0 < size && 0 < size_);
- void * limit = static_cast< char * >( vp) - size_;
- ::VirtualFree( limit, 0, MEM_RELEASE);
- }
-}
-
-}}
-
-# if defined(BOOST_MSVC)
-# pragma warning(pop)
-# endif
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif

Deleted: branches/release/libs/context/src/stack_utils_posix.cpp
==============================================================================
--- branches/release/libs/context/src/stack_utils_posix.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,80 +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)
-
-#define BOOST_CONTEXT_SOURCE
-
-#include <boost/context/stack_utils.hpp>
-
-extern "C" {
-#include <signal.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-#include <unistd.h>
-}
-
-#include <cmath>
-
-#include <boost/assert.hpp>
-
-namespace {
-
-static rlimit stacksize_limit_()
-{
- rlimit limit;
- const int result = ::getrlimit( RLIMIT_STACK, & limit);
- BOOST_ASSERT( 0 == result);
- return limit;
-}
-
-static rlimit stacksize_limit()
-{
- static rlimit limit = stacksize_limit_();
- return limit;
-}
-
-}
-
-namespace boost {
-namespace ctx {
-
-BOOST_CONTEXT_DECL
-std::size_t default_stacksize()
-{
- static std::size_t size = 256 * 1024;
- return size;
-}
-
-BOOST_CONTEXT_DECL
-std::size_t minimum_stacksize()
-{ return SIGSTKSZ; }
-
-BOOST_CONTEXT_DECL
-std::size_t maximum_stacksize()
-{
- BOOST_ASSERT( ! is_stack_unbound() );
- return static_cast< std::size_t >( stacksize_limit().rlim_max);
-}
-
-BOOST_CONTEXT_DECL
-bool is_stack_unbound()
-{ return RLIM_INFINITY == stacksize_limit().rlim_max; }
-
-BOOST_CONTEXT_DECL
-std::size_t pagesize()
-{
- static std::size_t pagesize( ::getpagesize() );
- return pagesize;
-}
-
-BOOST_CONTEXT_DECL
-std::size_t page_count( std::size_t stacksize)
-{
- return static_cast< std::size_t >(
- std::ceil(
- static_cast< float >( stacksize) / pagesize() ) );
-}
-
-}}

Deleted: branches/release/libs/context/src/stack_utils_windows.cpp
==============================================================================
--- branches/release/libs/context/src/stack_utils_windows.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
+++ (empty file)
@@ -1,84 +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)
-
-#define BOOST_CONTEXT_SOURCE
-
-#include <boost/context/stack_utils.hpp>
-
-extern "C" {
-#include <windows.h>
-}
-
-#include <cmath>
-#include <csignal>
-
-#include <boost/assert.hpp>
-
-namespace {
-
-static SYSTEM_INFO system_info_()
-{
- SYSTEM_INFO si;
- ::GetSystemInfo( & si);
- return si;
-}
-
-static SYSTEM_INFO system_info()
-{
- static SYSTEM_INFO si = system_info_();
- return si;
-}
-
-}
-
-namespace boost {
-namespace ctx {
-
-BOOST_CONTEXT_DECL
-std::size_t default_stacksize()
-{
- static std::size_t size = 256 * 1024;
- return size;
-}
-
-BOOST_CONTEXT_DECL
-std::size_t minimum_stacksize()
-{
- static std::size_t stacksize(
- static_cast< std::size_t >( system_info().dwAllocationGranularity) );
- return stacksize;
-}
-
-BOOST_CONTEXT_DECL
-std::size_t maximum_stacksize()
-{
- BOOST_ASSERT( ! is_stack_unbound() );
- static std::size_t stacksize = 8 * 1024 * 1024;
- return stacksize;
-}
-
-// Windows seams not to provide a limit for the stacksize
-BOOST_CONTEXT_DECL
-bool is_stack_unbound()
-{ return true; }
-
-BOOST_CONTEXT_DECL
-std::size_t pagesize()
-{
- static std::size_t pagesize(
- static_cast< std::size_t >( system_info().dwPageSize) );
- return pagesize;
-}
-
-BOOST_CONTEXT_DECL
-std::size_t page_count( std::size_t stacksize)
-{
- return static_cast< std::size_t >(
- std::ceil(
- static_cast< float >( stacksize) / pagesize() ) );
-}
-
-}}

Copied: branches/release/libs/context/src/utils_posix.cpp (from r80507, /trunk/libs/context/src/utils_posix.cpp)
==============================================================================
--- /trunk/libs/context/src/utils_posix.cpp (original)
+++ branches/release/libs/context/src/utils_posix.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -21,7 +21,7 @@
 #endif
 
 namespace boost {
-namespace ctx {
+namespace context {
 
 std::size_t pagesize()
 {

Copied: branches/release/libs/context/src/utils_windows.cpp (from r80507, /trunk/libs/context/src/utils_windows.cpp)
==============================================================================
--- /trunk/libs/context/src/utils_windows.cpp (original)
+++ branches/release/libs/context/src/utils_windows.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -36,7 +36,7 @@
 }
 
 namespace boost {
-namespace ctx {
+namespace context {
 
 std::size_t pagesize()
 { return static_cast< std::size_t >( system_info().dwPageSize); }

Modified: branches/release/libs/context/test/test_context.cpp
==============================================================================
--- branches/release/libs/context/test/test_context.cpp (original)
+++ branches/release/libs/context/test/test_context.cpp 2012-09-18 05:06:47 EDT (Tue, 18 Sep 2012)
@@ -10,15 +10,17 @@
 #include <string>
 #include <utility>
 
+#include <boost/array.hpp>
 #include <boost/assert.hpp>
 #include <boost/test/unit_test.hpp>
 #include <boost/utility.hpp>
 
 #include <boost/context/all.hpp>
 
-namespace ctx = boost::ctx;
+namespace ctx = boost::context;
 
-ctx::fcontext_t fcm, fc1, fc2;
+ctx::fcontext_t fcm;
+ctx::fcontext_t * fc = 0;
 int value1 = 0;
 std::string value2;
 double value3 = 0.;
@@ -26,25 +28,25 @@
 void f1( intptr_t)
 {
     ++value1;
- ctx::jump_fcontext( & fc1, & fcm, 0);
+ ctx::jump_fcontext( fc, & fcm, 0);
 }
 
 void f3( intptr_t)
 {
     ++value1;
- ctx::jump_fcontext( & fc1, & fcm, 0);
+ ctx::jump_fcontext( fc, & fcm, 0);
     ++value1;
- ctx::jump_fcontext( & fc1, & fcm, 0);
+ ctx::jump_fcontext( fc, & fcm, 0);
 }
 
 void f4( intptr_t)
 {
- ctx::jump_fcontext( & fc1, & fcm, 7);
+ ctx::jump_fcontext( fc, & fcm, 7);
 }
 
 void f5( intptr_t arg)
 {
- ctx::jump_fcontext( & fc1, & fcm, arg);
+ ctx::jump_fcontext( fc, & fcm, arg);
 }
 
 void f6( intptr_t arg)
@@ -52,9 +54,9 @@
     std::pair< int, int > data = * ( std::pair< int, int > * ) arg;
     int res = data.first + data.second;
     data = * ( std::pair< int, int > *)
- ctx::jump_fcontext( & fc1, & fcm, ( intptr_t) res);
+ ctx::jump_fcontext( fc, & fcm, ( intptr_t) res);
     res = data.first + data.second;
- ctx::jump_fcontext( & fc1, & fcm, ( intptr_t) res);
+ ctx::jump_fcontext( fc, & fcm, ( intptr_t) res);
 }
 
 void f7( intptr_t arg)
@@ -63,7 +65,7 @@
     { throw std::runtime_error( ( char *) arg); }
     catch ( std::runtime_error const& e)
     { value2 = e.what(); }
- ctx::jump_fcontext( & fc1, & fcm, arg);
+ ctx::jump_fcontext( fc, & fcm, arg);
 }
 
 void f8( intptr_t arg)
@@ -71,21 +73,49 @@
     double d = * ( double *) arg;
     d += 3.45;
     value3 = d;
- ctx::jump_fcontext( & fc1, & fcm, 0);
+ ctx::jump_fcontext( fc, & fcm, 0);
+}
+
+void test_stack()
+{
+ ctx::guarded_stack_allocator alloc;
+
+ bool unbound = ctx::guarded_stack_allocator::is_stack_unbound();
+ std::size_t min = ctx::guarded_stack_allocator::minimum_stacksize();
+ std::size_t def = ctx::guarded_stack_allocator::default_stacksize();
+ BOOST_CHECK( min <= def);
+ if ( ! unbound)
+ {
+ std::size_t max = ctx::guarded_stack_allocator::maximum_stacksize();
+ BOOST_CHECK( max >= def);
+ }
+}
+
+void test_setup()
+{
+ ctx::guarded_stack_allocator alloc;
+
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::minimum_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::minimum_stacksize(), f1);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::minimum_stacksize(), fc->fc_stack.size);
 }
 
 void test_start()
 {
     value1 = 0;
 
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
- fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f1);
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::minimum_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::minimum_stacksize(), f1);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::minimum_stacksize(), fc->fc_stack.size);
 
     BOOST_CHECK_EQUAL( 0, value1);
- ctx::jump_fcontext( & fcm, & fc1, 0);
+ ctx::jump_fcontext( & fcm, fc, 0);
     BOOST_CHECK_EQUAL( 1, value1);
 }
 
@@ -93,83 +123,95 @@
 {
     value1 = 0;
 
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
- fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f3);
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::minimum_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::minimum_stacksize(), f3);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::minimum_stacksize(), fc->fc_stack.size);
 
     BOOST_CHECK_EQUAL( 0, value1);
- ctx::jump_fcontext( & fcm, & fc1, 0);
+ ctx::jump_fcontext( & fcm, fc, 0);
     BOOST_CHECK_EQUAL( 1, value1);
- ctx::jump_fcontext( & fcm, & fc1, 0);
+ ctx::jump_fcontext( & fcm, fc, 0);
     BOOST_CHECK_EQUAL( 2, value1);
 }
 
 void test_result()
 {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
- fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- ctx::make_fcontext( & fc1, f4);
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::minimum_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::minimum_stacksize(), f4);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::minimum_stacksize(), fc->fc_stack.size);
 
- int result = ( int) ctx::jump_fcontext( & fcm, & fc1, 0);
+ int result = ( int) ctx::jump_fcontext( & fcm, fc, 0);
     BOOST_CHECK_EQUAL( 7, result);
 }
 
 void test_arg()
 {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
- fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
     int i = 7;
- ctx::make_fcontext( & fc1, f5);
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::minimum_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::minimum_stacksize(), f5);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::minimum_stacksize(), fc->fc_stack.size);
 
- int result = ( int) ctx::jump_fcontext( & fcm, & fc1, i);
+ int result = ( int) ctx::jump_fcontext( & fcm, fc, i);
     BOOST_CHECK_EQUAL( i, result);
 }
 
 void test_transfer()
 {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
- fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
     std::pair< int, int > data = std::make_pair( 3, 7);
- ctx::make_fcontext( & fc1, f6);
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::minimum_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::minimum_stacksize(), f6);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::minimum_stacksize(), fc->fc_stack.size);
 
- int result = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & data);
+ int result = ( int) ctx::jump_fcontext( & fcm, fc, ( intptr_t) & data);
     BOOST_CHECK_EQUAL( 10, result);
     data = std::make_pair( 7, 7);
- result = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & data);
+ result = ( int) ctx::jump_fcontext( & fcm, fc, ( intptr_t) & data);
     BOOST_CHECK_EQUAL( 14, result);
 }
 
 void test_exception()
 {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
- fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
     const char * what = "hello world";
- ctx::make_fcontext( & fc1, f7);
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::default_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::default_stacksize(), f7);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::default_stacksize(), fc->fc_stack.size);
 
- ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) what);
+ ctx::jump_fcontext( & fcm, fc, ( intptr_t) what);
     BOOST_CHECK_EQUAL( std::string( what), value2);
 }
 
 void test_fp()
 {
- ctx::stack_allocator alloc;
+ ctx::guarded_stack_allocator alloc;
 
- fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
- fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
     double d = 7.13;
- ctx::make_fcontext( & fc1, f8);
+ void * sp = alloc.allocate( ctx::guarded_stack_allocator::minimum_stacksize() );
+ fc = ctx::make_fcontext( sp, ctx::guarded_stack_allocator::minimum_stacksize(), f8);
+ BOOST_CHECK( fc);
+ BOOST_CHECK_EQUAL( sp, fc->fc_stack.sp);
+ BOOST_CHECK_EQUAL( ctx::guarded_stack_allocator::minimum_stacksize(), fc->fc_stack.size);
 
- ctx::jump_fcontext( & fcm, & fc1, (intptr_t) & d);
+ ctx::jump_fcontext( & fcm, fc, (intptr_t) & d);
     BOOST_CHECK_EQUAL( 10.58, value3);
 }
 
@@ -178,6 +220,8 @@
     boost::unit_test::test_suite * test =
         BOOST_TEST_SUITE("Boost.Context: context test suite");
 
+ test->add( BOOST_TEST_CASE( & test_stack) );
+ test->add( BOOST_TEST_CASE( & test_setup) );
     test->add( BOOST_TEST_CASE( & test_start) );
     test->add( BOOST_TEST_CASE( & test_jump) );
     test->add( BOOST_TEST_CASE( & test_result) );


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk