Index: src/platform-linux.cc |
diff --git a/src/platform-linux.cc b/src/platform-linux.cc |
index 885683398e24fa36930a3118d2a0c31c1902b770..ef97449b6506d28569b833c930589b26f8c3d6ca 100644 |
--- a/src/platform-linux.cc |
+++ b/src/platform-linux.cc |
@@ -80,139 +80,6 @@ static Mutex* limit_mutex = NULL; |
#ifdef __arm__ |
-static bool CPUInfoContainsString(const char * search_string) { |
- const char* file_name = "/proc/cpuinfo"; |
- // This is written as a straight shot one pass parser |
- // and not using STL string and ifstream because, |
- // on Linux, it's reading from a (non-mmap-able) |
- // character special device. |
- FILE* f = NULL; |
- const char* what = search_string; |
- |
- if (NULL == (f = fopen(file_name, "r"))) { |
- OS::PrintError("Failed to open /proc/cpuinfo\n"); |
- return false; |
- } |
- |
- int k; |
- while (EOF != (k = fgetc(f))) { |
- if (k == *what) { |
- ++what; |
- while ((*what != '\0') && (*what == fgetc(f))) { |
- ++what; |
- } |
- if (*what == '\0') { |
- fclose(f); |
- return true; |
- } else { |
- what = search_string; |
- } |
- } |
- } |
- fclose(f); |
- |
- // Did not find string in the proc file. |
- return false; |
-} |
- |
- |
-bool OS::ArmCpuHasFeature(CpuFeature feature) { |
- const char* search_string = NULL; |
- // 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 |
- // facility is universally available on the ARM architectures, |
- // so it's up to individual OSes to provide such. |
- switch (feature) { |
- case VFP3: |
- search_string = "vfpv3"; |
- break; |
- case NEON: |
- search_string = "neon"; |
- break; |
- case ARMv7: |
- search_string = "ARMv7"; |
- break; |
- case SUDIV: |
- search_string = "idiva"; |
- break; |
- case VFP32DREGS: |
- // This case is handled specially below. |
- break; |
- default: |
- UNREACHABLE(); |
- } |
- |
- if (feature == VFP32DREGS) { |
- return ArmCpuHasFeature(VFP3) && !CPUInfoContainsString("d16"); |
- } |
- |
- 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")) { |
- return true; |
- } |
- } |
- |
- return false; |
-} |
- |
- |
-CpuImplementer OS::GetCpuImplementer() { |
- static bool use_cached_value = false; |
- static CpuImplementer cached_value = UNKNOWN_IMPLEMENTER; |
- if (use_cached_value) { |
- return cached_value; |
- } |
- if (CPUInfoContainsString("CPU implementer\t: 0x41")) { |
- cached_value = ARM_IMPLEMENTER; |
- } else if (CPUInfoContainsString("CPU implementer\t: 0x51")) { |
- cached_value = QUALCOMM_IMPLEMENTER; |
- } else { |
- cached_value = UNKNOWN_IMPLEMENTER; |
- } |
- use_cached_value = true; |
- return cached_value; |
-} |
- |
- |
-CpuPart OS::GetCpuPart(CpuImplementer implementer) { |
- static bool use_cached_value = false; |
- static CpuPart cached_value = CPU_UNKNOWN; |
- if (use_cached_value) { |
- return cached_value; |
- } |
- if (implementer == ARM_IMPLEMENTER) { |
- if (CPUInfoContainsString("CPU part\t: 0xc0f")) { |
- cached_value = CORTEX_A15; |
- } else if (CPUInfoContainsString("CPU part\t: 0xc0c")) { |
- cached_value = CORTEX_A12; |
- } else if (CPUInfoContainsString("CPU part\t: 0xc09")) { |
- cached_value = CORTEX_A9; |
- } else if (CPUInfoContainsString("CPU part\t: 0xc08")) { |
- cached_value = CORTEX_A8; |
- } else if (CPUInfoContainsString("CPU part\t: 0xc07")) { |
- cached_value = CORTEX_A7; |
- } else if (CPUInfoContainsString("CPU part\t: 0xc05")) { |
- cached_value = CORTEX_A5; |
- } else { |
- cached_value = CPU_UNKNOWN; |
- } |
- } else { |
- cached_value = CPU_UNKNOWN; |
- } |
- use_cached_value = true; |
- return cached_value; |
-} |
- |
bool OS::ArmUsingHardFloat() { |
// GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify |
@@ -255,60 +122,6 @@ bool OS::ArmUsingHardFloat() { |
#endif // def __arm__ |
-#ifdef __mips__ |
-bool OS::MipsCpuHasFeature(CpuFeature feature) { |
- const char* search_string = NULL; |
- const char* file_name = "/proc/cpuinfo"; |
- // Simple detection of FPU at runtime for Linux. |
- // It is based on /proc/cpuinfo, which reveals hardware configuration |
- // to user-space applications. According to MIPS (early 2010), no similar |
- // facility is universally available on the MIPS architectures, |
- // so it's up to individual OSes to provide such. |
- // |
- // This is written as a straight shot one pass parser |
- // and not using STL string and ifstream because, |
- // on Linux, it's reading from a (non-mmap-able) |
- // character special device. |
- |
- switch (feature) { |
- case FPU: |
- search_string = "FPU"; |
- break; |
- default: |
- UNREACHABLE(); |
- } |
- |
- FILE* f = NULL; |
- const char* what = search_string; |
- |
- if (NULL == (f = fopen(file_name, "r"))) { |
- OS::PrintError("Failed to open /proc/cpuinfo\n"); |
- return false; |
- } |
- |
- int k; |
- while (EOF != (k = fgetc(f))) { |
- if (k == *what) { |
- ++what; |
- while ((*what != '\0') && (*what == fgetc(f))) { |
- ++what; |
- } |
- if (*what == '\0') { |
- fclose(f); |
- return true; |
- } else { |
- what = search_string; |
- } |
- } |
- } |
- fclose(f); |
- |
- // Did not find string in the proc file. |
- return false; |
-} |
-#endif // def __mips__ |
- |
- |
const char* OS::LocalTimezone(double time) { |
if (std::isnan(time)) return ""; |
time_t tv = static_cast<time_t>(floor(time/msPerSecond)); |