Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78129 - in trunk: boost/context libs/context/example libs/context/performance libs/context/src/asm libs/context/test
From: oliver.kowalke_at_[hidden]
Date: 2012-04-22 06:18:46


Author: olli
Date: 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
New Revision: 78129
URL: http://svn.boost.org/trac/boost/changeset/78129

Log:
context: remove argument for context function from make_fcontext()

Text files modified:
   trunk/boost/context/fcontext.hpp | 2
   trunk/libs/context/example/jump.cpp | 10 ++++----
   trunk/libs/context/example/link.cpp | 10 ++++----
   trunk/libs/context/example/transfer.cpp | 4 +-
   trunk/libs/context/performance/performance.cpp | 4 +-
   trunk/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S | 15 +++++--------
   trunk/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm | 19 ++++++-----------
   trunk/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S | 20 +++++++-----------
   trunk/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S | 20 +++++++-----------
   trunk/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S | 13 ++++-------
   trunk/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S | 16 ++++++--------
   trunk/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S | 4 --
   trunk/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm | 43 ++++++++++++++++++---------------------
   trunk/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S | 16 ++++++--------
   trunk/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S | 4 --
   trunk/libs/context/test/test_context.cpp | 14 ++++++------
   16 files changed, 92 insertions(+), 122 deletions(-)

Modified: trunk/boost/context/fcontext.hpp
==============================================================================
--- trunk/boost/context/fcontext.hpp (original)
+++ trunk/boost/context/fcontext.hpp 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -70,7 +70,7 @@
 extern "C" BOOST_CONTEXT_DECL
 intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu = true);
 extern "C" BOOST_CONTEXT_DECL
-void BOOST_CONTEXT_CALLDECL make_fcontext( fcontext_t * fc, void (* fn)( intptr_t), intptr_t vp);
+void BOOST_CONTEXT_CALLDECL make_fcontext( fcontext_t * fc, void (* fn)( intptr_t) );
 
 }}
 

Modified: trunk/libs/context/example/jump.cpp
==============================================================================
--- trunk/libs/context/example/jump.cpp (original)
+++ trunk/libs/context/example/jump.cpp 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -19,7 +19,7 @@
 void f1( intptr_t)
 {
                 std::cout << "f1: entered" << std::endl;
- std::cout << "f1: call jump_fcontext( & fc1, & fc2)" << std::endl;
+ std::cout << "f1: call jump_fcontext( & fc1, & fc2, 0)" << std::endl;
                 ctx::jump_fcontext( & fc1, & fc2, 0);
                 std::cout << "f1: return" << std::endl;
                 ctx::jump_fcontext( & fc1, & fcm, 0);
@@ -28,7 +28,7 @@
 void f2( intptr_t)
 {
                 std::cout << "f2: entered" << std::endl;
- std::cout << "f2: call jump_fcontext( & fc2, & fc1)" << std::endl;
+ std::cout << "f2: call jump_fcontext( & fc2, & fc1, 0)" << std::endl;
                 ctx::jump_fcontext( & fc2, & fc1, 0);
         BOOST_ASSERT( false && ! "f2: never returns");
 }
@@ -40,14 +40,14 @@
         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, 0);
+ 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, 0);
+ ctx::make_fcontext( & fc2, f2);
 
- std::cout << "main: call start_fcontext( & fcm, & fc1)" << std::endl;
+ std::cout << "main: call start_fcontext( & fcm, & fc1, 0)" << std::endl;
                 ctx::jump_fcontext( & fcm, & fc1, 0);
 
                 std::cout << "main: done" << std::endl;

Modified: trunk/libs/context/example/link.cpp
==============================================================================
--- trunk/libs/context/example/link.cpp (original)
+++ trunk/libs/context/example/link.cpp 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -19,7 +19,7 @@
 void f1( intptr_t)
 {
                 std::cout << "f1: entered" << std::endl;
- std::cout << "f1: call jump_fcontext( & fc1, & fc2)" << std::endl;
+ std::cout << "f1: call jump_fcontext( & fc1, & fc2, 0)" << std::endl;
                 ctx::jump_fcontext( & fc1, & fc2, 0);
                 std::cout << "f1: return" << std::endl;
 }
