[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r8738 - in /fsf/trunk/libc: ./ malloc/ nptl/ nptl/sysdeps/x86_64/ sysdeps/i386/ sysdeps/i386/i686/ sysdeps/i386/i686/multiar...



Author: eglibc
Date: Sat Aug  1 00:04:44 2009
New Revision: 8738

Log:
Import glibc-mainline for 2009-08-01

Added:
    fsf/trunk/libc/sysdeps/i386/i686/cacheinfo.c
    fsf/trunk/libc/sysdeps/i386/i686/multiarch/
    fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile   (with props)
    fsf/trunk/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym
    fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.c
    fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.h
    fsf/trunk/libc/sysdeps/i386/i686/multiarch/sched_cpucount.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/i686/
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/i686/sysconf.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/malloc/Makefile
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/descr.h
    fsf/trunk/libc/nptl/sysdeps/x86_64/configure
    fsf/trunk/libc/sysdeps/i386/__longjmp.S
    fsf/trunk/libc/sysdeps/i386/i686/Makefile
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
    fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c
    fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c
    fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
    fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Aug  1 00:04:44 2009
@@ -1,3 +1,46 @@
+2009-07-31  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (longjmp_msg): Yet
+	another rewrite.  Much smaller and faster.
+	* sysdeps/unix/sysv/linux/i386/____longjmp_chk.S: Likewise.
+
+	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (longjmp_msg): Get
+	ss_flags from the correct location.
+
+2009-07-31  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/i386/i686/Makefile (sysdep_routines): Add cacheinfo.
+	* sysdeps/i386/i686/cacheinfo.c: New file.
+	* sysdeps/i386/i686/multiarch/Makefile: New file.
+	* sysdeps/i386/i686/multiarch/ifunc-defines.sym: New file.
+	* sysdeps/i386/i686/multiarch/init-arch.c: New file.
+	* sysdeps/i386/i686/multiarch/init-arch.h: New file.
+	* sysdeps/i386/i686/multiarch/sched_cpucount.c: New file.
+	* sysdeps/unix/sysv/linux/i386/i686/sysconf.c: New file.
+	* sysdeps/x86_64/cacheinfo.c: Include <cpuid.h>.
+	(__cpuid_count): New. Provide the default.
+	(__x86_64_prefetchw): Define only if DISABLE_PREFETCHW is not defined.
+	(__x86_64_preferred_memory_instruction): Define only if
+	DISABLE_PREFERRED_MEMORY_INSTRUCTION is not defined.
+	(intel_check_word): Use __cpuid.
+	(handle_intel): Likewise.
+	(handle_amd): Likewise.
+	(__cache_sysconf): Likewise.
+	(init_cacheinfo): Updated.  Use __cpuid and __cpuid_count.
+	(__cache_sysconf): Likewise.
+	(init_cacheinfo): Updated.  Use __cpuid and __cpuid_count.
+	* sysdeps/x86_64/multiarch/init-arch.c: Include <cpuid.h>.
+	(get_common_indeces): Use __cpuid.
+	(__init_cpu_features): Likewise.  Disable SSSE3 on Atom only
+	if ENABLE_SSSE3_ON_ATOM is not defined.
+	* sysdeps/x86_64/multiarch/init-arch.h (HAS_SSE2): Define.
+	* sysdeps/x86_64/multiarch/sched_cpucount.c (POPCNT): Use
+	popcnt instead of popcntq.
+
+2009-07-31  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* malloc/Makefile (CFLAGS-obstack.c): Add $(uses-callbacks).
+
 2009-07-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/i386/____longjmp_chk.S: New file.

Modified: fsf/trunk/libc/malloc/Makefile
==============================================================================
--- fsf/trunk/libc/malloc/Makefile (original)
+++ fsf/trunk/libc/malloc/Makefile Sat Aug  1 00:04:44 2009
@@ -104,6 +104,7 @@
 include ../Rules
 
 CFLAGS-mcheck-init.c = $(PIC-ccflag)
+CFLAGS-obstack.c = $(uses-callbacks)
 
 $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o
 	-rm -f $@

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sat Aug  1 00:04:44 2009
@@ -1,3 +1,7 @@
+2009-07-31  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* descr.h: Better definition of *_BITMASK macros for cancellation.
+
 2009-07-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/x86_64/tls.h (TLS_TCB_ALIGN): Define explicitly to 32.

Modified: fsf/trunk/libc/nptl/descr.h
==============================================================================
--- fsf/trunk/libc/nptl/descr.h (original)
+++ fsf/trunk/libc/nptl/descr.h Sat Aug  1 00:04:44 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2006, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -243,25 +243,25 @@
   int cancelhandling;
   /* Bit set if cancellation is disabled.  */
 #define CANCELSTATE_BIT		0
-#define CANCELSTATE_BITMASK	0x01
+#define CANCELSTATE_BITMASK	(0x01 << CANCELSTATE_BIT)
   /* Bit set if asynchronous cancellation mode is selected.  */
 #define CANCELTYPE_BIT		1
-#define CANCELTYPE_BITMASK	0x02
+#define CANCELTYPE_BITMASK	(0x01 << CANCELTYPE_BIT)
   /* Bit set if canceling has been initiated.  */
 #define CANCELING_BIT		2
-#define CANCELING_BITMASK	0x04
+#define CANCELING_BITMASK	(0x01 << CANCELING_BIT)
   /* Bit set if canceled.  */
 #define CANCELED_BIT		3
-#define CANCELED_BITMASK	0x08
+#define CANCELED_BITMASK	(0x01 << CANCELED_BIT)
   /* Bit set if thread is exiting.  */
 #define EXITING_BIT		4
-#define EXITING_BITMASK		0x10
+#define EXITING_BITMASK		(0x01 << EXITING_BIT)
   /* Bit set if thread terminated and TCB is freed.  */
 #define TERMINATED_BIT		5
-#define TERMINATED_BITMASK	0x20
+#define TERMINATED_BITMASK	(0x01 << TERMINATED_BIT)
   /* Bit set if thread is supposed to change XID.  */
 #define SETXID_BIT		6
-#define SETXID_BITMASK		0x40
+#define SETXID_BITMASK		(0x01 << SETXID_BIT)
   /* Mask for the rest.  Helps the compiler to optimize.  */
 #define CANCEL_RESTMASK		0xffffff80
 

Modified: fsf/trunk/libc/nptl/sysdeps/x86_64/configure
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/x86_64/configure (original)
+++ fsf/trunk/libc/nptl/sysdeps/x86_64/configure Sat Aug  1 00:04:44 2009
@@ -1,10 +1,42 @@
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/i386.
 
-{ echo "$as_me:$LINENO: checking for .cfi_personality and .cfi_lsda pseudo-ops" >&5
-echo $ECHO_N "checking for .cfi_personality and .cfi_lsda pseudo-ops... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for .cfi_personality and .cfi_lsda pseudo-ops" >&5
+$as_echo_n "checking for .cfi_personality and .cfi_lsda pseudo-ops... " >&6; }
 if test "${libc_cv_asm_cfi_personality+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
     cat > conftest.s <<EOF
 ${libc_cv_dot_text}
@@ -18,7 +50,7 @@
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
     libc_cv_asm_cfi_personality=yes
   else
@@ -27,10 +59,10 @@
   rm -f conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $libc_cv_asm_cfi_personality" >&5
-echo "${ECHO_T}$libc_cv_asm_cfi_personality" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $libc_cv_asm_cfi_personality" >&5
+$as_echo "$libc_cv_asm_cfi_personality" >&6; }
 if test x"$libc_cv_asm_cfi_personality" != xyes; then
