-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJclSysInfo.pas
More file actions
6715 lines (6236 loc) · 231 KB
/
Copy pathJclSysInfo.pas
File metadata and controls
6715 lines (6236 loc) · 231 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{**************************************************************************************************}
{ }
{ Project JEDI Code Library (JCL) }
{ }
{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); }
{ you may not use this file except in compliance with the License. You may obtain a copy of the }
{ License at http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF }
{ ANY KIND, either express or implied. See the License for the specific language governing rights }
{ and limitations under the License. }
{ }
{ The Original Code is JclSysInfo.pas. }
{ }
{ The Initial Developer of the Original Code is Marcel van Brakel. }
{ Portions created by Marcel van Brakel are Copyright (C) Marcel van Brakel. All rights reserved. }
{ }
{ Contributors: }
{ Alexander Radchenko }
{ Andre Snepvangers (asnepvangers) }
{ Azret Botash }
{ Bryan Coutch }
{ Carl Clark }
{ Eric S. Fisher }
{ Florent Ouchet (outchy) }
{ Heiko Adams }
{ James Azarja }
{ Jean-Fabien Connault (cycocrew) }
{ John C Molyneux }
{ Marcel van Brakel }
{ Matthias Thoma (mthoma) }
{ Mike Lischke }
{ Nick Hodges }
{ Olivier Sannier (obones) }
{ Peter Friese }
{ Peter Thornquist (peter3) }
{ Petr Vones (pvones) }
{ Rik Barker }
{ Robert Marquardt (marquardt) }
{ Robert Rossmair (rrossmair) }
{ Scott Price }
{ Tom Hahn (tomhahn) }
{ Wim de Cleen }
{ }
{**************************************************************************************************}
{ }
{ This unit contains routines and classes to retrieve various pieces of system information. }
{ Examples are the location of standard folders, settings of environment variables, processor }
{ details and the Windows version. }
{ }
{**************************************************************************************************}
{ }
{ Last modified: $Date:: $ }
{ Revision: $Rev:: $ }
{ Author: $Author:: $ }
{ }
{**************************************************************************************************}
// Windows NT 4 and earlier do not support GetSystemPowerStatus (while introduced
// in NT4 - it is a stub there - implemented in Windows 2000 and later.
unit JclSysInfo;
{$I jcl.inc}
interface
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
{$IFDEF HAS_UNIT_LIBC}
Libc,
{$ENDIF HAS_UNIT_LIBC}
{$IFDEF HAS_UNITSCOPE}
{$IFDEF MSWINDOWS}
Winapi.Windows, WinApi.ActiveX, Winapi.ShlObj,
{$ENDIF MSWINDOWS}
System.Classes,
{$ELSE ~HAS_UNITSCOPE}
{$IFDEF MSWINDOWS}
Windows, ActiveX, ShlObj,
{$ENDIF MSWINDOWS}
Classes,
{$ENDIF ~HAS_UNITSCOPE}
JclBase, JclResources;
// Environment Variables
{$IFDEF MSWINDOWS}
type
TEnvironmentOption = (eoLocalMachine, eoCurrentUser, eoAdditional);
TEnvironmentOptions = set of TEnvironmentOption;
{$ENDIF MSWINDOWS}
function DelEnvironmentVar(const Name: string): Boolean;
function ExpandEnvironmentVar(var Value: string): Boolean;
function ExpandEnvironmentVarCustom(var Value: string; Vars: TStrings): Boolean;
function GetEnvironmentVar(const Name: string; out Value: string): Boolean; overload;
function GetEnvironmentVar(const Name: string; out Value: string; Expand: Boolean): Boolean; overload;
function GetEnvironmentVars(const Vars: TStrings): Boolean; overload;
function GetEnvironmentVars(const Vars: TStrings; Expand: Boolean): Boolean; overload;
function SetEnvironmentVar(const Name, Value: string): Boolean;
{$IFDEF MSWINDOWS}
function CreateEnvironmentBlock(const Options: TEnvironmentOptions; const AdditionalVars: TStrings): PChar;
procedure DestroyEnvironmentBlock(var Env: PChar);
procedure SetGlobalEnvironmentVariable(VariableName, VariableContent: string);
{$ENDIF MSWINDOWS}
// Common Folder Locations
{$IFDEF MSWINDOWS}
function GetCommonFilesFolder: string;
{$ENDIF MSWINDOWS}
function GetCurrentFolder: string;
{$IFDEF MSWINDOWS}
function GetProgramFilesFolder: string;
function GetWindowsFolder: string;
function GetWindowsSystemFolder: string;
function GetWindowsTempFolder: string;
function GetDesktopFolder: string;
function GetProgramsFolder: string;
{$ENDIF MSWINDOWS}
function GetPersonalFolder: string;
{$IFDEF MSWINDOWS}
function GetFavoritesFolder: string;
function GetStartupFolder: string;
function GetRecentFolder: string;
function GetSendToFolder: string;
function GetStartmenuFolder: string;
function GetDesktopDirectoryFolder: string;
function GetCommonDocumentsFolder: string;
function GetNethoodFolder: string;
function GetFontsFolder: string;
function GetCommonStartmenuFolder: string;
function GetCommonStartupFolder: string;
function GetPrinthoodFolder: string;
function GetProfileFolder: string;
function GetCommonProgramsFolder: string;
function GetCommonDesktopdirectoryFolder: string;
function GetCommonAppdataFolder: string;
function GetAppdataFolder: string;
function GetLocalAppData: string;
function GetCommonFavoritesFolder: string;
function GetTemplatesFolder: string;
function GetInternetCacheFolder: string;
function GetCookiesFolder: string;
function GetHistoryFolder: string;
// Advanced Power Management (APM)
type
TAPMLineStatus = (alsOffline, alsOnline, alsUnknown);
TAPMBatteryFlag = (abfHigh, abfLow, abfCritical, abfCharging, abfNoBattery, abfUnknown);
TAPMBatteryFlags = set of TAPMBatteryFlag;
function GetAPMLineStatus: TAPMLineStatus;
function GetAPMBatteryFlag: TAPMBatteryFlag;
function GetAPMBatteryFlags: TAPMBatteryFlags;
function GetAPMBatteryLifePercent: Integer;
function GetAPMBatteryLifeTime: DWORD;
function GetAPMBatteryFullLifeTime: DWORD;
// Identification
type
TFileSystemFlag =
(
fsCaseSensitive, // The file system supports case-sensitive file names.
fsCasePreservedNames, // The file system preserves the case of file names when it places a name on disk.
fsSupportsUnicodeOnDisk, // The file system supports Unicode in file names as they appear on disk.
fsPersistentACLs, // The file system preserves and enforces ACLs. For example, NTFS preserves and enforces ACLs, and FAT does not.
fsSupportsFileCompression, // The file system supports file-based compression.
fsSupportsVolumeQuotas, // The file system supports disk quotas.
fsSupportsSparseFiles, // The file system supports sparse files.
fsSupportsReparsePoints, // The file system supports reparse points.
fsSupportsRemoteStorage, // ?
fsVolumeIsCompressed, // The specified volume is a compressed volume; for example, a DoubleSpace volume.
fsSupportsObjectIds, // The file system supports object identifiers.
fsSupportsEncryption, // The file system supports the Encrypted File System (EFS).
fsSupportsNamedStreams, // The file system supports named streams.
fsVolumeIsReadOnly // The specified volume is read-only.
// Windows 2000/NT and Windows Me/98/95: This value is not supported.
);
TFileSystemFlags = set of TFileSystemFlag;
function GetVolumeName(const Drive: string): string;
function GetVolumeSerialNumber(const Drive: string): string;
function GetVolumeFileSystem(const Drive: string): string;
function GetVolumeFileSystemFlags(const Volume: string): TFileSystemFlags;
{$ENDIF MSWINDOWS}
function GetIPAddress(const HostName: string): string;
{$IFDEF MSWINDOWS}
procedure GetIpAddresses(Results: TStrings; const HostName: AnsiString); overload;
{$ENDIF MSWINDOWS}
procedure GetIpAddresses(Results: TStrings); overload;
function GetLocalComputerName: string;
function GetLocalUserName: string;
{$IFDEF MSWINDOWS}
function GetUserDomainName(const CurUser: string): string;
function GetWorkGroupName: WideString;
{$ENDIF MSWINDOWS}
function GetDomainName: string;
{$IFDEF MSWINDOWS}
function GetRegisteredCompany: string;
function GetRegisteredOwner: string;
function GetWindowsProductId: string;
function GetBIOSName: string;
function GetBIOSCopyright: string;
function GetBIOSExtendedInfo: string;
function GetBIOSDate: TDateTime;
{$ENDIF MSWINDOWS}
// Processes, Tasks and Modules
type
TJclTerminateAppResult = (taError, taClean, taKill);
function RunningProcessesList(const List: TStrings; FullPath: Boolean = True): Boolean;
{$IFDEF MSWINDOWS}
function LoadedModulesList(const List: TStrings; ProcessID: DWORD; HandlesOnly: Boolean = False): Boolean;
function GetTasksList(const List: TStrings): Boolean;
function ModuleFromAddr(const Addr: Pointer): HMODULE;
function IsSystemModule(const Module: HMODULE): Boolean;
procedure BeginModuleFromAddrCache;
procedure EndModuleFromAddrCache;
function CachedModuleFromAddr(const Addr: Pointer): HMODULE;
function IsMainAppWindow(Wnd: THandle): Boolean;
function IsWindowResponding(Wnd: THandle; Timeout: Integer): Boolean;
function GetWindowIcon(Wnd: THandle; LargeIcon: Boolean): HICON;
function GetWindowCaption(Wnd: THandle): string;
function TerminateTask(Wnd: THandle; Timeout: Integer): TJclTerminateAppResult;
function TerminateApp(ProcessID: DWORD; Timeout: Integer): TJclTerminateAppResult;
{$ENDIF MSWINDOWS}
{$IFDEF MSWINDOWS}
{.$IFNDEF FPC}
function GetPidFromProcessName(const ProcessName: string): THandle;
function GetProcessNameFromWnd(Wnd: THandle): string;
function GetProcessNameFromPid(PID: DWORD): string;
function GetMainAppWndFromPid(PID: DWORD): THandle;
function GetWndFromPid(PID: DWORD; const WindowClassName: string): HWND;
{.$ENDIF ~FPC}
function GetShellProcessName: string;
{.$IFNDEF FPC}
function GetShellProcessHandle: THandle;
{.$ENDIF ~FPC}
// Version Information
type
TWindowsVersion =
(wvUnknown, wvWin95, wvWin95OSR2, wvWin98, wvWin98SE, wvWinME,
wvWinNT31, wvWinNT35, wvWinNT351, wvWinNT4, wvWin2000, wvWinXP,
wvWin2003, wvWinXP64, wvWin2003R2, wvWinVista, wvWinServer2008,
wvWin7, wvWinServer2008R2, wvWin8, wvWin8RT, wvWinServer2012,
wvWin81, wvWin81RT, wvWinServer2012R2, wvWin10, wvWinServer2016,
wvWinServer2019, wvWinServer, wvWin11, wvWinServer2022, wvWinServer2025);
TWindowsEdition =
(weUnknown, weWinXPHome, weWinXPPro, weWinXPHomeN, weWinXPProN, weWinXPHomeK,
weWinXPProK, weWinXPHomeKN, weWinXPProKN, weWinXPStarter, weWinXPMediaCenter,
weWinXPTablet, weWinVistaStarter, weWinVistaHomeBasic, weWinVistaHomeBasicN,
weWinVistaHomePremium, weWinVistaBusiness, weWinVistaBusinessN,
weWinVistaEnterprise, weWinVistaUltimate, weWin7Starter, weWin7HomeBasic,
weWin7HomePremium, weWin7Professional, weWin7Enterprise, weWin7Ultimate,
weWin8, weWin8Pro, weWin8Enterprise, weWin8RT, weWin81, weWin81Pro,
weWin81Enterprise, weWin81RT, weWin10, weWin10Home, weWin10Pro,
weWin10Enterprise, weWin10Education);
TNtProductType =
(ptUnknown, ptWorkStation, ptServer, ptAdvancedServer,
ptPersonal, ptProfessional, ptDatacenterServer, ptEnterprise, ptWebEdition);
TProcessorArchitecture =
(paUnknown, // unknown processor
pax8632, // x86 32 bit processors (some P4, Celeron, Athlon and older)
pax8664, // x86 64 bit processors (latest P4, Celeron and Athlon64)
paIA64, // Itanium processors
paARM, // ARM 32 bit processors
paARM64); // ARM 64 bit processors
var
{ in case of additions, don't forget to update initialization section! }
IsWin95: Boolean = False;
IsWin95OSR2: Boolean = False;
IsWin98: Boolean = False;
IsWin98SE: Boolean = False;
IsWinME: Boolean = False;
IsWinNT: Boolean = False;
IsWinNT3: Boolean = False;
IsWinNT31: Boolean = False;
IsWinNT35: Boolean = False;
IsWinNT351: Boolean = False;
IsWinNT4: Boolean = False;
IsWin2K: Boolean = False;
IsWinXP: Boolean = False;
IsWin2003: Boolean = False;
IsWinXP64: Boolean = False;
IsWin2003R2: Boolean = False;
IsWinVista: Boolean = False;
IsWinServer2008: Boolean = False;
IsWin7: Boolean = False;
IsWinServer2008R2: Boolean = False;
IsWin8: Boolean = False;
IsWin8RT: Boolean = False;
IsWinServer2012: Boolean = False;
IsWin81: Boolean = False;
IsWin81RT: Boolean = False;
IsWinServer2012R2: Boolean = False;
IsWin10: Boolean = False;
IsWinServer2016: Boolean = False;
IsWinServer2019: Boolean = False;
IsWinServer2022: Boolean = False;
IsWinServer2025: Boolean = False;
IsWinServer: Boolean = False;
IsWin11: Boolean = False;
const
PROCESSOR_ARCHITECTURE_INTEL = 0;
{$EXTERNALSYM PROCESSOR_ARCHITECTURE_INTEL}
PROCESSOR_ARCHITECTURE_AMD64 = 9;
{$EXTERNALSYM PROCESSOR_ARCHITECTURE_AMD64}
PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10;
{$EXTERNALSYM PROCESSOR_ARCHITECTURE_IA32_ON_WIN64}
PROCESSOR_ARCHITECTURE_IA64 = 6;
{$EXTERNALSYM PROCESSOR_ARCHITECTURE_IA64}
PROCESSOR_ARCHITECTURE_ARM = 5;
{$EXTERNALSYM PROCESSOR_ARCHITECTURE_ARM}
PROCESSOR_ARCHITECTURE_ARM64 = 12;
{$EXTERNALSYM PROCESSOR_ARCHITECTURE_ARM64}
PROCESSOR_ARCHITECTURE_UNKNOWN = $FFFF;
{$EXTERNALSYM PROCESSOR_ARCHITECTURE_UNKNOWN}
const
Windows11InitialBuildNumber = 22000;
Windows2025ServerInitialBuildNumber = 26100;
function GetWindowsVersion: TWindowsVersion;
function GetWindowsEdition: TWindowsEdition;
function NtProductType: TNtProductType;
function GetWindowsVersionString: string;
function GetWindowsEditionString: string;
function GetWindowsProductString: string;
function GetWindowsProductName: string;
function NtProductTypeString: string;
function GetWindowsBuildNumber: Integer;
function GetWindowsMajorVersionNumber: Integer;
function GetWindowsMinorVersionNumber: Integer;
function GetWindowsVersionNumber: string;
function GetWindowsServicePackVersion: Integer;
function GetWindowsServicePackVersionString: string;
function GetWindowsDisplayVersion: string;
function GetWindowsReleaseId: Integer;
function GetWindowsReleaseName: String;
function GetWindowsReleaseCode: String;
function GetWindowsReleaseCodeName: String;
function GetWindowsReleaseVersion: String;
function GetWindows10DisplayVersion: string; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsDisplayVersion'{$ENDIF};{$ENDIF}
function GetWindows10ReleaseId: Integer; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsReleaseId'{$ENDIF};{$ENDIF}
function GetWindows10ReleaseName: String; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsReleaseName'{$ENDIF};{$ENDIF}
function GetWindows10ReleaseCodeName: String; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsReleaseCodeName'{$ENDIF};{$ENDIF}
function GetWindows10ReleaseVersion: String; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsReleaseVersion'{$ENDIF};{$ENDIF}
function GetWindowsServerDisplayVersion: string; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsDisplayVersion'{$ENDIF};{$ENDIF}
function GetWindowsServerReleaseId: Integer; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsReleaseId'{$ENDIF};{$ENDIF}
function GetWindowsServerReleaseVersion: String; {$IFDEF SUPPORTS_DEPRECATED}deprecated {$IFDEF SUPPORTS_DEPRECATED_DETAILS}'Use GetWindowsReleaseVersion'{$ENDIF};{$ENDIF}
function GetOpenGLVersion(const Win: THandle; out Version, Vendor: AnsiString): Boolean;
function GetNativeSystemInfo(var SystemInfo: TSystemInfo): Boolean;
function GetProcessorArchitecture: TProcessorArchitecture;
function IsWindows64: Boolean;
function JclCheckWinVersion(Major, Minor: Integer): Boolean;
{$ENDIF MSWINDOWS}
function GetOSVersionString: string;
// Hardware
{$IFDEF MSWINDOWS}
function GetMacAddresses(const Machine: string; const Addresses: TStrings): Integer;
{$ENDIF MSWINDOWS}
function ReadTimeStampCounter: Int64;
{$IFDEF WIN64}
{$EXTERNALSYM ReadTimeStampCounter}
{$ENDIF WIN64}
type
TTLBInformation = (tiEntries, tiAssociativity);
TCacheInformation = (ciLineSize {in Bytes}, ciLinesPerTag, ciAssociativity, ciSize);
TIntelSpecific = record
L2Cache: Cardinal;
CacheDescriptors: array [0..15] of Byte;
BrandID: Byte;
FlushLineSize: Byte;
APICID: Byte;
ExFeatures: Cardinal;
Ex64Features: Cardinal;
Ex64Features2: Cardinal;
PowerManagementFeatures: Cardinal;
PhysicalAddressBits: Byte;
VirtualAddressBits: Byte;
end;
TCyrixSpecific = record
L1CacheInfo: array [0..3] of Byte;
TLBInfo: array [0..3] of Byte;
end;
TAMDSpecific = packed record
ExFeatures: Cardinal;
ExFeatures2: Cardinal;
Features2: Cardinal;
BrandID: Byte;
FlushLineSize: Byte;
APICID: Byte;
ExBrandID: Word;
// do not split L1 MByte TLB
L1MByteInstructionTLB: array [TTLBInformation] of Byte;
L1MByteDataTLB: array [TTLBInformation] of Byte;
// do not split L1 KByte TLB
L1KByteInstructionTLB: array [TTLBInformation] of Byte;
L1KByteDataTLB: array [TTLBInformation] of Byte;
L1DataCache: array [TCacheInformation] of Byte;
L1InstructionCache: array [TCacheInformation] of Byte;
// do not split L2 MByte TLB
L2MByteInstructionTLB: array [TTLBInformation] of Byte; // L2 TLB for 2-MByte and 4-MByte pages
L2MByteDataTLB: array [TTLBInformation] of Byte; // L2 TLB for 2-MByte and 4-MByte pages
// do not split L2 KByte TLB
L2KByteDataTLB: array [TTLBInformation] of Byte; // L2 TLB for 4-KByte pages
L2KByteInstructionTLB: array [TTLBInformation] of Byte; // L2 TLB for 4-KByte pages
L2Cache: Cardinal;
L3Cache: Cardinal;
AdvancedPowerManagement: Cardinal;
PhysicalAddressSize: Byte;
VirtualAddressSize: Byte;
end;
TVIASpecific = record
ExFeatures: Cardinal;
DataTLB: array [TTLBInformation] of Byte;
InstructionTLB: array [TTLBInformation] of Byte;
L1DataCache: array [TCacheInformation] of Byte;
L1InstructionCache: array [TCacheInformation] of Byte;
L2DataCache: Cardinal;
end;
TTransmetaSpecific = record
ExFeatures: Cardinal;
DataTLB: array [TTLBInformation] of Byte;
CodeTLB: array [TTLBInformation] of Byte;
L1DataCache: array [TCacheInformation] of Byte;
L1CodeCache: array [TCacheInformation] of Byte;
L2Cache: Cardinal;
RevisionABCD: Cardinal;
RevisionXXXX: Cardinal;
Frequency: Cardinal;
CodeMorphingABCD: Cardinal;
CodeMorphingXXXX: Cardinal;
TransmetaFeatures: Cardinal;
TransmetaInformations: array [0..64] of Char;
CurrentVoltage: Cardinal;
CurrentFrequency: Cardinal;
CurrentPerformance: Cardinal;
end;
TCacheFamily = (
cfInstructionTLB, cfDataTLB,
cfL1InstructionCache, cfL1DataCache,
cfL2Cache, cfL2TLB, cfL3Cache, cfTrace, cfOther);
TCacheInfo = record
D: Byte;
Family: TCacheFamily;
Size: Cardinal;
WaysOfAssoc: Byte;
LineSize: Byte; // for Normal Cache
LinePerSector: Byte; // for L3 Normal Cache
Entries: Cardinal; // for TLB
I: PResStringRec;
end;
TFreqInfo = record
RawFreq: Int64;
NormFreq: Int64;
InCycles: Int64;
ExTicks: Int64;
end;
const
CPU_TYPE_INTEL = 1;
CPU_TYPE_CYRIX = 2;
CPU_TYPE_AMD = 3;
CPU_TYPE_TRANSMETA = 4;
CPU_TYPE_VIA = 5;
type
TSSESupport = (sse, sse2, sse3, ssse3, sse41, sse42, sse4A, sse5, avx);
TSSESupports = set of TSSESupport;
TCpuInfo = record
HasInstruction: Boolean;
AES: Boolean;
MMX: Boolean;
ExMMX: Boolean;
_3DNow: Boolean;
Ex3DNow: Boolean;
SSE: TSSESupports;
IsFDIVOK: Boolean;
Is64Bits: Boolean;
DEPCapable: Boolean;
HasCacheInfo: Boolean;
HasExtendedInfo: Boolean;
PType: Byte;
Family: Byte;
ExtendedFamily: Byte;
Model: Byte;
ExtendedModel: Byte;
Stepping: Byte;
Features: Cardinal;
FrequencyInfo: TFreqInfo;
VendorIDString: array [0..11] of AnsiChar;
Manufacturer: array [0..9] of AnsiChar;
CpuName: array [0..47] of AnsiChar;
L1DataCacheSize: Cardinal; // in kByte
L1DataCacheLineSize: Byte; // in Byte
L1DataCacheAssociativity: Byte;
L1InstructionCacheSize: Cardinal; // in kByte
L1InstructionCacheLineSize: Byte; // in Byte
L1InstructionCacheAssociativity: Byte;
L2CacheSize: Cardinal; // in kByte
L2CacheLineSize: Byte; // in Byte
L2CacheAssociativity: Byte;
L3CacheSize: Cardinal; // in kByte
L3CacheLineSize: Byte; // in Byte
L3CacheAssociativity: Byte;
L3LinesPerSector: Byte;
LogicalCore: Byte;
PhysicalCore: Byte;
HyperThreadingTechnology: Boolean;
HardwareHyperThreadingTechnology: Boolean;
// todo: TLB
case CpuType: Byte of
CPU_TYPE_INTEL: (IntelSpecific: TIntelSpecific;);
CPU_TYPE_CYRIX: (CyrixSpecific: TCyrixSpecific;);
CPU_TYPE_AMD: (AMDSpecific: TAMDSpecific;);
CPU_TYPE_TRANSMETA: (TransmetaSpecific: TTransmetaSpecific;);
CPU_TYPE_VIA: (ViaSpecific: TViaSpecific;);
end;
const
VendorIDIntel: array [0..11] of AnsiChar = 'GenuineIntel';
VendorIDCyrix: array [0..11] of AnsiChar = 'CyrixInstead';
VendorIDAMD: array [0..11] of AnsiChar = 'AuthenticAMD';
VendorIDTransmeta: array [0..11] of AnsiChar = 'GenuineTMx86';
VendorIDVIA: array [0..11] of AnsiChar = 'CentaurHauls';
// Constants to be used with Feature Flag set of a CPU
// eg. IF (Features and FPU_FLAG = FPU_FLAG) THEN CPU has Floating-Point unit on
// chip. However, Intel claims that in future models, a zero in the feature
// flags will mean that the chip has that feature, however, the following flags
// will work for any production 80x86 chip or clone.
// eg. IF (Features and FPU_FLAG = 0) then CPU has Floating-Point unit on chip.
const
{ 32 bits in a DWord Value }
BIT_0 = $00000001;
BIT_1 = $00000002;
BIT_2 = $00000004;
BIT_3 = $00000008;
BIT_4 = $00000010;
BIT_5 = $00000020;
BIT_6 = $00000040;
BIT_7 = $00000080;
BIT_8 = $00000100;
BIT_9 = $00000200;
BIT_10 = $00000400;
BIT_11 = $00000800;
BIT_12 = $00001000;
BIT_13 = $00002000;
BIT_14 = $00004000;
BIT_15 = $00008000;
BIT_16 = $00010000;
BIT_17 = $00020000;
BIT_18 = $00040000;
BIT_19 = $00080000;
BIT_20 = $00100000;
BIT_21 = $00200000;
BIT_22 = $00400000;
BIT_23 = $00800000;
BIT_24 = $01000000;
BIT_25 = $02000000;
BIT_26 = $04000000;
BIT_27 = $08000000;
BIT_28 = $10000000;
BIT_29 = $20000000;
BIT_30 = $40000000;
BIT_31 = DWORD($80000000);
{ Standard Feature Flags }
FPU_FLAG = BIT_0; // Floating-Point unit on chip
VME_FLAG = BIT_1; // Virtual Mode Extention
DE_FLAG = BIT_2; // Debugging Extention
PSE_FLAG = BIT_3; // Page Size Extention
TSC_FLAG = BIT_4; // Time Stamp Counter
MSR_FLAG = BIT_5; // Model Specific Registers
PAE_FLAG = BIT_6; // Physical Address Extention
MCE_FLAG = BIT_7; // Machine Check Exception
CX8_FLAG = BIT_8; // CMPXCHG8 Instruction
APIC_FLAG = BIT_9; // Software-accessible local APIC on Chip
BIT_10_FLAG = BIT_10; // Reserved, do not count on value
SEP_FLAG = BIT_11; // Fast System Call
MTRR_FLAG = BIT_12; // Memory Type Range Registers
PGE_FLAG = BIT_13; // Page Global Enable
MCA_FLAG = BIT_14; // Machine Check Architecture
CMOV_FLAG = BIT_15; // Conditional Move Instruction
PAT_FLAG = BIT_16; // Page Attribute Table
PSE36_FLAG = BIT_17; // 36-bit Page Size Extention
PSN_FLAG = BIT_18; // Processor serial number is present and enabled
CLFLSH_FLAG = BIT_19; // CLFLUSH intruction
BIT_20_FLAG = BIT_20; // Reserved, do not count on value
DS_FLAG = BIT_21; // Debug store
ACPI_FLAG = BIT_22; // Thermal monitor and clock control
MMX_FLAG = BIT_23; // MMX technology
FXSR_FLAG = BIT_24; // Fast Floating Point Save and Restore
SSE_FLAG = BIT_25; // Streaming SIMD Extensions
SSE2_FLAG = BIT_26; // Streaming SIMD Extensions 2
SS_FLAG = BIT_27; // Self snoop
HTT_FLAG = BIT_28; // Hyper-threading technology
TM_FLAG = BIT_29; // Thermal monitor
BIT_30_FLAG = BIT_30; // Reserved, do not count on value
PBE_FLAG = BIT_31; // Pending Break Enable
{ Standard Intel Feature Flags }
INTEL_FPU = BIT_0; // Floating-Point unit on chip
INTEL_VME = BIT_1; // Virtual Mode Extention
INTEL_DE = BIT_2; // Debugging Extention
INTEL_PSE = BIT_3; // Page Size Extention
INTEL_TSC = BIT_4; // Time Stamp Counter
INTEL_MSR = BIT_5; // Model Specific Registers
INTEL_PAE = BIT_6; // Physical Address Extention
INTEL_MCE = BIT_7; // Machine Check Exception
INTEL_CX8 = BIT_8; // CMPXCHG8 Instruction
INTEL_APIC = BIT_9; // Software-accessible local APIC on Chip
INTEL_BIT_10 = BIT_10; // Reserved, do not count on value
INTEL_SEP = BIT_11; // Fast System Call
INTEL_MTRR = BIT_12; // Memory Type Range Registers
INTEL_PGE = BIT_13; // Page Global Enable
INTEL_MCA = BIT_14; // Machine Check Architecture
INTEL_CMOV = BIT_15; // Conditional Move Instruction
INTEL_PAT = BIT_16; // Page Attribute Table
INTEL_PSE36 = BIT_17; // 36-bit Page Size Extention
INTEL_PSN = BIT_18; // Processor serial number is present and enabled
INTEL_CLFLSH = BIT_19; // CLFLUSH intruction
INTEL_BIT_20 = BIT_20; // Reserved, do not count on value
INTEL_DS = BIT_21; // Debug store
INTEL_ACPI = BIT_22; // Thermal monitor and clock control
INTEL_MMX = BIT_23; // MMX technology
INTEL_FXSR = BIT_24; // Fast Floating Point Save and Restore
INTEL_SSE = BIT_25; // Streaming SIMD Extensions
INTEL_SSE2 = BIT_26; // Streaming SIMD Extensions 2
INTEL_SS = BIT_27; // Self snoop
INTEL_HTT = BIT_28; // Hyper-threading technology
INTEL_TM = BIT_29; // Thermal monitor
INTEL_IA64 = BIT_30; // IA32 emulation mode on Itanium processors (IA64)
INTEL_PBE = BIT_31; // Pending Break Enable
{ Extended Intel Feature Flags }
EINTEL_SSE3 = BIT_0; // Streaming SIMD Extensions 3
EINTEL_PCLMULQDQ = BIT_1; // the processor supports the PCLMULQDQ instruction
EINTEL_DTES64 = BIT_2; // the processor supports DS area using 64-bit layout
EINTEL_MONITOR = BIT_3; // Monitor/MWAIT
EINTEL_DSCPL = BIT_4; // CPL Qualified debug Store
EINTEL_VMX = BIT_5; // Virtual Machine Technology
EINTEL_SMX = BIT_6; // Safer Mode Extensions
EINTEL_EST = BIT_7; // Enhanced Intel Speedstep technology
EINTEL_TM2 = BIT_8; // Thermal monitor 2
EINTEL_SSSE3 = BIT_9; // SSSE 3 extensions
EINTEL_CNXTID = BIT_10; // L1 Context ID
EINTEL_BIT_11 = BIT_11; // Reserved, do not count on value
EINTEL_FMA = BIT_12; // Fused Multiply Add
EINTEL_CX16 = BIT_13; // CMPXCHG16B instruction
EINTEL_XTPR = BIT_14; // Send Task Priority messages
EINTEL_PDCM = BIT_15; // Perf/Debug Capability MSR
EINTEL_BIT_16 = BIT_16; // Reserved, do not count on value
EINTEL_PCID = BIT_17; // Process-context Identifiers
EINTEL_DCA = BIT_18; // Direct Cache Access
EINTEL_SSE4_1 = BIT_19; // Streaming SIMD Extensions 4.1
EINTEL_SSE4_2 = BIT_20; // Streaming SIMD Extensions 4.2
EINTEL_X2APIC = BIT_21; // x2APIC feature
EINTEL_MOVBE = BIT_22; // MOVBE instruction
EINTEL_POPCNT = BIT_23; // A value of 1 indicates the processor supports the POPCNT instruction.
EINTEL_TSC_DL = BIT_24; // TSC-Deadline
EINTEL_AES = BIT_25; // the processor supports the AES instruction extensions
EINTEL_XSAVE = BIT_26; // XSAVE/XRSTOR processor extended states feature, XSETBV/XGETBV instructions and XFEATURE_ENABLED_MASK (XCR0) register
EINTEL_OSXSAVE = BIT_27; // OS has enabled features present in EINTEL_XSAVE
EINTEL_AVX = BIT_28; // Advanced Vector Extensions
EINTEL_BIT_29 = BIT_29; // Reserved, do not count on value
EINTEL_RDRAND = BIT_30; // the processor supports the RDRAND instruction.
EINTEL_BIT_31 = BIT_31; // Always return 0
{ Extended Intel 64 Bits Feature Flags }
EINTEL64_BIT_0 = BIT_0; // Reserved, do not count on value
EINTEL64_BIT_1 = BIT_1; // Reserved, do not count on value
EINTEL64_BIT_2 = BIT_2; // Reserved, do not count on value
EINTEL64_BIT_3 = BIT_3; // Reserved, do not count on value
EINTEL64_BIT_4 = BIT_4; // Reserved, do not count on value
EINTEL64_BIT_5 = BIT_5; // Reserved, do not count on value
EINTEL64_BIT_6 = BIT_6; // Reserved, do not count on value
EINTEL64_BIT_7 = BIT_7; // Reserved, do not count on value
EINTEL64_BIT_8 = BIT_8; // Reserved, do not count on value
EINTEL64_BIT_9 = BIT_9; // Reserved, do not count on value
EINTEL64_BIT_10 = BIT_10; // Reserved, do not count on value
EINTEL64_SYS = BIT_11; // 64 Bit - SYSCALL SYSRET
EINTEL64_BIT_12 = BIT_12; // Reserved, do not count on value
EINTEL64_BIT_13 = BIT_13; // Reserved, do not count on value
EINTEL64_BIT_14 = BIT_14; // Reserved, do not count on value
EINTEL64_BIT_15 = BIT_15; // Reserved, do not count on value
EINTEL64_BIT_16 = BIT_16; // Reserved, do not count on value
EINTEL64_BIT_17 = BIT_17; // Reserved, do not count on value
EINTEL64_BIT_18 = BIT_18; // Reserved, do not count on value
EINTEL64_BIT_19 = BIT_19; // Reserved, do not count on value
EINTEL64_XD = BIT_20; // Execution Disable Bit
EINTEL64_BIT_21 = BIT_21; // Reserved, do not count on value
EINTEL64_BIT_22 = BIT_22; // Reserved, do not count on value
EINTEL64_BIT_23 = BIT_23; // Reserved, do not count on value
EINTEL64_BIT_24 = BIT_24; // Reserved, do not count on value
EINTEL64_BIT_25 = BIT_25; // Reserved, do not count on value
EINTEL64_1GBYTE = BIT_26; // 1G-Byte pages are available
EINTEL64_RDTSCP = BIT_27; // RDTSCP and IA32_TSC_AUX are available
EINTEL64_BIT_28 = BIT_28; // Reserved, do not count on value
EINTEL64_EM64T = BIT_29; // Intel Extended Memory 64 Technology
EINTEL64_BIT_30 = BIT_30; // Reserved, do not count on value
EINTEL64_BIT_31 = BIT_31; // Reserved, do not count on value
{ Extended Intel 64 Bits Feature Flags continued }
EINTEL64_2_LAHF = BIT_0; // LAHF/SAHF available in 64 bit mode
EINTEL64_2_BIT_1 = BIT_1; // Reserved, do not count on value
EINTEL64_2_BIT_2 = BIT_2; // Reserved, do not count on value
EINTEL64_2_BIT_3 = BIT_3; // Reserved, do not count on value
EINTEL64_2_BIT_4 = BIT_4; // Reserved, do not count on value
EINTEL64_2_BIT_5 = BIT_5; // Reserved, do not count on value
EINTEL64_2_BIT_6 = BIT_6; // Reserved, do not count on value
EINTEL64_2_BIT_7 = BIT_7; // Reserved, do not count on value
EINTEL64_2_BIT_8 = BIT_8; // Reserved, do not count on value
EINTEL64_2_BIT_9 = BIT_9; // Reserved, do not count on value
EINTEL64_2_BIT_10 = BIT_10; // Reserved, do not count on value
EINTEL64_2_BIT_11 = BIT_11; // Reserved, do not count on value
EINTEL64_2_BIT_12 = BIT_12; // Reserved, do not count on value
EINTEL64_2_BIT_13 = BIT_13; // Reserved, do not count on value
EINTEL64_2_BIT_14 = BIT_14; // Reserved, do not count on value
EINTEL64_2_BIT_15 = BIT_15; // Reserved, do not count on value
EINTEL64_2_BIT_16 = BIT_16; // Reserved, do not count on value
EINTEL64_2_BIT_17 = BIT_17; // Reserved, do not count on value
EINTEL64_2_BIT_18 = BIT_18; // Reserved, do not count on value
EINTEL64_2_BIT_19 = BIT_19; // Reserved, do not count on value
EINTEL64_2_BIT_20 = BIT_20; // Reserved, do not count on value
EINTEL64_2_BIT_21 = BIT_21; // Reserved, do not count on value
EINTEL64_2_BIT_22 = BIT_22; // Reserved, do not count on value
EINTEL64_2_BIT_23 = BIT_23; // Reserved, do not count on value
EINTEL64_2_BIT_24 = BIT_24; // Reserved, do not count on value
EINTEL64_2_BIT_25 = BIT_25; // Reserved, do not count on value
EINTEL64_2_BIT_26 = BIT_26; // Reserved, do not count on value
EINTEL64_2_BIT_27 = BIT_27; // Reserved, do not count on value
EINTEL64_2_BIT_28 = BIT_28; // Reserved, do not count on value
EINTEL64_2_BIT_29 = BIT_29; // Reserved, do not count on value
EINTEL64_2_BIT_30 = BIT_30; // Reserved, do not count on value
EINTEL64_2_BIT_31 = BIT_31; // Reserved, do not count on value
{ INTEL Power Management Flags }
PINTEL_TEMPSENSOR = BIT_0; // Digital temperature sensor
PINTEL_TURBOBOOST = BIT_1; // Intel Turbo Boost Technology Available
PINTEL_ARAT = BIT_2; // APIC-Timer-always-running feature
PINTEL_BIT_3 = BIT_3; // Reverved, do not count on value
PINTEL_PLN = BIT_4; // Power Limit Notification constrols
PINTEL_ECMD = BIT_5; // Clock Modulation duty cycle extension
PINTEL_PTM = BIT_6; // Package Thermal Management
PINTEL_BIT_7 = BIT_7; // Reserved, do not count on value
PINTEL_BIT_8 = BIT_8; // Reserved, do not count on value
PINTEL_BIT_9 = BIT_9; // Reserved, do not count on value
PINTEL_BIT_10 = BIT_10; // Reserved, do not count on value
PINTEL_BIT_11 = BIT_11; // Reserved, do not count on value
PINTEL_BIT_12 = BIT_12; // Reserved, do not count on value
PINTEL_BIT_13 = BIT_13; // Reserved, do not count on value
PINTEL_BIT_14 = BIT_14; // Reserved, do not count on value
PINTEL_BIT_15 = BIT_15; // Reserved, do not count on value
PINTEL_BIT_16 = BIT_16; // Reserved, do not count on value
PINTEL_BIT_17 = BIT_17; // Reserved, do not count on value
PINTEL_BIT_18 = BIT_18; // Reserved, do not count on value
PINTEL_BIT_19 = BIT_19; // Reserved, do not count on value
PINTEL_BIT_20 = BIT_20; // Reserved, do not count on value
PINTEL_BIT_21 = BIT_21; // Reserved, do not count on value
PINTEL_BIT_22 = BIT_22; // Reserved, do not count on value
PINTEL_BIT_23 = BIT_23; // Reserved, do not count on value
PINTEL_BIT_24 = BIT_24; // Reserved, do not count on value
PINTEL_BIT_25 = BIT_25; // Reserved, do not count on value
PINTEL_BIT_26 = BIT_26; // Reserved, do not count on value
PINTEL_BIT_27 = BIT_27; // Reserved, do not count on value
PINTEL_BIT_28 = BIT_28; // Reserved, do not count on value
PINTEL_BIT_29 = BIT_29; // Reserved, do not count on value
PINTEL_BIT_30 = BIT_30; // Reserved, do not count on value
PINTEL_BIT_31 = BIT_31; // Reserved, do not count on value
{ AMD Standard Feature Flags }
AMD_FPU = BIT_0; // Floating-Point unit on chip
AMD_VME = BIT_1; // Virtual Mode Extention
AMD_DE = BIT_2; // Debugging Extention
AMD_PSE = BIT_3; // Page Size Extention
AMD_TSC = BIT_4; // Time Stamp Counter
AMD_MSR = BIT_5; // Model Specific Registers
AMD_PAE = BIT_6; // Physical address Extensions
AMD_MCE = BIT_7; // Machine Check Exception
AMD_CX8 = BIT_8; // CMPXCHG8 Instruction
AMD_APIC = BIT_9; // Software-accessible local APIC on Chip
AMD_BIT_10 = BIT_10; // Reserved, do not count on value
AMD_SEP_BIT = BIT_11; // SYSENTER and SYSEXIT instructions
AMD_MTRR = BIT_12; // Memory Type Range Registers
AMD_PGE = BIT_13; // Page Global Enable
AMD_MCA = BIT_14; // Machine Check Architecture
AMD_CMOV = BIT_15; // Conditional Move Instruction
AMD_PAT = BIT_16; // Page Attribute Table
AMD_PSE36 = BIT_17; // Page Size Extensions
AMD_BIT_18 = BIT_18; // Reserved, do not count on value
AMD_CLFLSH = BIT_19; // CLFLUSH instruction
AMD_BIT_20 = BIT_20; // Reserved, do not count on value
AMD_BIT_21 = BIT_21; // Reserved, do not count on value
AMD_BIT_22 = BIT_22; // Reserved, do not count on value
AMD_MMX = BIT_23; // MMX technology
AMD_FXSR = BIT_24; // FXSAVE and FXSTORE instructions
AMD_SSE = BIT_25; // SSE Extensions
AMD_SSE2 = BIT_26; // SSE2 Extensions
AMD_BIT_27 = BIT_27; // Reserved, do not count on value
AMD_HTT = BIT_28; // Hyper-Threading Technology
AMD_BIT_29 = BIT_29; // Reserved, do not count on value
AMD_BIT_30 = BIT_30; // Reserved, do not count on value
AMD_BIT_31 = BIT_31; // Reserved, do not count on value
{ AMD Standard Feature Flags continued }
AMD2_SSE3 = BIT_0; // SSE3 extensions
AMD2_PCLMULQDQ = BIT_1; // PCLMULQDQ instruction support
AMD2_BIT_2 = BIT_2; // Reserved, do not count on value
AMD2_MONITOR = BIT_3; // MONITOR/MWAIT instructions. See "MONITOR" and "MWAIT" in APM3.
AMD2_BIT_4 = BIT_4; // Reserved, do not count on value
AMD2_BIT_5 = BIT_5; // Reserved, do not count on value
AMD2_BIT_6 = BIT_6; // Reserved, do not count on value
AMD2_BIT_7 = BIT_7; // Reserved, do not count on value
AMD2_BIT_8 = BIT_8; // Reserved, do not count on value
AMD2_SSSE3 = BIT_9; // supplemental SSE3 extensions
AMD2_BIT_10 = BIT_10; // Reserved, do not count on value
AMD2_BIT_11 = BIT_11; // Reserved, do not count on value
AMD2_FMA = BIT_12; // FMA instruction support
AMD2_CMPXCHG16B = BIT_13; // CMPXCHG16B available
AMD2_BIT_14 = BIT_14; // Reserved, do not count on value
AMD2_BIT_15 = BIT_15; // Reserved, do not count on value
AMD2_BIT_16 = BIT_16; // Reserved, do not count on value
AMD2_BIT_17 = BIT_17; // Reserved, do not count on value
AMD2_BIT_18 = BIT_18; // Reserved, do not count on value
AMD2_SSE41 = BIT_19; // SSE4.1 instruction support
AMD2_SSE42 = BIT_20; // SSE4.2 instruction support
AMD2_BIT_21 = BIT_21; // Reserved, do not count on value
AMD2_BIT_22 = BIT_22; // Reserved, do not count on value
AMD2_POPCNT = BIT_23; // POPCNT instruction. See "POPCNT" in APM3.
AMD2_BIT_24 = BIT_24; // Reserved, do not count on value
AMD2_AES = BIT_25; // AES instruction support
AMD2_XSAVE = BIT_26; // XSAVE (and related) instructions are supported by hardware
AMD2_OSXSAVE = BIT_27; // XSAVE (and related) instructions are enabled
AMD2_AVX = BIT_28; // AVX instruction support
AMD2_F16C = BIT_29; // half-precision convert instruction support
AMD2_BIT_30 = BIT_30; // Reserved, do not count on value
AMD2_RAZ = BIT_31; // Reserved for use by hypervisor to indicate guest status
{ AMD Enhanced Feature Flags }
EAMD_FPU = BIT_0; // Floating-Point unit on chip
EAMD_VME = BIT_1; // Virtual Mode Extention
EAMD_DE = BIT_2; // Debugging Extention
EAMD_PSE = BIT_3; // Page Size Extention
EAMD_TSC = BIT_4; // Time Stamp Counter
EAMD_MSR = BIT_5; // Model Specific Registers
EAMD_PAE = BIT_6; // Physical-address extensions
EAMD_MCE = BIT_7; // Machine Check Exception
EAMD_CX8 = BIT_8; // CMPXCHG8 Instruction
EAMD_APIC = BIT_9; // Advanced Programmable Interrupt Controler
EAMD_BIT_10 = BIT_10; // Reserved, do not count on value
EAMD_SEP = BIT_11; // Fast System Call
EAMD_MTRR = BIT_12; // Memory-Type Range Registers
EAMD_PGE = BIT_13; // Page Global Enable
EAMD_MCA = BIT_14; // Machine Check Architecture
EAMD_CMOV = BIT_15; // Conditional Move Intructions
EAMD_PAT = BIT_16; // Page Attributes Table
EAMD_PSE2 = BIT_17; // Page Size Extensions
EAMD_BIT_18 = BIT_18; // Reserved, do not count on value
EAMD_BIT_19 = BIT_19; // Reserved, do not count on value
EAMD_NX = BIT_20; // No-Execute Page Protection
EAMD_BIT_21 = BIT_21; // Reserved, do not count on value
EAMD_EXMMX = BIT_22; // AMD Extensions to MMX technology
EAMD_MMX = BIT_23; // MMX technology
EAMD_FX = BIT_24; // FXSAVE and FXSTORE instructions
EAMD_FFX = BIT_25; // Fast FXSAVE and FXSTORE instructions
EAMD_1GBPAGE = BIT_26; // 1-GB large page support.
EAMD_RDTSCP = BIT_27; // RDTSCP instruction.
EAMD_BIT_28 = BIT_28; // Reserved, do not count on value
EAMD_LONG = BIT_29; // Long Mode (64-bit Core)
EAMD_EX3DNOW = BIT_30; // AMD Extensions to 3DNow! intructions
EAMD_3DNOW = BIT_31; // AMD 3DNOW! Technology
{ AMD Extended Feature Flags continued }
EAMD2_LAHF = BIT_0; // LAHF/SAHF available in 64-bit mode
EAMD2_CMPLEGACY = BIT_1; // core multi-processing legacy mode
EAMD2_SVM = BIT_2; // Secure Virtual Machine
EAMD2_EXTAPICSPACE = BIT_3; // This bit indicates the presence of extended APIC register space starting at offset 400h from the APIC Base Address Register, as specified in the BKDG.
EAMD2_ALTMOVCR8 = BIT_4; // LOCK MOV CR0 means MOV CR8
EAMD2_ABM = BIT_5; // ABM: Advanced bit manipulation. LZCNT instruction support.
EAMD2_SSE4A = BIT_6; // EXTRQ, INSERTQ, MOVNTSS, and MOVNTSD instruction support.
EAMD2_MISALIGNSSE = BIT_7; // Misaligned SSE mode.
EAMD2_3DNOWPREFETCH = BIT_8; // PREFETCH and PREFETCHW instruction support.
EAMD2_OSVW = BIT_9; // OS visible workaround.
EAMD2_IBS = BIT_10; // Instruction based sampling
EAMD2_XOP = BIT_11; // extended operation support
EAMD2_SKINIT = BIT_12; // SKINIT, STGI, and DEV support.
EAMD2_WDT = BIT_13; // Watchdog timer support.
EAMD2_BIT_14 = BIT_14; // Reserved, do not count on value
EAMD2_LWP = BIT_15; // lightweight profiling support
EAMD2_FMA4 = BIT_16; // 4-operand FMA instruction support.
EAMD2_BIT_17 = BIT_17; // Reserved, do not count on value
EAMD2_BIT_18 = BIT_18; // Reserved, do not count on value
EAMD2_NODEID = BIT_19; // Support for MSRC001_100C[NodeId, NodesPerProcessor]
EAMD2_BIT_20 = BIT_20; // Reserved, do not count on value
EAMD2_TBM = BIT_21; // trailing bit manipulation instruction support
EAMD2_TOPOLOGYEXT = BIT_22; // topology extensions support
EAMD2_BIT_23 = BIT_23; // Reserved, do not count on value
EAMD2_BIT_24 = BIT_24; // Reserved, do not count on value
EAMD2_BIT_25 = BIT_25; // Reserved, do not count on value
EAMD2_BIT_26 = BIT_26; // Reserved, do not count on value
EAMD2_BIT_27 = BIT_27; // Reserved, do not count on value
EAMD2_BIT_28 = BIT_28; // Reserved, do not count on value
EAMD2_BIT_29 = BIT_29; // Reserved, do not count on value
EAMD2_BIT_30 = BIT_30; // Reserved, do not count on value
EAMD2_BIT_31 = BIT_31; // Reserved, do not count on value
{ AMD Power Management Features Flags }
PAMD_TEMPSENSOR = BIT_0; // Temperature Sensor
PAMD_FREQUENCYID = BIT_1; // Frequency ID Control
PAMD_VOLTAGEID = BIT_2; // Voltage ID Control
PAMD_THERMALTRIP = BIT_3; // Thermal Trip
PAMD_THERMALMONITOR = BIT_4; // Thermal Monitoring
PAMD_BIT_5 = BIT_5; // Reserved, do not count on value
PAMD_100MHZSTEP = BIT_6; // 100 Mhz multiplier control.
PAMD_HWPSTATE = BIT_7; // Hardware P-State control.
PAMD_TSC_INVARIANT = BIT_8; // TSC rate is invariant
PAMD_CPB = BIT_9; // core performance boost
PAMD_EFFFREQRO = BIT_10; // read-only effective frequency interface
PAMD_BIT_11 = BIT_11; // Reserved, do not count on value
PAMD_BIT_12 = BIT_12; // Reserved, do not count on value
PAMD_BIT_13 = BIT_13; // Reserved, do not count on value
PAMD_BIT_14 = BIT_14; // Reserved, do not count on value
PAMD_BIT_15 = BIT_15; // Reserved, do not count on value
PAMD_BIT_16 = BIT_16; // Reserved, do not count on value
PAMD_BIT_17 = BIT_17; // Reserved, do not count on value
PAMD_BIT_18 = BIT_18; // Reserved, do not count on value
PAMD_BIT_19 = BIT_19; // Reserved, do not count on value
PAMD_BIT_20 = BIT_20; // Reserved, do not count on value
PAMD_BIT_21 = BIT_21; // Reserved, do not count on value
PAMD_BIT_22 = BIT_22; // Reserved, do not count on value
PAMD_BIT_23 = BIT_23; // Reserved, do not count on value
PAMD_BIT_24 = BIT_24; // Reserved, do not count on value
PAMD_BIT_25 = BIT_25; // Reserved, do not count on value
PAMD_BIT_26 = BIT_26; // Reserved, do not count on value
PAMD_BIT_27 = BIT_27; // Reserved, do not count on value
PAMD_BIT_28 = BIT_28; // Reserved, do not count on value
PAMD_BIT_29 = BIT_29; // Reserved, do not count on value
PAMD_BIT_30 = BIT_30; // Reserved, do not count on value
PAMD_BIT_31 = BIT_31; // Reserved, do not count on value
{ AMD TLB and L1 Associativity constants }
AMD_ASSOC_RESERVED = 0;
AMD_ASSOC_DIRECT = 1;
// 2 to 254 = direct value to the associativity
AMD_ASSOC_FULLY = 255;
{ AMD L2 Cache Associativity constants }
AMD_L2_ASSOC_DISABLED = 0;
AMD_L2_ASSOC_DIRECT = 1;
AMD_L2_ASSOC_2WAY = 2;
AMD_L2_ASSOC_4WAY = 4;
AMD_L2_ASSOC_8WAY = 6;
AMD_L2_ASSOC_16WAY = 8;
AMD_L2_ASSOC_32WAY = 10;
AMD_L2_ASSOC_48WAY = 11;
AMD_L2_ASSOC_64WAY = 12;
AMD_L2_ASSOC_96WAY = 13;
AMD_L2_ASSOC_128WAY = 14;
AMD_L2_ASSOC_FULLY = 15;
// TODO AMD SVM and LWP bits
{ VIA Standard Feature Flags }
VIA_FPU = BIT_0; // FPU present
VIA_VME = BIT_1; // Virtual Mode Extension
VIA_DE = BIT_2; // Debugging extensions
VIA_PSE = BIT_3; // Page Size Extensions (4MB)
VIA_TSC = BIT_4; // Time Stamp Counter
VIA_MSR = BIT_5; // Model Specific Registers