Microsoft KB Archive/321628

From BetaArchive Wiki

Article ID: 321628

Article Last Modified on 5/27/2005



APPLIES TO

  • Microsoft Windows CE Platform Builder 4.0



This article was previously published under Q321628


SUMMARY

This article describes a new function, VirtualSetAttributes, that permits you to modify processor-specific page attribute bits for a range of virtual memory. The update that is provided is conditionally supported, and you have to clean and build the platform after you install the update. A sample of code describes the new system function. This article also describes the parameters and the return values of the new function.


INTRODUCTION

You cannot modify processor-specific page attribute bits. No functionality exists for you to do this.

However, the means to modify processor-specific page attribute bits is useful for optimizing memory access on some microprocessors. This article implements a new function so that you can modify processor-specific page attribute bits. The new VirtualSetAttributes function permits you to change the per-page attributes for a range of virtual memory.

RESOLUTION

Hotfix information

A supported software update is now available from Microsoft as Windows CE 4.0 Core OS QFE 321628. To resolve this problem immediately, click the following article number for information about obtaining Windows CE Platform Builder and core operating system software updates:

837392 How to locate core operating system fixes for Microsoft Windows CE Platform Builder products


Prerequisites

This fix is supported only when all previously issued fixes for this product have also been installed.

Restart requirement

After you install this update, you must perform a clean build of the whole platform. To clean the platform, click Clean on the Build menu. To build the platform, click Build Platform on the Build menu.

Hotfix replacement information

This fix does not replace any other fixes.

File information

The English version of this package has the file attributes (or later) that are listed in the following table.

   Date         Time   Version            Size    File name
   ---------------------------------------------------------------------------------
   17-May-2002  23:05  4.0.2.517       2,816,344  020517_armv4i_wce40-q321628.exe  
   17-May-2002  23:05  4.0.2.517       2,808,152  020517_armv4t_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       2,812,248  020517_armv4_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       2,779,480  020517_mips16_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       3,012,952  020517_mipsii_fp_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       4,938,072  020517_mipsii_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       3,144,024  020517_mipsiv_fp_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       3,017,048  020517_mipsiv_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       2,627,928  020517_sh3_wce40-q321628.exe
   17-May-2002  23:05  4.0.2.517       2,656,600  020517_sh4_wce40-q321628.exe  
   17-May-2002  23:05  4.0.2.517       2,419,032  020517_x86_wce40-q321628.exe

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

   Date         Time                      Size    File name
   --------------------------------------------------------------

   Path: Public\Common\Oak\Inc
   24-Apr-2002  18:27                     39,647  Mkfuncs.h
   24-Apr-2002  18:29                     33,027  Pkfuncs.h
   24-Apr-2002  18:31                     12,199  Psyscall.h

   Path: Public\Common\Oak\Lib\Armv4\Debug
   25-Apr-2002  00:03                     67,606  Coredll.def
   25-Apr-2002  00:03                    151,182  Coremain.lib
   25-Apr-2002  00:06                  1,742,536  Nkmain.lib
   25-Apr-2002  00:06                  1,853,284  Nkprmain.lib
   25-Apr-2002  00:03                    710,294  Thunks.lib

   Path: Public\Common\Oak\Lib\Armv4\Retail
   25-Apr-2002  00:00                     67,590  Coredll.def
   25-Apr-2002  00:01                    140,678  Coremain.lib
   25-Apr-2002  00:05                  1,115,290  Nkmain.lib
   25-Apr-2002  00:06                  1,207,294  Nkprmain.lib
   25-Apr-2002  00:00                    847,528  Thunks.lib

   Path: Public\Common\Oak\Lib\Armv4i\Debug
   25-Apr-2002  00:16                     67,606  Coredll.def
   25-Apr-2002  00:16                    151,660  Coremain.lib
   25-Apr-2002  00:19                  1,746,460  Nkmain.lib
   25-Apr-2002  00:19                  1,857,458  Nkprmain.lib
   25-Apr-2002  00:16                    713,972  Thunks.lib

   Path: Public\Common\Oak\Lib\Armv4i\Retail
   25-Apr-2002  00:13                     67,590  Coredll.def
   25-Apr-2002  00:13                    141,150  Coremain.lib
   25-Apr-2002  00:18                  1,119,286  Nkmain.lib
   25-Apr-2002  00:18                  1,211,568  Nkprmain.lib
   25-Apr-2002  00:13                    851,180  Thunks.lib

   Path: Public\Common\Oak\Lib\Armv4t\Debug
   25-Apr-2002  00:09                     67,606  Coredll.def
   25-Apr-2002  00:09                    142,678  Coremain.lib
   25-Apr-2002  00:13                  1,615,588  Nkmain.lib
   25-Apr-2002  00:13                  1,719,424  Nkprmain.lib
   25-Apr-2002  00:09                    693,048  Thunks.lib

   Path: Public\Common\Oak\Lib\Armv4t\Retail
   25-Apr-2002  00:07                     67,590  Coredll.def
   25-Apr-2002  00:07                    140,134  Coremain.lib
   25-Apr-2002  00:12                  1,102,470  Nkmain.lib
   25-Apr-2002  00:12                  1,193,196  Nkprmain.lib
   25-Apr-2002  00:07                    865,826  Thunks.lib

   Path: Public\Common\Oak\Lib\Mips16\Debug
   25-Apr-2002  00:35                     67,664  Coredll.def
   25-Apr-2002  00:35                    158,888  Coremain.lib
   25-Apr-2002  00:38                  1,788,330  Nkmain.lib
   25-Apr-2002  00:38                  1,909,818  Nkprmain.lib
   25-Apr-2002  00:35                    770,656  Thunks.lib

   Path: Public\Common\Oak\Lib\Mips16\Retail
   25-Apr-2002  00:33                     67,648  Coredll.def
   25-Apr-2002  00:33                    123,024  Coremain.lib
   25-Apr-2002  00:37                    997,176  Nkmain.lib
   25-Apr-2002  00:37                  1,093,560  Nkprmain.lib
   25-Apr-2002  00:33                    710,806  Thunks.lib

   Path: Public\Common\Oak\Lib\Mipsii\Debug
   25-Apr-2002  00:22                     67,664  Coredll.def
   25-Apr-2002  00:22                    158,888  Coremain.lib
   25-Apr-2002  00:26                  1,784,476  Nkmipsiibmain.lib
   25-Apr-2002  00:25                  1,786,156  Nkmipsiimain.lib
   25-Apr-2002  00:26                  1,906,152  Nkprofmipsiibmain.lib
   25-Apr-2002  00:25                  1,907,832  Nkprofmipsiimain.lib
   25-Apr-2002  00:22                    770,656  Thunks.lib

   Path: Public\Common\Oak\Lib\Mipsii\Retail
   25-Apr-2002  00:20                     67,648  Coredll.def
   25-Apr-2002  00:20                    141,568  Coremain.lib
   25-Apr-2002  00:24                  1,134,776  Nkmipsiibmain.lib
   25-Apr-2002  00:24                  1,136,626  Nkmipsiimain.lib
   25-Apr-2002  00:25                  1,237,502  Nkprofmipsiibmain.lib
   25-Apr-2002  00:24                  1,239,354  Nkprofmipsiimain.lib
   25-Apr-2002  00:20                    913,726  Thunks.lib

   Path: Public\Common\Oak\Lib\MipsII_fp\Debug
   25-Apr-2002  00:41                     67,251  Coredll.def
   25-Apr-2002  00:41                    158,946  Coremain.lib
   25-Apr-2002  00:44                  1,854,296  Nkmain.lib
   25-Apr-2002  00:44                  1,975,988  Nkprmain.lib
   25-Apr-2002  00:41                    770,872  Thunks.lib

   Path: Public\Common\Oak\Lib\MipsII_fp\Retail
   25-Apr-2002  00:39                     67,235  Coredll.def
   25-Apr-2002  00:39                    141,656  Coremain.lib
   25-Apr-2002  00:43                  1,196,228  Nkmain.lib
   25-Apr-2002  00:44                  1,299,062  Nkprmain.lib
   25-Apr-2002  00:39                    913,952  Thunks.lib

   Path: Public\Common\Oak\Lib\Mipsiv\Debug
   25-Apr-2002  00:29                     67,664  Coredll.def
   25-Apr-2002  00:29                    164,150  Coremain.lib
   25-Apr-2002  00:32                  1,843,406  Nkmain.lib
   25-Apr-2002  00:32                  1,967,930  Nkprmain.lib
   25-Apr-2002  00:29                    788,460  Thunks.lib

   Path: Public\Common\Oak\Lib\Mipsiv\Retail
   25-Apr-2002  00:26                     67,648  Coredll.def
   25-Apr-2002  00:27                    148,070  Coremain.lib
   25-Apr-2002  00:31                  1,192,464  Nkmain.lib
   25-Apr-2002  00:32                  1,298,586  Nkprmain.lib
   25-Apr-2002  00:26                    931,976  Thunks.lib

   Path: Public\Common\Oak\Lib\Mipsiv_fp\Debug
   25-Apr-2002  00:47                     67,251  Coredll.def
   25-Apr-2002  00:47                    164,210  Coremain.lib
   25-Apr-2002  00:50                  1,919,272  Nkmain.lib
   25-Apr-2002  00:51                  2,043,818  Nkprmain.lib
   25-Apr-2002  00:47                    788,676  Thunks.lib

   Path: Public\Common\Oak\Lib\Mipsiv_fp\Retail
   25-Apr-2002  00:45                     67,235  Coredll.def
   25-Apr-2002  00:45                    148,156  Coremain.lib
   25-Apr-2002  00:50                  1,260,660  Nkmain.lib
   25-Apr-2002  00:50                  1,366,836  Nkprmain.lib
   25-Apr-2002  00:45                    932,200  Thunks.lib

   Path: Public\Common\Oak\Lib\Sh3\Debug
   24-Apr-2002  23:50                     68,929  Coredll.def
   24-Apr-2002  23:50                    133,210  Coremain.lib
   24-Apr-2002  23:53                  1,449,758  Nkmain.lib
   24-Apr-2002  23:53                  1,547,906  Nkprmain.lib
   24-Apr-2002  23:50                    663,420  Thunks.lib

   Path: Public\Common\Oak\Lib\Sh3\Retail
   24-Apr-2002  23:47                     68,913  Coredll.def
   24-Apr-2002  23:48                    126,420  Coremain.lib
   24-Apr-2002  23:53                    973,800  Nkmain.lib
   24-Apr-2002  23:53                  1,064,474  Nkprmain.lib
   24-Apr-2002  23:47                    820,868  Thunks.lib

   Path: Public\Common\Oak\Lib\Sh4\Debug
   24-Apr-2002  23:56                     69,019  Coredll.def
   24-Apr-2002  23:57                    132,960  Coremain.lib
   25-Apr-2002  00:00                  1,468,028  Nkmain.lib
   25-Apr-2002  00:00                  1,566,186  Nkprmain.lib
   24-Apr-2002  23:56                    665,590  Thunks.lib

   Path: Public\Common\Oak\Lib\Sh4\Retail
   24-Apr-2002  23:54                     69,003  Coredll.def
   24-Apr-2002  23:54                    126,038  Coremain.lib
   24-Apr-2002  23:59                    991,098  Nkmain.lib
   24-Apr-2002  23:59                  1,081,834  Nkprmain.lib
   24-Apr-2002  23:54                    823,352  Thunks.lib

   Path: Public\Common\Oak\Lib\X86\Debug
   24-Apr-2002  23:44                     66,926  Coredll.def
   24-Apr-2002  23:44                    118,672  Coremain.lib
   24-Apr-2002  23:47                  1,477,356  Nkmain.lib
   24-Apr-2002  23:47                  1,575,238  Nkprmain.lib
   24-Apr-2002  23:44                    513,618  Thunks.lib

   Path: Public\Common\Oak\Lib\X86\Retail
   24-Apr-2002  23:42                     66,910  Coredll.def
   24-Apr-2002  23:42                    112,216  Coremain.lib
   24-Apr-2002  23:46                    953,534  Nkmain.lib
   24-Apr-2002  23:46                  1,037,066  Nkprmain.lib
   24-Apr-2002  23:42                    688,006  Thunks.lib

