blob: 4579eff0ef4db19fcff2f6336f6f82ab9b5d6998 [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"
19#include "../include/asm/cpufeature.h"
H. Peter Anvin7414aa42008-08-27 17:56:44 -070020#include "../kernel/cpu/capflags.c"
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010021
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010022int main(void)
23{
H. Peter Anvin97fc0552008-09-16 15:09:26 -070024 int i, j;
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010025 const char *str;
26
Frans Pop3235dc32010-02-06 18:47:17 +010027 printf("static const char x86_cap_strs[] =\n");
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010028
H. Peter Anvin97fc0552008-09-16 15:09:26 -070029 for (i = 0; i < NCAPINTS; i++) {
30 for (j = 0; j < 32; j++) {
31 str = x86_cap_flags[i*32+j];
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010032
H. Peter Anvin97fc0552008-09-16 15:09:26 -070033 if (i == NCAPINTS-1 && j == 31) {
34 /* The last entry must be unconditional; this
35 also consumes the compiler-added null
36 character */
37 if (!str)
38 str = "";
39 printf("\t\"\\x%02x\\x%02x\"\"%s\"\n",
40 i, j, str);
41 } else if (str) {
42 printf("#if REQUIRED_MASK%d & (1 << %d)\n"
43 "\t\"\\x%02x\\x%02x\"\"%s\\0\"\n"
44 "#endif\n",
45 i, j, i, j, str);
46 }
H. Peter Anvinf0be6c62008-02-04 16:48:00 +010047 }
48 }
49 printf("\t;\n");
50 return 0;
51}