mkcpustr.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. * This is a host program to preprocess the CPU strings into a
  12. * compact format suitable for the setup code.
  13. */
  14. #include <stdio.h>
  15. #include "../include/asm/required-features.h"
  16. #include "../include/asm/cpufeature.h"
  17. #include "../kernel/cpu/capflags.c"
  18. int main(void)
  19. {
  20. int i, j;
  21. const char *str;
  22. printf("static const char x86_cap_strs[] =\n");
  23. for (i = 0; i < NCAPINTS; i++) {
  24. for (j = 0; j < 32; j++) {
  25. str = x86_cap_flags[i*32+j];
  26. if (i == NCAPINTS-1 && j == 31) {
  27. /* The last entry must be unconditional; this
  28. also consumes the compiler-added null
  29. character */
  30. if (!str)
  31. str = "";
  32. printf("\t\"\\x%02x\\x%02x\"\"%s\"\n",
  33. i, j, str);
  34. } else if (str) {
  35. printf("#if REQUIRED_MASK%d & (1 << %d)\n"
  36. "\t\"\\x%02x\\x%02x\"\"%s\\0\"\n"
  37. "#endif\n",
  38. i, j, i, j, str);
  39. }
  40. }
  41. }
  42. printf("\t;\n");
  43. return 0;
  44. }