Cpuid

This is a discussion on Cpuid within the C Programming forums, part of the General Programming Boards category; I need help builind a function that reads the CPU ID, a 64 bits hexadecimal number came from CPU. Any1 ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    7

    Cpuid

    I need help builind a function that reads the CPU ID, a 64 bits hexadecimal number came from CPU.
    Any1 knows how to do that? :S

    Obrigado,
    Tiago

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    That's some severely OS/compiler dependent stuff. Even then you may be looking at some assembly, if you don't have some library that will handle it for you. CPUID - Wikipedia, the free encyclopedia


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    7
    Quote Originally Posted by quzah View Post
    That's some severely OS/compiler dependent stuff. Even then you may be looking at some assembly, if you don't have some library that will handle it for you. CPUID - Wikipedia, the free encyclopedia


    Quzah.
    I tought that it was a way, an API/library to do this without touch assembly.

    I'll take a look.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    If there is, it's strictly compiler and OS specific as I mentioned earlier.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    What compiler are you using?

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    7
    Gcc.

  7. #7
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    For gcc:
    Code:
    unsigned int a, b, c, d;
    asm("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d));
    You'll have to put it in a function, obviously, but it should work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. noob to C need a little help!!!
    By sk8harddiefast in forum C Programming
    Replies: 8
    Last Post: 02-27-2010, 02:47 PM
  2. questions on multiple thread programming
    By lehe in forum C Programming
    Replies: 11
    Last Post: 03-27-2009, 08:44 AM
  3. how to get information from cpuid using c code
    By ZeroMemory in forum C Programming
    Replies: 2
    Last Post: 07-01-2008, 03:03 AM
  4. Problem with time count in ms
    By tezcatlipooca in forum C++ Programming
    Replies: 8
    Last Post: 07-30-2007, 03:04 AM
  5. amd cpuid documentation
    By valis in forum C Programming
    Replies: 1
    Last Post: 08-04-2005, 06:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21