diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-06-08 05:28:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-06-08 05:28:14 +0000 |
commit | 7726edc27354afe163f492c0e6a8d4354fddb494 (patch) | |
tree | 22a712872298767abf2b081d9f766a33cad8fa20 /nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S | |
parent | ede0f73aeabe62589f6ca19a6987f48aa0d06184 (diff) | |
download | glibc-7726edc27354afe163f492c0e6a8d4354fddb494.tar.gz glibc-7726edc27354afe163f492c0e6a8d4354fddb494.tar.xz glibc-7726edc27354afe163f492c0e6a8d4354fddb494.zip |
Update.
2003-06-07 Ulrich Drepper <drepper@redhat.com> * cleanup_routine.c: New file. * Versions (libpthread) [GLIBC_2.3.3]: Add __pthread_cleanup_routine. * sysdeps/pthread/pthread.h: Add support for fully exception-based cleanup handling. * Makefile (libpthread-routines): Add cleanup_routine. Add more CFLAGS variables to compile with exceptions. Add comments why which file needs unwind tables. (tests) [have-forced-unwind==yes]: Add tst-cancelx* and tst-cleanupx* tests. * tst-cancelx1.c: New file. * tst-cancelx2.c: New file. * tst-cancelx3.c: New file. * tst-cancelx4.c: New file. * tst-cancelx5.c: New file. * tst-cancelx6.c: New file. * tst-cancelx7.c: New file. * tst-cancelx8.c: New file. * tst-cancelx9.c: New file. * tst-cancelx10.c: New file. * tst-cancelx11.c: New file. * tst-cancelx12.c: New file. * tst-cancelx13.c: New file. * tst-cancelx14.c: New file. * tst-cancelx15.c: New file. * tst-cleanupx0.c: New file. * tst-cleanupx0.expect: New file. * tst-cleanupx1.c: New file. * tst-cleanupx2.c: New file. * tst-cleanupx3.c: New file. * tst-cleanup0.c: Make standard compliant. * tst-cleanup1.c: Likewise. * sysdeps/unix/sysv/linux/sem_timedwait.c: Add cancellation support. * sysdeps/unix/sysv/linux/sem_wait.c: Likewise. * sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i486/sem_wait.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Likewise. * sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Likewise. * sysdeps/i386/tcb-offsets.sym: Add RESULT, CANCELHANDLING, and CLEANUP_JMP_BUF. * sysdeps/x86_64/tcb-offsets.sym: Likewise. * tst-cancel12.c: New file. * tst-cancel13.c: New file. * tst-cancel14.c: New file. * tst-cancel15.c: New file. * Makefile (tests): Add tst-cancel12, tst-cancel13, tst-cancel14, and tst-cancel15. * tst-cancel1.c: Add some comments. * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S: Compute relative timeout correctly.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/i486/sem_timedwait.S | 78 |
1 files changed, 63 insertions, 15 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 |