blob: 637097e66a62a675de99040bdcf4f8fc011e2af0 [file] [log] [blame]
H. Peter Anvinf0be6c62008-02-04 16:48:00 +01001/* ----------------------------------------------------------------------- *
2 *
3 * Copyright 2008 rPath, Inc. - All Rights Reserved
4 *
5 * This file is part of the Linux kernel, and is made available under
6 * the terms of the GNU General Public License version 2 or (at your
7 * option) any later version; incorporated herein by reference.
8 *
9 * ----------------------------------------------------------------------- */
10
11/*
12 * This is a host program to preprocess the CPU strings into a
13 * compact format suitable for the setup code.
14 */
15
16#include <stdio.h>
17
David Howellsabbf1592012-10-02 18:01:26 +010018#include "../include/asm/required-features.h"
Dave Hansen381aa072014-09-11 14:15:13 -070019#include "../include/asm/disabled-features.h"
David Howellsabbf1592012-10-02 18:01:26 +010020#include "../include/asm/cpufeature.h"
H. Peter Anvin7414aa42008-08-27 17:56:44 -070021#include "../kernel/cpu/capflags.c"
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010022
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010023int main(void)
24{
H. Peter Anvin97fc0552008-09-16 15:09:26 -070025 int i, j;
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010026 const char *str;
27
Frans Pop3235dc32010-02-06 18:47:17 +010028 printf("static const char x86_cap_strs[] =\n");
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010029
H. Peter Anvin97fc0552008-09-16 15:09:26 -070030 for (i = 0; i < NCAPINTS; i++) {
31 for (j = 0; j < 32; j++) {
32 str = x86_cap_flags[i*32+j];
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010033
H. Peter Anvin97fc0552008-09-16 15:09:26 -070034 if (i == NCAPINTS-1 && j == 31) {
35 /* The last entry must be unconditional; this
36 also consumes the compiler-added null
37 character */
38 if (!str)
39 str = "";
40 printf("\t\"\\x%02x\\x%02x\"\"%s\"\n",
41 i, j, str);
42 } else if (str) {
43 printf("#if REQUIRED_MASK%d & (1 << %d)\n"
44 "\t\"\\x%02x\\x%02x\"\"%s\\0\"\n"
45 "#endif\n",
46 i, j, i, j, str);
47 }
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010048 }
49 }
50 printf("\t;\n");
51 return 0;
52}