Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78087 - in trunk: boost/context/detail libs/context/src/asm
From: oliver.kowalke_at_[hidden]
Date: 2012-04-20 03:59:31


Author: olli
Date: 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
New Revision: 78087
URL: http://svn.boost.org/trac/boost/changeset/78087

Log:
context: reorganize structure of struct fcontext_t

Text files modified:
   trunk/boost/context/detail/fcontext_arm.hpp | 7 +
   trunk/boost/context/detail/fcontext_i386.hpp | 7 +
   trunk/boost/context/detail/fcontext_i386_win.hpp | 7 +
   trunk/boost/context/detail/fcontext_mips.hpp | 11 +-
   trunk/boost/context/detail/fcontext_ppc.hpp | 7 +
   trunk/boost/context/detail/fcontext_x86_64.hpp | 7 +
   trunk/boost/context/detail/fcontext_x86_64_win.hpp | 27 ++--
   trunk/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S | 38 +++---
   trunk/libs/context/src/asm/fcontext_i386_ms_pe_masm.asm | 73 ++++++++------
   trunk/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S | 36 +++---
   trunk/libs/context/src/asm/fcontext_i386_sysv_macho_gas.S | 34 +++---
   trunk/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S | 46 ++++----
   trunk/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S | 188 +++++++++++++++++++-------------------
   trunk/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S | 196 ++++++++++++++++++++--------------------
   trunk/libs/context/src/asm/fcontext_x86_64_ms_pe_masm.asm | 93 ++++++++----------
   trunk/libs/context/src/asm/fcontext_x86_64_sysv_elf_gas.S | 32 +++---
   trunk/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S | 32 +++---
   17 files changed, 437 insertions(+), 404 deletions(-)

Modified: trunk/boost/context/detail/fcontext_arm.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_arm.hpp (original)
+++ trunk/boost/context/detail/fcontext_arm.hpp 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -29,12 +29,17 @@
     void * limit;
 };
 
+struct fp_t
+{
+ boost::uint32_t fc_freg[16];
+};
+
 struct fcontext_t
 {
     boost::uint32_t fc_greg[11];
- boost::uint32_t fc_freg[16];
     stack_t fc_stack;
     fcontext_t * fc_link;
+ fp_t fc_fp;
 };
 
 }

Modified: trunk/boost/context/detail/fcontext_i386.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_i386.hpp (original)
+++ trunk/boost/context/detail/fcontext_i386.hpp 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -29,12 +29,17 @@
     void * limit;
 };
 
+struct fp_t
+{
+ boost::uint32_t fc_freg[2];
+};
+
 struct fcontext_t
 {
     boost::uint32_t fc_greg[6];
- boost::uint32_t fc_freg[2];
     stack_t fc_stack;
     fcontext_t * fc_link;
+ fp_t fc_fp;
 };
 
 }

Modified: trunk/boost/context/detail/fcontext_i386_win.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_i386_win.hpp (original)
+++ trunk/boost/context/detail/fcontext_i386_win.hpp 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -29,14 +29,19 @@
     void * limit;
 };
 
+struct fp_t
+{
+ boost::uint32_t fc_freg[2];
+};
+
 struct fcontext_t
 {
     boost::uint32_t fc_greg[6];
- boost::uint32_t fc_freg[2];
     stack_t fc_stack;
     fcontext_t * fc_link;
     void * fc_excpt_lst;
     void * fc_local_storage;
+ fp_t fc_fp;
 };
 
 }

Modified: trunk/boost/context/detail/fcontext_mips.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_mips.hpp (original)
+++ trunk/boost/context/detail/fcontext_mips.hpp 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -31,16 +31,17 @@
     void * limit;
 };
 
+struct fp_t
+{
+ boost::uint64_t fc_freg[6];
+};
+
 struct fcontext_t
 {
     boost::uint64_t fc_greg[13];
-# if _MIPS_SIM == _ABI64
- boost::uint64_t fc_freg[8];
-# else
- boost::uint64_t fc_freg[6];
-# endif
     stack_t fc_stack;
     fcontext_t * fc_link;
+ fp_t fc_fp;
 };
 
 }

Modified: trunk/boost/context/detail/fcontext_ppc.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_ppc.hpp (original)
+++ trunk/boost/context/detail/fcontext_ppc.hpp 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -29,6 +29,11 @@
     void * limit;
 };
 
+struct fp_t
+{
+ boost::uint64_t fc_freg[19];
+};
+
 struct fcontext_t
 {
 # if defined(__powerpc64__)
@@ -36,9 +41,9 @@
 # else
     boost::uint32_t fc_greg[23];
 # endif
- boost::uint64_t fc_freg[19];
     stack_t fc_stack;
     fcontext_t * fc_link;
+ fp_t fc_fp;
 };
 
 }

Modified: trunk/boost/context/detail/fcontext_x86_64.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_x86_64.hpp (original)
+++ trunk/boost/context/detail/fcontext_x86_64.hpp 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -29,12 +29,17 @@
     void * limit;
 };
 
+struct fp_t
+{
+ boost::uint32_t fc_freg[2];
+};
+
 struct fcontext_t
 {
     boost::uint64_t fc_greg[8];
- boost::uint32_t fc_freg[2];
     stack_t fc_stack;
     fcontext_t * fc_link;
+ fp_t fc_fp;
 };
 
 }

Modified: trunk/boost/context/detail/fcontext_x86_64_win.hpp
==============================================================================
--- trunk/boost/context/detail/fcontext_x86_64_win.hpp (original)
+++ trunk/boost/context/detail/fcontext_x86_64_win.hpp 2012-04-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -30,31 +30,32 @@
     void * limit;
 };
 
-struct fcontext_t
+struct fp_t
 {
- boost::uint64_t fc_greg[10];
     boost::uint32_t fc_freg[2];
- stack_t fc_stack;
- fcontext_t * fc_link;
- void * fc_local_storage;
- void * fc_fp;
+ void * fc_xmm;
     boost::uint8_t fc_buffer[162];
 
- fcontext_t() :
- fc_greg(),
+ fp_t() :
         fc_freg(),
- fc_stack(),
- fc_link( 0),
- fc_local_storage( 0),
- fc_fp( 0),
+ fc_xmm( 0),
         fc_buffer()
     {
         if ( 0 != ( ( ( uintptr_t) fc_buffer) & 15) )
- fc_fp = ( boost::uint8_t *)
+ fc_xmm = ( boost::uint8_t *)
                 ( ( ( ( ( uintptr_t) fc_buffer) + 16) >> 4) << 4);
     }
 };
 
+struct fcontext_t
+{
+ boost::uint64_t fc_greg[10];
+ stack_t fc_stack;
+ fcontext_t * fc_link;
+ void * fc_local_storage;
+ fp_t fc_fp;
+};
+
 }
 
 }}

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -22,32 +22,32 @@
  * | pc | | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | *
+ * | 11 | 12 | | *
  * ------------------------------------------------------------- *
- * | 0x2c|0x30| 0x34| 0x38| 0x3c| 0x40| 0x44| 0x48| 0x4c| 0x50 | *
+ * | 0x2c| 0x30| | *
  * ------------------------------------------------------------- *
- * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | s24 | s25 | *
+ * |sbase|slimit| | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 21 | 22 | 23 | 24 | 25 | 26 | | *
+ * | 13 | | *
  * ------------------------------------------------------------- *
- * | 0x54| 0x58| 0x5c| 0x60| 0x64| 0x68| | *
+ * | 0x34| | *
  * ------------------------------------------------------------- *
