テクニカル ドキュメント #129



Doc ID: 129
製品: WinDriver
Version:  All
Windows NT PC 上での、 物理メモリの予約とロック

To reserve a segment of the physical memory (RAM) on your Windows
NT 4.0/2000/XP/Server 2003 PC for exclusive use, and then access this memory using WinDriver, follow the steps outlined in this document.

NOTE:
  • In most cases, there is no need to resort to this method in order to reserve segments of memory for exclusive use. Normally, you can lock a safe Direct Memory Access (DMA) buffer (e.g. using WinDriver's DMA APIs) and then access the buffer from your driver. The method described in the present document should be used only in rare cases of "memory-intensive" driver projects and only when the required memory block cannot be locked using standard methods, such as allocation of a contiguous DMA buffer.

  • When using this method, take special care not to write to the wrong memory addresses, so as to avoid system crashes, etc.

  1. Reserve the desired amount of RAM
  2. Calculate the base address of the reserved memory:
  3. Access the memory using WinDriver

  1. Reserve the desired amount of RAM:
    Modify the boot.ini file on your PC to add a "burnmemory" parameter to the relevant Windows configuration:
    /burnmemory=<size_in_MB>

    The following example reserves 100MB of RAM:

    multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /NoExecute=OptIn /burnmemory=100

    This instructs Windows to refrain from using the specified amount of memory in the highest area of the PC's physical memory (RAM).

    NOTE: When selecting the amount of memory to reserve, take care not to exceed or to take up too much of the memory allocated by default to the operating system's highest address space (see step #2). If the size of the reserved memory segment is too big, this might result in degraded OS performance.


  2. Calculate the base address of the reserved memory:
    To acquire the base address of the reserved memory segment, you must first determine the physical memory mapping on your PC and retrieve the base address and length (in bytes) of the highest address space used by the operating system. Then add the length of this address space to its base address to receive the base address of your reserved memory segment:

    <reserved memory base address> =
        <highest OS physical memory base address> +
        <length of the highest OS memory address space>


    NOTE: To verify the size of your reserved memory block, compare the length of the highest OS address space, before and after modifying boot.ini to reserve the memory (as outlined in step #1).

    You can determine the highest physical memory base address using either of the following methods:

    • From the registry:
      Open the registry (Start --> Run --> regedit.exe) and navigate to the HKEY_LOCAL_MACHINE\HARDWARE\RESOURCEMAP\System Resources\Physical Memory\.Translated registry key. This key is of type REG_RESOURCE_LIST and holds information regarding the physical memory mapping on your PC. To view a parsed version of the mapped addresses, double-click on the .Translated key, select the relevant resource from the Resource Lists dialog, and double-click on the resource (or select Display... ) in order to display the Resources dialog, which contains a list of all memory address ranges for the selected resource. The base address for your reserved physical memory block is calculated by locating the highest base address in the list and adding to it the length of the relevant address space.

      For example, for the following Resources dialog, the highest base address is 0x1000000 and the length of the address space that begins at this address is 0x1eff0000 =>

      <reserved memory base address> =
          0x1000000 + 0x1eff0000 = 0x1fff0000


      USB HID