summaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S156
1 files changed, 131 insertions, 25 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index 68741bffe8..5b301979b5 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -22,6 +22,7 @@
#include <lowlevellock.h>
#include <lowlevelcond.h>
#include <tcb-offsets.h>
+#include <kernel-features.h>
.text
@@ -100,7 +101,20 @@ __pthread_cond_wait:
4: call __pthread_enable_asynccancel
movl %eax, (%esp)
- movl %esi, %ecx /* movl $FUTEX_WAIT, %ecx */
+#if FUTEX_PRIVATE_FLAG > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ sete %cl
+ subl $1, %ecx
+#ifdef __ASSUME_PRIVATE_FUTEX
+ andl $FUTEX_PRIVATE_FLAG, %ecx
+#else
+ andl %gs:PRIVATE_FUTEX, %ecx
+#endif
+#if FUTEX_WAIT != 0
+ addl $FUTEX_WAIT, %ecx
+#endif
movl %edi, %edx
addl $cond_futex, %ebx
.Ladd_cond_futex:
@@ -161,7 +175,18 @@ __pthread_cond_wait:
addl $cond_nwaiters, %ebx
movl $SYS_futex, %eax
- movl $FUTEX_WAKE, %ecx
+#if FUTEX_PRIVATE_FLAG > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
+ sete %cl
+ subl $1, %ecx
+#ifdef __ASSUME_PRIVATE_FUTEX
+ andl $FUTEX_PRIVATE_FLAG, %ecx
+#else
+ andl %gs:PRIVATE_FUTEX, %ecx
+#endif
+ addl $FUTEX_WAKE, %ecx
movl $1, %edx
ENTER_KERNEL
subl $cond_nwaiters, %ebx
@@ -197,8 +222,16 @@ __pthread_cond_wait:
#else
leal cond_lock(%ebx), %edx
#endif
- /* XYZ */
- movl $LLL_SHARED, %ecx
+#if (LLL_SHARED-LLL_PRIVATE) > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ setne %cl
+ subl $1, %ecx
+ andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+#if LLL_PRIVATE != 0
+ addl $LLL_PRIVATE, %ecx
+#endif
call __lll_lock_wait
jmp 2b
@@ -210,8 +243,16 @@ __pthread_cond_wait:
#else
leal cond_lock(%ebx), %eax
#endif
- /* XYZ */
- movl $LLL_SHARED, %ecx
+#if (LLL_SHARED-LLL_PRIVATE) > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ setne %cl
+ subl $1, %ecx
+ andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+#if LLL_PRIVATE != 0
+ addl $LLL_PRIVATE, %ecx
+#endif
call __lll_unlock_wake
jmp 4b
@@ -222,8 +263,16 @@ __pthread_cond_wait:
#else
leal cond_lock(%ebx), %edx
#endif
- /* XYZ */
- movl $LLL_SHARED, %ecx
+#if (LLL_SHARED-LLL_PRIVATE) > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ setne %cl
+ subl $1, %ecx
+ andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+#if LLL_PRIVATE != 0
+ addl $LLL_PRIVATE, %ecx
+#endif
call __lll_lock_wait
jmp 6b
@@ -234,8 +283,16 @@ __pthread_cond_wait:
#else
leal cond_lock(%ebx), %eax
#endif
- /* XYZ */
- movl $LLL_SHARED, %ecx
+#if (LLL_SHARED-LLL_PRIVATE) > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ setne %cl
+ subl $1, %ecx
+ andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+#if LLL_PRIVATE != 0
+ addl $LLL_PRIVATE, %ecx
+#endif
call __lll_unlock_wake
jmp 11b
@@ -256,8 +313,16 @@ __pthread_cond_wait:
#else
leal cond_lock(%ebx), %eax
#endif
- /* XYZ */
- movl $LLL_SHARED, %ecx
+#if (LLL_SHARED-LLL_PRIVATE) > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ setne %cl
+ subl $1, %ecx
+ andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+#if LLL_PRIVATE != 0
+ addl $LLL_PRIVATE, %ecx
+#endif
call __lll_unlock_wake
movl %esi, %eax
@@ -292,8 +357,16 @@ __condvar_w_cleanup:
#else
leal cond_lock(%ebx), %edx
#endif
- /* XYZ */
- movl $LLL_SHARED, %ecx
+#if (LLL_SHARED-LLL_PRIVATE) > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ setne %cl
+ subl $1, %ecx
+ andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+#if LLL_PRIVATE != 0
+ addl $LLL_PRIVATE, %ecx
+#endif
call __lll_lock_wait
1: movl broadcast_seq(%ebx), %eax
@@ -332,7 +405,18 @@ __condvar_w_cleanup:
addl $cond_nwaiters, %ebx
movl $SYS_futex, %eax
- movl $FUTEX_WAKE, %ecx
+#if FUTEX_PRIVATE_FLAG > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex-cond_nwaiters(%ebx)
+ sete %cl
+ subl $1, %ecx
+#ifdef __ASSUME_PRIVATE_FUTEX
+ andl $FUTEX_PRIVATE_FLAG, %ecx
+#else
+ andl %gs:PRIVATE_FUTEX, %ecx
+#endif
+ addl $FUTEX_WAKE, %ecx
movl $1, %edx
ENTER_KERNEL
subl $cond_nwaiters, %ebx
@@ -351,15 +435,34 @@ __condvar_w_cleanup:
#else
leal cond_lock(%ebx), %eax
#endif
- /* XYZ */
- movl $LLL_SHARED, %ecx
+#if (LLL_SHARED-LLL_PRIVATE) > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex(%ebx)
+ setne %cl
+ subl $1, %ecx
+ andl $(LLL_SHARED-LLL_PRIVATE), %ecx
+#if LLL_PRIVATE != 0
+ addl $LLL_PRIVATE, %ecx
+#endif
call __lll_unlock_wake
/* Wake up all waiters to make sure no signal gets lost. */
2: testl %edi, %edi
jnz 5f
addl $cond_futex, %ebx
- movl $FUTEX_WAKE, %ecx
+#if FUTEX_PRIVATE_FLAG > 255
+ xorl %ecx, %ecx
+#endif
+ cmpl $-1, dep_mutex-cond_futex(%ebx)
+ sete %cl
+ subl $1, %ecx
+#ifdef __ASSUME_PRIVATE_FUTEX
+ andl $FUTEX_PRIVATE_FLAG, %ecx
+#else
+ andl %gs:PRIVATE_FUTEX, %ecx
+#endif
+ addl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
movl $0x7fffffff, %edx
ENTER_KERNEL
@@ -473,12 +576,12 @@ __condvar_w_cleanup:
.uleb128 16
.byte 0x83 # DW_CFA_offset %ebx
.uleb128 4
- .byte 2 # DW_CFA_advance_loc1
- .byte .Lsubl-.Lpush_ebx
+ .byte 4 # DW_CFA_advance_loc4
+ .4byte .Lsubl-.Lpush_ebx
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 16+FRAME_SIZE
- .byte 2 # DW_CFA_advance_loc1
- .byte .Laddl-.Lsubl
+ .byte 4 # DW_CFA_advance_loc4
+ .4byte .Laddl-.Lsubl
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 16
.byte 0x40+ .Lpop_ebx-.Laddl # DW_CFA_advance_loc+N
@@ -502,13 +605,16 @@ __condvar_w_cleanup:
.uleb128 3
.byte 0x83 # DW_CFA_offset %ebx
.uleb128 4
- .byte 0x40+.LSbl2-.LSbl1 # DW_CFA_advance_loc+N
+ .byte 4 # DW_CFA_advance_loc4
+ .4byte .LSbl2-.LSbl1
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 16+FRAME_SIZE
- .byte 0x40+.LSbl3-.LSbl2 # DW_CFA_advance_loc+N
+ .byte 4 # DW_CFA_advance_loc4
+ .4byte .LSbl3-.LSbl2
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 16
- .byte 0x40+.LSbl4-.LSbl3 # DW_CFA_advance_loc+N
+ .byte 4 # DW_CFA_advance_loc4
+ .4byte .LSbl4-.LSbl3
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 16+FRAME_SIZE
.align 4