Partager via


VirtualSetAttrib (Compact 2013)

10/16/2014

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

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

Parameters

  • lpvAddress
    [in] Start address of the virtual memory whose attributes are being changed.
  • cbSize
    [in] Length, in bytes, of the virtual memory whose attributes are being changed.
  • dwNewFlags
    [in] New value of the bits being set.
  • dwMask
    [in] Bits that are being 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

TRUE indicates success. FALSE indicates failure.

Remarks

The pfnVMSetAttrib member of NKGLOBAL points to this function.

This function is only available for use by the OEM adaptation layer (OAL).

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

The new value is calculated using the following formula:

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

If dwMask is set to zero, it behaves like 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 is bits 10 through 31 for most CPUs. Doing so causes unexpected system behavior.

This function changes the translation look-aside buffer (TLB) entry directly. The calling function should be aware of which CPU architecture it is running on and which attributes to change.

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

Requirements

Header

pkfuncs.h

Library

coredll.lib

See Also

Reference

Kernel Functions Available to the OAL