diff options
author | Ulrich Drepper <drepper@redhat.com> | 2007-08-25 17:24:23 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2007-08-25 17:24:23 +0000 |
commit | 76fca9f14a5fac1ab7a7b51e9bdff062fc364576 (patch) | |
tree | 28e1656ecb5220aef8d5a4e4964107739730195d /sysdeps/x86_64/cacheinfo.c | |
parent | 80e7d6a6d3c2894c281480f3131966fccdf881b7 (diff) | |
download | glibc-76fca9f14a5fac1ab7a7b51e9bdff062fc364576.tar.gz glibc-76fca9f14a5fac1ab7a7b51e9bdff062fc364576.tar.xz glibc-76fca9f14a5fac1ab7a7b51e9bdff062fc364576.zip |
* sysdeps/x86_64/cacheinfo.c (handle_amd): Fix computation of cvs/fedora-glibc-20070825T1839
associativity for fully-associative caches.
Diffstat (limited to 'sysdeps/x86_64/cacheinfo.c')
-rw-r--r-- | sysdeps/x86_64/cacheinfo.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sysdeps/x86_64/cacheinfo.c b/sysdeps/x86_64/cacheinfo.c index eef7fa8726..793dc2d357 100644 --- a/sysdeps/x86_64/cacheinfo.c +++ b/sysdeps/x86_64/cacheinfo.c @@ -296,14 +296,13 @@ handle_amd (int name) 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: @@ -319,7 +318,7 @@ handle_amd (int name) case 14: return 128; case 15: - return (ecx << 6) & 0x3fffc00; + return ((ecx >> 6) & 0x3fffc00) / (ecx & 0xff); default: return 0; } @@ -332,14 +331,13 @@ handle_amd (int name) return (edx & 0xf000) == 0 ? 0 : (edx & 0x3ffc0000) << 1; case _SC_LEVEL3_CACHE_ASSOC: - edx >>= 12; - switch (edx & 0xf) + switch ((edx >> 12) & 0xf) { case 0: case 1: case 2: case 4: - return edx & 0xf; + return (edx >> 12) & 0xf; case 6: return 8; case 8: @@ -355,7 +353,7 @@ handle_amd (int name) case 14: return 128; case 15: - return (edx & 0x3ffc0) << 13; + return ((edx & 0x3ffc0000) << 1) / (edx & 0xff); default: return 0; } |