Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /* ----------------------------------------------------------------------- *
0003  *
0004  *   Copyright 2008 rPath, Inc. - All Rights Reserved
0005  *
0006  * ----------------------------------------------------------------------- */
0007 
0008 /*
0009  * This is a host program to preprocess the CPU strings into a
0010  * compact format suitable for the setup code.
0011  */
0012 
0013 #include <stdio.h>
0014 
0015 #include "../include/asm/required-features.h"
0016 #include "../include/asm/disabled-features.h"
0017 #include "../include/asm/cpufeatures.h"
0018 #include "../include/asm/vmxfeatures.h"
0019 #include "../kernel/cpu/capflags.c"
0020 
0021 int main(void)
0022 {
0023     int i, j;
0024     const char *str;
0025 
0026     printf("static const char x86_cap_strs[] =\n");
0027 
0028     for (i = 0; i < NCAPINTS; i++) {
0029         for (j = 0; j < 32; j++) {
0030             str = x86_cap_flags[i*32+j];
0031 
0032             if (i == NCAPINTS-1 && j == 31) {
0033                 /* The last entry must be unconditional; this
0034                    also consumes the compiler-added null
0035                    character */
0036                 if (!str)
0037                     str = "";
0038                 printf("\t\"\\x%02x\\x%02x\"\"%s\"\n",
0039                        i, j, str);
0040             } else if (str) {
0041                 printf("#if REQUIRED_MASK%d & (1 << %d)\n"
0042                        "\t\"\\x%02x\\x%02x\"\"%s\\0\"\n"
0043                        "#endif\n",
0044                        i, j, i, j, str);
0045             }
0046         }
0047     }
0048     printf("\t;\n");
0049     return 0;
0050 }