OEMSetMemoryAttributes (Compact 2013)

10/16/2014

This function handles changes to memory attributes.

Syntax

BOOL OEMSetMemoryAttributes ( 
  LPVOID pVirtualAddr, 
  LPVOID pPhysAddr, 
  DWORD cbSize, 
  DWORD dwAttributes 
); 

Parameters

  • pVirtualAddr
    [in] Pointer to the beginning virtual memory address.

    The memory address must be page aligned.

  • pPhysAddr
    [in] Pointer to the corresponding physical memory address shifted by 8 bits or PHYSICAL_ADDRESS_UNKNOWN.

    If the value of this parameter is not set to PHYSICAL_ADDRESS_UNKNOWN, the physical address, for which pPhysAddr is less than 8, must be page aligned.

    The specified range must be physically contiguous, which means that the range (pVirtualAddr -> pVirtualAddr + cbSize) must be mapped to (pPhysAddr -> pPhysAddr + cbSize).

  • cbSize
    [in] Size, in bytes, of the memory to be changed.

    The size must be in multiple of pages.

  • dwAttributes
    [in] Memory attribute to be set.

    Only PAGE_WRITECOMBINE is supported. Write-combining enables bus write transfers to be combined into a larger transfer before the direct memory access (DMA) hardware sends a burst.

Return Value

Nonzero indicates success. Zero indicates failure.

Code Example

Description

The OAL initializes the pfnSetMemoryAttributes member of OEMGLOBAL to return false. When you use this default setting, any call to the CeSetMemoryAttributes function will not succeed.

If you implement OEMSetMemoryAttributes, initialize pfnSetMemoryAttributes in the OEMInit function. The following code example shows how to initialize pfnSetMemoryAttributes.

Code

OEMInit()
{
    //…
    g_pOemGlobal->pfnSetMemoryAttributes = OEMSetMemoryAttributes;
}

Requirements

Header

Developer Implemented

Library

OEMMain.lib or OEMMain_StaticKITL.lib

See Also

Reference

Optional OAL Functions
OEMGLOBAL
VirtualSetAttrib
OEMInit