Mapping a physical memory to linear address

Hai All,

I want to access the physical memory address of RAM in the system from a
User Mode Application. Is there any way to do this?

Are there funtions available to map the physical address to linear address
in the user mode.

Is it neccessary for me to write a kernel module to achieve this.

Any information is greatly helpful.

Thanks in advance,
kedar.

Hi kedar!

The following code should run in kernel mode for allocation . You get
userbuffer locked to logical buffer.
VirtualBuffer =
HalAllocateCommonBuffer(DmaAdapter,0x1000,&PhysicalBuffer,FALSE);

MemMDL =
IoAllocateMdl(VirtualBuffer,0x1000,FALSE,FALSE,NULL);

MmBuildMdlForNonPagedPool(MemMDL);

UserBuffer = MmMapLockedPages(MemMDL,UserMode);

So user get this address.

The following code should be used to deallocate buffer.

MmUnmapLockedPages(UserBuffer, MemMDL);

IoFreeMdl(MemMDL);

HalFreeCommonBuffer(DmaAdapter,0x1000,PhysicalBuffer,VirtualBuffer,FALSE);

You need to write an application which has ioctl calls to call these
routines

Vysyaraju Dali Raju


Vysyaraju Daliraju, / Systems Software Engineer
SBS Technologies, 8371C Central Ave. / Newark, CA 94560
Phone: 510-742-2570 / Fax: -2501 / EMail: xxxxx@sbs.com
mailto:xxxxx

-----Original Message-----
From: kedar [mailto:xxxxx@hotmail.com]
Sent: Friday, October 11, 2002 8:25 AM
To: NT Developers Interest List
Subject: [ntdev] Mapping a physical memory to linear address

Hai All,

I want to access the physical memory address of RAM in the system from a
User Mode Application. Is there any way to do this?

Are there funtions available to map the physical address to linear address
in the user mode.

Is it neccessary for me to write a kernel module to achieve this.

Any information is greatly helpful.

Thanks in advance,
kedar.


You are currently subscribed to ntdev as: xxxxx@sbs.com
To unsubscribe send a blank email to %%email.unsub%%</mailto:xxxxx>

> I want to access the physical memory address of RAM in the system
from a

User Mode Application. Is there any way to do this?

OpenFileMapping(\Device\PhysicalMemory)
MapViewOfFile…

The only great question is from where will you give the memory
address.

Max

In Windows 2000 and later, you can use the “Address Windowing
Extensions” as described in the Platform SDK docs. Of particular
interest are the functions AllocateUserPhysicalPages(),
MapUserPhysicalPages(), and FreeUserPhysicalPages(). Note there are
several restrictions when using these functions; read the docs. Also,
the physical memory is not guaranteed to be (physically) contiguous, but
will, of course, be contiguous in the virtual address space.

Chuck

----- Original Message -----
From: “kedar”
To: “NT Developers Interest List”
Sent: Friday, October 11, 2002 10:24 PM
Subject: [ntdev] Mapping a physical memory to linear address

> Hai All,
>
> I want to access the physical memory address of RAM in the system from
a
> User Mode Application. Is there any way to do this?
>
> Are there funtions available to map the physical address to linear
address
> in the user mode.
>
> Is it neccessary for me to write a kernel module to achieve this.
>
> Any information is greatly helpful.
>
> Thanks in advance,
> kedar.