From: Petar Jovanovic Date: Mon, 23 Nov 2015 15:35:54 +0000 (+0000) Subject: mips: improve recognition of different MIPS processors X-Git-Tag: svn/VALGRIND_3_12_0~287 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f90bbf2004569e53b4a58469f51403639af37fb1;p=thirdparty%2Fvalgrind.git mips: improve recognition of different MIPS processors Recognize correctly MIPS processors. Previously, for some of the cpu models, Valgrind would incorrectly assume it is a regular MIPS model, as it would find word MIPS in /proc/cpuinfo that came from "BogoMIPS" label. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15736 --- diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index 6110c930ff..33ed3b405b 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -703,10 +703,13 @@ static UInt VG_(get_machine_model)(void) /* Read /proc/cpuinfo and return the machine model. */ static UInt VG_(get_machine_model)(void) { - const char *search_MIPS_str = "MIPS"; - const char *search_Broadcom_str = "Broadcom"; - const char *search_Netlogic_str = "Netlogic"; - const char *search_Cavium_str= "Cavium"; + const char *search_Broadcom_str = "cpu model\t\t: Broadcom"; + const char *search_Cavium_str= "cpu model\t\t: Cavium"; + const char *search_Ingenic_str= "cpu model\t\t: Ingenic"; + const char *search_Loongson_str= "cpu model\t\t: ICT Loongson"; + const char *search_MIPS_str = "cpu model\t\t: MIPS"; + const char *search_Netlogic_str = "cpu model\t\t: Netlogic"; + Int n, fh; SysRes fd; SizeT num_bytes, file_buf_size; @@ -747,14 +750,18 @@ static UInt VG_(get_machine_model)(void) VG_(close)(fh); /* Parse file */ - if (VG_(strstr) (file_buf, search_Broadcom_str) != NULL) + if (VG_(strstr)(file_buf, search_Broadcom_str) != NULL) return VEX_PRID_COMP_BROADCOM; - if (VG_(strstr) (file_buf, search_Netlogic_str) != NULL) + if (VG_(strstr)(file_buf, search_Netlogic_str) != NULL) return VEX_PRID_COMP_NETLOGIC; if (VG_(strstr)(file_buf, search_Cavium_str) != NULL) return VEX_PRID_COMP_CAVIUM; - if (VG_(strstr) (file_buf, search_MIPS_str) != NULL) + if (VG_(strstr)(file_buf, search_MIPS_str) != NULL) return VEX_PRID_COMP_MIPS; + if (VG_(strstr)(file_buf, search_Ingenic_str) != NULL) + return VEX_PRID_COMP_INGENIC_E1; + if (VG_(strstr)(file_buf, search_Loongson_str) != NULL) + return (VEX_PRID_COMP_LEGACY | VEX_PRID_IMP_LOONGSON_64); /* Did not find string in the proc file. */ return -1;