CMP Game Media Group Presents: Home
  JoinHelpContact UsShop

Newswire
Features
Connection
Job Search
Directories
By Rob Wyatt
Gamasutra
July 9, 1999
Vol. 3: Issue 27

Features
Wyatt's World

Processor Detection and a Pentium III Update

Contents

Introduction

Part 2

How do I get a textual name for the processor?

The code…

More code…

Public Class Member 6:

bool get_processor_name

(

uint32_t processor,
std::string& name

)

Description

Returns a textual name for the specified processor in a format that can be displayed to the user.

Parameters

processor is the ID number of the processor for which the information is required. It must always be 0 on Windows 95/98.

name is a reference to a standard string class that will be filled with the next name of the processor.

Returns

False if an error occurred or an invalid processor was passed in. Under these conditions the contents of any return values are undefined.

 

Public Class Member 7:

bool get_serial_number

(

uint32_t processor,
ProcessorSerialNumber& serial

)

Description

Returns the unique serial number of the specified processor if it is present.

Parameters

processor is the ID number of the processor for which the information is required. It must always be 0 on Windows 95/98.

serial is a reference to a ProcessorSerialNumber class that will be filled with the 96-bit serial number.

Returns

False if an error occurred or an invalid processor was passed in. Under these conditions the contents of any return values are undefined. False will also be returned if the processor has no serial number capability.

 

Public Class Member 8:

bool get_cache_info

(

uint32_t processor,
ProcessorCahceInfo& cache

)

Description

Returns a description of both level 1 and level 2 cache sizes and the associativity of those caches. Not all processors can return information on both level 1 and level 2 caches.

Parameters

processor is the ID number of the processor for which the information is required. It must always be 0 on Windows 95/98.

cache is a reference to a ProcessorCahceInfo structure that will contain the results.

Returns

False if an error occurred or an invalid processor was passed in. Under these conditions the contents of any return values are undefined. False is also returned if the processor cannot return any cache info.

 

Public Class Member 9:

bool get_tlb_info

(

uint32_t processor,
ProcessorTLBInfo& tlb

)

Description

Returns a description of both the data and Translation Lookaside Buffers. Not all processors can return info on the TLBs.

Parameters

processor is the ID number of the processor for which the information is required. It must always be 0 on Windows 95/98.

tlb is a reference to a ProcessorTLBInfo structure that will contain the results.

Returns

False if an error occurred or an invalid processor was passed in. Under these conditions the contents of any return values are undefined.

 

Public Class Member 10:

bool get_cpuid_limits

(

uint32_t processor,
uint32_t& normal,
uint32_t& extended

)

Description

Returns the limits of the commands that can be passed to the CPUID instruction or the function below.

Parameters

processor is the ID number of the processor for which the information is required. It must always be 0 on Windows 95/98.

normal is the upper limit of the standard CPUID commands. These commands start at 0 and go to this value.

extended is the upper limit of the extended CPUID commands. These commands start at 0x80000000 and go to this value. On machines which do not support extended CPUID commands this value will be returned as 0xffffffff.

Returns

False if an error occurred or an invalid processor was passed in. Under these conditions the contents of any return values are undefined.

 

Public Class Member 11:

bool get_cpuid_data

(

uint32_t processor,
uint32_t cmd,
ProcessorCPUIDResult& res

)

Description

Gets the raw CPUID data for the given command on the given processor. The data returned is correct regardless of the calling thread affinity.

Parameters

processor is the ID number of the processor for which the information is required. It must always be 0 on Windows 95/98.

cmd is the command that you want to pass to the CPUID instruction

res is a reference to a ProcessorCPUIDResult structure that will contain the results. The results are the 128 bits from the EAX, EBX, ECX and EDX registers.

Returns

False if an error occurred or an invalid processor was passed in. Under these conditions the contents of any return values are undefined. False will also be returned if an invalid command is specified.

 

Additional Information

More information is available on processor detection from the following sources:

  • AMD application note 21922C, "Processor Recognition", and AMD application note 21035B, "Processor Recognition", both are available from the AMD web site at http://www.amd.com/K6/k6docs/index.html.

More information on multiprocessor support within Win32 can be found in the Microsoft Developer Network Library, some of which is available online at http://msdn.microsoft.com.

Rob Wyatt is a programmer at DreamWorks Interactive. Wyatt’s World requires your input and ideas, so if you have programming questions or topics you’d like to see addressed here in Wyatt’s World, let him know at Gamasutra@Rob-Wyatt.com.


[Back to] Introduction
 


Home | Join | Help | Contact Us | Shop | Newswire | Site Map | Calendar
Write for Us | Features | Connection | Job Search | Directories


Copyright © 2000 CMP Media Inc. All rights reserved.
Privacy Policy