summaryrefslogtreecommitdiff
path: root/libc/sysdeps/x86_64
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:26:54 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:26:54 +0000
commit83584a7af898dd93c48600fe850d150c51b10899 (patch)
tree0affa8ffee374ab83e40501d8d8967a03569c44d /libc/sysdeps/x86_64
parent04b4d23592609edcd19fd5a461bbe6d3cc677b5b (diff)
downloadeglibc2-83584a7af898dd93c48600fe850d150c51b10899.tar.gz
Merge changes between r2424 and r3467 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@3468 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/x86_64')
-rw-r--r--libc/sysdeps/x86_64/cacheinfo.c66
-rw-r--r--libc/sysdeps/x86_64/dl-trampoline.S7
-rw-r--r--libc/sysdeps/x86_64/ldbl2mpn.c1
-rw-r--r--libc/sysdeps/x86_64/sched_cpucount.c26
4 files changed, 91 insertions, 9 deletions
diff --git a/libc/sysdeps/x86_64/cacheinfo.c b/libc/sysdeps/x86_64/cacheinfo.c
index f8217a175..793dc2d35 100644
--- a/libc/sysdeps/x86_64/cacheinfo.c
+++ b/libc/sysdeps/x86_64/cacheinfo.c
@@ -55,11 +55,13 @@ static const struct intel_02_cache_info
{ 0x45, _SC_LEVEL2_CACHE_SIZE, 2097152, 4, 32 },
{ 0x46, _SC_LEVEL3_CACHE_SIZE, 4194304, 4, 64 },
{ 0x47, _SC_LEVEL3_CACHE_SIZE, 8388608, 8, 64 },
+ { 0x48, _SC_LEVEL2_CACHE_SIZE, 3145728, 12, 64 },
{ 0x49, _SC_LEVEL2_CACHE_SIZE, 4194304, 16, 64 },
{ 0x4a, _SC_LEVEL3_CACHE_SIZE, 6291456, 12, 64 },
{ 0x4b, _SC_LEVEL3_CACHE_SIZE, 8388608, 16, 64 },
{ 0x4c, _SC_LEVEL3_CACHE_SIZE, 12582912, 12, 64 },
{ 0x4d, _SC_LEVEL3_CACHE_SIZE, 16777216, 16, 64 },
+ { 0x4e, _SC_LEVEL2_CACHE_SIZE, 6291456, 24, 64 },
{ 0x60, _SC_LEVEL1_DCACHE_SIZE, 16384, 8, 64 },
{ 0x66, _SC_LEVEL1_DCACHE_SIZE, 8192, 4, 64 },
{ 0x67, _SC_LEVEL1_DCACHE_SIZE, 16384, 4, 64 },
@@ -257,7 +259,8 @@ handle_amd (int name)
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
: "0" (0x80000000));
- if (name >= _SC_LEVEL3_CACHE_SIZE)
+ /* No level 4 cache (yet). */
+ if (name > _SC_LEVEL3_CACHE_LINESIZE)
return 0;
unsigned int fn = 0x80000005 + (name >= _SC_LEVEL2_CACHE_SIZE);
@@ -278,36 +281,87 @@ handle_amd (int name)
{
case _SC_LEVEL1_DCACHE_SIZE:
return (ecx >> 14) & 0x3fc00;
+
case _SC_LEVEL1_DCACHE_ASSOC:
ecx >>= 16;
if ((ecx & 0xff) == 0xff)
/* Fully associative. */
return (ecx << 2) & 0x3fc00;
return ecx & 0xff;
+
case _SC_LEVEL1_DCACHE_LINESIZE:
return ecx & 0xff;
+
case _SC_LEVEL2_CACHE_SIZE:
return (ecx & 0xf000) == 0 ? 0 : (ecx >> 6) & 0x3fffc00;
+
case _SC_LEVEL2_CACHE_ASSOC:
- ecx >>= 12;
- switch (ecx & 0xf)
+ switch ((ecx >> 12) & 0xf)
{
case 0:
case 1:
case 2:
case 4:
- return ecx & 0xf;
+ return (ecx >> 12) & 0xf;
case 6:
return 8;
case 8:
return 16;
- case 0xf:
- return (ecx << 6) & 0x3fffc00;
+ case 10:
+ return 32;
+ case 11:
+ return 48;
+ case 12:
+ return 64;
+ case 13:
+ return 96;
+ case 14:
+ return 128;
+ case 15:
+ return ((ecx >> 6) & 0x3fffc00) / (ecx & 0xff);
default:
return 0;
}
+ /* NOTREACHED */
+
case _SC_LEVEL2_CACHE_LINESIZE:
return (ecx & 0xf000) == 0 ? 0 : ecx & 0xff;
+
+ case _SC_LEVEL3_CACHE_SIZE:
+ return (edx & 0xf000) == 0 ? 0 : (edx & 0x3ffc0000) << 1;
+
+ case _SC_LEVEL3_CACHE_ASSOC:
+ switch ((edx >> 12) & 0xf)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 4:
+ return (edx >> 12) & 0xf;
+ case 6:
+ return 8;
+ case 8:
+ return 16;
+ case 10:
+ return 32;
+ case 11:
+ return 48;
+ case 12:
+ return 64;
+ case 13:
+ return 96;
+ case 14:
+ return 128;
+ case 15:
+ return ((edx & 0x3ffc0000) << 1) / (edx & 0xff);
+ default:
+ return 0;
+ }
+ /* NOTREACHED */
+
+ case _SC_LEVEL3_CACHE_LINESIZE:
+ return (edx & 0xf000) == 0 ? 0 : edx & 0xff;
+
default:
assert (! "cannot happen");
}
diff --git a/libc/sysdeps/x86_64/dl-trampoline.S b/libc/sysdeps/x86_64/dl-trampoline.S
index c1686dae1..84fe4724b 100644
--- a/libc/sysdeps/x86_64/dl-trampoline.S
+++ b/libc/sysdeps/x86_64/dl-trampoline.S
@@ -1,5 +1,5 @@
/* PLT trampolines. x86-64 version.
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -120,13 +120,14 @@ _dl_runtime_profile:
leaq 104(%rsp), %rsi
movq %rsp, %rbx
cfi_def_cfa_register (1)
+ movq %r10, %rcx
+ addq $8, %r10
+ andq $0xfffffffffffffff0, %r10
subq %r10, %rsp
movq %rsp, %rdi
- movq %r10, %rcx
shrq $3, %rcx
rep
movsq
- andq $0xfffffffffffffff0, %rsp
movq 32(%rbx), %rcx
movq 40(%rbx), %rsi
movq 48(%rbx), %rdi
diff --git a/libc/sysdeps/x86_64/ldbl2mpn.c b/libc/sysdeps/x86_64/ldbl2mpn.c
new file mode 100644
index 000000000..641b789cd
--- /dev/null
+++ b/libc/sysdeps/x86_64/ldbl2mpn.c
@@ -0,0 +1 @@
+#include "../i386/ldbl2mpn.c"
diff --git a/libc/sysdeps/x86_64/sched_cpucount.c b/libc/sysdeps/x86_64/sched_cpucount.c
new file mode 100644
index 000000000..63d84a62e
--- /dev/null
+++ b/libc/sysdeps/x86_64/sched_cpucount.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifdef __amdfam10
+# define POPCNT(l) \
+ ({ __cpu_mask r; \
+ asm ("popcntq %1, %0" : "=r" (r) : "0" (l)); \
+ r; })
+#endif
+
+#include <posix/sched_cpucount.c>