H. Peter Anvin | f0be6c6 | 2008-02-04 16:48:00 +0100 | [diff] [blame] | 1 | /* ----------------------------------------------------------------------- * |
| 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 Howells | abbf159 | 2012-10-02 18:01:26 +0100 | [diff] [blame] | 18 | #include "../include/asm/required-features.h" |
Dave Hansen | 381aa07 | 2014-09-11 14:15:13 -0700 | [diff] [blame] | 19 | #include "../include/asm/disabled-features.h" |
David Howells | abbf159 | 2012-10-02 18:01:26 +0100 | [diff] [blame] | 20 | #include "../include/asm/cpufeature.h" |
H. Peter Anvin | 7414aa4 | 2008-08-27 17:56:44 -0700 | [diff] [blame] | 21 | #include "../kernel/cpu/capflags.c" |
H. Peter Anvin | f0be6c6 | 2008-02-04 16:48:00 +0100 | [diff] [blame] | 22 | |
H. Peter Anvin | f0be6c6 | 2008-02-04 16:48:00 +0100 | [diff] [blame] | 23 | int main(void) |
| 24 | { |
H. Peter Anvin | 97fc055 | 2008-09-16 15:09:26 -0700 | [diff] [blame] | 25 | int i, j; |
H. Peter Anvin | f0be6c6 | 2008-02-04 16:48:00 +0100 | [diff] [blame] | 26 | const char *str; |
| 27 | |
Frans Pop | 3235dc3 | 2010-02-06 18:47:17 +0100 | [diff] [blame] | 28 | printf("static const char x86_cap_strs[] =\n"); |
H. Peter Anvin | f0be6c6 | 2008-02-04 16:48:00 +0100 | [diff] [blame] | 29 | |
H. Peter Anvin | 97fc055 | 2008-09-16 15:09:26 -0700 | [diff] [blame] | 30 | for (i = 0; i < NCAPINTS; i++) { |
| 31 | for (j = 0; j < 32; j++) { |
| 32 | str = x86_cap_flags[i*32+j]; |
H. Peter Anvin | f0be6c6 | 2008-02-04 16:48:00 +0100 | [diff] [blame] | 33 | |
H. Peter Anvin | 97fc055 | 2008-09-16 15:09:26 -0700 | [diff] [blame] | 34 | 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 Anvin | f0be6c6 | 2008-02-04 16:48:00 +0100 | [diff] [blame] | 48 | } |
| 49 | } |
| 50 | printf("\t;\n"); |
| 51 | return 0; |
| 52 | } |