|
From: | Filip Navara |
Subject: | Re: [Qemu-devel] Windows NT page allocation |
Date: | Mon, 08 Nov 2004 18:00:40 +0100 |
User-agent: | Mozilla Thunderbird 0.9 (Windows/20041103) |
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
[Prev in Thread] | Current Thread | [Next in Thread] |