@@ -27,7 +27,7 @@
 void f2( intptr_t)
 {
                 std::cout << "f2: entered" << std::endl;
- std::cout << "f2: call jump_fcontext( & fc2, & fc1)" << std::endl;
+ std::cout << "f2: call jump_fcontext( & fc2, & fc1, 0)" << std::endl;
                 ctx::jump_fcontext( & fc2, & fc1, 0);
         BOOST_ASSERT( false && ! "f2: never returns");
 }
@@ -40,14 +40,14 @@
         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, 0);
+ 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, 0);
+ ctx::make_fcontext( & fc2, f2);
 
- std::cout << "main: call start_fcontext( & fcm, & fc1)" << std::endl;
+ std::cout << "main: call start_fcontext( & fcm, & fc1, 0)" << std::endl;
                 ctx::jump_fcontext( & fcm, & fc1, 0);
 
                 std::cout << "main: done" << std::endl;

Modified: trunk/libs/context/example/transfer.cpp
==============================================================================
--- trunk/libs/context/example/transfer.cpp (original)
+++ trunk/libs/context/example/transfer.cpp 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -35,9 +35,9 @@
     fc1.fc_stack.base = alloc.allocate(ctx::minimum_stacksize());
     fc1.fc_stack.limit =
         static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
- pair_t p( std::make_pair( 2, 7) );
- ctx::make_fcontext( & fc1, f1, ( intptr_t) & p);
+ ctx::make_fcontext( & fc1, f1);
     
+ pair_t p( std::make_pair( 2, 7) );
     int res = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & p);
     std::cout << p.first << " + " << p.second << " == " << res << std::endl;
     

Modified: trunk/libs/context/performance/performance.cpp
==============================================================================
--- trunk/libs/context/performance/performance.cpp (original)
+++ trunk/libs/context/performance/performance.cpp 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -65,7 +65,7 @@
         static_cast< char * >( alloc.allocate(ctx::default_stacksize() ) )
         - ctx::default_stacksize();
     uc.uc_stack.ss_size = ctx::default_stacksize();
- ::makecontext( & uc, f2, 0);
+ ::makecontext( & uc, f2, 7);
 
     // cache warum-up
 BOOST_PP_REPEAT_FROM_TO( 0, BOOST_PP_LIMIT_MAG, CALL_UCONTEXT, ~)
@@ -89,7 +89,7 @@
     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, 7);
+ ctx::make_fcontext( & fc, f1);
 
     ctx::jump_fcontext( & fcm, & fc, 7, preserve_fpu);
 

Modified: trunk/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -79,28 +79,25 @@
 .align 2
 .type make_fcontext,%function
 make_fcontext:
