📄 cpu.pas
字号:
{Copyright: Hagen Reddmann HaReddmann at T-Online dot de
Author: Hagen Reddmann
Remarks: Public Domain, this Copyright must be included
known Problems: none
Version: 5.1, Delphi Encryption Compendium
Delphi 2-7, BCB 3-4, designed and testet under D3-7
Description: CPU Detection, single Unit
Remarks:
- codesizes 503 (CPUType)
1003 (CPUType, CPUSpeed)
5035 (CPUType, CPUSpeed, CPUVendor) bytes
- datasize (BSS) 142 bytes
- datasize (DATA) 100 bytes if CPUVendor is used
minimal 645 bytes in EXE
}
unit CPU;
interface
type
{CPU Detection}
TCPUData = packed record
Typ: Byte;
Family: Byte;
Model: Byte;
Stepping: Byte;
Signature: Cardinal; // encoded Typ/Family/Model/Stepping
Features_EDX: Cardinal; // Features
Features_EBX: Cardinal;
Features_ECX: Cardinal;
FeaturesEx_EDX: Cardinal; // extended Features AMD/Cyrix
FeaturesEx_EBX: Cardinal;
FeaturesEx_ECX: Cardinal;
Vendor: array[0..12] of Char; // inculdes trailing #0
VendorEx: array[0..64] of Char; // " "
CPUID3: array[0..4] of Cardinal;
VendorID: Cardinal;
TLB_EAX: Cardinal; // Cache and TLB Infos, see Intel Docus
TLB_EDX: Cardinal;
TLB_EBX: Cardinal;
TLB_ECX: Cardinal;
end;
const
// CPU Family codes
cf386 = 3;
cf486 = 4;
cfPentium = 5;
cfPentiumPro = 6;
// CPU Types
ctOEM = 0;
ctOverdrive = 1;
ctDual = 2;
// Vendor codes
cvIntel = $506E7F40; // CRC('GenuineIntel'); Intel
cvAMD = $454D5A47; // CRC('AuthenticAMD'); AMD
cvCyrix = $7E7D554F; // CRC('CyrixInstead'); Cyrix
cvUMC = $20434D55; // CRC('UMC UMC UMC '); UMC
cvNexGen = $5B597D42; // CRC('NexGenDriven'); NexGen
cvCentaur = $4F706543; // CRC('CentaurHauls'); Centaur/IDT
cvRise = $65736952; // CRC('RiseRiseRise'); Rise Technology
cvTransmeta = $17337363; // CRC('GenuineTMx86'); Transmeta
// CPU Features
ffFPU = $00000001; // Floating Point Unit on Chip
ffVME = $00000002; // Virtual 8086 Mode Enhancements
ffDE = $00000004; // Debugging Extensions
ffPSE = $00000008; // Page Size Extensions
ffTSC = $00000010; // Time Stamp Counter, supports RDTSC Instruction
ffMSR = $00000020; // Model Specific Registers, supports RDMSR Instruction
ffPAE = $00000040; // Physical Address Extension
ffMCE = $00000080; // Machine Check Exception
ffCX8 = $00000100; // CMPXCHG Instruction supported
ffAPIC = $00000200; // Advanced Programmable Interrupt Controller
// ffRes1 = $00000400;
ffSEP = $00000800; // Fast System Call, SYSENTER and SYSEXIT Instruction
ffMTRR = $00001000; // Memory Type Range Registers
ffPGE = $00002000; // Global Flag Processor supported
ffMCA = $00004000; // Machine Check Architecture
ffCMOV = $00008000; // CMOV/FCOMI Instructions supported
ffFGPAT = $00010000; // Page Attribute Table, CMOVcc supported
ffPSE36 = $00020000; // PSE-36
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -