summaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S45
1 files changed, 31 insertions, 14 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
index 3fec0f4205..9db5516913 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_once.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -74,17 +74,23 @@ __pthread_once:
jnz 3f /* Different for generation -> run initializer. */
/* Somebody else got here first. Wait. */
- movq %r10, %rsi /* movq $FUTEX_WAIT, %rsi */
- movq $SYS_futex, %rax
+#if FUTEX_WAIT == 0
+ xorl %esi, %esi
+#else
+ movl $FUTEX_WAIT, %esi
+#endif
+ movl $SYS_futex, %eax
syscall
jmp 6b
/* Preserve the pointer to the control variable. */
3: pushq %rdi
.Lpush_rdi:
+ pushq %rdi
+.Lpush_rdi2:
.LcleanupSTART:
- callq *8(%rsp)
+ callq *16(%rsp)
.LcleanupEND:
/* Get the control variable address back. */
@@ -95,15 +101,18 @@ __pthread_once:
LOCK
incl (%rdi)
+ addq $8, %rsp
+.Ladd1:
+
/* Wake up all other threads. */
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %esi
- movq $SYS_futex, %rax
+ movl $SYS_futex, %eax
syscall
4: addq $8, %rsp
-.Ladd:
- xorq %rax, %rax
+.Ladd2:
+ xorl %eax, %eax
retq
.size __pthread_once,.-__pthread_once
@@ -124,8 +133,8 @@ clear_once_control:
movl $0, (%rdi)
movl $0x7fffffff, %edx
- movq $FUTEX_WAKE, %rsi
- movq $SYS_futex, %rax
+ movl $FUTEX_WAKE, %esi
+ movl $SYS_futex, %eax
syscall
movq %r8, %rdi
@@ -220,20 +229,28 @@ clear_once_control:
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 24
.byte 4 # DW_CFA_advance_loc4
- .long .Lpop_rdi-.Lpush_rdi
+ .long .Lpush_rdi2-.Lpush_rdi
+ .byte 14 # DW_CFA_def_cfa_offset
+ .uleb128 32
+ .byte 4 # DW_CFA_advance_loc4
+ .long .Lpop_rdi-.Lpush_rdi2
+ .byte 14 # DW_CFA_def_cfa_offset
+ .uleb128 24
+ .byte 4 # DW_CFA_advance_loc4
+ .long .Ladd1-.Lpop_rdi
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 16
.byte 4 # DW_CFA_advance_loc4
- .long .Ladd-.Lpop_rdi
+ .long .Ladd2-.Ladd1
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 8
.byte 4 # DW_CFA_advance_loc4
- .long clear_once_control-.Ladd
+ .long clear_once_control-.Ladd2
.byte 14 # DW_CFA_def_cfa_offset
- .uleb128 24
+ .uleb128 32
#if 0
.byte 4 # DW_CFA_advance_loc4
- .long .Lpop_rdi2-clear_once_control
+ .long .Lpop_rdi3-clear_once_control
.byte 14 # DW_CFA_def_cfa_offset
.uleb128 16
#endif