Ignore:
Timestamp:
May 25, 2014, 8:39:48 PM (5 years ago)
Author:
gb
Message:

Propagate r15802 from trunk. Fixes ticket:1190

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/1.9/source/lisp-kernel/pmcl-kernel.c

    r15473 r16083  
    15801580#ifdef ARM
    15811581int
    1582 arm_architecture_version = 0;
     1582arm_architecture_version = 7;
    15831583
    15841584Boolean
     
    15871587  Boolean win = false;
    15881588#ifdef LINUX
    1589 /* It's hard to determine ARM features in general, and especially
    1590    hard to do so from user mode.  Parse /proc/cpuinfo.
    1591    According to Android's cpufeatures library, some ARMv6 chips
    1592    are reported to have archutecture version 7; check the ELF
    1593    architecture in this case.
    1594 
    1595    (In other words, we assume that we're on ARMv7 or later if
    1596    the reported architecture is > 7, or if it's = 7 and the
    1597    ELF architecture is "v7l".)
    1598 */
    1599   FILE *f = fopen("/proc/cpuinfo", "r");
    1600   char *procline = NULL, *cpuline = NULL, line[129], *workline;
    1601   size_t n;
    1602 
    1603   if (f) {
    1604     while (1) {
    1605       if (fgets(line,128,f)==NULL) {
    1606         break;
    1607       }
    1608       n = strlen(line);
    1609       if (strncmp(line,"Processor",sizeof("Processor")-1) == 0) {
    1610         procline = malloc(n+1);
    1611         strcpy(procline,line);
    1612         procline[n]='\0';
    1613       } else if (strncmp(line, "CPU architecture",sizeof("CPU architecture")-1) == 0) {
    1614         cpuline = malloc(n+1);
    1615         strcpy(cpuline,line);
    1616         cpuline[n] = '\0';
    1617       }
    1618     }
    1619     if (procline) {
    1620       win = (strstr(procline, "v7l") != NULL);
    1621       if (win) {
    1622         arm_architecture_version = 7;
    1623       } else {
    1624         win = (strstr(procline, "v6l") != NULL);
    1625         if (win) {
    1626           arm_architecture_version = 6;
    1627         } else {
    1628           if (cpuline) {
    1629             workline = index(cpuline,':');
    1630             if (workline) {
    1631               arm_architecture_version = strtol(workline+1,NULL,0);
    1632               if (arm_architecture_version >= ARM_ARCHITECTURE_min) {
    1633                 win = true;
    1634               }
    1635             }
    1636           }
    1637         }
    1638       }
    1639     }
    1640     if (procline) {
    1641       free(procline);
    1642     }
    1643     if (cpuline) {
    1644       free(cpuline);
    1645     }
    1646     fclose(f);
    1647   }
     1589  extern void feature_check(), early_signal_handler();
     1590
     1591  install_signal_handler(SIGILL, (void *)early_signal_handler,0);
     1592  feature_check();
     1593  win = arm_architecture_version >= 6;
     1594  install_signal_handler(SIGILL, NULL, 0);
     1595
    16481596#endif
    16491597  return win;
Note: See TracChangeset for help on using the changeset viewer.