Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/x86/boot/mkcpustr.c
26424 views
1
// SPDX-License-Identifier: GPL-2.0-or-later
2
/* ----------------------------------------------------------------------- *
3
*
4
* Copyright 2008 rPath, Inc. - All Rights Reserved
5
*
6
* ----------------------------------------------------------------------- */
7
8
/*
9
* This is a host program to preprocess the CPU strings into a
10
* compact format suitable for the setup code.
11
*/
12
13
#include <stdio.h>
14
15
#include "../include/asm/cpufeatures.h"
16
#include "../include/asm/vmxfeatures.h"
17
#include "../kernel/cpu/capflags.c"
18
19
int main(void)
20
{
21
int i, j;
22
const char *str;
23
24
printf("#include <asm/cpufeaturemasks.h>\n\n");
25
printf("static const char x86_cap_strs[] =\n");
26
27
for (i = 0; i < NCAPINTS; i++) {
28
for (j = 0; j < 32; j++) {
29
str = x86_cap_flags[i*32+j];
30
31
if (i == NCAPINTS-1 && j == 31) {
32
/* The last entry must be unconditional; this
33
also consumes the compiler-added null
34
character */
35
if (!str)
36
str = "";
37
printf("\t\"\\x%02x\\x%02x\"\"%s\"\n",
38
i, j, str);
39
} else if (str) {
40
printf("#if REQUIRED_MASK%d & (1 << %d)\n"
41
"\t\"\\x%02x\\x%02x\"\"%s\\0\"\n"
42
"#endif\n",
43
i, j, i, j, str);
44
}
45
}
46
}
47
printf("\t;\n");
48
return 0;
49
}
50
51