I went through debuging a call to malloc() to try to find out where the link between virtual memory and physical memory is stored, but ended up with calls to HeapAlloc() that are stepped over by the debugger.

What I need to do is, given a buffer such as
int myBuffer = (int*)malloc(whateverSize * sizeof(int));

I want to lock the pages in physical memory and then map those pages to another virtual address.

Does anyone know how to do this?
Thanks in advance.

Antranik

Re: Anyone know how to access the Link between Page File & Physical Memory? by Rushikesh

Rushikesh
Tue Feb 03 22:24:39 CST 2004

Virtual to physical address transalation is done by MMU a hardware unit(part
of CPU).

For locking the pages you can use MmProbeAndLockPages. You will also need
to create MDL (Memory descriptor list) for the same.

~rushikesh.


"Antranik" <ardziv13REMOVE_CAPS@freenet.no_spam.am> wrote in message
news:E8CC72FD-CDDB-4C0A-9FBB-416E6CDEB9BD@microsoft.com...
> I went through debuging a call to malloc() to try to find out where the
link between virtual memory and physical memory is stored, but ended up with
calls to HeapAlloc() that are stepped over by the debugger.
>
> What I need to do is, given a buffer such as
> int myBuffer = (int*)malloc(whateverSize * sizeof(int));
>
> I want to lock the pages in physical memory and then map those pages to
another virtual address.
>
> Does anyone know how to do this?
> Thanks in advance.
>
> Antranik



Re: Anyone know how to access the Link between Page File & Physical Memory? by Maxim

Maxim
Tue Feb 03 09:52:23 CST 2004

You cannot do this without a driver.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


"Antranik" <ardziv13REMOVE_CAPS@freenet.no_spam.am> wrote in message
news:E8CC72FD-CDDB-4C0A-9FBB-416E6CDEB9BD@microsoft.com...
> I went through debuging a call to malloc() to try to find out where the link
between virtual memory and physical memory is stored, but ended up with calls
to HeapAlloc() that are stepped over by the debugger.
>
> What I need to do is, given a buffer such as
> int myBuffer = (int*)malloc(whateverSize * sizeof(int));
>
> I want to lock the pages in physical memory and then map those pages to
another virtual address.
>
> Does anyone know how to do this?
> Thanks in advance.
>
> Antranik



Re: Anyone know how to access the Link between Page File & Physical Memory? by ardziv13DELETE_CAPS

ardziv13DELETE_CAPS
Wed Feb 04 02:46:06 CST 2004

Thanks

but what about physical to virtual address translation? In other words, I already know how to go from virtual to physical, but what about physical to virtual? I don't want to copy the buffer (time-expensive opertion) either in physical memory or in the page file, but I want to have access to the same buffer from twi separate sets of user-space virtual addresses. I know about using MmGetSystemAddressForMdl() to map a buffer into system space, but I want to map the buffer (without copying) into another location in user-space, not system space

Thanks again
Antranik

Re: Anyone know how to access the Link between Page File & Physical Memory? by Rushikesh

Rushikesh
Fri Feb 06 16:59:58 CST 2004

You can use memory mapped files for sharing the data between two processes
in user space.

~rushikesh.

"Antranik" <ardziv13DELETE_CAPS@freenet.nospam.am> wrote in message
news:AC078685-35E7-4D12-BCE9-C2C696EB62F1@microsoft.com...
> Thanks,
>
> but what about physical to virtual address translation? In other words, I
already know how to go from virtual to physical, but what about physical to
virtual? I don't want to copy the buffer (time-expensive opertion) either
in physical memory or in the page file, but I want to have access to the
same buffer from twi separate sets of user-space virtual addresses. I know
about using MmGetSystemAddressForMdl() to map a buffer into system space,
but I want to map the buffer (without copying) into another location in
user-space, not system space.
>
> Thanks again,
> Antranik