diff options
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/i386')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S | 78 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S | 62 |
2 files changed, 113 insertions, 27 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S index aa3d74593d..9afe85f205 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S @@ -37,7 +37,14 @@ .globl sem_timedwait .type sem_timedwait,@function .align 16 + cfi_startproc sem_timedwait: + /* First check for cancellation. */ + movl %gs:CANCELHANDLING, %eax + andl $0xfffffff9, %eax + cmpl $8, %eax + je 10f + movl 4(%esp), %ecx movl (%ecx), %eax @@ -54,19 +61,28 @@ sem_timedwait: /* Check whether the timeout value is valid. */ 1: pushl %esi + cfi_adjust_cfa_offset(4) pushl %edi + cfi_adjust_cfa_offset(4) pushl %ebx - subl $8, %esp + cfi_adjust_cfa_offset(4) + subl $12, %esp + cfi_adjust_cfa_offset(12) - movl %esp, %esi - movl 28(%esp), %edi + movl 32(%esp), %edi + cfi_offset(7, -12) /* %edi */ /* Check for invalid nanosecond field. */ cmpl $1000000000, 4(%edi) - movl $EINVAL, %eax + movl $EINVAL, %esi + cfi_offset(6, -8) /* %esi */ jae 6f -7: xorl %ecx, %ecx + cfi_offset(3, -16) /* %ebx */ +7: call __pthread_enable_asynccancel + movl %eax, 8(%esp) + + xorl %ecx, %ecx movl %esp, %ebx movl %ecx, %edx movl $SYS_gettimeofday, %eax @@ -84,20 +100,25 @@ sem_timedwait: addl $1000000000, %edx subl $1, %ecx 5: testl %ecx, %ecx - movl $ETIMEDOUT, %eax + movl $ETIMEDOUT, %esi js 6f /* Time is already up. */ movl %ecx, (%esp) /* Store relative timeout. */ movl %edx, 4(%esp) - movl 24(%esp), %ebx + movl 28(%esp), %ebx xorl %ecx, %ecx + movl %esp, %esi movl $SYS_futex, %eax xorl %edx, %edx ENTER_KERNEL + movl %eax, %esi + + movl 8(%esp), %eax + call __pthread_disable_asynccancel - testl %eax, %eax + testl %esi, %esi je,pt 9f - cmpl $-EWOULDBLOCK, %eax + cmpl $-EWOULDBLOCK, %esi jne 3f 9: movl (%ebx), %eax @@ -109,14 +130,27 @@ sem_timedwait: cmpxchgl %ecx, (%ebx) jne,pn 8b - addl $8, %esp + addl $12, %esp + cfi_adjust_cfa_offset(-12) xorl %eax, %eax popl %ebx + cfi_adjust_cfa_offset(-4) + cfi_restore(3) popl %edi + cfi_adjust_cfa_offset(-4) + cfi_restore(7) popl %esi + cfi_adjust_cfa_offset(-4) + cfi_restore(6) + cfi_adjust_cfa_offset(-4) + cfi_restore(6) ret -3: negl %eax + cfi_adjust_cfa_offset(24) + cfi_offset(6, -8) /* %esi */ + cfi_offset(7, -12) /* %edi */ + cfi_offset(3, -16) /* %ebx */ +3: negl %esi 6: #ifdef PIC call __i686.get_pc_thunk.bx @@ -128,17 +162,31 @@ sem_timedwait: #if USE___THREAD movl %gs:0, %edx subl errno@gottpoff(%ebx), %edx - movl %eax, (%edx) + movl %esi, (%edx) #else - movl %eax, %edx call __errno_location@plt - movl %edx, (%eax) + movl %esi, (%eax) #endif - addl $8, %esp + addl $12, %esp + cfi_adjust_cfa_offset(-12) orl $-1, %eax popl %ebx + cfi_adjust_cfa_offset(-4) + cfi_restore(3) popl %edi + cfi_adjust_cfa_offset(-4) + cfi_restore(7) popl %esi + cfi_adjust_cfa_offset(-4) + cfi_restore(6) ret + +10: /* Canceled. */ + movl $0xffffffff, %gs:RESULT + LOCK + orl $0x10, %gs:CANCELHANDLING + movl %gs:CLEANUP_JMP_BUF, %eax + jmp __pthread_unwind + cfi_endproc .size sem_timedwait,.-sem_timedwait diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S index eb01ca84f7..ba4f54cd64 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S @@ -36,12 +36,25 @@ .globl __new_sem_wait .type __new_sem_wait,@function .align 16 + cfi_startproc __new_sem_wait: + /* First check for cancellation. */ + movl %gs:CANCELHANDLING, %eax + andl $0xfffffff9, %eax + cmpl $8, %eax + je 5f + pushl %ebx + cfi_adjust_cfa_offset(4) pushl %esi + cfi_adjust_cfa_offset(4) + subl $4, %esp + cfi_adjust_cfa_offset(4) - movl 12(%esp), %ebx + movl 16(%esp), %ebx + cfi_offset(3, -8) /* %ebx */ + cfi_offset(6, -12) /* %esi */ 3: movl (%ebx), %eax 2: testl %eax, %eax je,pn 1f @@ -52,21 +65,35 @@ __new_sem_wait: jne,pn 2b xorl %eax, %eax - popl %esi - popl %ebx + movl 4(%esp), %esi + cfi_restore(6) + movl 8(%esp), %ebx + cfi_restore(3) + addl $12, %esp + cfi_adjust_cfa_offset(-12) ret -1: xorl %esi, %esi + cfi_adjust_cfa_offset(8) + cfi_offset(3, -8) /* %ebx */ + cfi_offset(6, -12) /* %esi */ +1: call __pthread_enable_asynccancel + movl %eax, (%esp) + + xorl %esi, %esi movl $SYS_futex, %eax movl %esi, %ecx movl %esi, %edx ENTER_KERNEL + movl %eax, %esi + + movl (%esp), %eax + call __pthread_disable_asynccancel - testl %eax, %eax + testl %esi, %esi je 3b - cmpl $-EWOULDBLOCK, %eax + cmpl $-EWOULDBLOCK, %esi je 3b - negl %eax + negl %esi #ifdef PIC call __i686.get_pc_thunk.bx #else @@ -77,16 +104,27 @@ __new_sem_wait: #if USE___THREAD movl %gs:0, %edx subl errno@gottpoff(%ebx), %edx - movl %eax, (%edx) + movl %esi, (%edx) #else - movl %eax, %edx call __errno_location@plt - movl %edx, (%eax) + movl %esi, (%eax) #endif orl $-1, %eax - popl %esi - popl %ebx + movl 4(%esp), %esi + cfi_restore(6) + movl 8(%esp), %ebx + cfi_restore(3) + addl $12, %esp + cfi_adjust_cfa_offset(-12) ret + +5: /* Canceled. */ + movl $0xffffffff, %gs:RESULT + LOCK + orl $0x10, %gs:CANCELHANDLING + movl %gs:CLEANUP_JMP_BUF, %eax + jmp __pthread_unwind + cfi_endproc .size __new_sem_wait,.-__new_sem_wait versioned_symbol(libpthread, __new_sem_wait, sem_wait, GLIBC_2_1) #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1) |