Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Unified Diff: src/platform-linux.cc

Issue 5862002: Version 3.0.2. (Closed)
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« ChangeLog ('K') | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform-linux.cc
diff --git a/src/platform-linux.cc b/src/platform-linux.cc
index 7efb25de94f790aa877b0f702b98f2b178e73e3c..46c74b017ff0181bd8b2b6ccedd5f51def079cd0 100644
--- a/src/platform-linux.cc
+++ b/src/platform-linux.cc
@@ -134,7 +134,9 @@ static bool CPUInfoContainsString(const char * search_string) {
}
bool OS::ArmCpuHasFeature(CpuFeature feature) {
- const char* search_string = NULL;
+ const int max_items = 2;
+ const char* search_strings[max_items] = { NULL, NULL };
+ int search_items = 0;
// Simple detection of VFP at runtime for Linux.
// It is based on /proc/cpuinfo, which reveals hardware configuration
// to user-space applications. According to ARM (mid 2009), no similar
@@ -142,26 +144,25 @@ bool OS::ArmCpuHasFeature(CpuFeature feature) {
// so it's up to individual OSes to provide such.
switch (feature) {
case VFP3:
- search_string = "vfpv3";
+ search_strings[0] = "vfpv3";
+ // Some old kernels will report vfp for A8, not vfpv3, so we check for
+ // A8 explicitely. The cpuinfo file report the CPU Part which for Cortex
+ // A8 is 0xc08.
+ search_strings[1] = "0xc08";
+ search_items = 2;
+ ASSERT(search_items <= max_items);
break;
case ARMv7:
- search_string = "ARMv7";
+ search_strings[0] = "ARMv7" ;
+ search_items = 1;
+ ASSERT(search_items <= max_items);
break;
default:
UNREACHABLE();
}
- if (CPUInfoContainsString(search_string)) {
- return true;
- }
-
- if (feature == VFP3) {
- // Some old kernels will report vfp not vfpv3. Here we make a last attempt
- // to detect vfpv3 by checking for vfp *and* neon, since neon is only
- // available on architectures with vfpv3.
- // Checking neon on its own is not enough as it is possible to have neon
- // without vfp.
- if (CPUInfoContainsString("vfp") && CPUInfoContainsString("neon")) {
+ for (int i = 0; i < search_items; ++i) {
+ if (CPUInfoContainsString(search_strings[i])) {
return true;
}
}
« ChangeLog ('K') | « src/parser.cc ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698