Cpuid.c 713 B

123456789101112131415161718192021222324
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. /* This Hello World simply print out "Hello World" */
  4. #include "pal.h"
  5. #include "pal_debug.h"
  6. int main (int argc, char ** argv, char ** envp)
  7. {
  8. PAL_NUM values[4];
  9. __asm__ volatile("mov $0, %%rax\n"
  10. "cpuid\n"
  11. : "=a"(values[0]),
  12. "=b"(values[1]),
  13. "=c"(values[2]),
  14. "=d"(values[3])
  15. :: "memory");
  16. pal_printf("cpuid[0] = %08x %08x %08x %08x\n", values[0], values[1],
  17. values[2], values[3]);
  18. return 0;
  19. }