Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77448 - trunk/libs/context/src/asm
From: oliver.kowalke_at_[hidden]
Date: 2012-03-21 03:47:07


Author: olli
Date: 2012-03-21 03:47:04 EDT (Wed, 21 Mar 2012)
New Revision: 77448
URL: http://svn.boost.org/trac/boost/changeset/77448

Log:
context: remove differentiation between PIC and non-PIC in assembler

Text files modified:
   trunk/libs/context/src/asm/fcontext_arm_aapcs_elf_gas.S | 11 -----------
   trunk/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S | 20 +-------------------
   trunk/libs/context/src/asm/fcontext_mips32_o32_elf_gas.S | 12 ------------
   trunk/libs/context/src/asm/fcontext_ppc32_sysv_elf_gas.S | 17 -----------------
   trunk/libs/context/src/asm/fcontext_ppc64_sysv_elf_gas.S | 17 -----------------
   trunk/libs/context/src/asm/fcontext_x86_64_sysv_macho_gas.S | 15 ++++++++-------
   6 files changed, 9 insertions(+), 83 deletions(-)

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-03-21 03:47:04 EDT (Wed, 21 Mar 2012)
@@ -106,11 +106,7 @@
 
         push {a1,lr} @ save pointer to fcontext_t
         mov a1, a2 @ stack pointer as arg for boost_fcontext_align
-#ifdef __PIC__
         bl boost_fcontext_align_at_PLT @ align stack
-#else
- bl boost_fcontext_align @ align stack
-#endif
         mov a2, a1 @ begin of aligned stack
         pop {a1,lr} @ restore pointer to boost_fcontext_t
 
@@ -127,15 +123,8 @@
     mov a2, v2 @ load the adddress of the next context
     teq a2, #0 @ test if the address of the next context is a null pointer
 
-#ifdef __PIC__
     bne boost_fcontext_start_at_PLT @ install next context
 
     mov a1, #0
     bl _exit_at_PLT @ exit application
-#else
- bne boost_fcontext_start @ install next context
-
- mov a1, #0
- bl _exit @ exit application
-#endif
 .size boost_fcontext_make,.-boost_fcontext_make

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-03-21 03:47:04 EDT (Wed, 21 Mar 2012)
@@ -89,14 +89,10 @@
     pushl %eax /* save pointer to fcontext_t */
     pushl %ebx /* save EBX */
     pushl %edx /* stack pointer as arg for boost_fcontext_align */
-#ifdef __PIC__
     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 boost_fcontext_align_at_PLT /* align stack */
-#else
- call boost_fcontext_align /* align stack */
-#endif
     movl %eax, %edx /* begin of aligned stack */
     popl %eax /* remove arg for boost_fcontext_align */
     popl %ebx /* restore EBX */
@@ -110,14 +106,10 @@
     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 */
-#ifdef __PIC__
     call 2f
 2: popl %ecx /* address of label 1 */
     addl $link_fcontext-2b, %ecx /* compute address of label link_fcontext */
     movl %ecx, (%edx) /* store address of link_fcontext as return address on stack */
-#else
- movl $link_fcontext, (%edx) /* store address of link_fcontext as return address on stack */
-#endif
 
     xorl %eax, %eax /* set EAX to zero */
     ret
@@ -125,30 +117,20 @@
 link_fcontext:
     leal -0xc(%esp), %esp
 
-#ifdef __PIC__
     call 3f
-3: popl %ebx /* address of label 2 */
+3: popl %ebx /* address of label 3 */
     addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx /* compute address of GOT and store it in EBX */
-#endif
 
     testl %esi, %esi /* test if a next context was given */
     je 4f /* jump to finish */
 
     pushl %esi /* push the address of the next context on the stack */
     pushl %edi /* push the address of the current context to stack */
-#ifdef __PIC__
     call boost_fcontext_start_at_PLT /* jump to next context */
-#else
- call boost_fcontext_start /* jump to next context */
-#endif
 
 4:
     movl %eax, %eax
     pushl %eax /* exit code is zero */
-#ifdef __PIC__
     call _exit_at_PLT /* exit application */
-#else
- call _exit /* exit application */
-#endif
     hlt
 .size boost_fcontext_make,.-boost_fcontext_make

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-03-21 03:47:04 EDT (Wed, 21 Mar 2012)
@@ -126,12 +126,8 @@
     sw $ra, 24($sp)
     sw $a0, 20($sp)
     move $a0, $t0 # stack pointer as arg for boost_fcontext_align
-#ifdef __PIC__
     lw $t9, %call16(boost_fcontext_align)($gp) # align stack
     jalr $t9
-#else
- jal boost_fcontext_align # align stack
-#endif
     nop
     move $t0, $v0 # begin of aligned stack
     lw $ra, 24($sp)
@@ -154,20 +150,12 @@
     beqz $a1, 2f # test if a next context was given
 
     move $a0, $s0 # set A0 to address of current context
-#ifdef __PIC__
     lw $t9, %call16(boost_fcontext_start)($gp) # install next context
     jr $t9
-#else
- j boost_fcontext_start # install next context
-#endif
 
 2:
     move $a0, $zero
-#ifdef __PIC__
     lw $t9, %call16(_exit)($gp) # exit application
     jalr $t9
-#else
- j _exit # exit application
-#endif
 .end boost_fcontext_make
 .size boost_fcontext_make, .-boost_fcontext_make

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-03-21 03:47:04 EDT (Wed, 21 Mar 2012)
@@ -306,11 +306,7 @@
     mflr %r4 # load LR
     stw %r4, 20(%r1) # store LR on stack
     mr. %r3, %r0 # context stack as arg to boost_fcontext_algin
