From 7726edc27354afe163f492c0e6a8d4354fddb494 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 8 Jun 2003 05:28:14 +0000 Subject: Update. 2003-06-07 Ulrich Drepper * 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. --- nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S | 62 ++++++++++++++++++----- 1 file changed, 50 insertions(+), 12 deletions(-) (limited to 'nptl/sysdeps/unix/sysv/linux/i386/i486/sem_wait.S') 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) -- cgit v1.2.3