Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. char cpuid_str[13];
  6.  
  7. __asm__ (""
  8. /* TODO: Make cpuid call and copy string in cpuid_str.
  9. * eax needs to be 0
  10. * After cpuid call string is placed in (ebx, edx, ecx).
  11. */
  12. "xor eax,eax\n\t"
  13. "cpuid\n\t"
  14. "mov eax,%0\n\t"
  15. "mov [eax],ebx\n\t"
  16. "mov [eax + 4],edx\n\t"
  17. "mov [eax + 8],ecx\n\t"
  18. :
  19. :"r"(cpuid_str)
  20. :"eax","ebx","ecx","edx"
  21. );
  22.  
  23. cpuid_str[12] = '\0';
  24.  
  25. printf("CPUID string: %s\n", cpuid_str);
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement