Read CPU information using CPUID in DOS and WINDOWS

Source: Internet
Author: User
Tags dbase

I. Compile with VC ++ in WINDOWS.

Format: unsigned long DBase;
Char cA [13];
Char cB [49];
_ Asm
  {
Xor eax, eax
Cpuid
Mov DBase, eax
Mov dword ptr cA, ebx
Mov dword ptr cA + 4, edx
Mov dword ptr cA + 8, ecx


Mov eax, 0x80000002
Cpuid
Mov dword ptr cB, eax
Mov dword ptr cB + 4, ebx
Mov dword ptr cB + 8, ecx
Mov dword ptr cB + 12, edx

Mov eax, 0x80000003
Cpuid
Mov dword ptr cB + 16, eax
Mov dword ptr cB + 20, ebx
Mov dword ptr cB + 24, ecx
Mov dword ptr cB + 28, edx

Mov eax, 0x80000004
Cpuid
Mov dword ptr cB + 32, eax
Mov dword ptr cB + 36, ebx
Mov dword ptr cB + 40, ecx
Mov dword ptr cB + 44, edx
  }

2. In DOS, DJGPP must be used for compilation (32-bit support ).

Format:

# Define CPUID (op, a, B, c, d)
_ Asm _ volatile _ ("cpuid": "= a" (a), "= B" (B), "= c" (c ), "= d" (d): "a" (op ))

 

MSN: twinliwu@hotmail.com

        </

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.