Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84199 - in branches/release/libs/context: . src/asm
From: oliver.kowalke_at_[hidden]
Date: 2013-05-09 01:40:44


Author: olli
Date: 2013-05-09 01:40:43 EDT (Thu, 09 May 2013)
New Revision: 84199
URL: http://svn.boost.org/trac/boost/changeset/84199

Log:
context: merge from trunk

Properties modified:
   branches/release/libs/context/ (props changed)
Text files modified:
   branches/release/libs/context/src/asm/jump_i386_ms_pe_masm.asm | 103 ++++++++++++++++++++++-----------------
   branches/release/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm | 57 +++++++++++++--------
   branches/release/libs/context/src/asm/make_i386_ms_pe_masm.asm | 10 +++
   branches/release/libs/context/src/asm/make_ppc32_sysv_elf_gas.S | 2
   branches/release/libs/context/src/asm/make_ppc64_sysv_elf_gas.S | 7 +-
   branches/release/libs/context/src/asm/make_x86_64_ms_pe_masm.asm | 14 ++++-
   6 files changed, 116 insertions(+), 77 deletions(-)

Modified: branches/release/libs/context/src/asm/jump_i386_ms_pe_masm.asm
==============================================================================
--- branches/release/libs/context/src/asm/jump_i386_ms_pe_masm.asm (original)
+++ branches/release/libs/context/src/asm/jump_i386_ms_pe_masm.asm 2013-05-09 01:40:43 EDT (Thu, 09 May 2013)
@@ -39,6 +39,13 @@
 ; --------------------------------------------------------------
 ; | fc_mxcsr|fc_x87_cw| |
 ; --------------------------------------------------------------
+; --------------------------------------------------------------
+; | 13 | |
+; --------------------------------------------------------------
+; | 034h | |
+; --------------------------------------------------------------
+; |fc_deallo| |
+; --------------------------------------------------------------
 
 .386
 .XMM
@@ -46,62 +53,66 @@
 .code
 
 jump_fcontext PROC EXPORT
- mov ecx, [esp+04h] ; load address of the first fcontext_t arg
- mov [ecx], edi ; save EDI
- mov [ecx+04h], esi ; save ESI
- mov [ecx+08h], ebx ; save EBX
- mov [ecx+0ch], ebp ; save EBP
+ mov ecx, [esp+04h] ; load address of the first fcontext_t arg
+ mov [ecx], edi ; save EDI
+ mov [ecx+04h], esi ; save ESI
+ mov [ecx+08h], ebx ; save EBX
+ mov [ecx+0ch], ebp ; save EBP
 
     assume fs:nothing
- mov edx, fs:[018h] ; load NT_TIB
+ mov edx, fs:[018h] ; load NT_TIB
     assume fs:error
- mov eax, [edx] ; load current SEH exception list
- mov [ecx+024h], eax ; save current exception list
- mov eax, [edx+04h] ; load current stack base
- mov [ecx+018h], eax ; save current stack base
- mov eax, [edx+08h] ; load current stack limit
- mov [ecx+020h], eax ; save current stack limit
- mov eax, [edx+010h] ; load fiber local storage
- 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
-
- mov edx, [esp+08h] ; load address of the second fcontext_t arg
- mov edi, [edx] ; restore EDI
- mov esi, [edx+04h] ; restore ESI
- mov ebx, [edx+08h] ; restore EBX
- mov ebp, [edx+0ch] ; restore EBP
+ mov eax, [edx] ; load current SEH exception list
+ mov [ecx+024h], eax ; save current exception list
+ mov eax, [edx+04h] ; load current stack base
+ mov [ecx+018h], eax ; save current stack base
+ mov eax, [edx+08h] ; load current stack limit
+ mov [ecx+020h], eax ; save current stack limit
+ mov eax, [edx+0e0ch] ; load current deallocation stack
+ mov [ecx+034h], eax ; save current deallocation stack
+ mov eax, [edx+010h] ; load fiber local storage
+ 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
+
+ mov edx, [esp+08h] ; load address of the second fcontext_t arg
+ mov edi, [edx] ; restore EDI
+ mov esi, [edx+04h] ; restore ESI
+ mov ebx, [edx+08h] ; restore EBX
+ mov ebp, [edx+0ch] ; restore EBP
 
