[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r7661 - in /fsf/trunk/libc: ./ bits/ nptl/ nptl/sysdeps/unix/sysv/linux/i386/i486/ sysdeps/unix/sysv/linux/i386/
- To: commits@xxxxxxxxxx
- Subject: [commits] r7661 - in /fsf/trunk/libc: ./ bits/ nptl/ nptl/sysdeps/unix/sysv/linux/i386/i486/ sysdeps/unix/sysv/linux/i386/
- From: eglibc@xxxxxxxxxx
- Date: Sun, 04 Jan 2009 08:08:22 -0000
Author: eglibc
Date: Sun Jan 4 00:08:21 2009
New Revision: 7661
Log:
Import glibc-mainline for 2009-01-04
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/bits/resource.h
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/init.c
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysdep.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Jan 4 00:08:21 2009
@@ -1,3 +1,12 @@
+2009-01-03 Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
+
+ * bits/resource.h (PRIO_PROCESS, PRIO_PGRP, PRIO_USER): Add macros.
+
+2009-01-03 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/i386/sysdep.h: Describe 6th argument
+ handling.
+
2009-01-02 Ulrich Drepper <drepper@xxxxxxxxxx>
* sysdeps/unix/sysv/linux/kernel-features.h
Modified: fsf/trunk/libc/bits/resource.h
==============================================================================
--- fsf/trunk/libc/bits/resource.h (original)
+++ fsf/trunk/libc/bits/resource.h Sun Jan 4 00:08:21 2009
@@ -185,6 +185,9 @@
enum __priority_which
{
PRIO_PROCESS = 0, /* WHO is a process ID. */
+#define PRIO_PROCESS PRIO_PROCESS
PRIO_PGRP = 1, /* WHO is a process group ID. */
+#define PRIO_PGRP PRIO_PGRP
PRIO_USER = 2 /* WHO is a user ID. */
+#define PRIO_USER PRIO_USER
};
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sun Jan 4 00:08:21 2009
@@ -1,9 +1,18 @@
+2009-01-03 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * init.c (__pthread_initialize_minimal_internal): Cheat a bit by
+ only passing five parameters to FUTEX_WAIT_BITSET call.
+
+ * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+ (__lll_timedlock_wait): Use FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME
+ instead of computing relative timeout.
+
2009-01-02 Ulrich Drepper <drepper@xxxxxxxxxx>
* init.c (__pthread_initialize_minimal_internal): Check for
FUTEX_CLOCK_REALTIME flag.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S (__lll_timedlock_wait):
- Use FUTEX_WAIT_BITSET|FUTEX_CLOCK_READTIME instead of computing
+ Use FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME instead of computing
relative timeout.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Define
Modified: fsf/trunk/libc/nptl/init.c
==============================================================================
--- fsf/trunk/libc/nptl/init.c (original)
+++ fsf/trunk/libc/nptl/init.c Sun Jan 4 00:08:21 2009
@@ -305,10 +305,14 @@
#ifndef __ASSUME_FUTEX_CLOCK_REALTIME
{
int word = 0;
- word = INTERNAL_SYSCALL (futex, err, 6, &word,
+ /* NB: the syscall actually takes six parameters. The last is the
+ bit mask. But since we will not actually wait at all the value
+ is irrelevant. Given that passing six parameters is difficult
+ on some architectures we just pass whatever random value the
+ calling convention calls for to the kernel. It causes no harm. */
+ word = INTERNAL_SYSCALL (futex, err, 5, &word,
FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME
- | FUTEX_PRIVATE_FLAG, 1, NULL, 0,
- FUTEX_BITSET_MATCH_ANY);
+ | FUTEX_PRIVATE_FLAG, 1, NULL, 0);
if (!INTERNAL_SYSCALL_ERROR_P (word, err)
|| (INTERNAL_SYSCALL_ERRNO (word, err) != ENOSYS
&& INTERNAL_SYSCALL_ERRNO (word, err) != EINVAL))
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S Sun Jan 4 00:08:21 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -31,6 +31,8 @@
movl $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
# define LOAD_FUTEX_WAIT(reg) \
xorl $(FUTEX_WAIT | FUTEX_PRIVATE_FLAG), reg
+# define LOAD_FUTEX_WAIT_ABS(reg) \
+ xorl $(FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME), reg
# define LOAD_FUTEX_WAKE(reg) \
xorl $(FUTEX_WAKE | FUTEX_PRIVATE_FLAG), reg
#else
@@ -55,6 +57,10 @@
andl %gs:PRIVATE_FUTEX, reg ; \
orl $FUTEX_WAIT, reg
# endif
+# define LOAD_FUTEX_WAIT_ABS(reg) \
+ xorl $FUTEX_PRIVATE_FLAG, reg ; \
+ andl %gs:PRIVATE_FUTEX, reg ; \
+ orl $FUTEX_WAIT | FUTEX_CLOCK_REALTIME, reg
# define LOAD_FUTEX_WAKE(reg) \
xorl $FUTEX_PRIVATE_FLAG, reg ; \
andl %gs:PRIVATE_FUTEX, reg ; \
@@ -154,28 +160,81 @@
cfi_endproc
.size __lll_lock_wait,.-__lll_lock_wait
+ /* %ecx: futex
+ %esi: flags
+ %edx: timeout
+ %eax: futex value
+ */
.globl __lll_timedlock_wait
.type __lll_timedlock_wait,@function
.hidden __lll_timedlock_wait
.align 16
__lll_timedlock_wait:
cfi_startproc
+ pushl %ebp
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset(%ebp, 0)
+ pushl %ebx
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset(%ebx, 0)
+
+# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+# ifdef PIC
+ LOAD_PIC_REG (bx)
+ cmpl $0, __have_futex_clock_realtime@GOTOFF(%ebx)
+# else
+ cmpl $0, __have_futex_clock_realtime
+# endif
+ je .Lreltmo
+# endif
+
+ movl %ecx, %ebx
+ movl %esi, %ecx
+ movl %edx, %esi
+ movl $0xffffffff, %ebp
+ LOAD_FUTEX_WAIT_ABS (%ecx)
+
+ movl $2, %edx
+ cmpl %edx, %eax
+ jne 2f
+
+1: movl $SYS_futex, %eax
+ movl $2, %edx
+ ENTER_KERNEL
+
+2: xchgl %edx, (%ebx) /* NB: lock is implied */
+
+ testl %edx, %edx
+ jz 3f
+
+ cmpl $-ETIMEDOUT, %eax
+ je 4f
+ cmpl $-EINVAL, %eax
+ jne 1b
+4: movl %eax, %edx
+ negl %edx
+
+3: movl %edx, %eax
+7: popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
+ popl %ebp
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebp)
+ ret
+
+# ifndef __ASSUME_FUTEX_CLOCK_REALTIME
+.Lreltmo:
/* Check for a valid timeout value. */
cmpl $1000000000, 4(%edx)
jae 3f
+ pushl %esi
+ cfi_adjust_cfa_offset(4)
+ cfi_rel_offset(%esi, 0)
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)
+ cfi_rel_offset(%edi, 0)
/* Stack frame for the timespec and timeval structs. */
subl $8, %esp
@@ -236,23 +295,24 @@
6: addl $8, %esp
cfi_adjust_cfa_offset(-8)
+ popl %edi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%edi)
+ popl %esi
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%esi)
+7: popl %ebx
+ cfi_adjust_cfa_offset(-4)
+ cfi_restore(%ebx)
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)
movl %edx, %eax
ret
-3: movl $EINVAL, %eax
- ret
+3: movl $EINVAL, %edx
+ jmp 7b
+# endif
cfi_endproc
.size __lll_timedlock_wait,.-__lll_timedlock_wait
#endif
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysdep.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysdep.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/sysdep.h Sun Jan 4 00:08:21 2009
@@ -204,9 +204,11 @@
arg 3 %edx call-clobbered
arg 4 %esi call-saved
arg 5 %edi call-saved
+ arg 6 %ebp call-saved
The stack layout upon entering the function is:
+ 24(%esp) Arg# 6
20(%esp) Arg# 5
16(%esp) Arg# 4
12(%esp) Arg# 3
@@ -215,7 +217,7 @@
(%esp) Return address
(Of course a function with say 3 arguments does not have entries for
- arguments 4 and 5.)
+ arguments 4, 5, and 6.)
The following code tries hard to be optimal. A general assumption
(which is true according to the data books I have) is that