Browse Source

Supported detecting new kernel(2.6.36) & new Loongson3A03 CPU.

tags/v0.1alpha1
Xianyi Zhang 14 years ago
parent
commit
c84f8be453
2 changed files with 18 additions and 4 deletions
  1. +2
    -1
      Makefile.rule
  2. +16
    -3
      cpuid_mips.c

+ 2
- 1
Makefile.rule View File

@@ -95,7 +95,8 @@ VERSION = 0.1
# DEBUG = 1

ifeq ($(DEBUG), 1)
COMMON_OPT += -g -DDEBUG
COMMON_OPT += -g
# -DDEBUG
else
COMMON_OPT += -O2
endif


+ 16
- 3
cpuid_mips.c View File

@@ -99,9 +99,22 @@ int detect(void){

fclose(infile);

if (strstr(p, "Loongson-3A")) return CPU_LOONGSON3A;
else return CPU_SICORTEX;

if (strstr(p, "Loongson-3A")){
return CPU_LOONGSON3A;
}else if (strstr(p, "Loongson-3")){
infile = fopen("/proc/cpuinfo", "r");
while (fgets(buffer, sizeof(buffer), infile)){
if (!strncmp("system type", buffer, 11)){
p = strchr(buffer, ':') + 2;
break;
}
}
fclose(infile);
if (strstr(p, "loongson3a"))
return CPU_LOONGSON3A;
}else{
return CPU_SICORTEX;
}
#endif
return CPU_UNKNOWN;
}


Loading…
Cancel
Save