mkcpustr.c 1.2 KB

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