NKVirtualSetAttributes (Windows Embedded CE 6.0)

1/5/2010

This function enables OEMs to change the per-page attributes for a range of virtual memory, which is usually copied from a physical location not known to the kernel.

Syntax

BOOL NKVirtualSetAttributes(
  LPVOID lpvAddress,
  DWORD cbSize,
  DWORD dwNewFlags,
  DWORD dwMask,
  LPDWORD lpdwOldFlags
);

Parameters

  • lpvAddress
    [in] Start address of the virtual memory whose attributes are to be changed.
  • cbSize
    [in] Length, in bytes, of the virtual memory whose attributes are to be changed.
  • dwNewFlags
    [in] New value of the bits to be set.
  • dwMask
    [in] Bits that are to be changed.
  • lpdwOldFlags
    [in] If this parameter is not NULL, *lpdwOldFlags contains the original value of the page entry of the first page upon return.

Return Value

Returns TRUE if the function succeeded, and FALSE if it failed.

Remarks

NkVirtualSetAttributes is only available for use by the OAL.

The dwMask parameter specifies the bits to be changed. For example, if original value=0x00100010, dwMask=0x30, and dwNewFlags=0x030, the new value is 0x00100030.

The new value is calculated using the following formula:

newValue = (oldValue & ~dwMask)|(dwNewFlags & dwMask);

If dwMask is 0 (zero), it behaves similar to a query function. This means that nothing is changed and the original page entry is returned through lpdwOldFlags.

Note

Do not change the physical page number, which are bits 10 through 31 for most CPUs. Changing the page number causes unexpected system behavior.

The NKVirtualSetAttributes function changes the TLB entry directly. The calling function should be aware of what CPU architecture it is running on and which attributes to change.

The NKVirtualSetAttributes function can be used on the x86 and XScale microprocessors to speed up the display buffer.

The NKVirtualSetAttributes function does not work on SHx processors.

Requirements

Header pkfuncs.h
Library coredll.lib
Windows Embedded CE Windows CE 5.0 and later

See Also

Reference

Other OAL Functions

Other Resources

VirtualSetAttributes