home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 February
/
Chip_2004-02_cd1.bin
/
zkuste
/
konfig
/
download
/
msic
/
Help
/
Int
/
MSI_CPU.int
< prev
next >
Wrap
Text File
|
2003-08-26
|
14KB
|
366 lines
{*******************************************************}
{ }
{ MiTeC System Information Component }
{ CPU Detection Part }
{ version 8.3 for Delphi 5,6,7 }
{ }
{ Copyright ⌐ 1997,2003 Michal Mutl }
{ }
{*******************************************************}
{$INCLUDE MITEC_DEF.INC}
unit MSI_CPU;
interface
uses
SysUtils, Windows, Classes, MSI_Common;
type
TCPUType = (ctPrimary, ctOverDrive, ctSecondary, ctUnknown);
TCPUFamily = (cfUnknown, cf8086, cf286, cf386, cf486, cf586, cf686, cf786, cf8086_64);
TCPUArchitecture = (IA_32, IA_64);
TCPUIDResult = packed record
EAX: Cardinal;
EBX: Cardinal;
ECX: Cardinal;
EDX: Cardinal;
end;
TIntelCache = array [0..15] of Byte;
TAMDCache = record
L12MDataTLB: array [0..1] of Byte; //Entries, Associativity
L12MInstructionTLB: array [0..1] of Byte;
L14KDataTLB: array [0..1] of Byte;
L14KInstructionTLB: array [0..1] of Byte;
L1DataCache: array [0..3] of Byte; // Line size(B), Lines per tag, Associativity, Size(KB)
L1ICache: array [0..3] of Byte;
L22MDataTLB: array [0..1] of Byte;
L22MInstructionTLB: array [0..1] of Byte;
L24KDataTLB: array [0..1] of Byte;
L24KInstructionTLB: array [0..1] of Byte;
Level2Cache: array [0..3] of Byte;
end;
TCyrixCache = record
L1CacheInfo: array [0..3] of Byte;
TLBInfo: array [0..3] of Byte;
end;
TFreqInfo = record
RawFreq: Cardinal;
NormFreq: Cardinal;
InCycles: Cardinal;
ExTicks: Cardinal;
end;
const
{ CPUID EFLAGS Id bit }
CPUIDID_BIT = $200000;
{ CPUID execution levels }
CPUID_MAXLEVEL : DWORD = $0;
CPUID_VENDORSIGNATURE : DWORD = $0;
CPUID_CPUSIGNATURE : DWORD = $1;
CPUID_CPUFEATURESET : DWORD = $1;
CPUID_CACHETLB : DWORD = $2;
CPUID_CPUSERIALNUMBER : DWORD = $3;
CPUID_MAXLEVELEX : DWORD = $80000000;
CPUID_CPUSIGNATUREEX : DWORD = $80000001;
CPUID_CPUMARKETNAME1 : DWORD = $80000002;
CPUID_CPUMARKETNAME2 : DWORD = $80000003;
CPUID_CPUMARKETNAME3 : DWORD = $80000004;
CPUID_LEVEL1CACHETLB : DWORD = $80000005;
CPUID_LEVEL2CACHETLB : DWORD = $80000006;
CPUID_APMFEATURESET : DWORD = $80000007;
CPUID_PHYSADDR : DWORD = $80000008;
{ CPU vendors }
VENDOR_UNKNOWN = 0;
VENDOR_INTEL = 1;
VENDOR_AMD = 2;
VENDOR_CYRIX = 3;
VENDOR_IDT = 4;
VENDOR_NEXGEN = 5;
VENDOR_UMC = 6;
VENDOR_RISE = 7;
VENDOR_TM = 8;
VENDOR_SIS = 9;
VENDOR_NSC = 10;
{ Standard feature set flags }
SFS_FPU = 0;
SFS_VME = 1;
SFS_DE = 2;
SFS_PSE = 3;
SFS_TSC = 4;
SFS_MSR = 5;
SFS_PAE = 6;
SFS_MCE = 7;
SFS_CX8 = 8;
SFS_APIC = 9;
SFS_SEP = 11;
SFS_MTRR = 12;
SFS_PGE = 13;
SFS_MCA = 14;
SFS_CMOV = 15;
SFS_PAT = 16;
SFS_PSE36 = 17;
SFS_PSN = 18;
SFS_CLFSH = 19;
SFS_DS = 21;
SFS_ACPI = 22;
SFS_MMX = 23;
SFS_FXSR = 24;
SFS_SSE = 25;
SFS_SSE2 = 26;
SFS_SS = 27;
SFS_HTT = 28;
SFS_TM = 29;
{ Extended feature set flags (duplicates removed) }
EFS_MP = 19; { Multiprocessing capable }
EFS_EXMMXA = 22; { AMD Specific }
EFS_EXMMXC = 24; { Cyrix Specific }
EFS_3DNOW = 31;
EFS_EX3DNOW = 30;
{ AMD Cache Associativity }
AMDCA_L2OFF = $0;
AMDCA_DIRECTMAPPED = $1;
AMDCA_2WAY = $2;
AMDCA_4WAY = $4;
AMDCA_8WAY = $6;
AMDCA_16WAY = $8;
AMDCA_FULL = $F;
type
TCPUFeatures = class(TPersistent)
private
FSEP: boolean;
FMTRR: boolean;
FMSR: boolean;
FPSE: boolean;
FTSC: boolean;
FMCE: boolean;
FMMX: boolean;
FPAT: boolean;
FPAE: boolean;
FVME: boolean;
FPGE: boolean;
FCMOV: boolean;
FFPU: boolean;
FCX8: boolean;
FSIMD: Boolean;
FMCA: boolean;
FAPIC: boolean;
FDE: boolean;
FPSE36: boolean;
FSERIAL: Boolean;
F3DNOW: boolean;
FEX3DNOW: Boolean;
FEXMMX: Boolean;
FCLFSH: Boolean;
FACPI: Boolean;
FSS: Boolean;
FSIMD2: Boolean;
FTM: Boolean;
FDS: Boolean;
FFXSR: Boolean;
FHTT: Boolean;
public
CPUID: TCPUIDResult;
procedure GetInfo;
procedure Report(var sl: TStringList; Standalone: Boolean = True); virtual;
procedure GetFeaturesStr(var sl: TStringList);
published
property _3DNOW :Boolean read F3DNOW {$IFNDEF D6PLUS} write F3DNOW {$ENDIF} stored False;
property EX_3DNOW :Boolean read FEX3DNOW {$IFNDEF D6PLUS} write FEX3DNOW {$ENDIF} stored False;
property EX_MMX :Boolean read FEXMMX {$IFNDEF D6PLUS} write FEXMMX {$ENDIF} stored False;
property TM :Boolean read FTM {$IFNDEF D6PLUS} write FTM {$ENDIF} stored false;
property HTT :Boolean read FHTT {$IFNDEF D6PLUS} write FHTT {$ENDIF} stored False;
property SS :Boolean read FSS {$IFNDEF D6PLUS} write FSS {$ENDIF} stored false;
property SSE2 :Boolean read FSIMD2 {$IFNDEF D6PLUS} write FSIMD2 {$ENDIF} stored False;
property SSE :Boolean read FSIMD {$IFNDEF D6PLUS} write FSIMD {$ENDIF} stored False;
property FXSR :Boolean read FFXSR {$IFNDEF D6PLUS} write FFXSR {$ENDIF} stored false;
property MMX :Boolean read FMMX {$IFNDEF D6PLUS} write FMMX {$ENDIF} stored false;
property ACPI :Boolean read FACPI {$IFNDEF D6PLUS} write FACPI {$ENDIF} stored false;
property DS :Boolean read FDS {$IFNDEF D6PLUS} write FDS {$ENDIF} stored false;
property CLFSH :Boolean read FCLFSH {$IFNDEF D6PLUS} write FCLFSH {$ENDIF} stored false;
property PSN :Boolean read FSERIAL {$IFNDEF D6PLUS} write FSERIAL {$ENDIF} stored False;
property PSE36 :Boolean read FPSE36 {$IFNDEF D6PLUS} write FPSE36 {$ENDIF} stored false;
property PAT :Boolean read FPAT {$IFNDEF D6PLUS} write FPAT {$ENDIF} stored false;
property CMOV :Boolean read FCMOV {$IFNDEF D6PLUS} write FCMOV {$ENDIF} stored false;
property MCA :Boolean read FMCA {$IFNDEF D6PLUS} write FMCA {$ENDIF} stored false;
property PGE :Boolean read FPGE {$IFNDEF D6PLUS} write FPGE {$ENDIF} stored false;
property MTRR :Boolean read FMTRR {$IFNDEF D6PLUS} write FMTRR {$ENDIF} stored false;
property SEP :Boolean read FSEP {$IFNDEF D6PLUS} write FSEP {$ENDIF} stored false;
property APIC :Boolean read FAPIC {$IFNDEF D6PLUS} write FAPIC {$ENDIF} stored false;
property CX8 :Boolean read FCX8 {$IFNDEF D6PLUS} write FCX8 {$ENDIF} stored false;
property MCE :Boolean read FMCE {$IFNDEF D6PLUS} write FMCE {$ENDIF} stored false;
property PAE :Boolean read FPAE {$IFNDEF D6PLUS} write FPAE {$ENDIF} stored false;
property MSR :Boolean read FMSR {$IFNDEF D6PLUS} write FMSR {$ENDIF} stored false;
property TSC :Boolean read FTSC {$IFNDEF D6PLUS} write FTSC {$ENDIF} stored false;
property PSE :Boolean read FPSE {$IFNDEF D6PLUS} write FPSE {$ENDIF} stored false;
property DE :Boolean read FDE {$IFNDEF D6PLUS} write FDE {$ENDIF} stored false;
property VME :Boolean read FVME {$IFNDEF D6PLUS} write FVME {$ENDIF} stored false;
property FPU :Boolean read FFPU {$IFNDEF D6PLUS} write FFPU {$ENDIF} stored false;
end;
TCPUCache = class(TPersistent)
private
FFamily: integer;
FStepping: integer;
FModel: Integer;
FVendorID: string;
FLevel2: LongInt;
FLevel1: LongInt;
FLevel1Data: LongInt;
FLevel1Code: LongInt;
FDesc: TStrings;
FLevel3: LongInt;
public
IntelCache: TIntelCache;
AMDCache: TAMDCache;
CyrixCache: TCyrixCache;
constructor Create;
destructor Destroy; override;
procedure GetInfo(AVendor: DWORD);
procedure Report(var sl :TStringList; Standalone: Boolean = True); virtual;
property Descriptions: TStrings read FDesc;
property L1Data: LongInt read FLevel1Data;
property L1Code: LongInt read FLevel1Code;
published
property Level1: LongInt read FLevel1 {$IFNDEF D6PLUS} write FLevel1 {$ENDIF} stored FALSE;
property Level2: LongInt read FLevel2 {$IFNDEF D6PLUS} write FLevel2 {$ENDIF} stored FALSE;
property Level3: LongInt read FLevel3 {$IFNDEF D6PLUS} write FLevel3 {$ENDIF} stored FALSE;
end;
TCPU = class(TPersistent)
private
FFreq :integer;
FFeatures: TCPUFeatures;
FVendorReg: string;
FVendorIDReg: string;
FCount: integer;
FFamily: integer;
FStepping: integer;
FModel: integer;
FVendorID: string;
FTyp: DWORD;
FLevel: DWORD;
FCache: TCPUCache;
FSerial: string;
FDIV: Boolean;
FVendorCPUID: string;
FVendorIDCPUID: string;
FBrand: DWORD;
FCPUVendor: DWORD;
FCodeName: string;
FVendorEx: string;
FMode: TExceptionMode;
FCPUSig: TCPUIDResult;
FExtModel: integer;
FExtFamily: integer;
FCPUFamily: TCPUFamily;
FCPUType: TCPUType;
FExtStep: integer;
FCPUSigEx: TCPUIDResult;
FExtLevel: DWORD;
FPNSReg: string;
FFreqReg: DWORD;
FArch: TCPUArchitecture;
FGetCache, FGetFeat: Boolean;
public
constructor Create;
destructor Destroy; override;
procedure GetInfo(AGetCache: Boolean = True; AGetFeatures: Boolean = True);
procedure Report(var sl :TStringList; Standalone: Boolean = True); virtual;
property RegistryVendor :string read FVendorReg {$IFNDEF D6PLUS} write FVendorReg {$ENDIF} stored false;
property RegistryVendorID :string read FVendorIDReg {$IFNDEF D6PLUS} write FVendorIDReg {$ENDIF} stored False;
property RegistryNameString :string read FPNSReg {$IFNDEF D6PLUS} write FPNSReg {$ENDIF} stored False;
property RegistryFrequency :DWORD read FFreqReg {$IFNDEF D6PLUS} write FFreqReg {$ENDIF} stored False;
property CPUIDVendor :string read FVendorCPUID {$IFNDEF D6PLUS} write FVendorCPUID {$ENDIF} stored false;
property CPUIDNameString :string read FVendorIDCPUID {$IFNDEF D6PLUS} write FVendorIDCPUID {$ENDIF} stored False;
property ExtendedFamily :integer read FExtFamily {$IFNDEF D6PLUS} write FExtFamily {$ENDIF} stored false;
property ExtendedModel :integer read FExtModel {$IFNDEF D6PLUS} write FExtModel {$ENDIF} stored false;
property ExtendedStepping :integer read FExtStep {$IFNDEF D6PLUS} write FExtStep {$ENDIF} stored false;
property Brand: DWORD read FBrand {$IFNDEF D6PLUS} write FBrand {$ENDIF} stored False;
property Typ: DWORD read FTyp {$IFNDEF D6PLUS} write FTyp {$ENDIF} stored False;
property MaxFunctionLevel: DWORD read FLevel {$IFNDEF D6PLUS} write FLevel {$ENDIF} stored False;
property MaxExtendedFunctionLevel: DWORD read FExtLevel {$IFNDEF D6PLUS} write FExtLevel {$ENDIF} stored False;
property VendorType: DWORD read FCPUVendor {$IFNDEF D6PLUS} write FCPUVendor {$ENDIF} stored False;
property Signature: TCPUIDResult read FCPUSig {$IFNDEF D6PLUS} write FCPUSig {$ENDIF} stored False;
property ExtendedSignature: TCPUIDResult read FCPUSigEx {$IFNDEF D6PLUS} write FCPUSigEx {$ENDIF} stored False;
published
property ExceptionMode: TExceptionMode read FMode write FMode;
property Count :integer read FCount {$IFNDEF D6PLUS} write FCount {$ENDIF} stored false;
property Vendor :string read FVendorEx {$IFNDEF D6PLUS} write FVendorEx {$ENDIF} stored False;
property FriendlyName :string read FVendorID {$IFNDEF D6PLUS} write FVendorID {$ENDIF} stored false;
property CodeName: string read FCodeName {$IFNDEF D6PLUS} write FCodeName {$ENDIF} stored False;
property Frequency :integer read FFreq {$IFNDEF D6PLUS} write FFreq {$ENDIF} stored false;
property Family :integer read FFamily {$IFNDEF D6PLUS} write FFamily {$ENDIF} stored false;
property Model :integer read FModel {$IFNDEF D6PLUS} write FModel {$ENDIF} stored false;
property Stepping :integer read FStepping {$IFNDEF D6PLUS} write FStepping {$ENDIF} stored false;
property Features :TCPUFeatures read FFeatures {$IFNDEF D6PLUS} write FFeatures {$ENDIF} stored false;
property Cache: TCPUCache read FCache {$IFNDEF D6PLUS} write FCache {$ENDIF} stored false;
property SerialNumber: string read FSerial {$IFNDEF D6PLUS} write FSerial {$ENDIF} stored False;
property FDIVBug: Boolean read FDIV {$IFNDEF D6PLUS} write FDIV {$ENDIF} stored False;
property CPUType: TCPUType read FCPUType {$IFNDEF D6PLUS} write FCPUType {$ENDIF} stored False;
property FamilyType :TCPUFamily read FCPUFamily {$IFNDEF D6PLUS} write FCPUFamily {$ENDIF} stored false;
property Architecture: TCPUArchitecture read FArch {$IFNDEF D6PLUS} write FArch {$ENDIF} stored False;
end;
function ExecuteCPUID: TCPUIDResult; assembler;
function GetCPUVendor: DWORD;
var
CPUID_Level: DWORD;
const
CPUVendorsEx :array[VENDOR_INTEL..VENDOR_NSC] of string =
('Intel Corporation',
'Advanced Micro Devices',
'Cyrix Corporation',
'IDT/Centaur/VIA',
'NexGen Inc.',
'United Microelectronics Corp',
'Rise Technology',
'Transmeta',
'SiS',
'National Semiconductor');
CPUVendors :array[VENDOR_INTEL..VENDOR_NSC] of string =
('Intel',
'AMD',
'Cyrix',
'IDT',
'NexGen',
'UMC',
'Rise',
'Transmeta',
'SiS',
'NSC');
CPUTypes: array[TCPUType] of string = ('Primary','OverDrive', 'Secondary', 'Unknown');
function GetCPUSpeed_M1: TFreqInfo;
function GetCPUSpeed_M2(ADelay: DWORD): Single;
function GetCPUSpeed_M3: Double;
function RoundFrequency(const Frequency: Integer): Integer;
implementation