The VirtualSetAttributes function

This hotfix implements a new function, VirtualSetAttributes. This new function permits driver developers to change the per-page attributes for a range of virtual memory. The range of virtual memory is typically copied from a physical location that is not known to the kernel.

This function is currently useful only on the XScale microprocessor, where you can use the function to speed up the display buffer. The following code describes the new system function that is exposed by this update:

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

Parameters of the VirtualSetAttributes function

The VirtualSetAttributes function uses the following parameters:

  • lpvAddress

This parameter is the start address of the virtual memory whose attributes are to be changed.

  • cbSize

This parameter is the length, in bytes, of the virtual memory whose attributes are to be changed.

  • dwNewFlags

This parameter specifies the new value of the bits that are to be set.

  • dwMask

This parameter specifies the specific bits that are to be changed. See additional remarks later in this section.

  • lpdwOldFlags

If this parameter is not NULL, the *lpdwOldFlags parameter will contain the original value of the page entry of the first page upon return.

Return values of the VirtualSetAttributes function

  • Returns TRUE if the function succeeded.
  • Returns FALSE if the function failed.


Remarks

The dwMask parameter specifies the specific bits that are to be changed. For example, if the original is as follows, the new value will be 0x00100030:

  • value=0x00100010
  • dwMask=0x30
  • dwNewFlags=0x030

The new value is calculated by using the following formula:

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

If the dwMask parameter is 0, the parameter behaves in a manner that is similar to a query function. That is, nothing is changed, and the original page entry is returned through the lpdwOldFlags parameter.

Note Microsoft highly recommends that you do not change the actual physical page number. The actual physical page numbers are bits 10 through 31 for most CPUs. If you change the physical page numbers, you may experience unexpected system behavior.

Keywords: kbinfo kbbug kbfix kbqfe KB321628