From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CRD1d-000464-QZ for qemu-devel@nongnu.org; Mon, 08 Nov 2004 12:09:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CRD1c-00045G-DX for qemu-devel@nongnu.org; Mon, 08 Nov 2004 12:09:52 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CRD1b-000452-Uo for qemu-devel@nongnu.org; Mon, 08 Nov 2004 12:09:52 -0500 Received: from [195.250.128.83] (helo=smtp3.vol.cz) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CRCsj-0000kC-2h for qemu-devel@nongnu.org; Mon, 08 Nov 2004 12:00:41 -0500 Received: from [83.148.2.3] (a2prg-3.dialup.vol.cz [83.148.2.3]) by smtp3.vol.cz (8.12.9p2/8.12.9) with ESMTP id iA8H0cYb070209 for ; Mon, 8 Nov 2004 18:00:38 +0100 (CET) (envelope-from xnavara@volny.cz) Message-ID: <418FA638.8020805@volny.cz> Date: Mon, 08 Nov 2004 18:00:40 +0100 From: Filip Navara MIME-Version: 1.0 Subject: Re: [Qemu-devel] Windows NT page allocation References: <418F56FF.9060204@bellard.org> In-Reply-To: <418F56FF.9060204@bellard.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Fabrice Bellard wrote: > Does someone know how to allocate a single 4 KB page of memory in > Windows NT ? In user mode you can allocate one page using SYSTEM_INFO SystemInfo; GetSystemInfo(&SystemInfo); Address = VirtualAlloc(NULL, SystemInfo.dwPageSize, MEM_COMMIT | MEM_RESERVE*, *PAGE_EXECUTE_READWRITE); The problem is that the granuality of VirtualAlloc is 64Kb, so if you allocate 4Kb page this way you will end up with the rest 60Kb unusable (strictly speaking the memory can be still allocated using different mechanisms). It's possible to reserve more memory and then commit individual pages from the reserved region though. See http://msdn.microsoft.com/library/en-us/memory/base/reserving_and_committing_memory.asp for details. Can you be more specific about the usage you intend? Maybe I would be able to suggest you better solution... Regards, Filip