-#ifdef __PIC__
     bl boost_fcontext_align_at_plt # call boost_fcontext_align
-#else
- bl boost_fcontext_align # call boost_fcontext_align
-#endif
     mr. %r0, %r3 # load result into R0
     lwz %r4, 20(%r1) # pop LR from stack
     mtlr %r4 # restore LR
@@ -322,17 +318,12 @@
     stw %r0, 76(%r3) # save the stack base
     lwz %r0, 256(%r3) # load address of next user context
     stw %r0, 4(%r3) # save the next context
-#ifdef __PIC__
     mflr %r0 # load LR
     bl 1f # jump to label 1
 1:
     mflr %r4 # load LR
     addi %r4, %r4, link_fcontext - 1b # calulate absolute address of link_fcontext
     mtlr %r0 # restore LR
-#else
- lis %r4, link_fcontext_at_ha # get hight address of link_fcontext
- addi %r4, %r4, link_fcontext_at_l # get low address of link_fcontext
-#endif
     stw %r4, 84(%r3) # save address of link_fcontext
 
     li %r3, 0 # set return value to zero
@@ -343,17 +334,9 @@
     mr. %r4, %r14
     beq 2f # test if a next context was given
 
-#ifdef __PIC__
     bl boost_fcontext_start_at_plt # install next context
 
 2:
     li %r3, 0 # set return value to zero
     bl _exit_at_plt # exit application
-#else
- bl boost_fcontext_start # install next context
-
-2:
- li %r3, 0 # set return value to zero
- bl _exit # exit application
-#endif
 .size boost_fcontext_make, .-boost_fcontext_make

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-03-21 03:47:04 EDT (Wed, 21 Mar 2012)
@@ -320,11 +320,7 @@
     mflr %r4 # load LR
     stw %r4, 40(%r1) # store LR on stack
     mr. %r3, %r0 # context stack as arg to boost_fcontext_algin
-#ifdef __PIC__
     bl boost_fcontext_align_at_plt # call boost_fcontext_align
-#else
- bl boost_fcontext_align # call boost_fcontext_align
-#endif
     mr. %r0, %r3 # load result into R0
     lwz %r4, 40(%r1) # pop LR from stack
     mtlr %r4 # restore LR
@@ -336,17 +332,12 @@
     std %r0, 152(%r3) # save the stack base
     ld %r0, 360(%r3) # load address of next user context
     std %r0, 8(%r3) # save the next context
-#ifdef __PIC__
     mflr %r0 # load LR
     bl 1f # jump to label 1
 1:
     mflr %r4 # load LR
     addi %r4, %r4, link_fcontext - 1b # calulate absolute address of link_fcontext
     mtlr %r0 # restore LR
-#else
- lis %r4, link_fcontext_at_ha # get hight address of link_fcontext
- addi %r4, %r4, link_fcontext_at_l # get low address of link_fcontext
-#endif
     std %r4, 168(%r3) # save address of link_fcontext
 
     li %r3, 0 # set return value to zero
@@ -357,17 +348,9 @@
     mr. %r4, %r14
     beq 2f # test if a next context was given
 
-#ifdef __PIC__
     bl boost_fcontext_start_at_plt # install next context
 
 2:
     li %r3, 0 # set return value to zero
     bl _exit_at_plt # exit application
-#else
- bl boost_fcontext_start # install next context
-
-2:
- li %r3, 0 # set return value to zero
- bl _exit # exit application
-#endif
 .size boost_fcontext_make, .-boost_fcontext_make

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-03-21 03:47:04 EDT (Wed, 21 Mar 2012)
@@ -68,18 +68,18 @@
     movq (%rsi), %rbx /* restore RBX */
     movq 0x8(%rsi), %r12 /* restore R12 */
     movq 0x10(%rsi), %r13 /* restore R13 */
- movq 0x18(%rsi), %r15 /* restore R14 */
+ movq 0x18(%rsi), %r14 /* restore R14 */
     movq 0x20(%rsi), %r15 /* restore R15 */
     movq 0x28(%rsi), %rbp /* restore RBP */
 
- ldmxcsr 0x41(%rsi) /* restore SSE2 control and status word */
+ ldmxcsr 0x40(%rsi) /* restore SSE2 control and status word */
     fldcw 0x44(%rsi) /* restore x87 control word */
 
     movq %rdx, %rax /* use third arg as return value after jump */
 
     movq 0x30(%rsi), %rsp /* restore RSP */
     movq 0x38(%rsi), %rcx /* fetch the address to return to */
- movq %r13, %rdi /* restore RDI */
+ movq %r13, %rdi /* restore void pointer as argument */
 
     jmp *%rcx /* indirect jump to context */
 
@@ -103,8 +103,8 @@
     movq 0x58(%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 */
- leaq link_fcontext(%rip), %rcx /* helper code executed after fn() returns */
+ fnstcw 0x44(%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 */
     ret
@@ -115,8 +115,9 @@
     je 1f /* jump to finish */
 
     movq %rbx, %rdi /* restore current context */
- call _boost_fcontext_start /* install next context */
+ call boost_fcontext_start_at_PLT /* jump to next context */
 
 1:
     xorq %rdi, %rdi /* exit code is zero */
- call _exit /* exit application */
+ call _exit_at_PLT /* exit application */
+ hlt


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