-
Notifications
You must be signed in to change notification settings - Fork 1
/
cpuid_topology_parsecachetlb.c
622 lines (503 loc) · 22.6 KB
/
cpuid_topology_parsecachetlb.c
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
/*
* Copyright (C) 2023 by Intel Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpuid_topology.h"
/*
* Global application data variable
*/
extern GLOBAL_DATA g_GlobalData;
/*
* Internal Prototype APIs
*/
unsigned int ParseCache_Internal_FindMatchingCacheEntry(PCPUID_CACHE_INFO pCacheInfo, unsigned int NumberOfCaches, unsigned int CacheId, PCPUID_REGISTERS pCpuidRegisters);
unsigned int ParseCache_Internal_AddCacheEntry(PCPUID_CACHE_INFO pCacheInfo, unsigned int *pNumberOfCaches, unsigned int CacheId, unsigned int CacheMask, PCPUID_REGISTERS pCpuidRegisters);
unsigned int ParseTlb_Internal_FindMatchingTlbEntry(PCPUID_TLB_INFO pTlbInfo, unsigned int NumberOfTlbs, unsigned int TlbId, PCPUID_REGISTERS pCpuidRegisters);
unsigned int ParseTlb_Internal_AddTlbEntry(PCPUID_TLB_INFO pTlbInfo, unsigned int *pNumberOfTlbs, unsigned int TlbId, unsigned int TlbMask, PCPUID_REGISTERS pCpuidRegisters);
/*
* ParseCache_CpuidCacheExample
*
* This is an example of how to parse the CPUID Caching Information
* via CPUID Leaf 4.
*
* Arguments:
* None
*
* Return:
* None
*/
void ParseCache_CpuidCacheExample(void)
{
PCPUID_CACHE_INFO pCacheInfo;
unsigned int CacheIndex;
unsigned int NumberOfCaches;
unsigned int SubleafIndex;
CPUID_REGISTERS CpuidRegisters;
unsigned int NumberOfProcessors;
unsigned int ApicIdList[MAX_PROCESSORS];
unsigned int ProcessorIndex;
unsigned int MaxAddressibleIdSharingCache;
unsigned int CacheShift;
unsigned int CacheMask;
unsigned int CacheId;
CACHE_TYPE CacheType;
/*
* Note that the SDM reccomends to look at CPUID.4 if CPUID.2 contains 0FFh.
*
* However, if there is no intention of decoding CPUID Leaf 2 descriptors you can
* just check if CPUID.4 exists and has information. Only processors that are likely
* older than ~2005-2006 are likely to not have this Leaf.
*
*/
Tools_ReadCpuid(0, 0, &CpuidRegisters);
if (CpuidRegisters.x.Register.Eax >= 4)
{
/*
* This is an example and the simplest thing is dynamically hardcode to 10 caches per logical processor
* for simplicity.
*/
NumberOfProcessors = Tools_GatherPlatformApicIds(ApicIdList, MAX_PROCESSORS);
NumberOfCaches = 0;
pCacheInfo = (PCPUID_CACHE_INFO)calloc(NumberOfProcessors*MAX_CACHE_PER_LP, sizeof(CPUID_CACHE_INFO));
if (pCacheInfo)
{
/*
* This will enumerate through every logical processor and check each one's cache. It will then
* determine if that logical processor is expressing a new cache or an existing cache.
*
* This can be done by checking the entire CPUID Subleaf contents and using the generated Cache ID.
*
* Here we cannot assume anything about a subleaf number relationship between the enumerated cache and the
* other logical processors on the system which may be sharing it.
*
* This is going to be done the very long way. There is an assumption that an enumerated cache and logical
* processors that are included in that ID should all have the same cache information reported. However, as
* in the manual, we can verify by ensuring the entire subleaf is identical along with the generated Cache ID.
*
*
*/
for (ProcessorIndex = 0; ProcessorIndex < NumberOfProcessors; ProcessorIndex++)
{
Tools_SetAffinity(ProcessorIndex);
SubleafIndex = 0;
Tools_ReadCpuid(4, SubleafIndex, &CpuidRegisters);
CacheType = (CpuidRegisters.x.Register.Eax & 0x1F);
/*
* Enumerate subleafs until no more caches Cache Type is retuned.
*/
while (CacheType != CacheType_NoMoreCaches)
{
/*
* Compute the Cache ID for this cache; this is called
*
* Maximum Addressible IDs sharing this cache since not all APIC IDs
* may be assigned to a logical processor.
*
*/
MaxAddressibleIdSharingCache = (((CpuidRegisters.x.Register.Eax)>>14) & 0xFFF)+1;
/*
* We round to a power of 2 and create a CacheMask that can be used with
* APIC IDs to generate a Cache ID.
*
*/
CacheShift = Tools_CreateTopologyShift(MaxAddressibleIdSharingCache);
CacheMask = ~((1<<CacheShift)-1);
/*
* This mask can be used on other logical processor's APIC IDs to find
* processors sharing this cache. This code is going to instead check our
* cache array and see if it is already there. If not, then create a new
* cache in the array. If it is there, then add this APIC ID to that cache
* and continue on.
*
*/
CacheId = ApicIdList[ProcessorIndex] & CacheMask;
/*
* Find if this cache already exists in the cache list.
*/
CacheIndex = ParseCache_Internal_FindMatchingCacheEntry(pCacheInfo, NumberOfCaches, CacheId, &CpuidRegisters);
if(CacheIndex == INVALID_CACHE_INDEX)
{
/*
* This cache does not exist, so add this cache.
*/
CacheIndex = ParseCache_Internal_AddCacheEntry(pCacheInfo, &NumberOfCaches, CacheId, CacheMask, &CpuidRegisters);
}
/*
* Add this logical processor to the cache index, unless we had an error
* and we do not have any cache to add.
*/
if(CacheIndex != INVALID_CACHE_INDEX)
{
pCacheInfo[CacheIndex].ListOfApicIDsSharingThisCache[pCacheInfo[CacheIndex].NumberOfLPsSharingThisCache] = ApicIdList[ProcessorIndex];
pCacheInfo[CacheIndex].NumberOfLPsSharingThisCache++;
}
else
{
/*
* Should never reach here unless there were a lot of caches since
* we statically select a number.
*/
}
SubleafIndex++;
Tools_ReadCpuid(4, SubleafIndex, &CpuidRegisters);
CacheType = (CACHE_TYPE)(CpuidRegisters.x.Register.Eax & 0x1F);
}
}
Display_DisplayProcessorCaches(pCacheInfo, NumberOfCaches);
free(pCacheInfo);
pCacheInfo = NULL;
}
else
{
/*
* Memory Allocation Failure
*/
}
}
else
{
/*
* Does not support CPUID.4
*/
}
}
/*
* ParseCache_Internal_FindMatchingCacheEntry
*
* Searches the array to find a matching CacheID based on APIC ID parsing.
*
* Then there is a full CPUID Subleaf verification to determine this exactly
* matches the CPUID.4.n details.
*
* Arguments:
* Cache Array, Array Size, Cache ID to find, matching subleaf information for verification
*
* Return:
* Index if found
*/
unsigned int ParseCache_Internal_FindMatchingCacheEntry(PCPUID_CACHE_INFO pCacheInfo, unsigned int NumberOfCaches, unsigned int CacheId, PCPUID_REGISTERS pCpuidRegisters)
{
unsigned int CacheIndex;
unsigned int CacheFoundIndex;
CacheFoundIndex = INVALID_CACHE_INDEX;
for (CacheIndex = 0; CacheIndex < NumberOfCaches && CacheFoundIndex == INVALID_CACHE_INDEX; CacheIndex++)
{
if (pCacheInfo[CacheIndex].CacheId == CacheId)
{
/*
* Further verification this is the same by checking the complete subleaf matches, we do not care
* what the subleaf level was of the entry that created this cache or any that have been added,
* only that they are a complete same description.
*
*/
if (memcmp(&pCacheInfo[CacheIndex].CachedCpuidRegisters, pCpuidRegisters, sizeof(CPUID_REGISTERS)) == 0)
{
CacheFoundIndex = CacheIndex;
}
}
}
return CacheFoundIndex;
}
/*
* ParseCache_Internal_AddCacheEntry
*
* Adds a new cache entry based on the CPUID Input.
*
* Arguments:
* Cache Array, Array Size, Cache ID to add, CPUID subleaf information describing this cache
*
* Return:
* New Index
*/
unsigned int ParseCache_Internal_AddCacheEntry(PCPUID_CACHE_INFO pCacheInfo, unsigned int *pNumberOfCaches, unsigned int CacheId, unsigned int CacheMask, PCPUID_REGISTERS pCpuidRegisters)
{
unsigned int NewCacheIndex;
NewCacheIndex = *pNumberOfCaches;
*pNumberOfCaches = *pNumberOfCaches + 1;
/*
* Populate the cache base information from the CPUID descriptoin
*/
pCacheInfo[NewCacheIndex].CacheType = (pCpuidRegisters->x.Register.Eax & 0x1F);; /* EAX[4:0] */
pCacheInfo[NewCacheIndex].CacheLevel = ((pCpuidRegisters->x.Register.Eax>>5) & 0x7); /* EAX[7:5] Cache Level Starts at 1 */
pCacheInfo[NewCacheIndex].CacheId = CacheId;
pCacheInfo[NewCacheIndex].CacheMask = CacheMask;
/*
* Populate the cache details and calculate the size of the cache
*/
pCacheInfo[NewCacheIndex].CacheWays = (pCpuidRegisters->x.Register.Ebx>>22) + 1; /* EBX[31:22] + 1 */
pCacheInfo[NewCacheIndex].CachePartitions = ((pCpuidRegisters->x.Register.Ebx>>12) & 0x3FF) + 1; /* EBX[21:12] + 1 */
pCacheInfo[NewCacheIndex].CacheLineSize = (pCpuidRegisters->x.Register.Ebx & 0xFFF) + 1; /* EBX[11:0] + 1 */
pCacheInfo[NewCacheIndex].CacheSets = pCpuidRegisters->x.Register.Ecx + 1; /* ECX + 1 */
/*
* The number of Cache Ways is multiplied by the number of Sets.
*
* This is then expanded by the number of partitions and then the cache size to get the complete number of bytes
* for ths size of this cache.
*
*/
pCacheInfo[NewCacheIndex].CacheSizeInBytes = pCacheInfo[NewCacheIndex].CacheWays * pCacheInfo[NewCacheIndex].CacheLineSize *
pCacheInfo[NewCacheIndex].CachePartitions * pCacheInfo[NewCacheIndex].CacheSets;
/*
* Populate the extra attributes of the cache.
*/
pCacheInfo[NewCacheIndex].SelfInitializing = (pCpuidRegisters->x.Register.Eax & (1<<8)) ? BOOL_TRUE : BOOL_FALSE;
pCacheInfo[NewCacheIndex].CacheIsFullyAssociative = (pCpuidRegisters->x.Register.Eax & (1<<9)) ? BOOL_TRUE : BOOL_FALSE;
pCacheInfo[NewCacheIndex].WbinvdFlushsLowerLevelsSharing = (pCpuidRegisters->x.Register.Edx & 1) ? BOOL_FALSE : BOOL_TRUE;
pCacheInfo[NewCacheIndex].CacheIsInclusive = (pCpuidRegisters->x.Register.Edx & 2) ? BOOL_TRUE : BOOL_FALSE;
pCacheInfo[NewCacheIndex].CacheIsDirectMapped = (pCpuidRegisters->x.Register.Edx & 4) ? BOOL_TRUE : BOOL_FALSE;
pCacheInfo[NewCacheIndex].CacheIsComplex = pCacheInfo[NewCacheIndex].CacheIsDirectMapped ? BOOL_FALSE : BOOL_TRUE;
pCacheInfo[NewCacheIndex].NumberOfLPsSharingThisCache = 0;
memcpy(&pCacheInfo[NewCacheIndex].CachedCpuidRegisters, pCpuidRegisters, sizeof(CPUID_REGISTERS));
return NewCacheIndex;
}
/*
* ParseTlb_CpuidTlbExample
*
* This is an example of how to parse the CPUID TLB Information
* via CPUID Leaf 18H
*
* Arguments:
* None
*
* Return:
* None
*/
void ParseTlb_CpuidTlbExample(void)
{
PCPUID_TLB_INFO pTlbInfo;
unsigned int TlbIndex;
unsigned int NumberOfTlbs;
unsigned int SubleafIndex;
unsigned int MaxSubleaf;
CPUID_REGISTERS CpuidRegisters;
unsigned int NumberOfProcessors;
unsigned int ApicIdList[MAX_PROCESSORS];
unsigned int ProcessorIndex;
unsigned int MaxAddressibleIdSharingTlb;
unsigned int TlbShift;
unsigned int TlbMask;
unsigned int TlbId;
TLB_TYPE TlbType;
Tools_ReadCpuid(0, 0, &CpuidRegisters);
/*
* Note that the SDM reccomends to look at CPUID.18 if CPUID.2 contains 0FEh.
*
* However, if there is no intention of decoding CPUID Leaf 2 descriptors you can
* just check if CPUID.18 exists and has information. Over time, all processors will
* transition to returning Leaf 18H.
*
*/
if (CpuidRegisters.x.Register.Eax >= 0x18)
{
/*
* This is an example and the simplest thing is dynamically hardcode to 10 TLBs per logical processor
* for simplicity.
*/
NumberOfProcessors = Tools_GatherPlatformApicIds(ApicIdList, MAX_PROCESSORS);
NumberOfTlbs = 0;
pTlbInfo = (PCPUID_TLB_INFO)calloc(NumberOfProcessors*MAX_TLB_PER_LP, sizeof(CPUID_TLB_INFO));
if (pTlbInfo)
{
/*
* This will enumerate through every logical processor and check each one's TLB. It will then
* determine if that logical processor is expressing a new TLB or an existing TLB.
*
* This can be done by checking the entire CPUID Subleaf contents and using the generated TLB ID.
*
* Here we cannot assume anything about a subleaf number relationship between the enumerated TLB and the
* other logical processors on the system which may be sharing it.
*
* This is going to be done the very long way. There is an assumption that an enumerated TLB and logical
* processors that are included in that ID should all have the same TLB information reported. However, as
* in the manual, we can verify by ensuring the entire subleaf is identical along with the generated TLB ID.
*
*
*/
for (ProcessorIndex = 0; ProcessorIndex < NumberOfProcessors; ProcessorIndex++)
{
Tools_SetAffinity(ProcessorIndex);
MaxSubleaf = 0;
for (SubleafIndex = 0; SubleafIndex <= MaxSubleaf; SubleafIndex++)
{
Tools_ReadCpuid(0x18, SubleafIndex, &CpuidRegisters);
if (SubleafIndex == 0)
{
/*
* Subleaf 0 contains data in EBX, ECX, EDX and EAX is the maximum subleaf.
* Subsequent subleafs do not use EAX.
*/
MaxSubleaf = (CpuidRegisters.x.Register.Eax);
}
/*
* Clear EAX for all subleafs for direct compare to work easier.
*/
CpuidRegisters.x.Register.Eax = 0;
TlbType = (CpuidRegisters.x.Register.Edx & 0x1F); /* EDX[4:0] */
if (TlbType != TlbType_InvalidSubleaf)
{
/*
* Compute the Tlb ID for this tlb; this is called
*
* Maximum Addressible IDs sharing this translation cache since not all APIC IDs
* may be assigned to a logical processor.
*
*/
MaxAddressibleIdSharingTlb = (((CpuidRegisters.x.Register.Edx)>>14) & 0xFFF)+1;
/*
* We round to a power of 2 and create a TlbMask that can be used with
* APIC IDs to generate a Tlb ID.
*
*/
TlbShift = Tools_CreateTopologyShift(MaxAddressibleIdSharingTlb);
TlbMask = ~((1<<TlbShift)-1);
/*
* This mask can be used on other logical processor's APIC IDs to find
* processors sharing this TLB. This code is going to instead check our
* Tlb array and see if it is already there. If not, then create a new
* Tlb in the array. If it is there, then add this APIC ID to that Tlb
* and continue on.
*
*/
TlbId = ApicIdList[ProcessorIndex] & TlbMask;
/*
* Find if this TLB already exists in the TLB list.
*/
TlbIndex = ParseTlb_Internal_FindMatchingTlbEntry(pTlbInfo, NumberOfTlbs, TlbId, &CpuidRegisters);
if(TlbIndex == INVALID_TLB_INDEX)
{
/*
* This TLB does not exist, so add this TLB.
*/
TlbIndex = ParseTlb_Internal_AddTlbEntry(pTlbInfo, &NumberOfTlbs, TlbId, TlbMask, &CpuidRegisters);
}
/*
* Add this logical processor to the TLB index, unless we had an error
* and we do not have any TLB to add.
*/
if(TlbIndex != INVALID_TLB_INDEX)
{
pTlbInfo[TlbIndex].ListOfApicIDsSharingThisTlb[pTlbInfo[TlbIndex].NumberOfLPsSharingThisTlb] = ApicIdList[ProcessorIndex];
pTlbInfo[TlbIndex].NumberOfLPsSharingThisTlb++;
}
else
{
/*
* Should never reach here unless there were a lot of TLBs since
* we statically select a number.
*/
}
}
}
}
Display_DisplayProcessorTlbs(pTlbInfo, NumberOfTlbs);
free(pTlbInfo);
pTlbInfo = NULL;
}
else
{
/*
* Memory Allocation Failure
*/
}
}
else
{
/*
* Does not support CPUID.18H
*/
}
}
/*
* ParseTlb_Internal_FindMatchingTlbEntry
*
* Searches the array to find a matching TlbID based on APIC ID parsing.
*
* Then there is a full CPUID Subleaf verification to determine this exactly
* matches the CPUID.18.n details.
*
* Arguments:
* Tlb Array, Array Size, Tlb ID to find, matching subleaf information for verification
*
* Return:
* Index if found
*/
unsigned int ParseTlb_Internal_FindMatchingTlbEntry(PCPUID_TLB_INFO pTlbInfo, unsigned int NumberOfTlbs, unsigned int TlbId, PCPUID_REGISTERS pCpuidRegisters)
{
unsigned int TlbIndex;
unsigned int TlbFoundIndex;
TlbFoundIndex = INVALID_TLB_INDEX;
for (TlbIndex = 0; TlbIndex < NumberOfTlbs && TlbFoundIndex == INVALID_TLB_INDEX; TlbIndex++)
{
if (pTlbInfo[TlbIndex].TlbId == TlbId)
{
/*
* Further verification this is the same by checking the complete subleaf matches, we do not care
* what the subleaf level was of the entry that created this cache or any that have been added,
* only that they are a complete same description.
*
*/
if (memcmp(&pTlbInfo[TlbIndex].CachedCpuidRegisters, pCpuidRegisters, sizeof(CPUID_REGISTERS)) == 0)
{
TlbFoundIndex = TlbIndex;
}
}
}
return TlbFoundIndex;
}
/*
* ParseTlb_Internal_AddTlbEntry
*
* Adds a new Tlb entry based on the CPUID Input.
*
* Arguments:
* Tlb Array, Array Size, Tlb ID to add, CPUID subleaf information describing this Tlb
*
* Return:
* New Index
*/
unsigned int ParseTlb_Internal_AddTlbEntry(PCPUID_TLB_INFO pTlbInfo, unsigned int *pNumberOfTlbs, unsigned int TlbId, unsigned int TlbMask, PCPUID_REGISTERS pCpuidRegisters)
{
unsigned int NewTlbIndex;
NewTlbIndex = *pNumberOfTlbs;
*pNumberOfTlbs = *pNumberOfTlbs + 1;
/*
* Populate the TLB base information from the CPUID descriptoin
*/
pTlbInfo[NewTlbIndex].TlbType = (pCpuidRegisters->x.Register.Edx & 0x1F); /* EDX[4:0] */
pTlbInfo[NewTlbIndex].TlbLevel = ((pCpuidRegisters->x.Register.Edx>>5) & 0x7); /* EDX[7:5] Tlb Level Starts at 1 */
pTlbInfo[NewTlbIndex].TlbId = TlbId;
pTlbInfo[NewTlbIndex].TlbMask = TlbMask;
/*
* Supported page sizes EBX[3:0]
*/
pTlbInfo[NewTlbIndex]._4K_PageSizeEntries = (pCpuidRegisters->x.Register.Ebx & 1) ? BOOL_TRUE : BOOL_FALSE;
pTlbInfo[NewTlbIndex]._2MB_PageSizeEntries = (pCpuidRegisters->x.Register.Ebx & 2) ? BOOL_TRUE : BOOL_FALSE;
pTlbInfo[NewTlbIndex]._4MB_PageSizeEntries = (pCpuidRegisters->x.Register.Ebx & 4) ? BOOL_TRUE : BOOL_FALSE;
pTlbInfo[NewTlbIndex]._1GB_PageSizeEntries = (pCpuidRegisters->x.Register.Ebx & 8) ? BOOL_TRUE : BOOL_FALSE;
/*
* TLB Information
*/
pTlbInfo[NewTlbIndex].TlbParitioning = ((pCpuidRegisters->x.Register.Ebx>>8)&0x7); /* EBX[10:8] */
pTlbInfo[NewTlbIndex].TlbWays = ((pCpuidRegisters->x.Register.Ebx>>16)&0xFF); /* EBX[31:16] */
pTlbInfo[NewTlbIndex].TlbSets = (pCpuidRegisters->x.Register.Ecx); /* ECX[31:0] */
/*
* TLB Attributes
*/
pTlbInfo[NewTlbIndex].FullyAssociative = (pCpuidRegisters->x.Register.Edx & (1<<8)) ? BOOL_TRUE : BOOL_FALSE;
pTlbInfo[NewTlbIndex].NumberOfLPsSharingThisTlb = 0;
memcpy(&pTlbInfo[NewTlbIndex].CachedCpuidRegisters, pCpuidRegisters, sizeof(CPUID_REGISTERS));
return NewTlbIndex;
}