- mov eax, [esp+010h] ; check if fpu enve preserving was requested
+ mov eax, [esp+010h] ; check if fpu enve preserving was requested
     test eax, eax
     je nxt
 
- stmxcsr [ecx+02ch] ; save MMX control word
- fnstcw [ecx+030h] ; save x87 control word
- ldmxcsr [edx+02ch] ; restore MMX control word
- fldcw [edx+030h] ; restore x87 control word
+ stmxcsr [ecx+02ch] ; save MMX control word
+ fnstcw [ecx+030h] ; save x87 control word
+ ldmxcsr [edx+02ch] ; restore MMX control word
+ fldcw [edx+030h] ; restore x87 control word
 nxt:
- mov ecx, edx
+ mov ecx, edx
     assume fs:nothing
- mov edx, fs:[018h] ; load NT_TIB
+ mov edx, fs:[018h] ; load NT_TIB
     assume fs:error
- mov eax, [ecx+024h] ; load SEH exception list
- mov [edx], eax ; restore next SEH item
- mov eax, [ecx+018h] ; load stack base
- mov [edx+04h], eax ; restore stack base
- mov eax, [ecx+020h] ; load stack limit
- mov [edx+08h], eax ; restore stack limit
- mov eax, [ecx+028h] ; load fiber local storage
- mov [edx+010h], eax ; restore fiber local storage
-
- mov eax, [esp+0ch] ; use third arg as return value after jump
-
- mov esp, [ecx+010h] ; restore ESP
- mov [esp+04h], eax ; use third arg as first arg in context function
- mov ecx, [ecx+014h] ; fetch the address to return to
+ mov eax, [ecx+024h] ; load SEH exception list
+ mov [edx], eax ; restore next SEH item
+ mov eax, [ecx+018h] ; load stack base
+ mov [edx+04h], eax ; restore stack base
+ mov eax, [ecx+020h] ; load stack limit
+ mov [edx+08h], eax ; restore stack limit
+ mov eax, [ecx+034h] ; load deallocation stack
+ mov [edx+0e0ch], eax ; restore deallocation stack
+ mov eax, [ecx+028h] ; load fiber local storage
+ mov [edx+010h], eax ; restore fiber local storage
+
+ mov eax, [esp+0ch] ; use third arg as return value after jump
+
+ mov esp, [ecx+010h] ; restore ESP
+ mov [esp+04h], eax ; use third arg as first arg in context function
+ mov ecx, [ecx+014h] ; fetch the address to return to
 
     jmp ecx ; indirect jump to context
 jump_fcontext ENDP

Modified: branches/release/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm
==============================================================================
--- branches/release/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm (original)
+++ branches/release/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm 2013-05-09 01:40:43 EDT (Thu, 09 May 2013)
@@ -81,6 +81,13 @@
 ; ----------------------------------------------------------------------------------
 ; | SEE registers (XMM6-XMM15) |
 ; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 76 | 77 | |
+; ----------------------------------------------------------------------------------
+; | 0x130 | 0x134 | |
+; ----------------------------------------------------------------------------------
+; | fc_dealloc | |
+; ----------------------------------------------------------------------------------
 
 EXTERN _exit:PROC ; standard C library function
 .code
@@ -88,22 +95,24 @@
 jump_fcontext PROC EXPORT FRAME
     .endprolog
 
