All of lore.kernel.org
 help / color / mirror / Atom feed
From: Filip Navara <xnavara@volny.cz>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Windows NT page allocation
Date: Mon, 08 Nov 2004 18:00:40 +0100	[thread overview]
Message-ID: <418FA638.8020805@volny.cz> (raw)
In-Reply-To: <418F56FF.9060204@bellard.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

      reply	other threads:[~2004-11-08 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08 11:22 [Qemu-devel] Windows NT page allocation Fabrice Bellard
2004-11-08 17:00 ` Filip Navara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=418FA638.8020805@volny.cz \
    --to=xnavara@volny.cz \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.