linux: add support for MIPS
This commit is contained in:
parent
72e440d7e1
commit
5096f1e096
@ -222,7 +222,7 @@ SunOS)
|
||||
;;
|
||||
esac
|
||||
|
||||
for ARCH in __i386__ __x86_64__ __arm__; do
|
||||
for ARCH in __i386__ __x86_64__ __arm__ __mips__; do
|
||||
$SPARSE $SPARSE_FLAGS -D$ARCH=1 $SOURCES
|
||||
done
|
||||
|
||||
|
||||
1
gyp_uv
1
gyp_uv
@ -24,6 +24,7 @@ def host_arch():
|
||||
if machine == 'i386': return 'ia32'
|
||||
if machine == 'x86_64': return 'x64'
|
||||
if machine.startswith('arm'): return 'arm'
|
||||
if machine.startswith('mips'): return 'mips'
|
||||
return machine # Return as-is and hope for the best.
|
||||
|
||||
|
||||
|
||||
@ -427,7 +427,7 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
|
||||
char* model;
|
||||
FILE* fp;
|
||||
|
||||
/* Most are unused on non-ARM and non-x86 architectures. */
|
||||
/* Most are unused on non-ARM, non-MIPS and non-x86 architectures. */
|
||||
(void) &model_marker;
|
||||
(void) &speed_marker;
|
||||
(void) &speed_idx;
|
||||
@ -438,7 +438,10 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
|
||||
model_idx = 0;
|
||||
speed_idx = 0;
|
||||
|
||||
#if defined(__arm__) || defined(__i386__) || defined(__x86_64__)
|
||||
#if defined(__arm__) || \
|
||||
defined(__i386__) || \
|
||||
defined(__mips__) || \
|
||||
defined(__x86_64__)
|
||||
fp = fopen("/proc/cpuinfo", "r");
|
||||
if (fp == NULL)
|
||||
return -1;
|
||||
@ -456,10 +459,14 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#if defined(__arm__)
|
||||
/* Fallback for pre-3.8 kernels. */
|
||||
#if defined(__arm__) || defined(__mips__)
|
||||
if (model_idx < numcpus) {
|
||||
#if defined(__arm__)
|
||||
/* Fallback for pre-3.8 kernels. */
|
||||
static const char model_marker[] = "Processor\t: ";
|
||||
#else /* defined(__mips__) */
|
||||
static const char model_marker[] = "cpu model\t\t: ";
|
||||
#endif
|
||||
if (strncmp(buf, model_marker, sizeof(model_marker) - 1) == 0) {
|
||||
model = buf + sizeof(model_marker) - 1;
|
||||
model = strndup(model, strlen(model) - 1); /* Strip newline. */
|
||||
@ -471,18 +478,18 @@ static int read_models(unsigned int numcpus, uv_cpu_info_t* ci) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#else /* !__arm____ */
|
||||
#else /* !__arm__ && !__mips__ */
|
||||
if (speed_idx < numcpus) {
|
||||
if (strncmp(buf, speed_marker, sizeof(speed_marker) - 1) == 0) {
|
||||
ci[speed_idx++].speed = atoi(buf + sizeof(speed_marker) - 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* __arm__ */
|
||||
#endif /* __arm__ || __mips__ */
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
#endif /* __arm__ || __i386__ || __x86_64__ */
|
||||
#endif /* __arm__ || __i386__ || __mips__ || __x86_64__ */
|
||||
|
||||
/* Now we want to make sure that all the models contain *something* because
|
||||
* it's not safe to leave them as null. Copy the last entry unless there
|
||||
|
||||
Loading…
Reference in New Issue
Block a user