File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,29 @@ static char *cpuname[] = {
79
79
};
80
80
81
81
int detect (void ){
82
+ #ifdef __linux
83
+ FILE * infile ;
84
+ char buffer [512 ], * p ;
85
+
86
+ p = (char * )NULL ;
87
+ infile = fopen ("/proc/cpuinfo" , "r" );
88
+ while (fgets (buffer , sizeof (buffer ), infile )){
89
+ if (!strncmp ("isa" , buffer , 3 )){
90
+ p = strchr (buffer , '4' ) + 1 ; /* the 4 in rv64ima... */
91
+ #if 0
92
+ fprintf (stderr , "%s\n" , p );
93
+ #endif
94
+ break ;
95
+ }
96
+ }
97
+
98
+ fclose (infile );
99
+
100
+ if (strchr (p , 'v' )) return CPU_C910V ;
101
+
102
+ return CPU_GENERIC ;
103
+ #endif
104
+
82
105
return CPU_GENERIC ;
83
106
}
84
107
@@ -91,6 +114,7 @@ void get_architecture(void){
91
114
}
92
115
93
116
void get_subarchitecture (void ){
117
+ printf ("%s" ,cpuname [detect ()]);
94
118
}
95
119
96
120
void get_subdirname (void ){
You can’t perform that action at this time.
0 commit comments