- mov [rcx], r12 ; save R12
- mov [rcx+08h], r13 ; save R13
- mov [rcx+010h], r14 ; save R14
- mov [rcx+018h], r15 ; save R15
- mov [rcx+020h], rdi ; save RDI
- mov [rcx+028h], rsi ; save RSI
- mov [rcx+030h], rbx ; save RBX
- mov [rcx+038h], rbp ; save RBP
-
- mov r10, gs:[030h] ; load NT_TIB
- mov rax, [r10+08h] ; load current stack base
- mov [rcx+050h], rax ; save current stack base
- mov rax, [r10+010h] ; load current stack limit
- mov [rcx+060h], rax ; save current stack limit
- mov rax, [r10+018h] ; load fiber local storage
- mov [rcx+068h], rax ; save fiber local storage
+ mov [rcx], r12 ; save R12
+ mov [rcx+08h], r13 ; save R13
+ mov [rcx+010h], r14 ; save R14
+ mov [rcx+018h], r15 ; save R15
+ mov [rcx+020h], rdi ; save RDI
+ mov [rcx+028h], rsi ; save RSI
+ mov [rcx+030h], rbx ; save RBX
+ mov [rcx+038h], rbp ; save RBP
+
+ mov r10, gs:[030h] ; load NT_TIB
+ mov rax, [r10+08h] ; load current stack base
+ mov [rcx+050h], rax ; save current stack base
+ mov rax, [r10+010h] ; load current stack limit
+ mov [rcx+060h], rax ; save current stack limit
+ mov rax, [r10+01478h] ; load current deallocation stack
+ mov [rcx+0130h], rax ; save current deallocation stack
+ mov rax, [r10+018h] ; load fiber local storage
+ mov [rcx+068h], rax ; save fiber local storage
 
     test r9, r9
     je nxt
@@ -163,13 +172,15 @@
     mov rbx, [rdx+030h] ; restore RBX
     mov rbp, [rdx+038h] ; restore RBP
 
- mov r10, gs:[030h] ; load NT_TIB
- mov rax, [rdx+050h] ; load stack base
- mov [r10+08h], rax ; restore stack base
- mov rax, [rdx+060h] ; load stack limit
- mov [r10+010h], rax ; restore stack limit
- mov rax, [rdx+068h] ; load fiber local storage
- mov [r10+018h], rax ; restore fiber local storage
+ mov r10, gs:[030h] ; load NT_TIB
+ mov rax, [rdx+050h] ; load stack base
+ mov [r10+08h], rax ; restore stack base
+ mov rax, [rdx+060h] ; load stack limit
+ mov [r10+010h], rax ; restore stack limit
+ mov rax, [rdx+0130h] ; load deallocation stack
+ mov [r10+01478h], rax ; restore deallocation stack
+ mov rax, [rdx+068h] ; load fiber local storage
+ mov [r10+018h], rax ; restore fiber local storage
 
     mov rsp, [rdx+040h] ; restore RSP
     mov r10, [rdx+048h] ; fetch the address to returned to

Modified: branches/release/libs/context/src/asm/make_i386_ms_pe_masm.asm
==============================================================================
--- branches/release/libs/context/src/asm/make_i386_ms_pe_masm.asm (original)
+++ branches/release/libs/context/src/asm/make_i386_ms_pe_masm.asm 2013-05-09 01:40:43 EDT (Thu, 09 May 2013)
@@ -39,6 +39,13 @@
 ; --------------------------------------------------------------
 ; | fc_mxcsr|fc_x87_cw| |
 ; --------------------------------------------------------------
+; --------------------------------------------------------------
+; | 13 | |
+; --------------------------------------------------------------
+; | 034h | |
+; --------------------------------------------------------------
+; |fc_deallo| |
+; --------------------------------------------------------------
 
 .386
 .XMM
@@ -48,7 +55,7 @@
 
 make_fcontext PROC EXPORT
     mov eax, [esp+04h] ; load 1. arg of make_fcontext, pointer to context stack (base)
- lea eax, [eax-034h] ; reserve space for fcontext_t at top of context stack
+ lea eax, [eax-038h] ; reserve space for fcontext_t at top of context stack
 
     ; shift address in EAX to lower 16 byte boundary
     ; == pointer to fcontext_t and address of context stack
@@ -61,6 +68,7 @@
     neg edx ; negate stack size for LEA instruction (== substraction)
     lea ecx, [ecx+edx] ; compute bottom address of context stack (limit)
     mov [eax+020h], ecx ; save address of context stack (limit) in fcontext_t
+ mov [eax+034h], ecx ; save address of context stack limit as 'dealloction stack'
     mov ecx, [esp+0ch] ; load 3. arg of make_fcontext, pointer to context function
     mov [eax+014h], ecx ; save address of context function in fcontext_t
 

