Commit | Line | Data |
---|---|---|
d6910058 | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
f0be6c6a PA |
2 | /* ----------------------------------------------------------------------- * |
3 | * | |
4 | * Copyright 2008 rPath, Inc. - All Rights Reserved | |
5 | * | |
f0be6c6a PA |
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 | ||
abbf1590 | 15 | #include "../include/asm/required-features.h" |
381aa07a | 16 | #include "../include/asm/disabled-features.h" |
cd4d09ec | 17 | #include "../include/asm/cpufeatures.h" |
14442a15 | 18 | #include "../include/asm/vmxfeatures.h" |
7414aa41 | 19 | #include "../kernel/cpu/capflags.c" |
f0be6c6a | 20 | |
f0be6c6a PA |
21 | int main(void) |
22 | { | |
97fc0555 | 23 | int i, j; |
f0be6c6a PA |
24 | const char *str; |
25 | ||
3235dc3f | 26 | printf("static const char x86_cap_strs[] =\n"); |
f0be6c6a | 27 | |
97fc0555 PA |
28 | for (i = 0; i < NCAPINTS; i++) { |
29 | for (j = 0; j < 32; j++) { | |
30 | str = x86_cap_flags[i*32+j]; | |
31 | ||
32 | if (i == NCAPINTS-1 && j == 31) { | |
33 | /* The last entry must be unconditional; this | |
34 | also consumes the compiler-added null | |
35 | character */ | |
36 | if (!str) | |
37 | str = ""; | |
38 | printf("\t\"\\x%02x\\x%02x\"\"%s\"\n", | |
39 | i, j, str); | |
40 | } else if (str) { | |
41 | printf("#if REQUIRED_MASK%d & (1 << %d)\n" | |
42 | "\t\"\\x%02x\\x%02x\"\"%s\\0\"\n" | |
43 | "#endif\n", | |
44 | i, j, i, j, str); | |
45 | } | |
f0be6c6a PA |
46 | } |
47 | } | |
48 | printf("\t;\n"); | |
49 | return 0; | |
50 | } |