Skip to content

Commit

Permalink
* sysdeps/x86_64/cacheinfo.c (handle_amd): Fix computation of
Browse files Browse the repository at this point in the history
	associativity for fully-associative caches.
  • Loading branch information
Ulrich Drepper committed Aug 25, 2007
1 parent 80e7d6a commit 76fca9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2007-08-25 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/cacheinfo.c (handle_amd): Fix computation of
associativity for fully-associative caches.

* sysdeps/x86_64/cacheinfo.c (handle_amd): Handle L3 cache
requests. Fill on more associativity values for L2.
Patch mostly by Evandro Menezes.
Expand Down
14 changes: 6 additions & 8 deletions sysdeps/x86_64/cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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;
}
Expand All @@ -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:
Expand All @@ -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;
}
Expand Down

0 comments on commit 76fca9f

Please sign in to comment.