diff options
Diffstat (limited to 'nptl/sysdeps/unix')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S | 61 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S | 45 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h | 236 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S | 59 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h | 288 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S | 41 |
6 files changed, 565 insertions, 165 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S index ae6ce9453f..e2da5b04cf 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -41,9 +41,16 @@ .hidden __lll_mutex_lock_wait .align 16 __lll_mutex_lock_wait: + cfi_startproc pushl %edx + cfi_adjust_cfa_offset(4) pushl %ebx + cfi_adjust_cfa_offset(4) pushl %esi + cfi_adjust_cfa_offset(4) + cfi_offset(%edx, -8) + cfi_offset(%ebx, -12) + cfi_offset(%esi, -16) movl $2, %edx movl %ecx, %ebx @@ -63,9 +70,16 @@ __lll_mutex_lock_wait: jnz 1b popl %esi + cfi_adjust_cfa_offset(-4) + cfi_restore(%esi) popl %ebx + cfi_adjust_cfa_offset(-4) + cfi_restore(%ebx) popl %edx + cfi_adjust_cfa_offset(-4) + cfi_restore(%edx) ret + cfi_endproc .size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait @@ -75,17 +89,27 @@ __lll_mutex_lock_wait: .hidden __lll_mutex_timedlock_wait .align 16 __lll_mutex_timedlock_wait: + cfi_startproc /* Check for a valid timeout value. */ cmpl $1000000000, 4(%edx) jae 3f pushl %edi + cfi_adjust_cfa_offset(4) pushl %esi + cfi_adjust_cfa_offset(4) pushl %ebx + cfi_adjust_cfa_offset(4) pushl %ebp + cfi_adjust_cfa_offset(4) + cfi_offset(%edi, -8) + cfi_offset(%esi, -12) + cfi_offset(%ebx, -16) + cfi_offset(%ebp, -20) /* Stack frame for the timespec and timeval structs. */ subl $8, %esp + cfi_adjust_cfa_offset(8) movl %ecx, %ebp movl %edx, %edi @@ -140,12 +164,29 @@ __lll_mutex_timedlock_wait: jnz 7f 6: addl $8, %esp + cfi_adjust_cfa_offset(-8) popl %ebp + cfi_adjust_cfa_offset(-4) + cfi_restore(%ebp) popl %ebx + cfi_adjust_cfa_offset(-4) + cfi_restore(%ebx) popl %esi + cfi_adjust_cfa_offset(-4) + cfi_restore(%esi) popl %edi + cfi_adjust_cfa_offset(-4) + cfi_restore(%edi) ret +3: movl $EINVAL, %eax + ret + + cfi_adjust_cfa_offset(24) + cfi_offset(%edi, -8) + cfi_offset(%esi, -12) + cfi_offset(%ebx, -16) + cfi_offset(%ebp, -20) /* Check whether the time expired. */ 7: cmpl $-ETIMEDOUT, %ecx je 5f @@ -157,11 +198,9 @@ __lll_mutex_timedlock_wait: jz 6b jmp 1b -3: movl $EINVAL, %eax - ret - 5: movl $ETIMEDOUT, %eax jmp 6b + cfi_endproc .size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait #endif @@ -200,9 +239,16 @@ lll_unlock_wake_cb: .hidden __lll_mutex_unlock_wake .align 16 __lll_mutex_unlock_wake: + cfi_startproc pushl %ebx + cfi_adjust_cfa_offset(4) pushl %ecx + cfi_adjust_cfa_offset(4) pushl %edx + cfi_adjust_cfa_offset(4) + cfi_offset(%ebx, -8) + cfi_offset(%ecx, -12) + cfi_offset(%edx, -16) movl %eax, %ebx movl $0, (%eax) @@ -212,9 +258,16 @@ __lll_mutex_unlock_wake: ENTER_KERNEL popl %edx + cfi_adjust_cfa_offset(-4) + cfi_restore(%edx) popl %ecx + cfi_adjust_cfa_offset(-4) + cfi_restore(%ecx) popl %ebx + cfi_adjust_cfa_offset(-4) + cfi_restore(%ebx) ret + cfi_endproc .size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S index ff09745060..73d8bc4ccc 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S @@ -44,9 +44,16 @@ .hidden __lll_robust_mutex_lock_wait .align 16 __lll_robust_mutex_lock_wait: + cfi_startproc pushl %edx + cfi_adjust_cfa_offset(4) pushl %ebx + cfi_adjust_cfa_offset(4) pushl %esi + cfi_adjust_cfa_offset(4) + cfi_offset(%edx, -8) + cfi_offset(%ebx, -12) + cfi_offset(%esi, -16) movl %ecx, %ebx xorl %esi, %esi /* No timeout. */ @@ -81,9 +88,16 @@ __lll_robust_mutex_lock_wait: /* NB: %eax == 0 */ 3: popl %esi + cfi_adjust_cfa_offset(-4) + cfi_restore(%esi) popl %ebx + cfi_adjust_cfa_offset(-4) + cfi_restore(%ebx) popl %edx + cfi_adjust_cfa_offset(-4) + cfi_restore(%edx) ret + cfi_endproc .size __lll_robust_mutex_lock_wait,.-__lll_robust_mutex_lock_wait @@ -92,17 +106,27 @@ __lll_robust_mutex_lock_wait: .hidden __lll_robust_mutex_timedlock_wait .align 16 __lll_robust_mutex_timedlock_wait: + cfi_startproc /* Check for a valid timeout value. */ cmpl $1000000000, 4(%edx) jae 3f pushl %edi + cfi_adjust_cfa_offset(4) pushl %esi + cfi_adjust_cfa_offset(4) pushl %ebx + cfi_adjust_cfa_offset(4) pushl %ebp + cfi_adjust_cfa_offset(4) + cfi_offset(%edi, -8) + cfi_offset(%esi, -12) + cfi_offset(%ebx, -16) + cfi_offset(%ebp, -20) /* Stack frame for the timespec and timeval structs. */ subl $12, %esp + cfi_adjust_cfa_offset(12) movl %ecx, %ebp movl %edx, %edi @@ -170,19 +194,34 @@ __lll_robust_mutex_timedlock_wait: jnz 7f 6: addl $12, %esp + cfi_adjust_cfa_offset(-12) popl %ebp + cfi_adjust_cfa_offset(-4) + cfi_restore(%ebp) popl %ebx + cfi_adjust_cfa_offset(-4) + cfi_restore(%ebx) popl %esi + cfi_adjust_cfa_offset(-4) + cfi_restore(%esi) popl %edi + cfi_adjust_cfa_offset(-4) + cfi_restore(%edi) ret +3: movl $EINVAL, %eax + ret + + cfi_adjust_cfa_offset(28) + cfi_offset(%edi, -8) + cfi_offset(%esi, -12) + cfi_offset(%ebx, -16) + cfi_offset(%ebp, -20) /* Check whether the time expired. */ 7: cmpl $-ETIMEDOUT, %ecx jne 1b 8: movl $ETIMEDOUT, %eax jmp 6b - -3: movl $EINVAL, %eax - ret + cfi_endproc .size __lll_robust_mutex_timedlock_wait,.-__lll_robust_mutex_timedlock_wait diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h index ac788ebe5a..21de09fe91 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -68,6 +68,82 @@ #define BUSY_WAIT_NOP asm ("rep; nop") +#define LLL_STUB_UNWIND_INFO_START \ + ".section .eh_frame,\"a\",@progbits\n" \ +"5:\t" ".long 7f-6f # Length of Common Information Entry\n" \ +"6:\t" ".long 0x0 # CIE Identifier Tag\n\t" \ + ".byte 0x1 # CIE Version\n\t" \ + ".ascii \"zR\\0\" # CIE Augmentation\n\t" \ + ".uleb128 0x1 # CIE Code Alignment Factor\n\t" \ + ".sleb128 -4 # CIE Data Alignment Factor\n\t" \ + ".byte 0x8 # CIE RA Column\n\t" \ + ".uleb128 0x1 # Augmentation size\n\t" \ + ".byte 0x1b # FDE Encoding (pcrel sdata4)\n\t" \ + ".byte 0xc # DW_CFA_def_cfa\n\t" \ + ".uleb128 0x4\n\t" \ + ".uleb128 0x0\n\t" \ + ".align 4\n" \ +"7:\t" ".long 17f-8f # FDE Length\n" \ +"8:\t" ".long 8b-5b # FDE CIE offset\n\t" \ + ".long 1b-. # FDE initial location\n\t" \ + ".long 4b-1b # FDE address range\n\t" \ + ".uleb128 0x0 # Augmentation size\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x8\n\t" \ + ".uleb128 10f-9f\n" \ +"9:\t" ".byte 0x78 # DW_OP_breg8\n\t" \ + ".sleb128 3b-1b\n" +#define LLL_STUB_UNWIND_INFO_END \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x8\n\t" \ + ".uleb128 12f-11f\n" \ +"11:\t" ".byte 0x78 # DW_OP_breg8\n\t" \ + ".sleb128 3b-2b\n" \ +"12:\t" ".byte 0x40 + (3b-2b-1) # DW_CFA_advance_loc\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x8\n\t" \ + ".uleb128 16f-13f\n" \ +"13:\t" ".byte 0x78 # DW_OP_breg8\n\t" \ + ".sleb128 15f-14f\n\t" \ + ".byte 0x0d # DW_OP_const4s\n" \ +"14:\t" ".4byte 3b-.\n\t" \ + ".byte 0x1c # DW_OP_minus\n\t" \ + ".byte 0x0d # DW_OP_const4s\n" \ +"15:\t" ".4byte 18f-.\n\t" \ + ".byte 0x22 # DW_OP_plus\n" \ +"16:\t" ".align 4\n" \ +"17:\t" ".previous\n" + +/* Unwind info for + 1: lea ..., ... + 2: call ... + 3: jmp 18f + 4: + snippet. */ +#define LLL_STUB_UNWIND_INFO_3 \ +LLL_STUB_UNWIND_INFO_START \ +"10:\t" ".byte 0x40 + (2b-1b) # DW_CFA_advance_loc\n\t" \ +LLL_STUB_UNWIND_INFO_END + +/* Unwind info for + 1: lea ..., ... + 0: movl ..., ... + 2: call ... + 3: jmp 18f + 4: + snippet. */ +#define LLL_STUB_UNWIND_INFO_4 \ +LLL_STUB_UNWIND_INFO_START \ +"10:\t" ".byte 0x40 + (0b-1b) # DW_CFA_advance_loc\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x8\n\t" \ + ".uleb128 20f-19f\n" \ +"19:\t" ".byte 0x78 # DW_OP_breg8\n\t" \ + ".sleb128 3b-0b\n" \ +"20:\t" ".byte 0x40 + (2b-0b) # DW_CFA_advance_loc\n\t" \ +LLL_STUB_UNWIND_INFO_END + + #define lll_futex_wait(futex, val) \ ({ \ int __status; \ @@ -168,13 +244,14 @@ extern int __lll_mutex_unlock_wake (int *__futex) "jnz _L_mutex_lock_%=\n\t" \ ".subsection 1\n\t" \ ".type _L_mutex_lock_%=,@function\n" \ - "_L_mutex_lock_%=:\n\t" \ - "leal %2, %%ecx\n\t" \ - "call __lll_mutex_lock_wait\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_lock_%=,.-_L_mutex_lock_%=\n" \ + "_L_mutex_lock_%=:\n" \ + "1:\tleal %2, %%ecx\n" \ + "2:\tcall __lll_mutex_lock_wait\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_mutex_lock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=a" (ignore1), "=c" (ignore2), "=m" (futex) \ : "0" (0), "1" (1), "m" (futex) \ : "memory"); }) @@ -183,16 +260,17 @@ extern int __lll_mutex_unlock_wake (int *__futex) #define lll_robust_mutex_lock(futex, id) \ ({ int result, ignore; \ __asm __volatile (LOCK_INSTR "cmpxchgl %1, %2\n\t" \ - "jnz _L_mutex_lock_%=\n\t" \ + "jnz _L_robust_mutex_lock_%=\n\t" \ ".subsection 1\n\t" \ - ".type _L_mutex_lock_%=,@function\n" \ - "_L_mutex_lock_%=:\n\t" \ - "leal %2, %%ecx\n\t" \ - "call __lll_robust_mutex_lock_wait\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_lock_%=,.-_L_mutex_lock_%=\n" \ + ".type _L_robust_mutex_lock_%=,@function\n" \ + "_L_robust_mutex_lock_%=:\n" \ + "1:\tleal %2, %%ecx\n" \ + "2:\tcall __lll_robust_mutex_lock_wait\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_robust_mutex_lock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=a" (result), "=c" (ignore), "=m" (futex) \ : "0" (0), "1" (id), "m" (futex) \ : "memory"); \ @@ -207,13 +285,14 @@ extern int __lll_mutex_unlock_wake (int *__futex) "jnz _L_mutex_cond_lock_%=\n\t" \ ".subsection 1\n\t" \ ".type _L_mutex_cond_lock_%=,@function\n" \ - "_L_mutex_cond_lock_%=:\n\t" \ - "leal %2, %%ecx\n\t" \ - "call __lll_mutex_lock_wait\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_cond_lock_%=,.-_L_mutex_cond_lock_%=\n" \ + "_L_mutex_cond_lock_%=:\n" \ + "1:\tleal %2, %%ecx\n" \ + "2:\tcall __lll_mutex_lock_wait\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_mutex_cond_lock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=a" (ignore1), "=c" (ignore2), "=m" (futex) \ : "0" (0), "1" (2), "m" (futex) \ : "memory"); }) @@ -222,16 +301,17 @@ extern int __lll_mutex_unlock_wake (int *__futex) #define lll_robust_mutex_cond_lock(futex, id) \ ({ int result, ignore; \ __asm __volatile (LOCK_INSTR "cmpxchgl %1, %2\n\t" \ - "jnz _L_mutex_cond_lock_%=\n\t" \ + "jnz _L_robust_mutex_cond_lock_%=\n\t" \ ".subsection 1\n\t" \ - ".type _L_mutex_cond_lock_%=,@function\n" \ - "_L_mutex_cond_lock_%=:\n\t" \ - "leal %2, %%ecx\n\t" \ - "call __lll_robust_mutex_lock_wait\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_cond_lock_%=,.-_L_mutex_cond_lock_%=\n"\ + ".type _L_robust_mutex_cond_lock_%=,@function\n" \ + "_L_robust_mutex_cond_lock_%=:\n" \ + "1:\tleal %2, %%ecx\n" \ + "2:\tcall __lll_robust_mutex_lock_wait\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_robust_mutex_cond_lock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=a" (result), "=c" (ignore), "=m" (futex) \ : "0" (0), "1" (id | FUTEX_WAITERS), "m" (futex) \ : "memory"); \ @@ -244,14 +324,15 @@ extern int __lll_mutex_unlock_wake (int *__futex) "jnz _L_mutex_timedlock_%=\n\t" \ ".subsection 1\n\t" \ ".type _L_mutex_timedlock_%=,@function\n" \ - "_L_mutex_timedlock_%=:\n\t" \ - "leal %3, %%ecx\n\t" \ - "movl %7, %%edx\n\t" \ - "call __lll_mutex_timedlock_wait\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_timedlock_%=,.-_L_mutex_timedlock_%=\n"\ + "_L_mutex_timedlock_%=:\n" \ + "1:\tleal %3, %%ecx\n" \ + "0:\tmovl %7, %%edx\n" \ + "2:\tcall __lll_mutex_timedlock_wait\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_mutex_timedlock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_4 \ + "18:" \ : "=a" (result), "=c" (ignore1), "=&d" (ignore2), \ "=m" (futex) \ : "0" (0), "1" (1), "m" (futex), "m" (timeout) \ @@ -262,17 +343,18 @@ extern int __lll_mutex_unlock_wake (int *__futex) #define lll_robust_mutex_timedlock(futex, timeout, id) \ ({ int result, ignore1, ignore2; \ __asm __volatile (LOCK_INSTR "cmpxchgl %1, %3\n\t" \ - "jnz _L_mutex_timedlock_%=\n\t" \ + "jnz _L_robust_mutex_timedlock_%=\n\t" \ ".subsection 1\n\t" \ - ".type _L_mutex_timedlock_%=,@function\n" \ - "_L_mutex_timedlock_%=:\n\t" \ - "leal %3, %%ecx\n\t" \ - "movl %7, %%edx\n\t" \ - "call __lll_robust_mutex_timedlock_wait\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_timedlock_%=,.-_L_mutex_timedlock_%=\n"\ + ".type _L_robust_mutex_timedlock_%=,@function\n" \ + "_L_robust_mutex_timedlock_%=:\n" \ + "1:\tleal %3, %%ecx\n" \ + "0:\tmovl %7, %%edx\n" \ + "2:\tcall __lll_robust_mutex_timedlock_wait\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_robust_mutex_timedlock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_4 \ + "18:" \ : "=a" (result), "=c" (ignore1), "=&d" (ignore2), \ "=m" (futex) \ : "0" (0), "1" (id), "m" (futex), "m" (timeout) \ @@ -286,13 +368,14 @@ extern int __lll_mutex_unlock_wake (int *__futex) "jne _L_mutex_unlock_%=\n\t" \ ".subsection 1\n\t" \ ".type _L_mutex_unlock_%=,@function\n" \ - "_L_mutex_unlock_%=:\n\t" \ - "leal %0, %%eax\n\t" \ - "call __lll_mutex_unlock_wake\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_unlock_%=,.-_L_mutex_unlock_%=\n" \ + "_L_mutex_unlock_%=:\n" \ + "1:\tleal %0, %%eax\n" \ + "2:\tcall __lll_mutex_unlock_wake\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_mutex_unlock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=m" (futex), "=&a" (ignore) \ : "m" (futex) \ : "memory"); }) @@ -301,16 +384,17 @@ extern int __lll_mutex_unlock_wake (int *__futex) #define lll_robust_mutex_unlock(futex) \ (void) ({ int ignore; \ __asm __volatile (LOCK_INSTR "andl %2, %0\n\t" \ - "jne _L_mutex_unlock_%=\n\t" \ + "jne _L_robust_mutex_unlock_%=\n\t" \ ".subsection 1\n\t" \ - ".type _L_mutex_unlock_%=,@function\n" \ - "_L_mutex_unlock_%=:\n\t" \ - "leal %0, %%eax\n\t" \ - "call __lll_mutex_unlock_wake\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_unlock_%=,.-_L_mutex_unlock_%=\n" \ + ".type _L_robust_mutex_unlock_%=,@function\n" \ + "_L_robust_mutex_unlock_%=:\n\t" \ + "1:\tleal %0, %%eax\n" \ + "2:\tcall __lll_mutex_unlock_wake\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_robust_mutex_unlock_%=, 4b-1b\n\t"\ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=m" (futex), "=&a" (ignore) \ : "i" (FUTEX_WAITERS), "m" (futex) \ : "memory"); }) @@ -404,16 +488,17 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden; "je 0f\n\t" \ "lock\n" \ "0:\tcmpxchgl %1, %2\n\t" \ - "jnz _L_mutex_lock_%=\n\t" \ + "jnz _L_lock_%=\n\t" \ ".subsection 1\n\t" \ - ".type _L_mutex_lock_%=,@function\n" \ - "_L_mutex_lock_%=:\n\t" \ - "leal %2, %%ecx\n\t" \ - "call __lll_mutex_lock_wait\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_lock_%=,.-_L_mutex_lock_%=\n" \ + ".type _L_lock_%=,@function\n" \ + "_L_lock_%=:\n" \ + "1:\tleal %2, %%ecx\n" \ + "2:\tcall __lll_mutex_lock_wait\n" \ + "3:\tjmp 18f\n" \ + "4:\t.size _L_lock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=a" (ignore1), "=c" (ignore2), "=m" (futex) \ : "0" (0), "1" (1), "m" (futex), \ "i" (offsetof (tcbhead_t, multiple_threads)) \ @@ -425,17 +510,18 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden; __asm __volatile ("cmpl $0, %%gs:%P3\n\t" \ "je 0f\n\t" \ "lock\n" \ - "0:\tsubl $1,%0\n\t" \ - "jne _L_mutex_unlock_%=\n\t" \ + "0:\tsubl $1,%0\n\t" \ + "jne _L_unlock_%=\n\t" \ ".subsection 1\n\t" \ - ".type _L_mutex_unlock_%=,@function\n" \ - "_L_mutex_unlock_%=:\n\t" \ - "leal %0, %%eax\n\t" \ - "call __lll_mutex_unlock_wake\n\t" \ - "jmp 1f\n\t" \ - ".size _L_mutex_unlock_%=,.-_L_mutex_unlock_%=\n" \ + ".type _L_unlock_%=,@function\n" \ + "_L_unlock_%=:\n" \ + "1:\tleal %0, %%eax\n" \ + "2:\tcall __lll_mutex_unlock_wake\n" \ + "3:\tjmp 18f\n\t" \ + "4:\t.size _L_unlock_%=, 4b-1b\n\t" \ ".previous\n" \ - "1:" \ + LLL_STUB_UNWIND_INFO_3 \ + "18:" \ : "=m" (futex), "=&a" (ignore) \ : "m" (futex), \ "i" (offsetof (tcbhead_t, multiple_threads)) \ diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S index 3a49e25dd2..90f10e6f4f 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -43,9 +43,13 @@ .hidden __lll_mutex_lock_wait .align 16 __lll_mutex_lock_wait: + cfi_startproc pushq %r10 + cfi_adjust_cfa_offset(8) pushq %rdx - + cfi_adjust_cfa_offset(8) + cfi_offset(%r10, -16) + cfi_offset(%rdx, -24) xorq %r10, %r10 /* No timeout. */ movl $2, %edx #if FUTEX_WAIT == 0 @@ -67,8 +71,13 @@ __lll_mutex_lock_wait: jnz 1b popq %rdx + cfi_adjust_cfa_offset(-8) + cfi_restore(%rdx) popq %r10 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r10) retq + cfi_endproc .size __lll_mutex_lock_wait,.-__lll_mutex_lock_wait @@ -78,18 +87,30 @@ __lll_mutex_lock_wait: .hidden __lll_mutex_timedlock_wait .align 16 __lll_mutex_timedlock_wait: + cfi_startproc /* Check for a valid timeout value. */ cmpq $1000000000, 8(%rdx) jae 3f pushq %r8 + cfi_adjust_cfa_offset(8) pushq %r9 + cfi_adjust_cfa_offset(8) pushq %r12 + cfi_adjust_cfa_offset(8) pushq %r13 + cfi_adjust_cfa_offset(8) pushq %r14 + cfi_adjust_cfa_offset(8) + cfi_offset(%r8, -16) + cfi_offset(%r9, -24) + cfi_offset(%r12, -32) + cfi_offset(%r13, -40) + cfi_offset(%r14, -48) /* Stack frame for the timespec and timeval structs. */ subq $16, %rsp + cfi_adjust_cfa_offset(16) movq %rdi, %r12 movq %rdx, %r13 @@ -147,13 +168,33 @@ __lll_mutex_timedlock_wait: jnz 7f 6: addq $16, %rsp + cfi_adjust_cfa_offset(-16) popq %r14 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r14) popq %r13 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r13) popq %r12 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r12) popq %r9 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r9) popq %r8 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r8) + retq + +3: movl $EINVAL, %eax retq + cfi_adjust_cfa_offset(56) + cfi_offset(%r8, -16) + cfi_offset(%r9, -24) + cfi_offset(%r12, -32) + cfi_offset(%r13, -40) + cfi_offset(%r14, -48) /* Check whether the time expired. */ 7: cmpq $-ETIMEDOUT, %rcx je 5f @@ -165,11 +206,9 @@ __lll_mutex_timedlock_wait: jz 6b jmp 1b -3: movl $EINVAL, %eax - retq - 5: movl $ETIMEDOUT, %eax jmp 6b + cfi_endproc .size __lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait #endif @@ -199,8 +238,13 @@ lll_unlock_wake_cb: .hidden __lll_mutex_unlock_wake .align 16 __lll_mutex_unlock_wake: + cfi_startproc pushq %rsi + cfi_adjust_cfa_offset(8) pushq %rdx + cfi_adjust_cfa_offset(8) + cfi_offset(%rsi, -16) + cfi_offset(%rdx, -24) movl $0, (%rdi) movl $FUTEX_WAKE, %esi @@ -209,8 +253,13 @@ __lll_mutex_unlock_wake: syscall popq %rdx + cfi_adjust_cfa_offset(-8) + cfi_restore(%rdx) popq %rsi + cfi_adjust_cfa_offset(-8) + cfi_restore(%rsi) retq + cfi_endproc .size __lll_mutex_unlock_wake,.-__lll_mutex_unlock_wake diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h index c354e8489c..97085bf018 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h @@ -49,6 +49,104 @@ #define BUSY_WAIT_NOP asm ("rep; nop") +#define LLL_STUB_UNWIND_INFO_START \ + ".section .eh_frame,\"a\",@progbits\n" \ +"7:\t" ".long 9f-8f # Length of Common Information Entry\n" \ +"8:\t" ".long 0x0 # CIE Identifier Tag\n\t" \ + ".byte 0x1 # CIE Version\n\t" \ + ".ascii \"zR\\0\" # CIE Augmentation\n\t" \ + ".uleb128 0x1 # CIE Code Alignment Factor\n\t" \ + ".sleb128 -8 # CIE Data Alignment Factor\n\t" \ + ".byte 0x10 # CIE RA Column\n\t" \ + ".uleb128 0x1 # Augmentation size\n\t" \ + ".byte 0x1b # FDE Encoding (pcrel sdata4)\n\t" \ + ".byte 0x12 # DW_CFA_def_cfa_sf\n\t" \ + ".uleb128 0x7\n\t" \ + ".sleb128 16\n\t" \ + ".align 8\n" \ +"9:\t" ".long 23f-10f # FDE Length\n" \ +"10:\t" ".long 10b-7b # FDE CIE offset\n\t" \ + ".long 1b-. # FDE initial location\n\t" \ + ".long 6b-1b # FDE address range\n\t" \ + ".uleb128 0x0 # Augmentation size\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x10\n\t" \ + ".uleb128 12f-11f\n" \ +"11:\t" ".byte 0x80 # DW_OP_breg16\n\t" \ + ".sleb128 4b-1b\n" +#define LLL_STUB_UNWIND_INFO_END \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x10\n\t" \ + ".uleb128 14f-13f\n" \ +"13:\t" ".byte 0x80 # DW_OP_breg16\n\t" \ + ".sleb128 4b-2b\n" \ +"14:\t" ".byte 0x40 + (3b-2b) # DW_CFA_advance_loc\n\t" \ + ".byte 0x0e # DW_CFA_def_cfa_offset\n\t" \ + ".uleb128 0\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x10\n\t" \ + ".uleb128 16f-15f\n" \ +"15:\t" ".byte 0x80 # DW_OP_breg16\n\t" \ + ".sleb128 4b-3b\n" \ +"16:\t" ".byte 0x40 + (4b-3b-1) # DW_CFA_advance_loc\n\t" \ + ".byte 0x0e # DW_CFA_def_cfa_offset\n\t" \ + ".uleb128 128\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x10\n\t" \ + ".uleb128 20f-17f\n" \ +"17:\t" ".byte 0x80 # DW_OP_breg16\n\t" \ + ".sleb128 19f-18f\n\t" \ + ".byte 0x0d # DW_OP_const4s\n" \ +"18:\t" ".4byte 4b-.\n\t" \ + ".byte 0x1c # DW_OP_minus\n\t" \ + ".byte 0x0d # DW_OP_const4s\n" \ +"19:\t" ".4byte 24f-.\n\t" \ + ".byte 0x22 # DW_OP_plus\n" \ +"20:\t" ".byte 0x40 + (5b-4b+1) # DW_CFA_advance_loc\n\t" \ + ".byte 0x13 # DW_CFA_def_cfa_offset_sf\n\t" \ + ".sleb128 16\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x10\n\t" \ + ".uleb128 22f-21f\n" \ +"21:\t" ".byte 0x80 # DW_OP_breg16\n\t" \ + ".sleb128 4b-5b\n" \ +"22:\t" ".align 8\n" \ +"23:\t" ".previous\n" + +/* Unwind info for + 1: leaq ..., %rdi + 2: subq $128, %rsp + 3: callq ... + 4: addq $128, %rsp + 5: jmp 24f + 6: + snippet. */ +#define LLL_STUB_UNWIND_INFO_5 \ +LLL_STUB_UNWIND_INFO_START \ +"12:\t" ".byte 0x40 + (2b-1b) # DW_CFA_advance_loc\n\t" \ +LLL_STUB_UNWIND_INFO_END + +/* Unwind info for + 1: leaq ..., %rdi + 0: movq ..., %rdx + 2: subq $128, %rsp + 3: callq ... + 4: addq $128, %rsp + 5: jmp 24f + 6: + snippet. */ +#define LLL_STUB_UNWIND_INFO_6 \ +LLL_STUB_UNWIND_INFO_START \ +"12:\t" ".byte 0x40 + (0b-1b) # DW_CFA_advance_loc\n\t" \ + ".byte 0x16 # DW_CFA_val_expression\n\t" \ + ".uleb128 0x10\n\t" \ + ".uleb128 26f-25f\n" \ +"25:\t" ".byte 0x80 # DW_OP_breg16\n\t" \ + ".sleb128 4b-0b\n" \ +"26:\t" ".byte 0x40 + (2b-0b) # DW_CFA_advance_loc\n\t" \ +LLL_STUB_UNWIND_INFO_END + + #define lll_futex_wait(futex, val) \ ({ \ int __status; \ @@ -138,14 +236,18 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; (void) ({ int ignore1, ignore2, ignore3; \ __asm __volatile (LOCK_INSTR "cmpxchgl %0, %2\n\t" \ "jnz 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %2, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_mutex_lock_wait\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_mutex_lock_%=, @function\n" \ + "_L_mutex_lock_%=:\n" \ + "1:\tleaq %2, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_mutex_lock_wait\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_mutex_lock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=S" (ignore1), "=&D" (ignore2), "=m" (futex),\ "=a" (ignore3) \ : "0" (1), "m" (futex), "3" (0) \ @@ -153,17 +255,21 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; #define lll_robust_mutex_lock(futex, id) \ - ({ int result, ignore1, ignore2; \ + ({ int result, ignore1, ignore2; \ __asm __volatile (LOCK_INSTR "cmpxchgl %0, %2\n\t" \ "jnz 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %2, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_robust_mutex_lock_wait\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_robust_mutex_lock_%=, @function\n" \ + "_L_robust_mutex_lock_%=:\n" \ + "1:\tleaq %2, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_robust_mutex_lock_wait\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_robust_mutex_lock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=S" (ignore1), "=&D" (ignore2), "=m" (futex), \ "=a" (result) \ : "0" (id), "m" (futex), "3" (0) \ @@ -175,14 +281,18 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; (void) ({ int ignore1, ignore2, ignore3; \ __asm __volatile (LOCK_INSTR "cmpxchgl %0, %2\n\t" \ "jnz 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %2, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_mutex_lock_wait\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_mutex_cond_lock_%=, @function\n" \ + "_L_mutex_cond_lock_%=:\n" \ + "1:\tleaq %2, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_mutex_lock_wait\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_mutex_cond_lock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=S" (ignore1), "=&D" (ignore2), "=m" (futex),\ "=a" (ignore3) \ : "0" (2), "m" (futex), "3" (0) \ @@ -193,14 +303,18 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; ({ int result, ignore1, ignore2; \ __asm __volatile (LOCK_INSTR "cmpxchgl %0, %2\n\t" \ "jnz 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %2, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_robust_mutex_lock_wait\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_robust_mutex_cond_lock_%=, @function\n" \ + "_L_robust_mutex_cond_lock_%=:\n" \ + "1:\tleaq %2, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_robust_mutex_lock_wait\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_robust_mutex_cond_lock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=S" (ignore1), "=&D" (ignore2), "=m" (futex), \ "=a" (result) \ : "0" (id | FUTEX_WAITERS), "m" (futex), "3" (0) \ @@ -212,15 +326,19 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; ({ int result, ignore1, ignore2, ignore3; \ __asm __volatile (LOCK_INSTR "cmpxchgl %2, %4\n\t" \ "jnz 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %4, %%rdi\n\t" \ - "movq %8, %%rdx\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_mutex_timedlock_wait\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_mutex_timedlock_%=, @function\n" \ + "_L_mutex_timedlock_%=:\n" \ + "1:\tleaq %4, %%rdi\n" \ + "0:\tmovq %8, %%rdx\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_mutex_timedlock_wait\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_mutex_timedlock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_6 \ + "24:" \ : "=a" (result), "=&D" (ignore1), "=S" (ignore2), \ "=&d" (ignore3), "=m" (futex) \ : "0" (0), "2" (1), "m" (futex), "m" (timeout) \ @@ -232,15 +350,19 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; ({ int result, ignore1, ignore2, ignore3; \ __asm __volatile (LOCK_INSTR "cmpxchgl %2, %4\n\t" \ "jnz 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %4, %%rdi\n\t" \ - "movq %8, %%rdx\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_robust_mutex_timedlock_wait\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_robust_mutex_timedlock_%=, @function\n" \ + "_L_robust_mutex_timedlock_%=:\n" \ + "1:\tleaq %4, %%rdi\n" \ + "0:\tmovq %8, %%rdx\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_robust_mutex_timedlock_wait\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_robust_mutex_timedlock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_6 \ + "24:" \ : "=a" (result), "=&D" (ignore1), "=S" (ignore2), \ "=&d" (ignore3), "=m" (futex) \ : "0" (0), "2" (id), "m" (futex), "m" (timeout) \ @@ -252,14 +374,18 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; (void) ({ int ignore; \ __asm __volatile (LOCK_INSTR "decl %0\n\t" \ "jne 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %0, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_mutex_unlock_wake\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_mutex_unlock_%=, @function\n" \ + "_L_mutex_unlock_%=:\n" \ + "1:\tleaq %0, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_mutex_unlock_wake\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_mutex_unlock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=m" (futex), "=&D" (ignore) \ : "m" (futex) \ : "ax", "cx", "r11", "cc", "memory"); }) @@ -269,14 +395,18 @@ extern int __lll_mutex_unlock_wait (int *__futex) attribute_hidden; (void) ({ int ignore; \ __asm __volatile (LOCK_INSTR "andl %2, %0\n\t" \ "jne 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %0, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_mutex_unlock_wake\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_robust_mutex_unlock_%=, @function\n" \ + "_L_robust_mutex_unlock_%=:\n" \ + "1:\tleaq %0, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_mutex_unlock_wake\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_robust_mutex_unlock_%=, 6b-1b\n\t"\ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=m" (futex), "=&D" (ignore) \ : "i" (FUTEX_WAITERS), "m" (futex) \ : "ax", "cx", "r11", "cc", "memory"); }) @@ -351,17 +481,21 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden; "je 0f\n\t" \ "lock; cmpxchgl %0, %2\n\t" \ "jnz 1f\n\t" \ - "jmp 2f\n" \ + "jmp 24f\n" \ "0:\tcmpxchgl %0, %2\n\t" \ "jnz 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %2, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_mutex_lock_wait\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_lock_%=, @function\n" \ + "_L_lock_%=:\n" \ + "1:\tleaq %2, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_mutex_lock_wait\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_lock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=S" (ignore1), "=&D" (ignore2), "=m" (futex),\ "=a" (ignore3) \ : "0" (1), "m" (futex), "3" (0) \ @@ -374,17 +508,21 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden; "je 0f\n\t" \ "lock; decl %0\n\t" \ "jne 1f\n\t" \ - "jmp 2f\n" \ + "jmp 24f\n" \ "0:\tdecl %0\n\t" \ "jne 1f\n\t" \ - ".subsection 1\n" \ - "1:\tleaq %0, %%rdi\n\t" \ - "subq $128, %%rsp\n\t" \ - "callq __lll_mutex_unlock_wake\n\t" \ - "addq $128, %%rsp\n\t" \ - "jmp 2f\n\t" \ + ".subsection 1\n\t" \ + ".type _L_unlock_%=, @function\n" \ + "_L_unlock_%=:\n" \ + "1:\tleaq %0, %%rdi\n" \ + "2:\tsubq $128, %%rsp\n" \ + "3:\tcallq __lll_mutex_unlock_wake\n" \ + "4:\taddq $128, %%rsp\n" \ + "5:\tjmp 24f\n" \ + "6:\t.size _L_unlock_%=, 6b-1b\n\t" \ ".previous\n" \ - "2:" \ + LLL_STUB_UNWIND_INFO_5 \ + "24:" \ : "=m" (futex), "=&D" (ignore) \ : "m" (futex) \ : "ax", "cx", "r11", "cc", "memory"); }) diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S index 1a088e27b1..69243950d7 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S @@ -46,8 +46,13 @@ .hidden __lll_robust_mutex_lock_wait .align 16 __lll_robust_mutex_lock_wait: + cfi_startproc pushq %r10 + cfi_adjust_cfa_offset(8) pushq %rdx + cfi_adjust_cfa_offset(8) + cfi_offset(%r10, -16) + cfi_offset(%rdx, -24) xorq %r10, %r10 /* No timeout. */ #if FUTEX_WAIT == 0 @@ -85,8 +90,13 @@ __lll_robust_mutex_lock_wait: /* NB: %rax == 0 */ 3: popq %rdx + cfi_adjust_cfa_offset(-8) + cfi_restore(%rdx) popq %r10 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r10) retq + cfi_endproc .size __lll_robust_mutex_lock_wait,.-__lll_robust_mutex_lock_wait @@ -95,17 +105,27 @@ __lll_robust_mutex_lock_wait: .hidden __lll_robust_mutex_timedlock_wait .align 16 __lll_robust_mutex_timedlock_wait: + cfi_startproc /* Check for a valid timeout value. */ cmpq $1000000000, 8(%rdx) jae 3f pushq %r8 + cfi_adjust_cfa_offset(8) pushq %r9 + cfi_adjust_cfa_offset(8) pushq %r12 + cfi_adjust_cfa_offset(8) pushq %r13 + cfi_adjust_cfa_offset(8) + cfi_offset(%r8, -16) + cfi_offset(%r9, -24) + cfi_offset(%r12, -32) + cfi_offset(%r13, -40) /* Stack frame for the timespec and timeval structs. */ subq $24, %rsp + cfi_adjust_cfa_offset(24) movq %rdi, %r12 movq %rdx, %r13 @@ -176,19 +196,34 @@ __lll_robust_mutex_timedlock_wait: jnz 7f 6: addq $24, %rsp + cfi_adjust_cfa_offset(-24) popq %r13 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r13) popq %r12 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r12) popq %r9 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r9) popq %r8 + cfi_adjust_cfa_offset(-8) + cfi_restore(%r8) retq +3: movl $EINVAL, %eax + retq + + cfi_adjust_cfa_offset(56) + cfi_offset(%r8, -16) + cfi_offset(%r9, -24) + cfi_offset(%r12, -32) + cfi_offset(%r13, -40) /* Check whether the time expired. */ 7: cmpq $-ETIMEDOUT, %rcx jne 1b 8: movl $ETIMEDOUT, %eax jmp 6b - -3: movl $EINVAL, %eax - retq + cfi_endproc .size __lll_robust_mutex_timedlock_wait,.-__lll_robust_mutex_timedlock_wait |