示例#1
0
enum MACHTYPE ProbeArch()
{
   enum ARCHFAM fam;
   enum MACHTYPE mach=MACHOther;
   int ierr, i;
   char res[1024];

   fam = ProbeArchFam(NULL);
   switch(fam)
   {
   case AFIA64:
      res[0] = '\0';
      ierr = CmndOneLine(NULL, "hinv -c processor | fgrep 'Itanium'", res);
      if (!ierr && res[0] != '\0')
      {
         if (strstr(res, "Itanium 2")) mach = IA64Itan2;
         else if (strstr(res, "Itanium")) mach = IA64Itan;
      }
      break;
   case AFMIPS:
      res[0] = '\0';
      ierr = CmndOneLine(NULL, "hinv -c processor | fgrep 'CPU'", res);
      if (!ierr && res[0] != '\0')
      {
         if (strstr(res, "R12000") || strstr(res, "R10000") ||
             strstr(res, "R14000") || strstr(res, "R16000"))
            mach = MIPSR1xK;
      }
      break;
   }
   return(mach);
}
示例#2
0
enum MACHTYPE ProbeArch()
{
   enum ARCHFAM fam;
   enum MACHTYPE mach=MACHOther;
   int ierr, i;
   char *res;

   fam = ProbeArchFam(NULL);
   switch(fam)
   {
   case AFPPC: /* don't know */
      res = atlsys_1L(NULL, "/usr/sbin/prtconf | fgrep 'Processor Type'", 0, 0);
      if (res)
      {
         if (strstr(res, "PowerPC_POWER5"))
            mach = IbmPwr5;
         else if (strstr(res, "PowerPC_POWER7"))
            mach = IbmPwr7;
         else if (strstr(res, "PowerPC_POWER6"))
            mach = IbmPwr6;
         else if (strstr(res, "PowerPC_POWER4"))
            mach = IbmPwr4;
         free(res);
      }
      break;
   }
   return(mach);
}
示例#3
0
enum MACHTYPE ProbeArch()
{
   enum ARCHFAM fam;
   enum MACHTYPE mach=MACHOther;
   int ierr, i;
   char res[1024];

   fam = ProbeArchFam(NULL);
   switch(fam)
   {
   case AFSPARC:
      if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -pv | fgrep UltraSPARC", res))
      {
         if (strstr(res, "UltraSPARC-IV"))
            mach = SunUSIV;
         else if (strstr(res, "UltraSPARC-III"))
            mach = SunUSIII;
         else if (strstr(res, "UltraSPARC-II"))
            mach = SunUSII;
         else if (strstr(res, "UltraSPARC-I"))
            mach = SunUSI;
      }
/*
 *    sparcv9 could be UltraSPARC I,II, III or IV.  Only USIII/IV run faster
 *    than 650Mhz (AFAIK), and as far as ATLAS is concerned, USIII & IV are
 *    same processor; so declare anything with Mhz > 700 as an USIII.  Newer
 *    chips should have the newer psrinfo used above, which allows more
 *    precise determination anyway.  Actually, USIII redesign happened at
 *    1050Mhz, so I should probably call anything Mhz > 1040 an USIV, but
 *    I assume most USIV will have the newer SunOS/psrinfo above, so declare
 *    anything using this to be USIII, to minimize user confusion.
 */
      else if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep sparcv9", res))
      {
         mach = SunUSX;
         if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep MHz", res))
         {
            i = GetIntBeforeWord("MHz", res);
            if (i != BADINT && i > 700) mach = SunUSIII;
         }
         else if (!CmndOneLine(NULL, "/usr/sbin/psrinfo -v | fgrep GHz", res))
            mach = SunUSIII;
      }
      break;
   }
   return(mach);
}
示例#4
0
enum MACHTYPE ProbeArch()
{
   enum ARCHFAM fam;
   enum MACHTYPE mach=MACHOther;
   int ierr, i;
   char res[1024];