Modified: branches/release/libs/context/src/asm/make_ppc32_sysv_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/make_ppc32_sysv_elf_gas.S (original)
+++ branches/release/libs/context/src/asm/make_ppc32_sysv_elf_gas.S 2013-05-09 01:40:43 EDT (Thu, 09 May 2013)
@@ -78,7 +78,7 @@
 
     # call align_stack, R3 contains address at 16 byte boundary after return
     # == pointer to fcontext_t and address of context stack
- rlwinm %r3, %r3, 0, 0, 27
+ clrrwi %r3, %r3, 4
 
     stw %r0, 92(%r3) # save address of context stack (base) in fcontext_t
     stw %r4, 96(%r3) # save context stack size in fcontext_t

Modified: branches/release/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
==============================================================================
--- branches/release/libs/context/src/asm/make_ppc64_sysv_elf_gas.S (original)
+++ branches/release/libs/context/src/asm/make_ppc64_sysv_elf_gas.S 2013-05-09 01:40:43 EDT (Thu, 09 May 2013)
@@ -99,13 +99,13 @@
 
     # call align_stack, R3 contains address at 16 byte boundary after return
     # == pointer to fcontext_t and address of context stack
- rlwinm %r3, %r3, 0, 0, 59
+ clrrdi %r3, %r3, 4
 
     std %r0, 184(%r3) # save address of context stack (base) in fcontext_t
     std %r4, 192(%r3) # save context stack size in fcontext_t
     std %r5, 176(%r3) # save address of context function in fcontext_t
 
- subf %r0, %r3, 64 # 64 bytes on stack for parameter area (== 8 registers)
+ subi %r0, %r3, 64 # 64 bytes on stack for parameter area (== 8 registers)
     std %r0, 152(%r3) # save the stack base
 
     mflr %r0 # load LR
@@ -128,5 +128,6 @@
     stwu %r1, -32(%r1) # allocate stack space, SP % 16 == 0
 
     li %r3, 0 # set return value to zero
- bl _exit_at_plt # exit application
+ bl _exit # exit application
+ nop
 .size .make_fcontext, .-.make_fcontext

Modified: branches/release/libs/context/src/asm/make_x86_64_ms_pe_masm.asm
==============================================================================
--- branches/release/libs/context/src/asm/make_x86_64_ms_pe_masm.asm (original)
+++ branches/release/libs/context/src/asm/make_x86_64_ms_pe_masm.asm 2013-05-09 01:40:43 EDT (Thu, 09 May 2013)
@@ -81,6 +81,13 @@
 ; ----------------------------------------------------------------------------------
 ; | SEE registers (XMM6-XMM15) |
 ; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 76 | 77 | |
+; ----------------------------------------------------------------------------------
+; | 0x130 | 0x134 | |
+; ----------------------------------------------------------------------------------
+; | fc_dealloc | |
+; ----------------------------------------------------------------------------------
 
 EXTERN _exit:PROC ; standard C library function
 .code
@@ -88,7 +95,7 @@
 make_fcontext PROC EXPORT FRAME ; generate function table entry in .pdata and unwind information in
     .endprolog ; .xdata for a function's structured exception handling unwind behavior
 
- lea rax, [rcx-0130h] ; reserve space for fcontext_t at top of context stack
+ lea rax, [rcx-0138h] ; reserve space for fcontext_t at top of context stack
 
     ; shift address in RAX to lower 16 byte boundary
     ; == pointer to fcontext_t and address of context stack
@@ -99,8 +106,9 @@
     mov [rax+050h], rcx ; save address of context stack pointer (base) in fcontext_t
 
     neg rdx ; negate stack size for LEA instruction (== substraction)
- lea rcx, [rcx+rdx] ; compute bottom address of context stack (limit)
- mov [rax+060h], rcx ; save bottom address of context stack (limit) in fcontext_t
+ lea rcx, [rcx+rdx] ; compute bottom address of context stack (limit)
+ mov [rax+060h], rcx ; save bottom address of context stack (limit) in fcontext_t
+ mov [rax+0130h], rcx ; save address of context stack limit as 'dealloction stack'
 
     stmxcsr [rax+070h] ; save MMX control and status word
     fnstcw [rax+074h] ; save x87 control word


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