x86: Support compiling out human-friendly processor feature names
The table mapping CPUID bits to human-readable strings takes up a non-trivial amount of space, and only exists to support /proc/cpuinfo and a couple of kernel messages. Since programs depend on the format of /proc/cpuinfo, force inclusion of the table when building with /proc support; otherwise, support omitting that table to save space, in which case the kernel messages will print features numerically instead. In addition to saving 1408 bytes out of vmlinux, this also saves 1373 bytes out of the uncompressed setup code, which contributes directly to the size of bzImage. Signed-off-by: Josh Triplett <josh@joshtriplett.org>
此提交包含在:
@@ -16,7 +16,9 @@
|
||||
*/
|
||||
|
||||
#include "boot.h"
|
||||
#ifdef CONFIG_X86_FEATURE_NAMES
|
||||
#include "cpustr.h"
|
||||
#endif
|
||||
|
||||
static char *cpu_name(int level)
|
||||
{
|
||||
@@ -32,11 +34,48 @@ static char *cpu_name(int level)
|
||||
}
|
||||
}
|
||||
|
||||
static void show_cap_strs(u32 *err_flags)
|
||||
{
|
||||
int i, j;
|
||||
#ifdef CONFIG_X86_FEATURE_NAMES
|
||||
const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs;
|
||||
for (i = 0; i < NCAPINTS; i++) {
|
||||
u32 e = err_flags[i];
|
||||
for (j = 0; j < 32; j++) {
|
||||
if (msg_strs[0] < i ||
|
||||
(msg_strs[0] == i && msg_strs[1] < j)) {
|
||||
/* Skip to the next string */
|
||||
msg_strs += 2;
|
||||
while (*msg_strs++)
|
||||
;
|
||||
}
|
||||
if (e & 1) {
|
||||
if (msg_strs[0] == i &&
|
||||
msg_strs[1] == j &&
|
||||
msg_strs[2])
|
||||
printf("%s ", msg_strs+2);
|
||||
else
|
||||
printf("%d:%d ", i, j);
|
||||
}
|
||||
e >>= 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < NCAPINTS; i++) {
|
||||
u32 e = err_flags[i];
|
||||
for (j = 0; j < 32; j++) {
|
||||
if (e & 1)
|
||||
printf("%d:%d ", i, j);
|
||||
e >>= 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int validate_cpu(void)
|
||||
{
|
||||
u32 *err_flags;
|
||||
int cpu_level, req_level;
|
||||
const unsigned char *msg_strs;
|
||||
|
||||
check_cpu(&cpu_level, &req_level, &err_flags);
|
||||
|
||||
@@ -49,34 +88,9 @@ int validate_cpu(void)
|
||||
}
|
||||
|
||||
if (err_flags) {
|
||||
int i, j;
|
||||
puts("This kernel requires the following features "
|
||||
"not present on the CPU:\n");
|
||||
|
||||
msg_strs = (const unsigned char *)x86_cap_strs;
|
||||
|
||||
for (i = 0; i < NCAPINTS; i++) {
|
||||
u32 e = err_flags[i];
|
||||
|
||||
for (j = 0; j < 32; j++) {
|
||||
if (msg_strs[0] < i ||
|
||||
(msg_strs[0] == i && msg_strs[1] < j)) {
|
||||
/* Skip to the next string */
|
||||
msg_strs += 2;
|
||||
while (*msg_strs++)
|
||||
;
|
||||
}
|
||||
if (e & 1) {
|
||||
if (msg_strs[0] == i &&
|
||||
msg_strs[1] == j &&
|
||||
msg_strs[2])
|
||||
printf("%s ", msg_strs+2);
|
||||
else
|
||||
printf("%d:%d ", i, j);
|
||||
}
|
||||
e >>= 1;
|
||||
}
|
||||
}
|
||||
show_cap_strs(err_flags);
|
||||
putchar('\n');
|
||||
return -1;
|
||||
} else {
|
||||
|
新增問題並參考
封鎖使用者