Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-08-29 10:16:47 +0300
committerCorinna Vinschen <corinna@vinschen.de>2015-08-29 10:16:47 +0300
commit38fd7ddb790609db3e91540d183fb8b62250d969 (patch)
treed4e89397a7d1f80da69e79bbf7752633ae2f9507 /newlib/libc
parent35d5d87540c3262c341c35e974d0d3a53ce30684 (diff)
Allow sysconf to return CPU cache information
* include/sys/unistd.h (_SC_LEVEL*): Add cache-related variables as on Linux. * fhandler_proc.cc (format_proc_cpuinfo): Fetch cache information from new cache functions in sysconf.cc, get_cpu_cache_intel and get_cpu_cache_amd. * sysconf.cc (__nt_query_system): New local helper. (get_nproc_values): Utilize __nt_query_system on pre-Windows 7 systems. Use GetLogicalProcessorInformationEx otherwise to handle more than 64 CPUs. Only handle _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN. (get_phys_pages): New helper to handle _SC_PHYS_PAGES. (cpuid2_cache_descriptor): New array to map Intel CPUID 2 descriptor values to cache type, cache size, associativity and linesize. (cpuid2_cache_desc_compar): Comparision function for bsearch over cpuid2_cache_descriptor. (get_cpu_cache_intel_cpuid2): New function to fetch cache info from Intel CPUID 2. (get_cpu_cache_intel_cpuid4): Ditto from Intel CPUID 4. (get_cpu_cache_intel): New function as CPU-specific entry point. (assoc): New array to map associativity values from AMD CPUID 0x80000006. (get_cpu_cache_amd): New function to fetch cache info from AMD CPUIDs 0x80000005 and 0x80000006. (get_cpu_cache): New function to fetch cache info. (sca): Call get_phys_pages if _SC_PHYS_PAGES is requested. Call get_cpu_cache for new _SC_* cache requests. (SC_MAX): Set to _SC_LEVEL4_CACHE_LINESIZE. (get_phys_pages(void)): Call get_phys_pages(int). * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * new-features.xml (ov-new2.3): Document sysconf cache addition. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/include/sys/unistd.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index eb26921cc..a1ad12e05 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -425,6 +425,21 @@ int _EXFUN(unlinkat, (int, const char *, int));
#define _SC_THREAD_ROBUST_PRIO_INHERIT 122
#define _SC_THREAD_ROBUST_PRIO_PROTECT 123
#define _SC_XOPEN_UUCP 124
+#define _SC_LEVEL1_ICACHE_SIZE 125
+#define _SC_LEVEL1_ICACHE_ASSOC 126
+#define _SC_LEVEL1_ICACHE_LINESIZE 127
+#define _SC_LEVEL1_DCACHE_SIZE 128
+#define _SC_LEVEL1_DCACHE_ASSOC 129
+#define _SC_LEVEL1_DCACHE_LINESIZE 130
+#define _SC_LEVEL2_CACHE_SIZE 131
+#define _SC_LEVEL2_CACHE_ASSOC 132
+#define _SC_LEVEL2_CACHE_LINESIZE 133
+#define _SC_LEVEL3_CACHE_SIZE 134
+#define _SC_LEVEL3_CACHE_ASSOC 135
+#define _SC_LEVEL3_CACHE_LINESIZE 136
+#define _SC_LEVEL4_CACHE_SIZE 137
+#define _SC_LEVEL4_CACHE_ASSOC 138
+#define _SC_LEVEL4_CACHE_LINESIZE 139
/*
* pathconf values per IEEE Std 1003.1, 2008 Edition