From: Bhentai on
Hi,

I want to allocate a certain memory area in RAM using the
MmAllocateContiguousMemorySpecifyCache function. I've put my boundaries for
my lowest and highest acceptable values and I want to get all the the
availeble space between those values. For Example:

MmAllocateContiguousMemorySpecifyCache(
0x4000, //diff between highest and lowest acceptable
0x44000, //lowest acceptable
0x48001, //highest acceptable
0, // boundary address multiple
MmNonCached); //cache type

I was able to get a return pointer corresponding to the virtual address
value but if I call MmGetPhysicalAddress with my previously returned value, I
get a physical address of 0x45000, following my example. So this would mean
that my complete buffer would range between 0x45000 and 0x49000 if it was
allocated correctly, and this does not respect the previoulsy entered
acceptable ranged values in MmAllocateContiguousMemorySpecifyCache. What is
wrong with my setup and why is MmAllocateContiguousMemorySpecifyCache
behaving like that?

Regards
From: eagersh on
On Dec 7, 3:59 pm, Bhentai <b.laj...(a)daptech.com> wrote:
> Hi,
>
> I want to allocate a certain memory area in RAM using the
> MmAllocateContiguousMemorySpecifyCache function. I've put my boundaries for
> my lowest and highest acceptable values and I want to get all the the
> availeble space between those values. For Example:
>
>   MmAllocateContiguousMemorySpecifyCache(
> 0x4000, //diff between highest and lowest acceptable
> 0x44000, //lowest acceptable
> 0x48001, //highest acceptable
> 0, // boundary address multiple
> MmNonCached); //cache type
>
> I was able to get a return pointer corresponding to the virtual address
> value but if I call MmGetPhysicalAddress with my previously returned value, I
> get a physical address of 0x45000, following my example. So this would mean
> that my complete buffer would range between 0x45000 and 0x49000 if it was
> allocated correctly, and this does not respect the previoulsy entered
> acceptable ranged values in MmAllocateContiguousMemorySpecifyCache. What is
> wrong with my setup and why is MmAllocateContiguousMemorySpecifyCache
> behaving like that?
>
> Regards

It could possible that 0x44000 address is taken already. If you want
to more restriction on allocating memory try to specify a value != 0
in boundary address multiple.

Igor Sharovar
From: Maxim S. Shatskih on
> I was able to get a return pointer corresponding to the virtual address
> value but if I call MmGetPhysicalAddress

Use ->AllocateCommonBuffer instead, this is a more supported way.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com