-  { { echo "$as_me:$LINENO: error: assembler too old, .cfi_personality support missing" >&5
-echo "$as_me: error: assembler too old, .cfi_personality support missing" >&2;}
+  { { $as_echo "$as_me:$LINENO: error: assembler too old, .cfi_personality support missing" >&5
+$as_echo "$as_me: error: assembler too old, .cfi_personality support missing" >&2;}
    { (exit 1); exit 1; }; }
 fi

Modified: fsf/trunk/libc/sysdeps/i386/__longjmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/__longjmp.S (original)
+++ fsf/trunk/libc/sysdeps/i386/__longjmp.S Sat Aug  1 00:04:44 2009
@@ -33,9 +33,6 @@
 	movl (JB_SP*4)(%eax), %ecx
 	PTR_DEMANGLE (%edx)
 	PTR_DEMANGLE (%ecx)
-# ifdef CHECK_ESP
-	CHECK_ESP (%ecx)
-# endif
 	cfi_def_cfa(%eax, 0)
 	cfi_register(%eip, %edx)
 	cfi_register(%esp, %ecx)
@@ -57,12 +54,6 @@
 	movl %ecx, %esp
 #else
 	movl 4(%esp), %ecx	/* User's jmp_buf in %ecx.  */
-
-# ifdef CHECK_ESP
-	movl (JB_SP*4)(%ecx), %eax
-	CHECK_ESP (%eax)
-# endif
-
 	movl 8(%esp), %eax	/* Second argument is return value.  */
 	/* Save the return address now.  */
 	movl (JB_PC*4)(%ecx), %edx

Modified: fsf/trunk/libc/sysdeps/i386/i686/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/Makefile (original)
+++ fsf/trunk/libc/sysdeps/i386/i686/Makefile Sat Aug  1 00:04:44 2009
@@ -5,3 +5,7 @@
 
 # So that we can test __m128's alignment
 stack-align-test-flags += -msse
+
+ifeq ($(subdir),string)
+sysdep_routines += cacheinfo
+endif

Added: fsf/trunk/libc/sysdeps/i386/i686/cacheinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/cacheinfo.c (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/cacheinfo.c Sat Aug  1 00:04:44 2009
@@ -1,0 +1,8 @@
+#define __x86_64_data_cache_size_half __x86_data_cache_size_half
+#define __x86_64_shared_cache_size __x86_shared_cache_size
+#define __x86_64_shared_cache_size_half __x86_shared_cache_size_half
+
+#define DISABLE_PREFETCHW
+#define DISABLE_PREFERRED_MEMORY_INSTRUCTION
+
+#include <sysdeps/x86_64/cacheinfo.c>

Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile
==============================================================================
Binary file - no diff available.

Propchange: fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile
------------------------------------------------------------------------------
    svn:mime-type = audio/x-669-mod

Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/ifunc-defines.sym Sat Aug  1 00:04:44 2009
@@ -1,0 +1,17 @@
+#include "init-arch.h"
+#include <stddef.h>
+
+--
+
+CPU_FEATURES_SIZE	sizeof (struct cpu_features)
+KIND_OFFSET		offsetof (struct cpu_features, kind)
+CPUID_OFFSET		offsetof (struct cpu_features, cpuid)
+CPUID_SIZE		sizeof (struct cpuid_registers)
+CPUID_EAX_OFFSET	offsetof (struct cpuid_registers, eax)
+CPUID_EBX_OFFSET	offsetof (struct cpuid_registers, ebx)
+CPUID_ECX_OFFSET	offsetof (struct cpuid_registers, ecx)
+CPUID_EDX_OFFSET	offsetof (struct cpuid_registers, edx)
+FAMILY_OFFSET		offsetof (struct cpu_features, family)
+MODEL_OFFSET		offsetof (struct cpu_features, model)
+
+COMMON_CPUID_INDEX_1

Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.c (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.c Sat Aug  1 00:04:44 2009
@@ -1,0 +1,3 @@
+#define ENABLE_SSSE3_ON_ATOM
+
+#include <sysdeps/x86_64/multiarch/init-arch.c>

Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.h
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.h (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/init-arch.h Sat Aug  1 00:04:44 2009
@@ -1,0 +1,1 @@
+#include <sysdeps/x86_64/multiarch/init-arch.h>

Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/sched_cpucount.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/sched_cpucount.c (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/sched_cpucount.c Sat Aug  1 00:04:44 2009
@@ -1,0 +1,1 @@
+#include <sysdeps/x86_64/multiarch/sched_cpucount.c>

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S Sat Aug  1 00:04:44 2009
@@ -58,8 +58,6 @@
 	PTR_DEMANGLE (%edx)
 	PTR_DEMANGLE (%edi)
 
-	pushl	$0
-	cfi_adjust_cfa_offset(4)
 	cmpl	%edi, %esp
 	jbe	.Lok
 
@@ -69,15 +67,25 @@
 	movl	%esp, %ecx
 	movl	$__NR_sigaltstack, %eax
 	ENTER_KERNEL
-	movl	4(%esp), %ebx
-	addl	$12, %esp
+	/* Without working sigaltstack we cannot perform the test.  */
+	test	%eax, %eax
+	jne	.Lok2
+	testl	$1, 4(%esp)
+	jz	.Lfail
+
+	movl	(%esp), %eax
+	addl	8(%esp), %eax
+	subl	%edi, %eax
+	cmpl	8(%esp), %eax
+	jae	.Lok2
+
+.Lfail:	CALL_FAIL
+
+.Lok2:	addl	$12, %esp
 	cfi_adjust_cfa_offset(-12)
-	movl	8(%esp), %ecx
-	testl	%eax, %eax
-	jne	.Lok
-	andl	$1, %ebx
-	movl	%ebx, (%esp)
-.Lok:
+	movl	4(%esp), %ecx
+
+.Lok:	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%ecx, 0)
 	cfi_register(%eip, %edx)
 	cfi_register(%esp, %edi)
@@ -86,15 +94,11 @@
 	cfi_offset(%edi, JB_DI*4)
 	cfi_offset(%ebp, JB_BP*4)
 
-	movl	12(%esp), %eax	/* Second argument is return value.  */
-	xchgl	%edi, %esp
-	cfi_restore(%edi)
-
-	cmpl	%esp, %edi
-	jnbe	.Lcheck
+	movl	8(%esp), %eax	/* Second argument is return value.  */
+	movl	%edi, %esp
 
 	/* Restore registers.  */
-.Lout:	movl	(JB_BX*4)(%ecx), %ebx
+	movl	(JB_BX*4)(%ecx), %ebx
 	movl	(JB_SI*4)(%ecx), %esi
 	movl	(JB_DI*4)(%ecx), %edi
 	movl	(JB_BP*4)(%ecx), %ebp
@@ -105,39 +109,4 @@
 
 	/* Jump to saved PC.  */
 	jmp	*%edx
-
-	cfi_def_cfa(%ecx, 0)
-	cfi_register(%eip, %edx)
-	cfi_offset(%ebx, JB_BX*4)
-	cfi_offset(%esi, JB_SI*4)
-	cfi_offset(%edi, JB_DI*4)
-	cfi_offset(%ebp, JB_BP*4)
-
-.Lcheck:
-	cmpl	$0, (%edi)
-	je	.Lfail
-
-	subl	$12, %esp
-	cfi_adjust_cfa_offset(12)
-	xorl	%ebx, %ebx
-	movl	%esp, %ecx
-	movl	$__NR_sigaltstack, %eax
-	ENTER_KERNEL
-	testl	$1, 4(%esp)
-	leal	12(%esp), %esp
-	movl	8(%edi), %ecx
-	movl	12(%edi), %eax
-	cfi_adjust_cfa_offset(-12)
-	je	.Lout
-
-.Lfail:	xchgl	%edi, %esp
-	cfi_def_cfa(%esp, 8)
-	cfi_restore(%esp)
-	cfi_restore(%ebx)
-	cfi_restore(%esi)
-	cfi_undefined(%edi)
-	cfi_restore(%ebp)
-
-	CALL_FAIL
-	hlt
 END (____longjmp_chk)

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/i686/sysconf.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/i686/sysconf.c (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/i686/sysconf.c Sat Aug  1 00:04:44 2009
@@ -1,0 +1,1 @@
+#include <sysdeps/unix/sysv/linux/x86_64/sysconf.c>

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S Sat Aug  1 00:04:44 2009
@@ -58,31 +58,36 @@
 	PTR_DEMANGLE (%rdx)
 #endif
 
+	cmpq	%r8, %rsp
+	jbe	.Lok
+
 	/* Save function parameters.  */
 	movq	%rdi, %r10
 	movl	%esi, %ecx
 
-	xorl	%eax, %eax
-	cmpq	%r8, %rsp
-	jbe	.Lok
-
-	subq	$24, %rsp
-	cfi_adjust_cfa_offset(24)
 	xorl	%edi, %edi
-	movq	%rsp, %rsi
+	leaq	-24(%rsp), %rsi
 	movl	$__NR_sigaltstack, %eax
 	syscall
+	/* Without working sigaltstack we cannot perform the test.  */
 	testl	%eax, %eax
-	movl	$0, %eax
-	leaq	24(%rsp), %rsp
-	cfi_adjust_cfa_offset(-24)
-	jne	.Lok
-	movl	8(%rsp), %eax
-	andl	$1, %eax
+	jne	.Lok2
+	testl	$1, -16(%rsp)
+	jz	.Lfail
 
-.Lok:
-	/* We add unwind information for the target here.  */
-	cfi_def_cfa(%r10, 0)
+	movq	-24(%rsp), %rax
+	addq	-8(%rsp), %rax
+	subq	%r8, %rax
+	cmpq	-8(%rsp), %rax
+	jae	.Lok2
+
+.Lfail:	CALL_FAIL
+
+.Lok2:	movq	%r10, %rdi
+	movl	%ecx, %esi
+
+.Lok:	/* We add unwind information for the target here.  */
+	cfi_def_cfa(%rdi, 0)
 	cfi_register(%rsp,%r8)
 	cfi_register(%rbp,%r9)
 	cfi_register(%rip,%rdx)
@@ -91,55 +96,14 @@
 	cfi_offset(%r13,JB_R13*8)
 	cfi_offset(%r14,JB_R14*8)
 	cfi_offset(%r15,JB_R15*8)
-
-	xchgq	%r8, %rsp
-	cfi_restore(%rsp)
-	xchgq	%r9, %rbp
-	cfi_restore(%rbp)
-
-	movq	(JB_RBX*8)(%r10),%rbx
-	movq	(JB_R12*8)(%r10),%r12
-	movq	(JB_R13*8)(%r10),%r13
-	movq	(JB_R14*8)(%r10),%r14
-	movq	(JB_R15*8)(%r10),%r15
-
-	cmpq	%rsp, %r8
-	jnbe	.Lcheck
-
+	movq	(JB_RBX*8)(%rdi),%rbx
+	movq	(JB_R12*8)(%rdi),%r12
+	movq	(JB_R13*8)(%rdi),%r13
+	movq	(JB_R14*8)(%rdi),%r14
+	movq	(JB_R15*8)(%rdi),%r15
 	/* Set return value for setjmp.  */
-.Lout:	movl	%ecx, %eax
+	movl	%esi, %eax
+	movq	%r8,%rsp
+	movq	%r9,%rbp
 	jmpq	*%rdx
-
-.Lcheck:
-	testl	%eax, %eax
-	je	.Lfail
-
-	subq	$24, %rsp
-	cfi_adjust_cfa_offset(24)
-	xorl	%edi, %edi
-	movq	%rsp, %rsi
-	movl	$__NR_sigaltstack, %eax
-	syscall
-	addq	$24, %rsp
-	cfi_adjust_cfa_offset(-24)
-	testl	$1, 8(%rsp)
-	je	.Lout
-
-.Lfail:	xchgq	%r8, %rsp
-	/* We want the stack trace to show that of the caller.  */
-	cfi_def_cfa(%rsp, 8)
-	cfi_restore(%rsp)
-	cfi_register(%rbp, %r9)
-	cfi_restore(%rip)
-	cfi_restore(%rbx)
-	cfi_restore(%r12)
-	cfi_restore(%r13)
-	cfi_restore(%r14)
-	cfi_restore(%r15)
-
-	xchgq	%r9, %rbp
-	cfi_restore(%rbp)
-
-	CALL_FAIL
-	hlt
 END (BP_SYM (____longjmp_chk))

Modified: fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/cacheinfo.c Sat Aug  1 00:04:44 2009
@@ -22,6 +22,26 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <cpuid.h>
+
+#ifndef __cpuid_count
+/* FIXME: Provide __cpuid_count if it isn't defined.  Copied from gcc
+   4.4.0.  Remove this if gcc 4.4 is the minimum requirement.  */
+# if defined(__i386__) && defined(__PIC__)
+/* %ebx may be the PIC register.  */
+#  define __cpuid_count(level, count, a, b, c, d)		\
+  __asm__ ("xchg{l}\t{%%}ebx, %1\n\t"			\
+	   "cpuid\n\t"					\
+	   "xchg{l}\t{%%}ebx, %1\n\t"			\
+	   : "=a" (a), "=r" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level), "2" (count))
+# else
+#  define __cpuid_count(level, count, a, b, c, d)		\
+  __asm__ ("cpuid\n\t"					\
+	   : "=a" (a), "=b" (b), "=c" (c), "=d" (d)	\
+	   : "0" (level), "2" (count))
+# endif
+#endif
 
 #ifdef USE_MULTIARCH
 # include "multiarch/init-arch.h"
@@ -176,9 +196,7 @@
 	      unsigned int ebx;
 	      unsigned int ecx;
 	      unsigned int edx;
-	      asm volatile ("cpuid"
-			    : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-			    : "0" (1));
+	      __cpuid (1, eax, ebx, ecx, edx);
 
 	      family = ((eax >> 20) & 0xff) + ((eax >> 8) & 0xf);
 	      model = (((eax >>16) & 0xf) << 4) + ((eax >> 4) & 0xf);
@@ -250,9 +268,7 @@
       unsigned int ebx;
       unsigned int ecx;
       unsigned int edx;
-      asm volatile ("cpuid"
-		    : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		    : "0" (2));
+      __cpuid (2, eax, ebx, ecx, edx);
 
       /* The low byte of EAX in the first round contain the number of
 	 rounds we have to make.  At least one, the one we are already
@@ -296,9 +312,7 @@
   unsigned int ebx;
   unsigned int ecx;
   unsigned int edx;
-  asm volatile ("cpuid"
-		: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		: "0" (0x80000000));
+  __cpuid (0x80000000, eax, ebx, ecx, edx);
 
   /* No level 4 cache (yet).  */
   if (name > _SC_LEVEL3_CACHE_LINESIZE)
@@ -308,9 +322,7 @@
   if (eax < fn)
     return 0;
 
-  asm volatile ("cpuid"
-		: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		: "0" (fn));
+  __cpuid (fn, eax, ebx, ecx, edx);
 
   if (name < _SC_LEVEL1_DCACHE_SIZE)
     {
@@ -424,9 +436,7 @@
   unsigned int ebx;
   unsigned int ecx;
   unsigned int edx;
-  asm volatile ("cpuid"
-		: "=a" (max_cpuid), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		: "0" (0));
+  __cpuid (0, max_cpuid, ebx, ecx, edx);
 #endif
 
   if (is_intel)
@@ -449,9 +459,13 @@
    L2 or L3 size.  */
 long int __x86_64_shared_cache_size_half attribute_hidden = 1024 * 1024 / 2;
 long int __x86_64_shared_cache_size attribute_hidden = 1024 * 1024;
+
+#ifndef DISABLE_PREFETCHW
 /* PREFETCHW support flag for use in memory and string routines.  */
 int __x86_64_prefetchw attribute_hidden;
-
+#endif
+
+#ifndef DISABLE_PREFERRED_MEMORY_INSTRUCTION
 /* Instructions preferred for memory and string routines.
 
   0: Regular instructions
@@ -461,6 +475,7 @@
 
   */
 int __x86_64_preferred_memory_instruction attribute_hidden;
+#endif
 
 
 static void
@@ -483,9 +498,7 @@
     __init_cpu_features ();
 #else
   int max_cpuid;
-  asm volatile ("cpuid"
-		: "=a" (max_cpuid), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		: "0" (0));
+  __cpuid (0, max_cpuid, ebx, ecx, edx);
 #endif
 
   if (is_intel)
@@ -509,17 +522,17 @@
       ecx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx;
       edx = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx;
 #else
-      asm volatile ("cpuid"
-		    : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		    : "0" (1));
-#endif
-
+      __cpuid (1, eax, ebx, ecx, edx);
+#endif
+
+#ifndef DISABLE_PREFERRED_MEMORY_INSTRUCTION
       /* Intel prefers SSSE3 instructions for memory/string routines
 	 if they are avaiable.  */
       if ((ecx & 0x200))
 	__x86_64_preferred_memory_instruction = 3;
       else
 	__x86_64_preferred_memory_instruction = 2;
+#endif
 
       /* Figure out the number of logical threads that share the
 	 highest cache level.  */
@@ -530,9 +543,7 @@
 	  /* Query until desired cache level is enumerated.  */
 	  do
 	    {
-              asm volatile ("cpuid"
-		            : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		            : "0" (4), "2" (i++));
+	      __cpuid_count (4, i++, eax, ebx, ecx, edx);
 
 	      /* There seems to be a bug in at least some Pentium Ds
 		 which sometimes fail to iterate all cache parameters.
@@ -566,9 +577,7 @@
       shared = handle_amd (_SC_LEVEL3_CACHE_SIZE);
 
       /* Get maximum extended function. */
-      asm volatile ("cpuid"
-		    : "=a" (max_cpuid_ex), "=b" (ebx), "=c" (ecx), "=d" (edx)
-		    : "0" (0x80000000));
+      __cpuid (0x80000000, max_cpuid_ex, ebx, ecx, edx);
 
       if (shared <= 0)
 	/* No shared L3 cache.  All we have is the L2 cache.  */
@@ -579,10 +588,7 @@
 	  if (max_cpuid_ex >= 0x80000008)
 	    {
 	      /* Get width of APIC ID.  */
-	      asm volatile ("cpuid"
-			    : "=a" (max_cpuid_ex), "=b" (ebx), "=c" (ecx),
-			      "=d" (edx)
-			    : "0" (0x80000008));
+	      __cpuid (0x80000008, max_cpuid_ex, ebx, ecx, edx);
 	      threads = 1 << ((ecx >> 12) & 0x0f);
 	    }
 
@@ -590,10 +596,7 @@
 	    {
 	      /* If APIC ID width is not available, use logical
 		 processor count.  */
-	      asm volatile ("cpuid"
-			    : "=a" (max_cpuid_ex), "=b" (ebx), "=c" (ecx),
-			      "=d" (edx)
-			    : "0" (0x00000001));
+	      __cpuid (0x00000001, max_cpuid_ex, ebx, ecx, edx);
 
 	      if ((edx & (1 << 28)) != 0)
 		threads = (ebx >> 16) & 0xff;
@@ -608,15 +611,15 @@
 	  shared += core;
 	}
 
+#ifndef DISABLE_PREFETCHW
       if (max_cpuid_ex >= 0x80000001)
 	{
-	  asm volatile ("cpuid"
-			: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
-			: "0" (0x80000001));
+	  __cpuid (0x80000001, eax, ebx, ecx, edx);
 	  /*  PREFETCHW     || 3DNow!  */
 	  if ((ecx & 0x100) || (edx & 0x80000000))
 	    __x86_64_prefetchw = -1;
 	}
+#endif
     }
 
   if (data > 0)

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.c Sat Aug  1 00:04:44 2009
@@ -18,6 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <cpuid.h>
 #include "init-arch.h"
 
 
@@ -27,12 +28,10 @@
 static void
 get_common_indeces (void)
 {
-  asm volatile ("cpuid"
-		: "=a" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax),
-		  "=b" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx),
-		  "=c" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx),
-		  "=d" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx)
-		: "0" (1));
+  __cpuid (1, __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax,
+	   __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx,
+	   __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx,
+	   __cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx);
 
   unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
   __cpu_features.family = (eax >> 8) & 0x0f;
@@ -47,10 +46,7 @@
   unsigned int ecx;
   unsigned int edx;
 
-  asm volatile ("cpuid"
-		: "=a" (__cpu_features.max_cpuid), "=b" (ebx), "=c" (ecx),
-		  "=d" (edx)
-		: "0" (0));
+  __cpuid (0, __cpu_features.max_cpuid, ebx, ecx, edx);
 
   /* This spells out "GenuineIntel".  */
   if (ebx == 0x756e6547 && ecx == 0x6c65746e && edx == 0x49656e69)
@@ -71,9 +67,11 @@
 	{
 	  __cpu_features.model += extended_model;
 
+#ifndef ENABLE_SSSE3_ON_ATOM
 	  if (__cpu_features.model == 0x1c)
 	    /* Avoid SSSE3 on Atom since it is slow.  */
 	    __cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx &= ~(1 << 9);
+#endif
 	}
     }
   /* This spells out "AuthenticAMD".  */

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h Sat Aug  1 00:04:44 2009
@@ -61,6 +61,9 @@
 /* Following are the feature tests used throughout libc.  */
 
 #ifndef NOT_IN_libc
+# define HAS_SSE2 \
+  ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx & (1 << 26)) != 0)
+
 # define HAS_POPCOUNT \
   ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0)
 
@@ -70,6 +73,9 @@
 # define HAS_FMA \
   ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 12)) != 0)
 #else
+# define HAS_SSE2 \
+  ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].edx & (1 << 26)) != 0)
+
 # define HAS_POPCOUNT \
   ((__get_cpu_features ()->cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0)
 

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/sched_cpucount.c Sat Aug  1 00:04:44 2009
@@ -27,7 +27,7 @@
 
 #define POPCNT(l) \
   ({ __cpu_mask r; \
-     asm ("popcntq %1, %0" : "=r" (r) : "0" (l));\
+     asm ("popcnt %1, %0" : "=r" (r) : "0" (l));\
      r; })
 #define __sched_cpucount static popcount_cpucount
 #include <posix/sched_cpucount.c>