Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8770001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:28:16+00:00 2026-06-13T17:28:16+00:00

I am trying to access the Information using CPUID in C++. I have produced

  • 0

I am trying to access the Information using CPUID in C++.
I have produced this code so far and could not go any longer.
I found some useful articles here and on the web but they did not seem to help me.

I am supposed to use instructions and registers from x88 only.
This is the code.

int b[5] = {0} ;

for (int a = 0; a < 5 ; a++)
{
    __cpuid (b,a) ;
    std::cout << "The code " << a << " gives " << b[0] << std::endl;
}

I am unable to go any further as I cannot understand how to fetch the information from this array bitwise. I have this wiki and msdn article which explains the scheme.
My question is not very good but I would appreciate any help or direction in this regard.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:28:17+00:00Added an answer on June 13, 2026 at 5:28 pm

    I suppose your problem is not about accessing the array data through an index, which is as you already done b[0], b[1] and so on. You need a little bit of bit (!) manipulation. You have to mask out the bits you are not interested in and interpret what is left; e.g.

        (b[0] & 0xF0) >> 4
    

    will give you 4 bits (4-7) that are the model according to MSDN. And so on. Consider the following

        3            2            1
        1098 7654 3210 9876 5432 1098 7654 3210
        0000 0000 0000 0000 0000 0000 0000 0000 
        \R_/ \ext_Fam/ \eM/ RRpp \fm/ \md/ \sd/
    
        R = reserved
        ext_Fam = extended family
        eM = extended model
        pp = processor type
        fm = family
        md = model
        sd = stepping id
    

    (int supposed 32 bit int — or wider)

    If you want e.g. the processor type, you need:

        0000 0000 0000 0000 0011 0000 0000 0000 
        \R_/ \ext_Fam/ \eM/ RRpp \fm/ \md/ \sd/
    

    and then shift (logical shift) right of 3 “nibbles” (12). So

       (b[0] >> 12) & 3
    

    will give you a number representing processor type. (The number 3 is 11 in base 2, so it’s the right mask to select only the rightmost two bits).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access my Google spreadsheets using the GData API. I have followed
i am trying to access some information from a running Microsoft Word application using
I'm trying to access information in a previously created multidimensional array. Using print_r() ,
I am trying to access information on a website that uses frames. When I
I am trying to access information from an Oracle meta-data table from within a
Hi I'm trying to access a WCF service which returns a JSON Array using
I am trying to access a file for xml parsing with this: InputStream inputStream
I have some information stored as SharedPreferences. I need to access that information from
I am trying to access information under C:\Users\Public\Documents\ which displays as C:\Users\Public\Public Documents\ on
I'm trying to access information within a Graph object in Mathematica 8. For some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.