Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mapping physical Ram addresses (MmMapIoSpace)

1,008 views
Skip to first unread message

summj...@gmail.com

unread,
Apr 28, 2008, 5:45:28 AM4/28/08
to
Hey

Im trying to map the physical Ram address to logical address in order
to read\write from it.
I have a driver that needs to read from the physical Ram address 0
(needs to read the first sector).

My code goes like this : (i found few samples that where pretty
similar)

baseAddress = MmMapIoSpace(MmGetPhysicalAddress((void*)0, 512, 0);

I assume I get the virtual address that I am looking for , that I can
read the sector from it. (I actually get something, but its hard to
tell if its what I wanted)

I dont know if the code is good. The way i thought testing this is
opening the physical RAM by winhex, changing the RAM and trying to
read it through my driver. The problem is Winhex displays
"UNREACHABLE PAGE" over these areas in the ram.
Does anyone know how i can test my code?

Tim Roberts

unread,
Apr 30, 2008, 2:12:29 AM4/30/08
to
summj...@gmail.com wrote:
>
>Im trying to map the physical Ram address to logical address in order
>to read\write from it.
>I have a driver that needs to read from the physical Ram address 0
>(needs to read the first sector).

Huh? RAM does not have "sectors". If you want to read the first sector of
your hard disk, it's possible to do that, but that doesn't have anything to
do with physical RAM addresses.

There's nothing particularly interesting at physical address 0. What are
you really trying to do?

>My code goes like this : (i found few samples that where pretty
>similar)
>
>baseAddress = MmMapIoSpace(MmGetPhysicalAddress((void*)0, 512, 0);

MmGetPhysicalAddress returns the physical address corresponding to a
virtual address. Windows XP does not put anything at virtual address 0, so
the code you have above will always fail.

You can try MmMapIoSpace on physical address 0, but you will need to make
sure the cache type matches whatever mapping might already exist.

>I assume I get the virtual address that I am looking for , that I can
>read the sector from it. (I actually get something, but its hard to
>tell if its what I wanted)

I doubt it.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

summj...@gmail.com

unread,
May 1, 2008, 10:17:46 AM5/1/08
to
On 30 אפריל, 09:12, Tim Roberts <t...@probo.com> wrote:
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.

hey , and thanks for trying to help me BZ

to make things short , i need to map the ram in my kernel mode driver.
the way i need to do it is by starting with a physical address X,
mapping / converting it to a logical address, and reading from the
represented logical address.

i found the upper sample and thought it might be a fine start point,
but it isnt.

Tim Roberts

unread,
May 1, 2008, 11:17:53 PM5/1/08
to
summj...@gmail.com wrote:
>
>to make things short , i need to map the ram in my kernel mode driver.
>the way i need to do it is by starting with a physical address X,
>mapping / converting it to a logical address, and reading from the
>represented logical address.
>
>i found the upper sample and thought it might be a fine start point,
>but it isnt.

You didn't answer ANY of the questions I asked. You haven't said what
problem you are trying to solve. Instead, you have focused in on the way
you THINK you need to solve it.

Tell us what the overall problem is, and then we can advise you on a
workable solution.

summj...@gmail.com

unread,
May 3, 2008, 5:05:50 AM5/3/08
to
First of all, thanks for the attention and I'm sorry for not being
informative in my last replay

I'm starting my world in kernel device drivers, and I got an
assignment-> to present the ram, similiar to the way winhex does.
For solving this problem, I have a device driver that gets a requst
(via Io Control Code from a user mode application) for a physical ram
address that he needs to presented . my driver needs to translate this
address to a logical address and read it and retrieve the data the has
been to the user mode application.
i hope now i managed to give you a clue of what im looking for...

thanks alot for help!

Pavel A.

unread,
May 3, 2008, 12:27:51 PM5/3/08
to
<summj...@gmail.com> wrote in message
news:8b88a647-2ab5-4e5e...@b1g2000hsg.googlegroups.com...

Then you're already done. Run windbg in live mode
and get all your memory dumps.

--PA

Tim Roberts

unread,
May 3, 2008, 11:52:51 PM5/3/08
to

Pavel is right. This problem has been solved many times before. DDKs up
through the Windows XP DDK included a sample driver that did this, as does
the code included with Sven Schreiber's book "Undocumented Windows 2000
Secrets"

summj...@gmail.com

unread,
May 7, 2008, 5:39:39 AM5/7/08
to
thanks. i succeeded to do what i wanted

i just created a LARGE_INTEGER variable , assigned the quadpart to
the physical address i need. then called

LARGE_INTEGER physicalAddress;
physicalAddress.quadpart = MyAddress;

baseAddress = MmMapIoSpace(physicalAddress, 512, 0);

and then i coppied the data with memset, from baseAddress;

Rossetoecioccolato

unread,
May 7, 2008, 12:14:11 PM5/7/08
to
How did you know what cache attributes to use with MmMapIoSpace? Do you own
physical address 0? I think not. Supposing there has already a mapped
address zero (e.g. using \Device\PhysicalMemory)?

Regards,

Rossetoecioccolato.

<summj...@gmail.com> wrote in message
news:a7e0be5d-39f4-4c45...@m36g2000hse.googlegroups.com...

0 new messages