- * | s26 | s27 | s28 | s29 | s30 | s31 | | *
+ * |fclnk| | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 27 | 28 | | *
+ * | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
  * ------------------------------------------------------------- *
- * | 0x6c| 0x70| | *
+ * | 0x38|0x3c| 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c | *
  * ------------------------------------------------------------- *
- * |sbase|slimit| | *
+ * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | s24 | s25 | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 29 | | *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | | *
  * ------------------------------------------------------------- *
- * | 0x74| | *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| | *
  * ------------------------------------------------------------- *
- * |fclnk| | *
+ * | s26 | s27 | s28 | s29 | s30 | s31 | | *
  * ------------------------------------------------------------- *
  * *
  * *****************************************************************/
@@ -60,13 +60,13 @@
     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__))
- ldr a4, [a1,#44]
+ ldr a4, [a1,#56]
     stmia a4, {s16-s31} @ save S16-S31
 #endif
 
     ldr a1, [a2,#8] @ restore A1 as first arg
 #if (defined(__VFP_FP__) && !defined(__SOFTFP__))
- ldr a4, [a2,#44]
+ ldr a4, [a2,#56]
     ldmia a4, {s16-s31} @ restore S16-S31
 #endif
         
@@ -81,13 +81,13 @@
     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__))
- ldr a4, [a1,#44]
+ ldr a4, [a1,#56]
     stmia a4, {s16-s31} @ save S16-S31
 #endif
 
         mov a1, a3 @ use thrid arg as return value after jump
 #if (defined(__VFP_FP__) && !defined(__SOFTFP__))
- ldr a4, [a2,#44]
+ ldr a4, [a2,#56]
     ldmia a4, {s16-s31} @ restore S16-S31
 #endif
 
@@ -102,16 +102,16 @@
     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
- ldr a2, [a1,#108] @ load the stack base
+ 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 boost_fcontext_t
+ pop {a1,lr} @ restore pointer to fcontext_t
 
     str a2, [a1,#32] @ save the stack base
- ldr a2, [a1,#116] @ load the address of the next context
+ ldr a2, [a1,#52] @ load the address of the next context
     str a2, [a1,#4] @ save the address of the next context
     adr a2, link_fcontext @ load address of link_fcontext
     str a2, [a1,#36] @ save address of link_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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -16,28 +16,36 @@
 ; --------------------------------------------------------------
 ; | 018h | 01ch | |
 ; --------------------------------------------------------------
-; | fc_mxcsr|fc_x87_cw| |
+; | ss_base | ss_limit| |
 ; --------------------------------------------------------------
 ; --------------------------------------------------------------
-; | 8 | 9 | |
+; | 8 | |
 ; --------------------------------------------------------------
-; | 020h | 024h | |
+; | 020h | |
 ; --------------------------------------------------------------
-; | ss_base | ss_limit| |
+; | fc_link | |
+; --------------------------------------------------------------
+; --------------------------------------------------------------
+; | 9 | |
+; --------------------------------------------------------------
+; | 024h | |
+; --------------------------------------------------------------
+; |fc_except| |
 ; --------------------------------------------------------------
 ; --------------------------------------------------------------
 ; | 10 | |
 ; --------------------------------------------------------------
 ; | 028h | |
 ; --------------------------------------------------------------
-; | fc_link | |
+; |fc_strage| |
 ; --------------------------------------------------------------
 ; --------------------------------------------------------------
-; | 12 | |
+; | 10 | 11 | |
 ; --------------------------------------------------------------
-; | 030h | |
+; | 02ch | 030h | |
 ; --------------------------------------------------------------
-; |fc_strge | |
+; --------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| |
 ; --------------------------------------------------------------
 
 .386
@@ -60,22 +68,22 @@
     mov edx, fs:[018h] ; load NT_TIB
     assume fs:error
     mov eax, [edx] ; load current SEH exception list
- mov [ecx+02ch], eax ; save current exception list
+ mov [ecx+024h], eax ; save current exception list
     mov eax, [edx+04h] ; load current stack base
- mov [ecx+020h], eax ; save current stack base
+ mov [ecx+018h], eax ; save current stack base
     mov eax, [edx+08h] ; load current stack limit
- mov [ecx+024h], eax ; save current stack limit
+ mov [ecx+01ch], eax ; save current stack limit
     mov eax, [edx+010h] ; load fiber local storage
- mov [ecx+030h], eax ; save fiber local storage
-
-; stmxcsr [ecx+018h] ; save SSE2 control word
-; fnstcw [ecx+01ch] ; save x87 control word
+ mov [ecx+028h], 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
 
+; stmxcsr [ecx+02ch] ; save MMX control word
+; fnstcw [ecx+030h] ; save x87 control word
+
 
     mov ecx, [esp+08h] ; load address of the second fcontext_t arg
     mov edi, [ecx] ; restore EDI
@@ -86,17 +94,18 @@
     assume fs:nothing
     mov edx, fs:[018h] ; load NT_TIB
     assume fs:error
- mov eax, [ecx+02ch] ; load SEH exception list
+ mov eax, [ecx+024h] ; load SEH exception list
     mov [edx], eax ; restore next SEH item
- mov eax, [ecx+020h] ; load stack base
+ mov eax, [ecx+018h] ; load stack base
     mov [edx+04h], eax ; restore stack base
- mov eax, [ecx+024h] ; load stack limit
+ mov eax, [ecx+01ch] ; load stack limit
     mov [edx+08h], eax ; restore stack limit
- mov eax, [ecx+030h] ; load fiber local storage
+ mov eax, [ecx+028h] ; load fiber local storage
     mov [edx+010h], eax ; restore fiber local storage
 
-; ldmxcsr [ecx+018h] ; restore SSE2 control word
-; fldcw [ecx+01ch] ; restore x87 control word
+
+; ldmxcsr [ecx+02ch] ; restore MMX control word
+; fldcw [ecx+030h] ; restore x87 control word
 
     mov eax, [esp+0ch] ; use third arg as return value after jump
 
@@ -115,7 +124,7 @@
 
     push eax ; save pointer to fcontext_t
     push edx ; stack pointer as arg for align_stack
- call align_stack ; 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
@@ -123,19 +132,19 @@
     lea edx, [edx-014h] ; reserve space for last frame on stack, (ESP + 4) % 16 == 0
     mov [eax+010h], edx ; save the address
 
- 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
+ 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
 
- mov ecx, [eax+028h] ; load the address of the next context
+ 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+018h] ; save SSE2 control word
- fnstcw [eax+01ch] ; save x87 control word
+ stmxcsr [eax+02ch] ; save MMX control word
+ fnstcw [eax+030h] ; save x87 control word
     mov ecx, link_fcontext ; load helper code executed after fn() returns
     mov [edx], ecx ; save helper code executed adter fn() returns
     xor eax, eax ; set EAX to zero
@@ -149,7 +158,7 @@
 
     push esi ; push the address of the next context on the stack
     push edi ; push the address of the current context on the stack
- call start_fcontext ; install next context
+ call start_fcontext ; install next context
 
 finish:
     xor eax, eax ; set EAX to zero

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -19,21 +19,21 @@
  * -------------------i------------------------------------------ *
  * | 0x18 | 0x1c | | *
  * -------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
+ * | sbase | slimit | | *
  * -------------------------------------------------------------- *
  * -------------------------------------------------------------- *
- * | 8 | 9 | | *
+ * | 8 | | *
  * -------------------------------------------------------------- *
- * | 0x20 | 0x24 | | *
+ * | 0x20 | | *
  * -------------------------------------------------------------- *
- * | sbase | slimit | | *
+ * | fc_link | | *
  * -------------------------------------------------------------- *
  * -------------------------------------------------------------- *
- * | 10 | | *
+ * | 9 | 10 | | *
  * -------------------------------------------------------------- *
- * | 0x28 | | *
+ * | 0x24 | 0x28 | | *
  * -------------------------------------------------------------- *
- * | fc_link | | *
+ * | fc_mxcsr|fc_x87_cw| | *
  * -------------------------------------------------------------- *
  * *
  * *****************************************************************/
@@ -49,8 +49,8 @@
     movl %ebx, 0x8(%ecx) /* save EBX */
     movl %ebp, 0xc(%ecx) /* save EBP */
 
-/* stmxcsr 0x18(%ecx) */ /* save SSE2 control and status word */
-/* fnstcw 0x1c(%ecx) */ /* save x87 control word */
+/* stmxcsr 0x24(%ecx) */ /* save MMX control and status word */
+/* fnstcw 0x28(%ecx) */ /* save x87 control word */
 
     leal 0x4(%esp), %eax /* exclude the return address */
     movl %eax, 0x10(%ecx) /* save as stack pointer */
@@ -64,8 +64,8 @@
     movl 0x8(%ecx), %ebx /* restore EBX */
     movl 0xc(%ecx), %ebp /* restore EBP */
 
-/* ldmxcsr 0x18(%ecx) */ /* restore SSE2 control and status word */
-/* fldcw 0x1c(%ecx) */ /* restore x87 control word */
+/* ldmxcsr 0x24(%ecx) */ /* restore MMX control and status word */
+/* fldcw 0x28(%ecx) */ /* restore x87 control word */
 
     movl 0xc(%esp), %eax /* use third arg as return value after jump */
 
@@ -84,7 +84,7 @@
     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 0x20(%eax), %edx /* load the stack base */
+ movl 0x18(%eax), %edx /* load the stack base */
 
     pushl %eax /* save pointer to fcontext_t */
     pushl %ebx /* save EBX */
@@ -92,7 +92,7 @@
     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 */
+ 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 */
@@ -100,12 +100,14 @@
 
     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 0x28(%eax), %ecx /* load the address of the next context */
+ 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 */
- stmxcsr 0x18(%eax) /* save SSE2 control and status word */
- fnstcw 0x1c(%eax) /* save x87 control word */
+
+; 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 $link_fcontext-2b, %ecx /* compute address of label link_fcontext */
@@ -126,7 +128,7 @@
 
     pushl %esi /* push the address of the next context on the stack */
     pushl %edi /* push the address of the current context to stack */
- call start_fcontext_at_PLT /* jump to next context */
+ call start_fcontext_at_PLT /* jump to next context */
 
 4:
     movl %eax, %eax

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -19,21 +19,21 @@
  * -------------------i------------------------------------------ *
  * | 0x18 | 0x1c | | *
  * -------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
+ * | sbase | slimit | | *
  * -------------------------------------------------------------- *
  * -------------------------------------------------------------- *
- * | 8 | 9 | | *
+ * | 8 | | *
  * -------------------------------------------------------------- *
- * | 0x20 | 0x24 | | *
+ * | 0x20 | | *
  * -------------------------------------------------------------- *
- * | sbase | slimit | | *
+ * | fc_link | | *
  * -------------------------------------------------------------- *
  * -------------------------------------------------------------- *
- * | 10 | | *
+ * | 9 | 10 | | *
  * -------------------------------------------------------------- *
- * | 0x28 | | *
+ * | 0x24 | 0x28 | | *
  * -------------------------------------------------------------- *
- * | fc_link | | *
+ * | fc_mxcsr|fc_x87_cw| | *
  * -------------------------------------------------------------- *
  * *
  * *****************************************************************/
@@ -48,8 +48,8 @@
     movl %ebx, 0x8(%ecx) /* save EBX */
     movl %ebp, 0xc(%ecx) /* save EBP */
 
-/* stmxcsr 0x18(%ecx) */ /* save SSE2 control and status word */
-/* fnstcw 0x1c(%ecx) */ /* save x87 control word */
+/* stmxcsr 0x24(%ecx) */ /* save MMX control and status word */
+/* fnstcw 0x28(%ecx) */ /* save x87 control word */
 
     leal 0x4(%esp), %eax /* exclude the return address */
     movl %eax, 0x10(%ecx) /* save as stack pointer */
@@ -63,8 +63,8 @@
     movl 0x8(%ecx), %ebx /* restore EBX */
     movl 0xc(%ecx), %ebp /* restore EBP */
 
-/* ldmxcsr 0x18(%ecx) */ /* restore SSE2 control and status word */
-/* fldcw 0x1c(%ecx) */ /* restore x87 control word */
+/* ldmxcsr 0x24(%ecx) */ /* restore MMX control and status word */
+/* fldcw 0x28(%ecx) */ /* restore x87 control word */
 
     movl 0xc(%esp), %eax /* use third arg as return value after jump */
 
@@ -81,7 +81,7 @@
     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 0x20(%eax), %edx /* load the stack base */
+ movl 0x18(%eax), %edx /* load the stack base */
 
     pushl %eax /* save pointer to fcontext_t */
     pushl %ebx /* save EBX */
@@ -89,7 +89,7 @@
     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 */
+ 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 */
@@ -97,12 +97,14 @@
 
     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 0x28(%eax), %ecx /* load the address of the next context */
+ 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 */
- stmxcsr 0x18(%eax) /* save SSE2 control and status word */
- fnstcw 0x1c(%eax) /* save x87 control word */
+
+; 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 $link_fcontext-2b, %ecx /* compute address of label link_fcontext */

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -22,25 +22,25 @@
  * | S8 | RA | PC | | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 13 | 14 | 15 | 16 | 17 | 18 | | *
+ * | 13 | 14 | | *
  * ------------------------------------------------------------- *
- * | 104 | 112 | 120 | 128 | 136 | 144 | | *
+ * | 104 | 112 | | *
  * ------------------------------------------------------------- *
- * | F20 | F22 | F24 | F26 | F28 | F30 | | *
+ * |sbase|slimt| | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 19 | 20 | | *
+ * | 15 | | *
  * ------------------------------------------------------------- *
- * | 152 | 156 | | *
+ * | 120 | | *
  * ------------------------------------------------------------- *
- * |sbase|slimt| | *
+ * |flink| | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 21 | | *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | | *
  * ------------------------------------------------------------- *
- * | 160 | | *
+ * | 128 | 136 | 144 | 152 | 160 | 168 | | *
  * ------------------------------------------------------------- *
- * |flink| | *
+ * | F20 | F22 | F24 | F26 | F28 | F30 | | *
  * ------------------------------------------------------------- *
  * *
  * *****************************************************************/
@@ -66,12 +66,12 @@
     sw $ra, 96($a0) # save RA as PC
 
 #if defined(__mips_hard_float)
- s.d $f20, 104($a0) # save F20
- s.d $f22, 112($a0) # save F22
- s.d $f24, 120($a0) # save F24
- s.d $f26, 128($a0) # save F26
- s.d $f28, 136($a0) # save F28
- s.d $f30, 144($a0) # save F30
+ s.d $f20, 128($a0) # save F20
+ s.d $f22, 136($a0) # save F22
+ s.d $f24, 144($a0) # save F24
+ s.d $f26, 152($a0) # save F26
+ s.d $f28, 160($a0) # save F28
+ s.d $f30, 168($a0) # save F30
 #endif
 
 
@@ -90,12 +90,12 @@
     move $a0, $s2 # restore void pointer as argument
 
 #if defined(__mips_hard_float)
- l.d $f20, 104($a1) # restore F20
- l.d $f22, 112($a1) # restore F22
- l.d $f24, 120($a1) # restore F24
- l.d $f26, 128($a1) # restore F26
- l.d $f28, 136($a1) # restore F28
- l.d $f30, 144($a1) # restore F30
+ l.d $f20, 128($a1) # restore F20
+ l.d $f22, 136($a1) # restore F22
+ l.d $f24, 144($a1) # restore F24
+ l.d $f26, 152($a1) # restore F26
+ l.d $f28, 160($a1) # restore F28
+ l.d $f30, 168($a1) # restore F30
 #endif
 
     move $v0, $a2 # use third arg as return value after jump
@@ -120,7 +120,7 @@
     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
- lw $t0, 152($a0) # load the stack base
+ lw $t0, 104($a0) # load the stack base
 
     sub $sp, $sp, 28
     sw $ra, 24($sp)
@@ -136,7 +136,7 @@
 
     sub $t0, $t0, 16 # reserve 16 byte of argument space
     sw $t0, 72($a0) # save the stack base
- lw $t0, 160($a0) # load address of next user context
+ lw $t0, 120($a0) # load address of next user context
     sw $t0, 8($a0) # save the next context
     la $t9, link_fcontext # get address of link_fcontext
     sw $t9, 88($a0) # save address of link_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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -29,46 +29,46 @@
  * | CR | LR | PC | | | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | *
+ * | 24 | 25 | | *
  * ------------------------------------------------------------- *
- * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | *
+ * | 96 | 100 | | *
  * ------------------------------------------------------------- *
- * | F14 | F15 | F16 | F17 | F18 | *
+ * |sbase|slimt| | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | *
+ * | 26 | | *
  * ------------------------------------------------------------- *
- * | 136 | 140 | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | *
+ * | 104 | | *
  * ------------------------------------------------------------- *
- * | F19 | F20 | F21 | F22 | F23 | *
+ * |flink| | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | *
+ * | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | *
  * ------------------------------------------------------------- *
- * | 176 | 180 | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | *
+ * | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 | 144 | *
  * ------------------------------------------------------------- *
- * | F24 | F25 | F26 | F27 | F28 | *
+ * | F14 | F15 | F16 | F17 | F18 | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | | *
+ * | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
  * ------------------------------------------------------------- *
- * | 216 | 220 | 224 | 228 | 232 | 236 | 240 | 244 | | *
+ * | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 | 184 | *
  * ------------------------------------------------------------- *
- * | F29 | F30 | F31 | fpscr | | *
+ * | F19 | F20 | F21 | F22 | F23 | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 62 | 63 | | *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | *
  * ------------------------------------------------------------- *
- * | 248 | 252 | | *
+ * | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | 224 | *
  * ------------------------------------------------------------- *
- * |sbase|slimt| | *
+ * | F24 | F25 | F26 | F27 | F28 | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 64 | | *
+ * | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | | *
  * ------------------------------------------------------------- *
- * | 256 | | *
+ * | 228 | 232 | 236 | 240 | 244 | 248 | 252 | 256 | | *
  * ------------------------------------------------------------- *
- * |flink| | *
+ * | F29 | F30 | F31 | fpscr | | *
  * ------------------------------------------------------------- *
  * *
  * *****************************************************************/
@@ -105,26 +105,26 @@
     stw %r0, 84(%r3) # save LR
     stw %r0, 88(%r3) # save LR as PC
 
- stfd %f14, 96(%r3) # save F14
- stfd %f15, 104(%r3) # save F15
- stfd %f16, 112(%r3) # save F16
- stfd %f17, 120(%r3) # save F17
- stfd %f18, 128(%r3) # save F18
- stfd %f19, 136(%r3) # save F19
- stfd %f20, 144(%r3) # save F20
- stfd %f21, 152(%r3) # save F21
- stfd %f22, 160(%r3) # save F22
- stfd %f23, 168(%r3) # save F23
- stfd %f24, 176(%r3) # save F24
- stfd %f25, 184(%r3) # save F25
- stfd %f26, 192(%r3) # save F26
- stfd %f27, 200(%r3) # save F27
- stfd %f28, 208(%r3) # save F28
- stfd %f29, 216(%r3) # save F29
- stfd %f30, 224(%r3) # save F30
- stfd %f31, 232(%r3) # save F31
+ stfd %f14, 108(%r3) # save F14
+ stfd %f15, 116(%r3) # save F15
+ stfd %f16, 124(%r3) # save F16
+ stfd %f17, 132(%r3) # save F17
+ stfd %f18, 140(%r3) # save F18
+ stfd %f19, 148(%r3) # save F19
+ stfd %f20, 156(%r3) # save F20
+ stfd %f21, 164(%r3) # save F21
+ stfd %f22, 172(%r3) # save F22
+ stfd %f23, 180(%r3) # save F23
+ stfd %f24, 188(%r3) # save F24
+ stfd %f25, 196(%r3) # save F25
+ stfd %f26, 204(%r3) # save F26
+ stfd %f27, 212(%r3) # save F27
+ stfd %f28, 220(%r3) # save F28
+ stfd %f29, 228(%r3) # save F29
+ stfd %f30, 236(%r3) # save F30
+ stfd %f31, 244(%r3) # save F31
     mffs %f0 # load FPSCR
- stfd %f0, 240(%r3) # save FPSCR
+ stfd %f0, 252(%r3) # save FPSCR
 
 
     lwz %r13, 0(%r4) # restore R13
@@ -153,25 +153,25 @@
     lwz %r0, 84(%r4) # load LR
     mtlr %r0 # restore LR
 
- lfd %f14, 96(%r4) # restore F14
- lfd %f15, 104(%r4) # restore F15
- lfd %f16, 112(%r4) # restore F16
- lfd %f17, 120(%r4) # restore F17
- lfd %f18, 128(%r4) # restore F18
- lfd %f19, 136(%r4) # restore F19
- lfd %f20, 144(%r4) # restore F20
- lfd %f21, 152(%r4) # restore F21
- lfd %f22, 160(%r4) # restore F22
- lfd %f23, 168(%r4) # restore F23
- lfd %f24, 176(%r4) # restore F24
- lfd %f25, 184(%r4) # restore F25
- lfd %f26, 192(%r4) # restore F26
- lfd %f27, 200(%r4) # restore F27
- lfd %f28, 208(%r4) # restore F28
- lfd %f29, 216(%r4) # restore F29
- lfd %f30, 224(%r4) # restore F30
- lfd %f31, 232(%r4) # restore F31
- lfd %f0, 240(%r4) # load FPSCR
+ lfd %f14, 108(%r4) # restore F14
+ lfd %f15, 116(%r4) # restore F15
+ lfd %f16, 124(%r4) # restore F16
+ lfd %f17, 132(%r4) # restore F17
+ lfd %f18, 140(%r4) # restore F18
+ lfd %f19, 148(%r4) # restore F19
+ lfd %f20, 156(%r4) # restore F20
+ lfd %f21, 164(%r4) # restore F21
+ lfd %f22, 172(%r4) # restore F22
+ lfd %f23, 180(%r4) # restore F23
+ lfd %f24, 188(%r4) # restore F24
+ lfd %f25, 196(%r4) # restore F25
+ lfd %f26, 204(%r4) # restore F26
+ lfd %f27, 212(%r4) # restore F27
+ lfd %f28, 220(%r4) # restore F28
+ lfd %f29, 228(%r4) # restore F29
+ lfd %f30, 236(%r4) # restore F30
+ lfd %f31, 244(%r4) # restore F31
+ lfd %f0, 252(%r4) # load FPSCR
     mtfsf 0xff, %f0 # restore FPSCR
 
     lwz %r0, 88(%r4) # load PC
@@ -213,26 +213,26 @@
     stw %r0, 84(%r3) # save LR
     stw %r0, 88(%r3) # save LR as PC
 
- stfd %f14, 92(%r3) # save F14
- stfd %f15, 100(%r3) # save F15
- stfd %f16, 108(%r3) # save F16
- stfd %f17, 116(%r3) # save F17
- stfd %f18, 124(%r3) # save F18
- stfd %f19, 132(%r3) # save F19
- stfd %f20, 140(%r3) # save F20
- stfd %f21, 148(%r3) # save F21
- stfd %f22, 156(%r3) # save F22
- stfd %f23, 164(%r3) # save F23
- stfd %f24, 172(%r3) # save F24
- stfd %f25, 180(%r3) # save F25
- stfd %f26, 188(%r3) # save F26
- stfd %f27, 196(%r3) # save F27
- stfd %f28, 204(%r3) # save F28
- stfd %f29, 212(%r3) # save F29
- stfd %f30, 220(%r3) # save F30
- stfd %f31, 228(%r3) # save F31
+ stfd %f14, 108(%r3) # save F14
+ stfd %f15, 116(%r3) # save F15
+ stfd %f16, 124(%r3) # save F16
+ stfd %f17, 132(%r3) # save F17
+ stfd %f18, 140(%r3) # save F18
+ stfd %f19, 148(%r3) # save F19
+ stfd %f20, 156(%r3) # save F20
+ stfd %f21, 164(%r3) # save F21
+ stfd %f22, 172(%r3) # save F22
+ stfd %f23, 180(%r3) # save F23
+ stfd %f24, 188(%r3) # save F24
+ stfd %f25, 196(%r3) # save F25
+ stfd %f26, 204(%r3) # save F26
+ stfd %f27, 212(%r3) # save F27
+ stfd %f28, 220(%r3) # save F28
+ stfd %f29, 228(%r3) # save F29
+ stfd %f30, 236(%r3) # save F30
+ stfd %f31, 244(%r3) # save F31
     mffs %f0 # load FPSCR
- stfd %f0, 236(%r3) # save FPSCR
+ stfd %f0, 252(%r3) # save FPSCR
 
 
     lwz %r13, 0(%r4) # restore R13
@@ -261,25 +261,25 @@
     lwz %r0, 84(%r4) # load LR
     mtlr %r0 # restore LR
 
- lfd %f14, 92(%r4) # restore F14
- lfd %f15, 100(%r4) # restore F15
- lfd %f16, 108(%r4) # restore F16
- lfd %f17, 116(%r4) # restore F17
- lfd %f18, 124(%r4) # restore F18
- lfd %f19, 132(%r4) # restore F19
- lfd %f20, 140(%r4) # restore F20
- lfd %f21, 148(%r4) # restore F21
- lfd %f22, 156(%r4) # restore F22
- lfd %f23, 164(%r4) # restore F23
- lfd %f24, 172(%r4) # restore F24
- lfd %f25, 180(%r4) # restore F25
- lfd %f26, 188(%r4) # restore F26
- lfd %f27, 196(%r4) # restore F27
- lfd %f28, 204(%r4) # restore F28
- lfd %f29, 212(%r4) # restore F29
- lfd %f30, 220(%r4) # restore F30
- lfd %f31, 228(%r4) # restore F31
- lfd %f0, 236(%r4) # load FPSCR
+ lfd %f14, 108(%r4) # restore F14
+ lfd %f15, 116(%r4) # restore F15
+ lfd %f16, 124(%r4) # restore F16
+ lfd %f17, 132(%r4) # restore F17
+ lfd %f18, 140(%r4) # restore F18
+ lfd %f19, 148(%r4) # restore F19
+ lfd %f20, 156(%r4) # restore F20
+ lfd %f21, 164(%r4) # restore F21
+ lfd %f22, 172(%r4) # restore F22
+ lfd %f23, 180(%r4) # restore F23
+ lfd %f24, 188(%r4) # restore F24
+ lfd %f25, 196(%r4) # restore F25
+ lfd %f26, 204(%r4) # restore F26
+ lfd %f27, 212(%r4) # restore F27
+ lfd %f28, 220(%r4) # restore F28
+ lfd %f29, 228(%r4) # restore F29
+ lfd %f30, 236(%r4) # restore F30
+ lfd %f31, 244(%r4) # restore F31
+ lfd %f0, 252(%r4) # load FPSCR
     mtfsf 0xff, %f0 # restore FPSCR
 
     mr. %r3, %r5 # use third arg as return value after jump

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -43,46 +43,46 @@
  * | CR | LR | PC | | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | *
+ * | 46 | 47 | 48 | 49 | | *
  * ------------------------------------------------------------- *
- * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | *
+ * | 184 | 188 | 192 | 196 | | *
  * ------------------------------------------------------------- *
- * | F14 | F15 | F16 | F17 | F18 | *
+ * | sbase | slimt | | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | *
+ * | 50 | 51 | | *
  * ------------------------------------------------------------- *
- * | 232 | 236 | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | *
+ * | 200 | 204 | | *
  * ------------------------------------------------------------- *
- * | F19 | F20 | F21 | F22 | F23 | *
+ * | flink | | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | *
+ * | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | *
  * ------------------------------------------------------------- *
- * | 272 | 276 | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | *
+ * | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | 240 | 244 | *
  * ------------------------------------------------------------- *
- * | F24 | F25 | F26 | F27 | F28 | *
+ * | F14 | F15 | F16 | F17 | F18 | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | | *
+ * | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | *
  * ------------------------------------------------------------- *
- * | 312 | 316 | 320 | 324 | 328 | 332 | 336 | 340 | | *
+ * | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | 280 | 284 | *
  * ------------------------------------------------------------- *
- * | F29 | F30 | F31 | fpscr | | *
+ * | F19 | F20 | F21 | F22 | F23 | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 86 | 87 | 88 | 89 | | *
+ * | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | *
  * ------------------------------------------------------------- *
- * | 344 | 348 | 352 | 356 | | *
+ * | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | 320 | 324 | *
  * ------------------------------------------------------------- *
- * | sbase | slimt | | *
+ * | F24 | F25 | F26 | F27 | F28 | *
  * ------------------------------------------------------------- *
  * ------------------------------------------------------------- *
- * | 90 | 91 | | *
+ * | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | | *
  * ------------------------------------------------------------- *
- * | 360 | 364 | | *
+ * | 328 | 332 | 336 | 340 | 344 | 348 | 352 | 356 | | *
  * ------------------------------------------------------------- *
- * | flink | | *
+ * | F29 | F30 | F31 | fpscr | | *
  * ------------------------------------------------------------- *
  * *
  * *****************************************************************/
@@ -126,26 +126,26 @@
     std %r0, 168(%r3) # save LR
     std %r0, 176(%r3) # save LR as PC
 
- stfd %f14, 192(%r3) # save F14
- stfd %f15, 200(%r3) # save F15
- stfd %f16, 208(%r3) # save F16
- stfd %f17, 216(%r3) # save F17
- stfd %f18, 224(%r3) # save F18
- stfd %f19, 232(%r3) # save F19
- stfd %f20, 240(%r3) # save F20
- stfd %f21, 248(%r3) # save F21
- stfd %f22, 256(%r3) # save F22
- stfd %f23, 264(%r3) # save F23
- stfd %f24, 272(%r3) # save F24
- stfd %f25, 280(%r3) # save F25
- stfd %f26, 288(%r3) # save F26
- stfd %f27, 296(%r3) # save F27
- stfd %f28, 304(%r3) # save F28
- stfd %f29, 312(%r3) # save F29
- stfd %f30, 320(%r3) # save F30
- stfd %f31, 328(%r3) # save F31
+ stfd %f14, 208(%r3) # save F14
+ stfd %f15, 216(%r3) # save F15
+ stfd %f16, 224(%r3) # save F16
+ stfd %f17, 232(%r3) # save F17
+ stfd %f18, 240(%r3) # save F18
+ stfd %f19, 248(%r3) # save F19
+ stfd %f20, 256(%r3) # save F20
+ stfd %f21, 264(%r3) # save F21
+ stfd %f22, 272(%r3) # save F22
+ stfd %f23, 280(%r3) # save F23
+ stfd %f24, 288(%r3) # save F24
+ stfd %f25, 296(%r3) # save F25
+ stfd %f26, 304(%r3) # save F26
+ stfd %f27, 312(%r3) # save F27
+ stfd %f28, 320(%r3) # save F28
+ stfd %f29, 328(%r3) # save F29
+ stfd %f30, 336(%r3) # save F30
+ stfd %f31, 344(%r3) # save F31
     mffs %f0 # load FPSCR
- stfd %f0, 336(%r3) # save FPSCR
+ stfd %f0, 352(%r3) # save FPSCR
 
 
     ld %r13, 0(%r4) # restore R13
@@ -174,25 +174,25 @@
     ld %r0, 168(%r4) # load LR
     mtlr %r0 # restore LR
 
- lfd %f14, 192(%r4) # restore F14
- lfd %f15, 200(%r4) # restore F15
- lfd %f16, 208(%r4) # restore F16
- lfd %f17, 216(%r4) # restore F17
- lfd %f18, 224(%r4) # restore F18
- lfd %f19, 232(%r4) # restore F19
- lfd %f20, 240(%r4) # restore F20
- lfd %f21, 248(%r4) # restore F21
- lfd %f22, 256(%r4) # restore F22
- lfd %f23, 264(%r4) # restore F23
- lfd %f24, 272(%r4) # restore F24
- lfd %f25, 280(%r4) # restore F25
- lfd %f26, 288(%r4) # restore F26
- lfd %f27, 296(%r4) # restore F27
- lfd %f28, 304(%r4) # restore F28
- lfd %f29, 312(%r4) # restore F29
- lfd %f30, 320(%r4) # restore F30
- lfd %f31, 328(%r4) # restore F31
- lfd %f0, 336(%r4) # load FPSCR
+ lfd %f14, 208(%r4) # restore F14
+ lfd %f15, 216(%r4) # restore F15
+ lfd %f16, 224(%r4) # restore F16
+ lfd %f17, 232(%r4) # restore F17
+ lfd %f18, 240(%r4) # restore F18
+ lfd %f19, 248(%r4) # restore F19
+ lfd %f20, 256(%r4) # restore F20
+ lfd %f21, 264(%r4) # restore F21
+ lfd %f22, 272(%r4) # restore F22
+ lfd %f23, 280(%r4) # restore F23
+ lfd %f24, 288(%r4) # restore F24
+ lfd %f25, 296(%r4) # restore F25
+ lfd %f26, 304(%r4) # restore F26
+ lfd %f27, 312(%r4) # restore F27
+ lfd %f28, 320(%r4) # restore F28
+ lfd %f29, 328(%r4) # restore F29
+ lfd %f30, 336(%r4) # restore F30
+ lfd %f31, 344(%r4) # restore F31
+ lfd %f0, 352(%r4) # load FPSCR
     mtfsf 0xff, %f0 # restore FPSCR
 
     ld %r0, 176(%r4) # load PC
@@ -241,26 +241,26 @@
     std %r0, 168(%r3) # save LR
     std %r0, 176(%r3) # save LR as PC
 
- stfd %f14, 192(%r3) # save F14
- stfd %f15, 200(%r3) # save F15
- stfd %f16, 208(%r3) # save F16
- stfd %f17, 216(%r3) # save F17
- stfd %f18, 224(%r3) # save F18
- stfd %f19, 232(%r3) # save F19
- stfd %f20, 240(%r3) # save F20
- stfd %f21, 248(%r3) # save F21
- stfd %f22, 256(%r3) # save F22
- stfd %f23, 264(%r3) # save F23
- stfd %f24, 272(%r3) # save F24
- stfd %f25, 280(%r3) # save F25
- stfd %f26, 288(%r3) # save F26
- stfd %f27, 296(%r3) # save F27
- stfd %f28, 304(%r3) # save F28
- stfd %f29, 312(%r3) # save F29
- stfd %f30, 320(%r3) # save F30
- stfd %f31, 328(%r3) # save F31
+ stfd %f14, 208(%r3) # save F14
+ stfd %f15, 216(%r3) # save F15
+ stfd %f16, 224(%r3) # save F16
+ stfd %f17, 232(%r3) # save F17
+ stfd %f18, 240(%r3) # save F18
+ stfd %f19, 248(%r3) # save F19
+ stfd %f20, 256(%r3) # save F20
+ stfd %f21, 264(%r3) # save F21
+ stfd %f22, 272(%r3) # save F22
+ stfd %f23, 280(%r3) # save F23
+ stfd %f24, 288(%r3) # save F24
+ stfd %f25, 296(%r3) # save F25
+ stfd %f26, 304(%r3) # save F26
+ stfd %f27, 312(%r3) # save F27
+ stfd %f28, 320(%r3) # save F28
+ stfd %f29, 328(%r3) # save F29
+ stfd %f30, 336(%r3) # save F30
+ stfd %f31, 344(%r3) # save F31
     mffs %f0 # load FPSCR
- stfd %f0, 336(%r3) # save FPSCR
+ stfd %f0, 352(%r3) # save FPSCR
 
 
     ld %r13, 0(%r4) # restore R13
@@ -289,25 +289,25 @@
     ld %r0, 168(%r4) # load LR
     mtlr %r0 # restore LR
 
- lfd %f14, 192(%r4) # restore F14
- lfd %f15, 200(%r4) # restore F15
- lfd %f16, 208(%r4) # restore F16
- lfd %f17, 216(%r4) # restore F17
- lfd %f18, 224(%r4) # restore F18
- lfd %f19, 232(%r4) # restore F19
- lfd %f20, 240(%r4) # restore F20
- lfd %f21, 248(%r4) # restore F21
- lfd %f22, 256(%r4) # restore F22
- lfd %f23, 264(%r4) # restore F23
- lfd %f24, 272(%r4) # restore F24
- lfd %f25, 280(%r4) # restore F25
- lfd %f26, 288(%r4) # restore F26
- lfd %f27, 296(%r4) # restore F27
- lfd %f28, 304(%r4) # restore F28
- lfd %f29, 312(%r4) # restore F29
- lfd %f30, 320(%r4) # restore F30
- lfd %f31, 328(%r4) # restore F31
- lfd %f0, 336(%r4) # load FPSCR
+ lfd %f14, 208(%r4) # restore F14
+ lfd %f15, 216(%r4) # restore F15
+ lfd %f16, 224(%r4) # restore F16
+ lfd %f17, 232(%r4) # restore F17
+ lfd %f18, 240(%r4) # restore F18
+ lfd %f19, 248(%r4) # restore F19
+ lfd %f20, 256(%r4) # restore F20
+ lfd %f21, 264(%r4) # restore F21
+ lfd %f22, 272(%r4) # restore F22
+ lfd %f23, 280(%r4) # restore F23
+ lfd %f24, 288(%r4) # restore F24
+ lfd %f25, 296(%r4) # restore F25
+ lfd %f26, 304(%r4) # restore F26
+ lfd %f27, 312(%r4) # restore F27
+ lfd %f28, 320(%r4) # restore F28
+ lfd %f29, 328(%r4) # restore F29
+ lfd %f30, 336(%r4) # restore F30
+ lfd %f31, 344(%r4) # restore F31
+ lfd %f0, 352(%r4) # load FPSCR
     mtfsf 0xff, %f0 # restore FPSCR
 
     mr. %r3, %r5 # use third arg as return value after jump
@@ -333,15 +333,15 @@
     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, 344(%r3) # load the stack base
+ 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 boost_fcontext_algin
- bl align_stack_at_plt # call align_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
@@ -351,7 +351,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, 360(%r3) # load address of next user context
+ 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

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -19,46 +19,39 @@
 ; | RDI | RSI | RBX | RBP |
 ; ----------------------------------------------------------------------------------
 ; ----------------------------------------------------------------------------------
-; | 16 | 17 | 18 | 19 | |
+; | 16 | 17 | 18 | 19 | |
 ; ----------------------------------------------------------------------------------
-; | 0x40 | 0x44 | 0x48 | 0x4c | |
+; | 0x40 | 0x44 | 0x48 | 0x4c | |
 ; ----------------------------------------------------------------------------------
 ; | RSP | RIP | |
 ; ----------------------------------------------------------------------------------
 ; ----------------------------------------------------------------------------------
-; | 20 | 21 | |
+; | 20 | 21 | 22 | 23 | |
 ; ----------------------------------------------------------------------------------
-; | 0x50 | 0x54 | |
+; | 0x50 | 0x54 | 0x58 | 0x5c | |
 ; ----------------------------------------------------------------------------------
-; | fc_mxcsr|fc_x87_cw| |
+; | sbase | slimit | |
 ; ----------------------------------------------------------------------------------
 ; ----------------------------------------------------------------------------------
-; | 22 | 23 | 24 | 25 | |
+; | 24 | 25 | |
 ; ----------------------------------------------------------------------------------
-; | 0x58 | 0x5c | 0x60 | 0x64 | |
+; | 0x60 | 0x64 | |
 ; ----------------------------------------------------------------------------------
-; | sbase | slimit | |
+; | fc_link | |
 ; ----------------------------------------------------------------------------------
 ; ----------------------------------------------------------------------------------
 ; | 26 | 27 | |
 ; ----------------------------------------------------------------------------------
 ; | 0x68 | 0x6c | |
 ; ----------------------------------------------------------------------------------
-; | fc_link | |
-; ----------------------------------------------------------------------------------
-; ----------------------------------------------------------------------------------
-; | 28 | 29 | |
-; ----------------------------------------------------------------------------------
-; | 0x70 | 0x74 | |
-; ----------------------------------------------------------------------------------
 ; | fbr_strg | |
 ; ----------------------------------------------------------------------------------
 ; ----------------------------------------------------------------------------------
-; | 30 | 31 | |
+; | 28 | 29 | 30 | 31 | |
 ; ----------------------------------------------------------------------------------
-; | 0x78 | 0x7c | |
+; | 0x70 | 0x74 | 0x78 | 0x7c | |
 ; ----------------------------------------------------------------------------------
-; | fc_fp | |
+; | fc_mxcsr|fc_x87_cw| fc_xmm | |
 ; ----------------------------------------------------------------------------------
 ; ----------------------------------------------------------------------------------
 ; | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
@@ -116,11 +109,25 @@
 
     mov r9, gs:[030h] ; load NT_TIB
     mov rax, [r9+08h] ; load current stack base
- mov [rcx+058h], rax ; save current stack base
+ mov [rcx+050h], rax ; save current stack base
     mov rax, [r9+010h] ; load current stack limit
- mov [rcx+060h], rax ; save current stack limit
+ mov [rcx+058h], rax ; save current stack limit
     mov rax, [r9+018h] ; load fiber local storage
- mov [rcx+070h], rax ; save fiber local storage
+ mov [rcx+068h], rax ; save fiber local storage
+
+; stmxcsr [rcx+070h] ; save MMX control and status word
+; fnstcw [rcx+074h] ; save x87 control word
+
+ movaps [rcx+080h], xmm6
+ movaps [rcx+090h], xmm7
+ movaps [rcx+0100h], xmm8
+ movaps [rcx+0110h], xmm9
+ movaps [rcx+0120h], xmm10
+ movaps [rcx+0130h], xmm11
+ movaps [rcx+0140h], xmm12
+ movaps [rcx+0150h], xmm13
+ movaps [rcx+0160h], xmm14
+ movaps [rcx+0170h], xmm15
 
     lea rax, [rsp+08h] ; exclude the return address
     mov [rcx+040h], rax ; save as stack pointer
@@ -137,22 +144,16 @@
     mov rbx, [rdx+030h] ; restore RBX
     mov rbp, [rdx+038h] ; restore RBP
 
-; stmxcsr [rcx+050h] ; save SSE2 control and status word
-; fnstcw [rcx+054h] ; save x87 control word
-
- movaps [rcx+080h], xmm6
- movaps [rcx+090h], xmm7
- movaps [rcx+0100h], xmm8
- movaps [rcx+0110h], xmm9
- movaps [rcx+0120h], xmm10
- movaps [rcx+0130h], xmm11
- movaps [rcx+0140h], xmm12
- movaps [rcx+0150h], xmm13
- movaps [rcx+0160h], xmm14
- movaps [rcx+0170h], xmm15
+ mov r9, gs:[030h] ; load NT_TIB
+ mov rax, [rdx+050h] ; load stack base
+ mov [r9+08h], rax ; restore stack base
+ mov rax, [rdx+058h] ; load stack limit
+ mov [r9+010h], rax ; restore stack limit
+ mov rax, [rdx+068h] ; load fiber local storage
+ mov [r9+018h], rax ; restore fiber local storage
 
-; ldmxcsr [rdx+050h] ; restore SSE2 control and status word
-; fldcw [rdx+054h] ; restore x87 control word
+; ldmxcsr [rdx+070h] ; restore MMX control and status word
+; fldcw [rdx+074h] ; restore x87 control word
 
     movaps xmm6, [rdx+080h]
     movaps xmm7, [rdx+090h]
@@ -165,14 +166,6 @@
     movaps xmm14, [rdx+0160h]
     movaps xmm15, [rdx+0170h]
 
- mov r9, gs:[030h] ; load NT_TIB
- mov rax, [rdx+058h] ; load stack base
- mov [r9+08h], rax ; restore stack base
- mov rax, [rdx+060h] ; load stack limit
- mov [r9+010h], rax ; restore stack limit
- mov rax, [rdx+070h] ; load fiber local storage
- mov [r9+018h], rax ; restore fiber local storage
-
     mov rsp, [rdx+040h] ; restore RSP
     mov r9, [rdx+048h] ; fetch the address to returned to
     mov rcx, r14 ; restore RCX as first argument for called context
@@ -188,10 +181,10 @@
     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+058h] ; load the address where the context stack beginns
+ 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 boost_fcontext_algin
+ 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
@@ -202,10 +195,10 @@
     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+068h] ; load the address of the next context
+ mov rax, [rcx+060h] ; load the address of the next context
     mov [rcx+08h], rax ; save the address of next context
- stmxcsr [rcx+050h] ; save SSE2 control and status word
- fnstcw [rcx+054h] ; save x87 control word
+ stmxcsr [rcx+070h] ; save MMX control and status word
+ fnstcw [rcx+074h] ; save x87 control word
 
     lea rax, link_fcontext ; helper code executed after fn() returns
     mov [rdx], rax ; store address off the helper function as return address
@@ -225,7 +218,7 @@
     mov rdx, r13 ; second argumnet eq. address of next context
     mov [rsp+010h], rdx
     mov [rsp+08h], rcx
- call start_fcontext ; install next context
+ call start_fcontext ; install next context
 
 finish:
     xor rcx, rcx

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -22,25 +22,25 @@
  * | R15 | RBP | RSP | RIP | *
  * ---------------------------------------------------------------------------------- *
  * ---------------------------------------------------------------------------------- *
- * | 16 | 17 | | *
+ * | 16 | 17 | 18 | 19 | | *
  * ---------------------------------------------------------------------------------- *
- * | 0x40 | 0x44 | | *
+ * | 0x40 | 0x44 | 0x48 | 0x4c | | *
  * ---------------------------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
+ * | sbase | slimit | | *
  * ---------------------------------------------------------------------------------- *
  * ---------------------------------------------------------------------------------- *
- * | 18 | 19 | 20 | 21 | | *
+ * | 20 | 21 | | *
  * ---------------------------------------------------------------------------------- *
- * | 0x48 | 0x4c | 0x50 | 0x54 | | *
+ * | 0x50 | 0x54 | | *
  * ---------------------------------------------------------------------------------- *
- * | sbase | slimit | | *
+ * | fc_link | | *
  * ---------------------------------------------------------------------------------- *
  * ---------------------------------------------------------------------------------- *
  * | 22 | 23 | | *
  * ---------------------------------------------------------------------------------- *
  * | 0x58 | 0x5c | | *
  * ---------------------------------------------------------------------------------- *
- * | fc_link | | *
+ * | fc_mxcsr|fc_x87_cw| | *
  * ---------------------------------------------------------------------------------- *
  * *
  * **************************************************************************************/
@@ -57,8 +57,8 @@
     movq %r15, 0x20(%rdi) /* save R15 */
     movq %rbp, 0x28(%rdi) /* save RBP */
 
- stmxcsr 0x40(%rdi) /* save SSE2 control and status word */
- fnstcw 0x44(%rdi) /* save x87 control word */
+ stmxcsr 0x58(%rdi) /* save MMX control and status word */
+ fnstcw 0x5c(%rdi) /* save x87 control word */
 
     leaq 0x8(%rsp), %rcx /* exclude the return address and save as stack pointer */
     movq %rcx, 0x30(%rdi) /* save as stack pointer */
@@ -73,8 +73,8 @@
     movq 0x20(%rsi), %r15 /* restore R15 */
     movq 0x28(%rsi), %rbp /* restore RBP */
 
- ldmxcsr 0x40(%rsi) /* restore SSE2 control and status word */
- fldcw 0x44(%rsi) /* restore x87 control word */
+ ldmxcsr 0x58(%rsi) /* restore MMX control and status word */
+ fldcw 0x5c(%rsi) /* restore x87 control word */
 
     movq %rdx, %rax /* use third arg as return value after jump */
 
@@ -93,20 +93,20 @@
     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 0x48(%rdi), %rdx /* load the stack base */
+ 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 */
+ 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) % 16 == 0 */
     movq %rdx, 0x30(%rdi) /* save the address */
- movq 0x58(%rdi), %rcx /* load the address of the next context */
+ movq 0x50(%rdi), %rcx /* load the address of the next context */
     movq %rcx, 0x8(%rdi) /* save the address of next context */
- stmxcsr 0x40(%rdi) /* save SSE2 control and status word */
- fnstcw 0x44(%rdi) /* save x87 control word */
+ stmxcsr 0x58(%rdi) /* save MMX control and status word */
+ fnstcw 0x5c(%rdi) /* save x87 control word */
     leaq link_fcontext(%rip), %rcx /* helper code executed after context function returns */
     movq %rcx, (%rdx)
     xorq %rax, %rax /* set RAX to zero */

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-20 03:59:28 EDT (Fri, 20 Apr 2012)
@@ -22,25 +22,25 @@
  * | R15 | RBP | RSP | RIP | *
  * ---------------------------------------------------------------------------------- *
  * ---------------------------------------------------------------------------------- *
- * | 16 | 17 | | *
+ * | 16 | 17 | 18 | 19 | | *
  * ---------------------------------------------------------------------------------- *
- * | 0x40 | 0x44 | | *
+ * | 0x40 | 0x44 | 0x48 | 0x4c | | *
  * ---------------------------------------------------------------------------------- *
- * | fc_mxcsr|fc_x87_cw| | *
+ * | sbase | slimit | | *
  * ---------------------------------------------------------------------------------- *
  * ---------------------------------------------------------------------------------- *
- * | 18 | 19 | 20 | 21 | | *
+ * | 20 | 21 | | *
  * ---------------------------------------------------------------------------------- *
- * | 0x48 | 0x4c | 0x50 | 0x54 | | *
+ * | 0x50 | 0x54 | | *
  * ---------------------------------------------------------------------------------- *
- * | sbase | slimit | | *
+ * | fc_link | | *
  * ---------------------------------------------------------------------------------- *
  * ---------------------------------------------------------------------------------- *
  * | 22 | 23 | | *
  * ---------------------------------------------------------------------------------- *
  * | 0x58 | 0x5c | | *
  * ---------------------------------------------------------------------------------- *
- * | fc_link | | *
+ * | fc_mxcsr|fc_x87_cw| | *
  * ---------------------------------------------------------------------------------- *
  * *
  * **************************************************************************************/
@@ -56,8 +56,8 @@
     movq %r15, 0x20(%rdi) /* save R15 */
     movq %rbp, 0x28(%rdi) /* save RBP */
 
- stmxcsr 0x40(%rdi) /* save SSE2 control and status word */
- fnstcw 0x44(%rdi) /* save x87 control word */
+ stmxcsr 0x58(%rdi) /* save MMX control and status word */
+ fnstcw 0x5c(%rdi) /* save x87 control word */
 
     leaq 0x8(%rsp), %rcx /* exclude the return address and save as stack pointer */
     movq %rcx, 0x30(%rdi) /* save as stack pointer */
@@ -72,8 +72,8 @@
     movq 0x20(%rsi), %r15 /* restore R15 */
     movq 0x28(%rsi), %rbp /* restore RBP */
 
- ldmxcsr 0x40(%rsi) /* restore SSE2 control and status word */
- fldcw 0x44(%rsi) /* restore x87 control word */
+ ldmxcsr 0x58(%rsi) /* restore MMX control and status word */
+ fldcw 0x5c(%rsi) /* restore x87 control word */
 
     movq %rdx, %rax /* use third arg as return value after jump */
 
@@ -90,20 +90,20 @@
     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 0x48(%rdi), %rdx /* load the stack base */
+ 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 */
+ 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) % 16 == 0 */
     movq %rdx, 0x30(%rdi) /* save the address */
- movq 0x58(%rdi), %rcx /* load the address of the next context */
+ movq 0x50(%rdi), %rcx /* load the address of the next context */
     movq %rcx, 0x8(%rdi) /* save the address of next context */
- stmxcsr 0x40(%rdi) /* save SSE2 control and status word */
- fnstcw 0x44(%rdi) /* save x87 control word */
+ stmxcsr 0x58(%rdi) /* save MMX control and status word */
+ fnstcw 0x5c(%rdi) /* save x87 control word */
     leaq link_fcontext(%rip), %rcx /* helper code executed after context function returns */
     movq %rcx, (%rdx)
     xorq %rax, %rax /* set RAX to zero */


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