mkcpustr.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/disabled-features.h"
  17. #include "../include/asm/cpufeatures.h"
  18. #include "../kernel/cpu/capflags.c"
  19. int main(void)
  20. {
  21. int i, j;
  22. const char *str;
  23. printf("static const char x86_cap_strs[] =\n");
  24. for (i = 0; i < NCAPINTS; i++) {
  25. for (j = 0; j < 32; j++) {
  26. str = x86_cap_flags[i*32+j];
  27. if (i == NCAPINTS-1 && j == 31) {
  28. /* The last entry must be unconditional; this
  29. also consumes the compiler-added null
  30. character */
  31. if (!str)
  32. str = "";
  33. printf("\t\"\\x%02x\\x%02x\"\"%s\"\n",
  34. i, j, str);
  35. } else if (str) {
  36. printf("#if REQUIRED_MASK%d & (1 << %d)\n"
  37. "\t\"\\x%02x\\x%02x\"\"%s\\0\"\n"
  38. "#endif\n",
  39. i, j, i, j, str);
  40. }
  41. }
  42. }
  43. printf("\t;\n");
  44. return 0;
  45. }