- str a1, [a1,#0] @ save the address of the current context
- str a2, [a1,#40] @ save address of the function supposed to be run
- str a3, [a1,#8] @ save void pointer
+ 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
+ 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 stack base
- ldr a2, [a1,#52] @ load the address of the next context
- str a2, [a1,#4] @ save the address of the next context
+ str a2, [a1,#32] @ save the aligned stack base
 
- adr a2, finish @ helper code executed after context function returns
+ adr a2, finish @ address of finish; called after context function returns
     str a2, [a1,#36]
 
     mov a1, #0
     bx lr
 
 finish:
- mov a1, #0
+ mov a1, #0 @ exit code is zero
     bl _exit_at_PLT @ exit application
 .size make_fcontext,.-make_fcontext

Modified: trunk/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm
==============================================================================
--- trunk/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm (original)
+++ trunk/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -116,9 +116,9 @@
 
 make_fcontext PROC EXPORT
     mov eax, [esp+04h] ; load address of the fcontext_t arg0
- mov [eax], eax ; save the address of current context
- mov ecx, [esp+08h] ; load the address of the function supposed to run
- mov [eax+014h], ecx ; save the address of the function supposed to run
+ 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
@@ -129,7 +129,7 @@
     pop eax ; restore pointer to fcontext_t
 
     lea edx, [edx-014h] ; reserve space for last frame on stack, (ESP + 4) % 16 == 0
- mov [eax+010h], edx ; save the address
+ 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
@@ -138,22 +138,17 @@
     lea ecx, [edx+08h] ; load address of next SEH item
     mov [eax+02ch], ecx ; save next SEH
 
- mov ecx, [eax+020h] ; load the address of the next context
- mov [eax+04h], ecx ; save the address of the next context
- mov ecx, [esp+0ch] ; load the address of the void pointer arg2
- mov [edx+04h], ecx ; save the address of the void pointer onto the context stack
-
 ; stmxcsr [eax+02ch] ; save MMX control word
 ; fnstcw [eax+030h] ; save x87 control word
 
- mov ecx, finish ; helper code executed after context function returns
+ mov ecx, finish ; address of finish
     mov [edx], ecx
 
- xor eax, eax ; set EAX to zero
+ xor eax, eax
     ret
 
 finish:
- xor eax, eax ; set EAX to zero
+ xor eax, eax
     push eax ; exit code is zero
     call _exit ; exit application
     hlt

Modified: trunk/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -83,15 +83,15 @@
 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 function supposed to run */
- movl %ecx, 0x14(%eax) /* save the address of the function supposed to run */
+ 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 */
+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 */
@@ -100,21 +100,17 @@
     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 address as stack pointer */
- movl 0x20(%eax), %ecx /* load the address of the next context */
- movl %ecx, 0x4(%eax) /* save the address of the next context */
- movl 0xc(%esp), %ecx /* load the address of the void pointer */
- movl %ecx, 0x4(%edx) /* save the address of the void pointer */
+ movl %edx, 0x10(%eax) /* save the aligned stack base */
 
 ; stmxcsr 0x24(%eax) /* save MMX control and status word */
 ; fnstcw 0x30(%eax) /* save x87 control word */
 
     call 2f
-2: popl %ecx /* address of label 1 */
- addl $finish-2b, %ecx /* compute address of label finish */
- movl %ecx, (%edx) /* store address of finish as return address on stack */
+2: popl %ecx /* address of label 2 */
+ addl $finish-2b, %ecx /* helper code executed after context function returns */
+ movl %ecx, (%edx)
 
- xorl %eax, %eax /* set EAX to zero */
+ xorl %eax, %eax
     ret
 
 finish:

Modified: trunk/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -80,15 +80,15 @@
 _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 function supposed to run */
- movl %ecx, 0x14(%eax) /* save the address of the function supposed to run */
+ 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 */
+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 */
@@ -97,21 +97,17 @@
     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 address as stack pointer */
- movl 0x20(%eax), %ecx /* load the address of the next context */
- movl %ecx, 0x4(%eax) /* save the address of the next context */
- movl 0xc(%esp), %ecx /* load the address of the void pointer */
- movl %ecx, 0x4(%edx) /* save the address of the void pointer */
+ movl %edx, 0x10(%eax) /* save the aligned stack base */
 
 ; stmxcsr 0x24(%eax) /* save MMX control and status word */
 ; fnstcw 0x30(%eax) /* save x87 control word */
 
     call 2f
-2: popl %ecx /* address of label 1 */
- addl $finish-2b, %ecx /* compute address of label finish */
- movl %ecx, (%edx) /* store address of finish as return address on stack */
+2: popl %ecx /* address of label 2 */
+ addl $finish-2b, %ecx /* helper code executed after context function returns */
+ movl %ecx, (%edx)
 
- xorl %eax, %eax /* set EAX to zero */
+ xorl %eax, %eax
     ret
 
 finish:

Modified: trunk/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -119,8 +119,7 @@
 #endif
     sw $a0, ($a0) # save the current context
     sw $gp, 24($a0) # save global pointer
- sw $a1, 96($a0) # save the address of the function supposed to be run
- sw $a2, 16($a0) # save void pointer
+ sw $a1, 96($a0) # save the address of the context function
     lw $t0, 104($a0) # load the stack base
 
     sub $sp, $sp, 28
@@ -136,19 +135,17 @@
     addi $sp, $sp, 28
 
     sub $t0, $t0, 16 # reserve 16 byte of argument space
- sw $t0, 72($a0) # save the stack base
- lw $t0, 120($a0) # load address of next user context
- sw $t0, 8($a0) # save the next context
+ sw $t0, 72($a0) # save the algned stack base
 
- la $t9, finish # get address of finish
- sw $t9, 88($a0) # save address of finish
+ 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
+ move $a0, $zero # exit code is zero
     lw $t9, %call16(_exit)($gp) # exit application
     jalr $t9
 .end make_fcontext

Modified: trunk/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -189,8 +189,7 @@
 .type make_fcontext,@function
 make_fcontext:
     stw %r3, 0(%r3) # save the current context
- stw %r4, 88(%r3) # save the address of the function supposed to to be run
- stw %r5, 8(%r3) # save void pointer
+ stw %r4, 88(%r3) # save the address of the context function
     lwz %r0, 92(%r3) # load the stack base
 
     li %r4, 28
@@ -208,21 +207,20 @@
 
     li %r4, 32
     subf %r0, %r4, %r0 # 32 bytes on stack for parameter area(== 8 registers)
- stw %r0, 76(%r3) # save the stack base
- lwz %r0, 100(%r3) # load address of next user context
- stw %r0, 4(%r3) # save the next context
+ 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 # calulate absolute address of finish
+ addi %r4, %r4, finish - 1b # address of finish; called after context function returns
     mtlr %r0 # restore LR
- stw %r4, 84(%r3) # save address of finish
+ stw %r4, 84(%r3)
 
- li %r3, 0 # set return value to zero
+ li %r3, 0
     blr
 
 finish:
- li %r3, 0 # set return value to zero
+ li %r3, 0 # exit code is zero
     bl _exit_at_plt # exit application
 .size make_fcontext, .-make_fcontext

Modified: trunk/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -218,7 +218,6 @@
 .make_fcontext:
     std %r3, 0(%r3) # save the current context
     std %r4, 176(%r3) # save the address of the function supposed to be run
- std %r5, 16(%r3) # save void pointer
     ld %r0, 184(%r3) # load the stack base
 
     li %r4, 56
@@ -237,8 +236,7 @@
     li %r4, 64
     subf %r0, %r4, %r0 # 64 bytes on stack for parameter area (== 8 registers)
     std %r0, 152(%r3) # save the stack base
- ld %r0, 200(%r3) # load address of next user context
- std %r0, 8(%r3) # save the next context
+
     mflr %r0 # load LR
     bl 1f # jump to label 1
 1:

Modified: trunk/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm
==============================================================================
--- trunk/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm (original)
+++ trunk/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -118,15 +118,15 @@
     fnstcw [rcx+074h] ; save x87 control word
         mov r10, [rcx+078h] ; 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
+ 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
 
     lea rax, [rsp+08h] ; exclude the return address
     mov [rcx+040h], rax ; save as stack pointer
@@ -154,15 +154,15 @@
     fldcw [rdx+074h] ; restore x87 control word
         mov r10, [rdx+078h] ; 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]
+ 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]
 
     mov rsp, [rdx+040h] ; restore RSP
     mov r10, [rdx+048h] ; fetch the address to returned to
@@ -173,12 +173,11 @@
     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
+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 [rcx+010h], r8 ; save the the void pointer
     mov rdx, [rcx+050h] ; load the address where the context stack beginns
 
     push rcx ; save pointer to fcontext_t
@@ -193,8 +192,6 @@
     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
 
- mov rax, [rcx+060h] ; load the address of the next context
- mov [rcx+08h], rax ; save the address of next context
     stmxcsr [rcx+070h] ; save MMX control and status word
     fnstcw [rcx+074h] ; save x87 control word
 

Modified: trunk/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -89,9 +89,8 @@
 .type make_fcontext,@function
 .align 16
 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 %rdx, 0x10(%rdi) /* save the the void pointer */
+ 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 */
@@ -100,17 +99,16 @@
     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 */
- movq 0x50(%rdi), %rcx /* load the address of the next context */
- movq %rcx, 0x8(%rdi) /* save the address of next context */
+ 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 0x58(%rdi) /* save MMX control and status word */
     fnstcw 0x5c(%rdi) /* save x87 control word */
 
- leaq finish(%rip), %rcx /* helper code executed after context function returns */
+ leaq finish(%rip), %rcx /* address of finish; called after context function returns */
     movq %rcx, (%rdx)
 
- xorq %rax, %rax /* set RAX to zero */
+ xorq %rax, %rax
     ret
 
 finish:

Modified: trunk/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S
==============================================================================
--- trunk/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S (original)
+++ trunk/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -88,7 +88,6 @@
 _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 %rdx, 0x10(%rdi) /* save the the void pointer */
     movq 0x40(%rdi), %rdx /* load the stack base */
 
     pushq %rdi /* save pointer to fcontext_t */
@@ -99,8 +98,7 @@
 
     leaq -0x8(%rdx), %rdx /* reserve space for the last frame on stack, (RSP + 8) % 16 == 0 */
     movq %rdx, 0x30(%rdi) /* save the address */
- movq 0x50(%rdi), %rcx /* load the address of the next context */
- movq %rcx, 0x8(%rdi) /* save the address of next context */
+
     stmxcsr 0x58(%rdi) /* save MMX control and status word */
     fnstcw 0x5c(%rdi) /* save x87 control word */
 

Modified: trunk/libs/context/test/test_context.cpp
==============================================================================
--- trunk/libs/context/test/test_context.cpp (original)
+++ trunk/libs/context/test/test_context.cpp 2012-04-22 06:18:43 EDT (Sun, 22 Apr 2012)
@@ -82,7 +82,7 @@
 
     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, 0);
+ ctx::make_fcontext( & fc1, f1);
 
     BOOST_CHECK_EQUAL( 0, value1);
     ctx::jump_fcontext( & fcm, & fc1, 0);
@@ -97,7 +97,7 @@
 
     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, 0);
+ ctx::make_fcontext( & fc1, f3);
 
     BOOST_CHECK_EQUAL( 0, value1);
     ctx::jump_fcontext( & fcm, & fc1, 0);
@@ -112,7 +112,7 @@
 
     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, 0);
+ ctx::make_fcontext( & fc1, f4);
 
     int result = ( int) ctx::jump_fcontext( & fcm, & fc1, 0);
     BOOST_CHECK_EQUAL( 7, result);
@@ -125,7 +125,7 @@
     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, i);
+ ctx::make_fcontext( & fc1, f5);
 
     int result = ( int) ctx::jump_fcontext( & fcm, & fc1, i);
     BOOST_CHECK_EQUAL( i, result);
@@ -138,7 +138,7 @@
     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, ( intptr_t) & data);
+ ctx::make_fcontext( & fc1, f6);
 
     int result = ( int) ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) & data);
     BOOST_CHECK_EQUAL( 10, result);
@@ -154,7 +154,7 @@
     fc1.fc_stack.base = alloc.allocate( ctx::minimum_stacksize() );
     fc1.fc_stack.limit = static_cast< char * >( fc1.fc_stack.base) - ctx::minimum_stacksize();
     char * what = "hello world";
- ctx::make_fcontext( & fc1, f7, ( intptr_t) what);
+ ctx::make_fcontext( & fc1, f7);
 
     ctx::jump_fcontext( & fcm, & fc1, ( intptr_t) what);
     BOOST_CHECK_EQUAL( std::string( what), value2);
@@ -167,7 +167,7 @@
     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, ( intptr_t) & d);
+ ctx::make_fcontext( & fc1, f8);
 
     ctx::jump_fcontext( & fcm, & fc1, (intptr_t) & d);
     BOOST_CHECK_EQUAL( 10.58, value3);


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