Intel ARCHITECTURE IA-32 User Manual Page 477

  • Download
  • Add to my manuals
  • Print
  • Page
    / 636
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 476
Vol. 3A 10-37
MEMORY CACHE CONTROL
The pseudocode for the Get4KMemType() function in Example 10-17 obtains the memory type
for a single 4-KByte range at a given physical address. The sample code determines whether an
PHY_ADDRESS falls within a fixed range by comparing the address with the known fixed
ranges: 0 to 7FFFFH (64-KByte regions), 80000H to BFFFFH (16-KByte regions), and C0000H
to FFFFFH (4-KByte regions). If an address falls within one of these ranges, the appropriate bits
within one of its MTRRs determine the memory type.
Example 10-17. Get4KMemType() Pseudocode
IF IA32_MTRRCAP.FIX AND MTRRdefType.FE /* fixed registers enabled */
THEN IF PHY_ADDRESS is within a fixed range
return IA32_MTRR_FIX.Type;
FI;
FOR each variable-range MTRR in IA32_MTRRCAP.VCNT
IF IA32_MTRR_PHYSMASK.V = 0
THEN continue;
FI;
IF (PHY_ADDRESS AND IA32_MTRR_PHYSMASK.Mask) =
(IA32_MTRR_PHYSBASE.Base
AND IA32_MTRR_PHYSMASK.Mask)
THEN
return IA32_MTRR_PHYSBASE.Type;
FI;
ROF;
return MTRRdefType.Type;
10.11.7.2 MemTypeSet() Function
The MemTypeSet() function in Example 10-18 sets a MTRR for the physical memory range
specified by the parameters base and size to the type specified by type. The base address and
size are multiples of 4 KBytes and the size is not 0.
Example 10-18. MemTypeSet Pseudocode
IF CPU_FEATURES.MTRR (* processor supports MTRRs *)
THEN
IF BASE and SIZE are not 4-KByte aligned or size is 0
THEN return INVALID;
FI;
IF (BASE + SIZE) wrap 4-GByte address space
THEN return INVALID;
FI;
IF TYPE is invalid for Pentium 4, Intel Xeon, and P6 family processors
THEN return UNSUPPORTED;
FI;
IF TYPE is WC and not supported
THEN return UNSUPPORTED;
Page view 476
1 2 ... 472 473 474 475 476 477 478 479 480 481 482 ... 635 636

Comments to this Manuals

No comments