test: mimisc.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# mimisc.c File Reference

`#include "mi.h"`

Go to the source code of this file.

## Classes

struct | _CACHE_ATTRIBUTE_DESCRIPTOR

## Typedefs

typedef enum _MEM_TYPES | MEM_TYPES
typedef _CACHE_ATTRIBUTE_DESCRIPTOR | CACHE_ATTRIBUTE_DESCRIPTOR
typedef _CACHE_ATTRIBUTE_DESCRIPTOR * | PCACHE_ATTRIBUTE_DESCRIPTOR

## Enumerations

enum | _MEM_TYPES { RegularMemory, MemoryMappedIo, VideoDisplayBuffer, IoPort, RomMemory }

## Functions

ULONG | MiCheckMemoryAttribute (IN PFN_NUMBER PageFrameNumber)
| MiDisableCaching (IN PMMPTE PointerPte;)

## Variables

LIST_ENTRY | MmCacheAttributeDescriptorListHead
ULONG | MmDefaultCacheAttribute = MM_PTE_MA_WBU
UCHAR | MmDisableCache [16]

## Typedef Documentation

typedef struct _CACHE_ATTRIBUTE_DESCRIPTOR CACHE_ATTRIBUTE_DESCRIPTOR

typedef enum _MEM_TYPES MEM_TYPES

typedef struct _CACHE_ATTRIBUTE_DESCRIPTOR * PCACHE_ATTRIBUTE_DESCRIPTOR

## Enumeration Type Documentation

enum _MEM_TYPES

Enumeration values:

  RegularMemory |
  MemoryMappedIo |
  VideoDisplayBuffer |
  IoPort |
  RomMemory |

Definition at line 31 of file mimisc.c.

    00031                         {
    00032     RegularMemory,
    00033     MemoryMappedIo,
    00034     VideoDisplayBuffer,
    00035     IoPort,
    00036     RomMemory
    00037 } MEM_TYPES;

## Function Documentation

ULONG MiCheckMemoryAttribute | ( | IN PFN_NUMBER | PageFrameNumber | ) |

Definition at line 60 of file mimisc.c.

References MmCacheAttributeDescriptorListHead, and MmDefaultCacheAttribute.

Referenced by MiDisableCaching().

    00066                   :
    00067
    00068     This function examines the physical address which is given
    00069     by the physical page frame number, and returns the cache
    00070     attributes type for that page. The returned value is used to specify
    00071     the MemoryAttribute field in the HARDWARE_PTE structure to map
    00072     that page.
    00073
    00074     This function searches the cache descriptor attribute link
    00075     lists to see if the specific cache attribute is defined for
    00076     that physical address range.
    00077
    00078     If the physical address range is not defined in the cache
    00079     descriptor attribute link lists, returns the default memory
    00080     attribute.
    00081
    00082 Arguments:
    00083
    00084     PageFrameIndex - Supplies the physical page frame number to be
    00085                      examined for the cache attribute.
    00086
    00087 Return Value:
    00088
    00089     Returns a cache attribute type for the supplied physical page
    00090     frame number.
    00091
    00092 Environment:
    00093
    00094     Kernel Mode Only.
    00095
    00096 --*/
    00097
    00098 {
    00099    PLIST_ENTRY NextMd;
    00100
    00101    NextMd = MmCacheAttributeDescriptorListHead.Flink;
    00102
    00103    While (NextMd != MmCacheAttributeDescriptorListHead) {
    00104
    00105        CacheAttributeDescriptor = CONTAINING_RECORD(NextMd,
    00106                                                      CACHE_ATTRIBUTE_DESCRIPTOR,
    00107                                                      ListEntry);
    00108
    00109        if ((PageFrameNumber >= CacheAttributeDescriptor.BasePage) ||
    00110            (PageFrameNumber < CacheAttributeDescriptor.PageCount)) {
    00111
    00112            return (CacheAttributeDescriptor.CacheAttribute);
    00113
    00114        }
    00115
    00116        NextMd = CacheAttributeDescriptor->ListEntry.Flink;
    00117    }
    00118
    00119    //
    00120    // if the cache memory descriptor is not found,
    00121    // return the default cache attribute, MmDefaultCacheAttribute.
    00122    //
    00123
    00124    return (MmDefaultCacheAttribute);
    00125
    00126 }

MiDisableCaching | ( | IN PMMPTE PointerPte; |  | ) |

Definition at line 139 of file mimisc.c.

References MiCheckMemoryAttribute(), and MmDisableCache.

    00145                    :
    00146
    00147     This macro takes a valid PTE and sets the caching state to be
    00148     disabled.
    00149
    00150 Argments
    00151
    00152     PTE - Supplies a pointer to the valid PTE.
    00153
    00154 Return Value:
    00155
    00156     None.
    00157
    00158 Environment:
    00159
    00160     Kernel mode
    00161
    00162 --*/
    00163
    00164 {
    00165     ULONG CacheAttribute;
    00166
    00167     CacheAttribute = MiCheckMemoryAttribute(TempPte.u.Hard.PageFrameNumber);
    00168
    00169     if (MmDisableCache[CacheAttribute]) {
    00170
    00171         //
    00172         // The returned CacheAttributes indicate uncachable.
    00173         //
    00174
    00175         PointerPte->u.Hard.MemAttribute = CacheAttribute;
    00176
    00177     } else {
    00178
    00179         //
    00180         // Set the most conservative cache memory attribute,
    00181         // UCO (Uncachable, Non-coalescing, Sequential & Non-
    00182         // speculative and Ordered.
    00183         //
    00184
    00185         PointerPte->u.Hard.MemAttribute = MM_PTE_MA_UCO;
    00186
    00187     }
    00188 }

## Variable Documentation

LIST_ENTRY MmCacheAttributeDescriptorListHead

| Definition at line 49 of file mimisc.c. Referenced by MiCheckMemoryAttribute().

ULONG MmDefaultCacheAttribute = MM_PTE_MA_WBU

| Definition at line 55 of file mimisc.c. Referenced by MiCheckMemoryAttribute().

UCHAR MmDisableCache[16]

Initial value:

     {0, 0, 0, 0, 0, 0, 0, 0
                               1, 1, 0, 1, 0, 1, 0, 0}

Definition at line 134 of file mimisc.c.

Referenced by MiDisableCaching().