Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- void VendorID()
- {
- unsigned long iEax = 0, iEbx = 0, iEcx = 0, iEdx = 0;
- char szVenderID[12] = {'\0'};
- __asm{
- mov eax, 0x0000000
- cpuid
- mov dword ptr[szVenderID+0], ebx
- mov dword ptr[szVenderID+4], edx
- mov dword ptr[szVenderID+8], ecx
- mov byte ptr[szVenderID+12], '\0'
- mov iEax, eax
- mov iEbx, ebx
- mov iEcx, ecx
- mov iEdx, edx
- }
- cout << "**** eax = 0x0000000 ****\n";
- cout << "EAX:0x" << setw(8) << setfill('0') << hex << iEax << endl;
- cout << "EBX:0x" << setw(8) << setfill('0') << hex << iEbx << endl;
- cout << "ECX:0x" << setw(8) << setfill('0') << hex << iEcx << endl;
- cout << "EDX:0x" << setw(8) << setfill('0') << hex << iEdx << endl;
- cout << "Vendor ID is " << szVenderID << endl;
- cout << "\n";
- return;
- }
- void ProcesserSerialNumber()
- {
- unsigned long iEax = 0, iEbx = 0, iEcx = 0, iEdx = 0;
- __asm{
- mov eax, 0x0000003
- cpuid
- mov iEax, eax
- mov iEbx, ebx
- mov iEcx, ecx
- mov iEdx, edx
- }
- cout << "**** eax = 0x00000003 ****\n";
- cout << "EAX:0x" << setw(8) << setfill('0') << hex << iEax << endl;
- cout << "EBX:0x" << setw(8) << setfill('0') << hex << iEbx << endl;
- cout << "ECX:0x" << setw(8) << setfill('0') << hex << iEcx << endl;
- cout << "EDX:0x" << setw(8) << setfill('0') << hex << iEdx << endl;
- cout << "\n";
- return;
- }
- void HighestExtendedFunctionSupported()
- {
- unsigned long iEax = 0, iEbx = 0, iEcx = 0, iEdx = 0;
- __asm{
- mov eax, 80000000h
- cpuid
- mov iEax, eax
- }
- cout << "**** eax = 80000000h ****\n";
- cout << "EAX:0x" << setw(8) << setfill('0') << hex << iEax << endl;
- cout << "\n";
- return;
- }
- void ProcessorBrandString()
- {
- char szPBS[48] = {'\0'};
- __asm{
- mov eax, 80000002h
- cpuid
- mov dword ptr[szPBS+0], eax
- mov dword ptr[szPBS+4], ebx
- mov dword ptr[szPBS+8], ecx
- mov dword ptr[szPBS+12], edx
- mov eax, 80000003h
- cpuid
- mov dword ptr[szPBS+16], eax
- mov dword ptr[szPBS+20], ebx
- mov dword ptr[szPBS+24], ecx
- mov dword ptr[szPBS+28], edx
- mov eax, 80000004h
- cpuid
- mov dword ptr[szPBS+32] ,eax
- mov dword ptr[szPBS+36], ebx
- mov dword ptr[szPBS+40], ecx
- mov dword ptr[szPBS+44], edx
- mov word ptr[szPBS+48], '\0'
- }
- cout << "**** eax = 80000002h, 80000003h, 80000004h ****\n";
- cout << "Processor Brand String : " << szPBS << endl;
- cout << "\n";
- return;
- }
- void main()
- {
- ios::sync_with_stdio(false);
- cin.tie(0);
- VendorID();
- ProcesserSerialNumber();
- HighestExtendedFunctionSupported();
- ProcessorBrandString();
- cin.get();
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement