Link to home
Start Free TrialLog in
Avatar of mathursaurabh
mathursaurabhFlag for India

asked on

How would I catch the Processor Id...???

Hello all,

I need to catch the CPU Unique Id for my applications' processing. Ay idea how I can do this...? I'm not an expert, but yes I am quite familiar with C.
Any help would be more than helpful.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rajeev_devin
rajeev_devin

>> _emit 0xF0 0xA2
Is this correct. As I know _emit can define a single byte.

By the way what the function is doing.
Can you please explain.
Well, here's some nice info for IA-32 :

http://www.sandpile.org/ia32/cpuid.htm

from this site :

http://www.sandpile.org/
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"I need to catch the CPU Unique Id for my applications' processing"
What OS and what hardware are you using?

BTW your application may not be shure that it's running on specific CPU, even when you reach next line of your C application.
Avatar of mathursaurabh

ASKER

> On Intel/AMD, like
>
>#pragma warning(disable:4035) // disable: 'function' : no return value
>
>DWORD GetCPUID () {
>
>#define cpuid __asm _emit 0xF0 0xA2   // hex opcode for CPUID
> __asm{
>  xor eax, eax
>  _emit 0xF0 0xA2
> }
>
> // return value is the content of EAX
>}
>
>#pragma warning(default:4035)

Thanks for the response jkr, but I am confused how am I supposed to use the folowing code snippet..?? Can you please details it a btit more..??
Also if you can let me know how to call a C file from with-in a shell script while your .rpm package is getting installed. This C file would provide the necessary inout to the shell script which would then forward this input to the installing software. Any clue on this...??


Thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial