All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Windows NT page allocation
@ 2004-11-08 11:22 Fabrice Bellard
  2004-11-08 17:00 ` Filip Navara
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Bellard @ 2004-11-08 11:22 UTC (permalink / raw)
  To: qemu-devel

Hi,

Does someone know how to allocate a single 4 KB page of memory in 
Windows NT ?

Fabrice.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Windows NT page allocation
  2004-11-08 11:22 [Qemu-devel] Windows NT page allocation Fabrice Bellard
@ 2004-11-08 17:00 ` Filip Navara
  0 siblings, 0 replies; 2+ messages in thread
From: Filip Navara @ 2004-11-08 17:00 UTC (permalink / raw)
  To: qemu-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-11-08 17:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-08 11:22 [Qemu-devel] Windows NT page allocation Fabrice Bellard
2004-11-08 17:00 ` Filip Navara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.