This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][alpha] Fix _SC_LEVEL*CACHE*


sysconf() on alpha returns improper results for _SC_LEVEL*CACHE*
entries:

| LEVEL1_ICACHE_SIZE                 64
| LEVEL1_ICACHE_ASSOC                65536
| LEVEL1_ICACHE_LINESIZE             2
| LEVEL1_DCACHE_SIZE                 64
| LEVEL1_DCACHE_ASSOC                65536
|?LEVEL1_DCACHE_LINESIZE             2
| LEVEL2_CACHE_SIZE                  64
| LEVEL2_CACHE_ASSOC                 4194304
| LEVEL2_CACHE_LINESIZE              1

This is due to the entries number being not properly aligned on modulo
3. This probably used to work at some point, but now that more entries
have been added, it doesn't work anymore. The patch below fixes that.


2011-04-01  Aurelien Jarno  <aurelien@aurel32.net>

        * sysdeps/unix/sysv/linux/alpha/sysconf.c: Fix cache sysconf
	switch.

diff --git a/sysdeps/unix/sysv/linux/alpha/sysconf.c b/sysdeps/unix/sysv/linux/alpha/sysconf.c
index 51a2a47..30faa3f 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysconf.c
+++ b/sysdeps/unix/sysv/linux/alpha/sysconf.c
@@ -135,7 +135,7 @@ __sysconf (int name)
   if (shape <= 0)
     return shape;
 
-  switch (name % 3)
+  switch ((name - _SC_LEVEL1_ICACHE_SIZE) % 3)
     {
     case 0: /* total size */
       return shape & -0x100;
-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73aurelien@aurel32.net                 http://www.aurel32.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]