mkcpustr.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 "../kernel/cpu/feature_names.c"
  16. #if NCAPFLAGS > 8
  17. # error "Need to adjust the boot code handling of CPUID strings"
  18. #endif
  19. int main(void)
  20. {
  21. int i;
  22. const char *str;
  23. printf("static const char x86_cap_strs[] = \n");
  24. for (i = 0; i < NCAPINTS*32; i++) {
  25. str = x86_cap_flags[i];
  26. if (i == NCAPINTS*32-1) {
  27. /* The last entry must be unconditional; this
  28. also consumes the compiler-added null character */
  29. if (!str)
  30. str = "";
  31. printf("\t\"\\x%02x\"\"%s\"\n", i, str);
  32. } else if (str) {
  33. printf("#if REQUIRED_MASK%d & (1 << %d)\n"
  34. "\t\"\\x%02x\"\"%s\\0\"\n"
  35. "#endif\n",
  36. i >> 5, i & 31, i, str);
  37. }
  38. }
  39. printf("\t;\n");
  40. return 0;
  41. }