From: Tom Hughes Date: Sat, 2 Apr 2005 17:30:19 +0000 (+0000) Subject: Get cache detection going again on x86. X-Git-Tag: svn/VALGRIND_3_0_0~809 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=738816fc3cd06541f01127a6d8e26d533f049a07;p=thirdparty%2Fvalgrind.git Get cache detection going again on x86. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3509 --- diff --git a/cachegrind/amd64/cg_arch.c b/cachegrind/amd64/cg_arch.c index 209d26511a..b82c4e2860 100644 --- a/cachegrind/amd64/cg_arch.c +++ b/cachegrind/amd64/cg_arch.c @@ -250,17 +250,16 @@ Int get_caches_from_CPUID(cache_t* I1c, cache_t* D1c, cache_t* L2c) { Int level, ret; Char vendor_id[13]; - /* Trap for illegal instruction, in case it's a really old processor that - * doesn't support CPUID. */ - if (VG_(has_cpuid)()) { - VG_(cpuid)(0, &level, (int*)&vendor_id[0], - (int*)&vendor_id[8], (int*)&vendor_id[4]); - vendor_id[12] = '\0'; - } else { + + if (!VG_(has_cpuid)()) { VG_(message)(Vg_DebugMsg, "CPUID instruction not supported"); return -1; } + VG_(cpuid)(0, &level, (int*)&vendor_id[0], + (int*)&vendor_id[8], (int*)&vendor_id[4]); + vendor_id[12] = '\0'; + if (0 == level) { VG_(message)(Vg_DebugMsg, "CPUID level is 0, early Pentium?\n"); return -1; diff --git a/cachegrind/x86/cg_arch.c b/cachegrind/x86/cg_arch.c index e284740873..1372b66332 100644 --- a/cachegrind/x86/cg_arch.c +++ b/cachegrind/x86/cg_arch.c @@ -35,7 +35,6 @@ // Probably only works for Intel and AMD chips, and probably only for some of // them. -#if 0 static void micro_ops_warn(Int actual_size, Int used_size, Int line_size) { VG_(message)(Vg_DebugMsg, @@ -245,25 +244,18 @@ Int AMD_cache_info(cache_t* I1c, cache_t* D1c, cache_t* L2c) return 0; } -#endif static Int get_caches_from_CPUID(cache_t* I1c, cache_t* D1c, cache_t* L2c) { - VG_(message)(Vg_DebugMsg, "Can't auto-detect CPUID yet, giving up"); - return -1; -#if 0 Int level, ret; Char vendor_id[13]; -// tl_assert(res == 0); -// -// res = VG_(sigaction)( VKI_SIGILL, &sigill_new, &sigill_saved ); -// tl_assert(res == 0); if (!VG_(has_cpuid)()) { VG_(message)(Vg_DebugMsg, "CPUID instruction not supported"); return -1; } + VG_(cpuid)(0, &level, (int*)&vendor_id[0], (int*)&vendor_id[8], (int*)&vendor_id[4]); vendor_id[12] = '\0'; @@ -305,7 +297,6 @@ Int get_caches_from_CPUID(cache_t* I1c, cache_t* D1c, cache_t* L2c) L2c->size *= 1024; return ret; -#endif }