   fam = ProbeArchFam(NULL);
   switch(fam)
   {
   case AFPPC:
      if ( !CmndOneLine(NULL, "cat /proc/cpuinfo | fgrep cpu", res) )
      {
#if 0
         if (strstr(res, "604e")) mach = PPC604e;
         else if (strstr(res, "604")) mach = PPC604;
         else
#endif
         if (strstr(res, "G4")) mach = PPCG4;
         else if (strstr(res, "7400")) mach = PPCG4;
         else if (strstr(res, "7410")) mach = PPCG4;
         else if (strstr(res, "7447")) mach = PPCG4;
         else if (strstr(res, "7455")) mach = PPCG4;
         else if (strstr(res, "PPC970FX")) mach = PPCG5;
         else if (strstr(res, "PPC970MP")) mach = PPCG5;
         else if (strstr(res, "POWER7")) mach = IbmPwr7;
         else if (strstr(res, "POWER6")) mach = IbmPwr6;
         else if (strstr(res, "POWER5")) mach = IbmPwr5;
         else if (strstr(res, "POWER4")) mach = IbmPwr4;
      }
      break;
   case AFMIPS:
      res[0] = '\0';
      ierr = CmndOneLine(NULL, "fgrep 'cpu model' /proc/cpuinfo", res);
      if (!ierr && res[0] != '\0')
      {
         if (strstr(res, "ICE9"))
            mach = MIPSICE9;
/*
 *       I have no access to what cpuinfo on Linux does for this procs, so this
 *       is a WAG as to what it would say
 */
         else if (strstr(res, "R10000") || strstr(res, "R12000") ||
                  strstr(res, "R12000") || strstr(res, "R14000"))
            mach = MIPSR1xK;
      }
      break;
   case AFIA64:
      res[0] = '\0';
      ierr = CmndOneLine(NULL, "fgrep 'IA-64' /proc/cpuinfo", res);
      if (ierr || res[0] == '\0')
         ierr = CmndOneLine(NULL, "fgrep \"model name\" /proc/cpuinfo", res);
      if (!ierr && res[0] != '\0')
      {
         if (strstr(res, "IA-64") || strstr(res, "McKinley"))
            mach = IA64Itan2;
         else if (strstr(res, "Itanium")) mach = IA64Itan;
      }
      break;
   case AFX86:
      res[0] = '\0';
      ierr = CmndOneLine(NULL, "fgrep 'model name' /proc/cpuinfo", res);
      if (ierr || res[0] == '\0')
         ierr = CmndOneLine(NULL, "fgrep model /proc/cpuinfo", res);
      if (!ierr && res[0] != '\0')
      {
         if (strstr(res, "Pentium"))
         { /* Pentium of some flavor */
            if (strstr(res, " III ")) mach = IntPIII;
            else if (strstr(res, " II ")) mach = IntPII;
            else if (strstr(res, "Pro")) mach = IntPPRO;
            else if (strstr(res, "MMX")) mach = IntP5MMX;
            else if (strstr(res, " 4 "))
            {
               ierr = CmndOneLine(NULL,
                      "fgrep 'model' /proc/cpuinfo | fgrep -v 'name'", res);
               if (!ierr)
               {
                  i = GetLastInt(res);
                  if (i < 3) mach = IntP4;
                  else if (i == 3) mach = IntP4E;
               }
            }
         }
         else if (strstr(res, "Core"))
         {
            if (strstr(res, "i7"))
            {
               if (strstr(res, "2600"))
                  mach = IntCorei2;
               else
                  mach = IntCorei1;
            }
            if (strstr(res, "i5"))
            {
               if (strstr(res, "i5-2500") || strstr(res, "i5-2400") ||
	           strstr(res, "i5-2390") || strstr(res, "i5-2300"))
                  mach = IntCorei2;
               else
                  mach = IntCorei1;
            }
         }
         else if (strstr(res, "Xeon")) /* dreaded Xeon-is-anything */
         {
            if (strstr(res, "E5420")) mach = IntCore2;
         }
         else if (strstr(res, "Efficeon")) mach = TMEff;
         else if (strstr(res, "Athlon HX")) mach = AmdHammer;
         else if (strstr(res, "Opteron") || strstr(res, "Hammer") ||
                  strstr(res, "Athlon(tm) 64"))
            mach = AmdHammer;
         else if (strstr(res, "Athlon")) mach = AmdAthlon;
         else if (strstr(res, "AMD-K7")) mach = AmdAthlon;
      }
      break;
/*
 *    Add these back if we get machine access and can test
 */
   case AFSPARC:  /* don't know here anymore */
      #if 0
      if ( !CmndOneLine(NULL, "fgrep cpu /proc/cpuinfo", res) )
      {
         if (strstr(res, "UltraSparc II")) mach = SunUS2;
         else if (strstr(res, "UltraSparc I")) mach = SunUS1;
         else if (strstr(res, "UltraSparc")) mach = SunUSX;
      }
      #endif
      break;
   case AFALPHA:
      #if 0
      res[0] = '\0';
      ierr = CmndOneLine(NULL, "fgrep 'model name' /proc/cpuinfo", res);
      if (ierr || res[0] == '\0')
         ierr = CmndOneLine(NULL, "fgrep model /proc/cpuinfo", res);
      if (!ierr && res[0] != '\0')
      {
         if (strstr(res, "EV5")) mach = Dec21164;
         else if (strstr(res, "EV4")) mach = Dec21064;
         else if (strstr(res, "EV6")) mach = Dec21264;
      }
      #endif
      break;
   default:
#if 0
      if (!CmndOneLine(NULL, "fgrep 'cpu family' /proc/cpuinfo", res))
         if (strstr(res, "PA-RISC 2.0")) mach = HPPA20;
#else
     ;
#endif
   }
   return(mach);
}