summaryrefslogtreecommitdiff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-08-25 18:55:07 +0000
committerJakub Jelinek <jakub@redhat.com>2007-08-25 18:55:07 +0000
commitdd3394742b3e2e01f403b1c1b41ed39273b2212e (patch)
tree5fed86738b0d518989679f3194f896fc9fcebbe2 /sysdeps/x86_64
parent9b0cdd693e7f54fd35fd58931b940efe6ccb88cd (diff)
Updated to fedora-glibc-20070825T1839
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/cacheinfo.c64
-rw-r--r--sysdeps/x86_64/dl-trampoline.S7
2 files changed, 62 insertions, 9 deletions
diff --git a/sysdeps/x86_64/cacheinfo.c b/sysdeps/x86_64/cacheinfo.c
index 8855b6d45f..793dc2d357 100644
--- a/sysdeps/x86_64/cacheinfo.c
+++ b/sysdeps/x86_64/cacheinfo.c
@@ -259,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);
@@ -280,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/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
index c1686dae10..84fe4724b1 100644
--- a/sysdeps/x86_64/dl-trampoline.S
+++ b/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