Who Can tell me the difference between MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe

Who Can tell me the difference between MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe?

craig

MmGetMdlVirtualAddress returns the original va for the physical pages mapped by the mdl. Usually this is a process specific user mode va and is thus not generally used for accessing the data from kernel mode. More typically it is used to calculate the offset into the first physical page where the actual data starts.

MmGetSystemAddressForMdlSafe returns a kernel mode va for the physical pages mapped by the mdl. This second va is in fact useful in the kernel in any process context for accessing the user data.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of craiglei
Sent: Monday, June 10, 2002 4:38 AM
To: NT Developers Interest List
Subject: [ntdev] Who Can tell me the difference between
MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe

Who Can tell me the difference between MmGetMdlVirtualAddress
and MmGetSystemAddressForMdlSafe?

craig

b嫮绠范\够?v诘譲僧J沧吺N嫴鎟竮莡y櫒秹j鞯综]>X妒

One returns the original user-mode address on which MDL was built.
Another maps the MDL pages to kernel space and returns the mapped
address, which is always valid regardless on what process and on what
IRQL you are.

Max

----- Original Message -----
From: “craiglei”
To: “NT Developers Interest List”
Sent: Monday, June 10, 2002 12:37 PM
Subject: [ntdev] Who Can tell me the difference between
MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe

> Who Can tell me the difference between MmGetMdlVirtualAddress and
MmGetSystemAddressForMdlSafe?
>
> craig
>
>
> b‹­ç®·¶\¹»?vÚµ×jÉÆ)¶Šçiû¢dº{nlj·zwnV‘éŠ[•æz{zþØy²Û²·

What about allocate a new mdl in kernel mode driver? If a mdl is allocated in kernel driver why there is difference between the
value of MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe?

Driver’s code address is virtual address or kernel address(System Address)?

craig
----- Original Message -----
From: “Mark Roddy”
To: “NT Developers Interest List”
Sent: Monday, June 10, 2002 6:50 PM
Subject: [ntdev] RE: Who Can tell me the difference between MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe

MmGetMdlVirtualAddress returns the original va for the physical pages mapped by the mdl. Usually this is a process specific user mode va and is thus not generally used for accessing the data from kernel mode. More typically it is used to calculate the offset into the first physical page where the actual data starts.

MmGetSystemAddressForMdlSafe returns a kernel mode va for the physical pages mapped by the mdl. This second va is in fact useful in the kernel in any process context for accessing the user data.

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of craiglei
> Sent: Monday, June 10, 2002 4:38 AM
> To: NT Developers Interest List
> Subject: [ntdev] Who Can tell me the difference between
> MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe
>
>
> Who Can tell me the difference between MmGetMdlVirtualAddress
> and MmGetSystemAddressForMdlSafe?
>
> craig
>
>
> b嫮绠范\够?v诘譲僧J沧吺N嫴鎟竮莡y櫒秹j鞯综]>X妒
>


You are currently subscribed to ntdev as: xxxxx@tgegroup.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

“craiglei” wrote in message news:xxxxx@ntdev…
> What about allocate a new mdl in kernel mode driver? If a mdl is allocated
in kernel driver why there is difference between the
> value of MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe?
>
> Driver’s code address is virtual address or kernel address(System
Address)?
>
> craig

Mr. Roddy’s answer was, perhaps, not as clear as you needed it to be.

MmGetSystemAddressForMdl(Safe)(…) takes a buffer described by an MDL and
maps it into the high 2GB of kernel virtual addressing space. If the MDL
was built CORRECTLY, and the kernel virtual address that represents the data
buffer is in the high 2GB of kernel virtual address space, then the return
from these two functions will indeed be the same.

Something tells me you have a root issue or question here. How about
sharing that with us, and we’ll try to answer it…

Peter
OSR

@“Peter_Viscarola_(OSR)” said:
“craiglei” wrote in message news:xxxxx@ntdev…

What about allocate a new mdl in kernel mode driver? If a mdl is allocated
in kernel driver why there is difference between the
value of MmGetMdlVirtualAddress and MmGetSystemAddressForMdlSafe?

Driver’s code address is virtual address or kernel address(System
Address)?

craig

Mr. Roddy’s answer was, perhaps, not as clear as you needed it to be.

MmGetSystemAddressForMdl(Safe)(…) takes a buffer described by an MDL and
maps it into the high 2GB of kernel virtual addressing space. If the MDL
was built CORRECTLY, and the kernel virtual address that represents the data
buffer is in the high 2GB of kernel virtual address space, then the return
from these two functions will indeed be the same.
If physical memory is allocated for different purpose (may be some controller) and another driver might be creating MDL for that physical memory reference then va where it refer. I am just wondering how some controller will operate on physical memory allocated (does it also refer virtual address) if this is the case what virtual address does it be pointing…?

Something tells me you have a root issue or question here. How about
sharing that with us, and we’ll try to answer it…

Peter
OSR

When you create an MDL, you always start from a virtual address. The system will fill in the MDL with the physical pages for that set of virtual addresses. You make it sound like we start from a physical address and work backwards, but that’s just not the way it is.

@davs_shrus: Good job, re-opening g a 17 year old thread!

https://i.kym-cdn.com/photos/images/masonry/000/028/451/Necropost.jpg![](/uploads/db2714/original/1X/59023def4f86fc5768034af7a28d39fac0ac6da5.jpeg “”)

Closing thread.

If you have a question, post it in a new thread. Please.

Peter