I have a kernel virtual address (which actually points to a block of
contiguous physical memory). I have a top level driver which communicates
with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
address mapping of this physical memory. How do you do this?
Thanks In Advance,
Joe
Joe,
you wrote on Tuesday, March 26, 2002, 16:29:15:
JM> I have a kernel virtual address (which actually points to a block of
JM> contiguous physical memory). I have a top level driver which
JM> communicates with a user mode program via IOCTLs. One IOCTL wants to
JM> make a user-mode address mapping of this physical memory. How do you
JM> do this?
There is a section object in the NT name space, \Device\PhysicalMemory,
that represents the physical memory. It is possible to map this into
user space, see “WinIo” at http://www.internals.com/utilities_main.htm
(contains source).
Ralf.
Create a MDL from it, then call MmMapLockedPages(…UserMode…) on it.
Note that you must unmap this before the process will exit, otherwise, the OS will bugcheck.
CLEANUP handler is a great place to do this unmap.
Max
----- Original Message -----
From: “Joe Moriarty”
To: “NT Developers Interest List”
Sent: Tuesday, March 26, 2002 6:29 PM
Subject: [ntdev] Map kernel memory to user-mode
> I have a kernel virtual address (which actually points to a block of
> contiguous physical memory). I have a top level driver which communicates
> with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
> address mapping of this physical memory. How do you do this?
>
> Thanks In Advance,
> Joe
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q191840
–
Bill McKenzie
“Joe Moriarty” wrote in message
news:xxxxx@ntdev…
>
> I have a kernel virtual address (which actually points to a block of
> contiguous physical memory). I have a top level driver which communicates
> with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
> address mapping of this physical memory. How do you do this?
>
> Thanks In Advance,
> Joe
>
>
>
Refer to http://www.osr.com/ntinsider/2000/sharing_memory.htm. This
article is very good.
Regards,
Jeyaram
Actually,
with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
address mapping of this physical memory.
You don’t. You pend an Irp that returns data as soon as it is available in
the outbuffer of your DeviceIoControl. You are not supposed to directly
access kernal mode memory from an application…or to map a user mode
address to the device driver. At least that is what you will find NT Driver
guys prefer you to do. This is a DOS like usage of memory, that has been
going on for ages (UNIX too) but is somehow banned in NT. Actually OSR has
a page on their web site that talks about the actual code to do this.
Sharing Memory Between Drivers and Applications is the name of the Article,
I dont have the actual addr.
FWIW,
Asher
----- Original Message -----
From: “Joe Moriarty”
To: “NT Developers Interest List”
Sent: Tuesday, March 26, 2002 9:29 AM
Subject: [ntdev] Map kernel memory to user-mode
> I have a kernel virtual address (which actually points to a block of
> contiguous physical memory). I have a top level driver which communicates
> with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
> address mapping of this physical memory. How do you do this?
>
> Thanks In Advance,
> Joe
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> To unsubscribe send a blank email to %%email.unsub%%
>
Dogmatism apart, sharing memory between driver and app is what
Direct or Neither I/O is supposed to do, right ? Just take advantage
of it. Or you can do it by hand mapping the space yourself, if that’s
what you feel like doing. The easiest way of course is not to have
apps look at driver space, but to have the driver access app space.
Incidentally, this is where segmentation comes in great. You can
easily write an IoControl function to pass a segment from the app
to the driver, so that the driver uses that segment as a common
memory area to maintain state to the app and to get command info
from the app. Keeps things wrapped up properly, and you get a
protection fault if you piss outside the urinol.
Alberto.
On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
Actually,
> with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
> address mapping of this physical memory.
You don’t. You pend an Irp that returns data as soon as it is available in
the outbuffer of your DeviceIoControl. You are not supposed to directly
access kernal mode memory from an application…or to map a user mode
address to the device driver. At least that is what you will find NT Driver
guys prefer you to do. This is a DOS like usage of memory, that has been
going on for ages (UNIX too) but is somehow banned in NT. Actually OSR has
a page on their web site that talks about the actual code to do this.
Sharing Memory Between Drivers and Applications is the name of the Article,
I dont have the actual addr.
FWIW,
Asher
----- Original Message -----
From: “Joe Moriarty”
> To: “NT Developers Interest List”
> Sent: Tuesday, March 26, 2002 9:29 AM
> Subject: [ntdev] Map kernel memory to user-mode
>
>
> > I have a kernel virtual address (which actually points to a block of
> > contiguous physical memory). I have a top level driver which communicates
> > with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
> > address mapping of this physical memory. How do you do this?
> >
> > Thanks In Advance,
> > Joe
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to %%email.unsub%%
>
> from the app. Keeps things wrapped up properly, and you get a
protection fault if you piss outside the urinol.
Thought it was more about aiming for that little blue grate in the urinol.
Asher
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Wednesday, March 27, 2002 7:23 AM
Subject: [ntdev] Re: Map kernel memory to user-mode
> Dogmatism apart, sharing memory between driver and app is what
> Direct or Neither I/O is supposed to do, right ? Just take advantage
> of it. Or you can do it by hand mapping the space yourself, if that’s
> what you feel like doing. The easiest way of course is not to have
> apps look at driver space, but to have the driver access app space.
>
> Incidentally, this is where segmentation comes in great. You can
> easily write an IoControl function to pass a segment from the app
> to the driver, so that the driver uses that segment as a common
> memory area to maintain state to the app and to get command info
> from the app. Keeps things wrapped up properly, and you get a
> protection fault if you piss outside the urinol.
>
> Alberto.
>
>
> On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
>
> > Actually,
> >
> > > with a user mode program via IOCTLs. One IOCTL wants to make a
user-mode
> > > address mapping of this physical memory.
> >
> > You don’t. You pend an Irp that returns data as soon as it is available
in
> > the outbuffer of your DeviceIoControl. You are not supposed to directly
> > access kernal mode memory from an application…or to map a user mode
> > address to the device driver. At least that is what you will find NT
Driver
> > guys prefer you to do. This is a DOS like usage of memory, that has
been
> > going on for ages (UNIX too) but is somehow banned in NT. Actually OSR
has
> > a page on their web site that talks about the actual code to do this.
> > Sharing Memory Between Drivers and Applications is the name of the
Article,
> > I dont have the actual addr.
> >
> > FWIW,
> >
> > Asher
> >
> > ----- Original Message -----
> > From: “Joe Moriarty”
> > To: “NT Developers Interest List”
> > Sent: Tuesday, March 26, 2002 9:29 AM
> > Subject: [ntdev] Map kernel memory to user-mode
> >
> >
> > > I have a kernel virtual address (which actually points to a block of
> > > contiguous physical memory). I have a top level driver which
communicates
> > > with a user mode program via IOCTLs. One IOCTL wants to make a
user-mode
> > > address mapping of this physical memory. How do you do this?
> > >
> > > Thanks In Advance,
> > > Joe
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@ieee.org
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> To unsubscribe send a blank email to %%email.unsub%%
>
So, has the topic of this thread changed from “memory mapping” to “streams”?
BTW: It’s spelled “unrinal”. (“Urinol” sounds like one of those drugs that
the big pharma companies advertise on TV. “Urinol isn’t right for everyone.
People taking Urinol for extended periods may experience dizziness and a
complete cessation of biological activity. Ask your doctor about Urinol.”)
-Art
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Asher Hoodin
Sent: Thursday, March 28, 2002 10:05 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Map kernel memory to user-mode
> from the app. Keeps things wrapped up properly, and you get a
> protection fault if you piss outside the urinol.
Thought it was more about aiming for that little blue grate in the urinol.
Asher
----- Original Message -----
From:
> To: “NT Developers Interest List”
> Sent: Wednesday, March 27, 2002 7:23 AM
> Subject: [ntdev] Re: Map kernel memory to user-mode
>
>
> > Dogmatism apart, sharing memory between driver and app is what
> > Direct or Neither I/O is supposed to do, right ? Just take advantage
> > of it. Or you can do it by hand mapping the space yourself, if that’s
> > what you feel like doing. The easiest way of course is not to have
> > apps look at driver space, but to have the driver access app space.
> >
> > Incidentally, this is where segmentation comes in great. You can
> > easily write an IoControl function to pass a segment from the app
> > to the driver, so that the driver uses that segment as a common
> > memory area to maintain state to the app and to get command info
> > from the app. Keeps things wrapped up properly, and you get a
> > protection fault if you piss outside the urinol.
> >
> > Alberto.
> >
> >
> > On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
> >
> > > Actually,
> > >
> > > > with a user mode program via IOCTLs. One IOCTL wants to make a
> user-mode
> > > > address mapping of this physical memory.
> > >
> > > You don’t. You pend an Irp that returns data as soon as it
> is available
> in
> > > the outbuffer of your DeviceIoControl. You are not supposed
> to directly
> > > access kernal mode memory from an application…or to map a user mode
> > > address to the device driver. At least that is what you will find NT
> Driver
> > > guys prefer you to do. This is a DOS like usage of memory, that has
> been
> > > going on for ages (UNIX too) but is somehow banned in NT.
> Actually OSR
> has
> > > a page on their web site that talks about the actual code to do this.
> > > Sharing Memory Between Drivers and Applications is the name of the
> Article,
> > > I dont have the actual addr.
> > >
> > > FWIW,
> > >
> > > Asher
> > >
> > > ----- Original Message -----
> > > From: “Joe Moriarty”
> > > To: “NT Developers Interest List”
> > > Sent: Tuesday, March 26, 2002 9:29 AM
> > > Subject: [ntdev] Map kernel memory to user-mode
> > >
> > >
> > > > I have a kernel virtual address (which actually points to a block of
> > > > contiguous physical memory). I have a top level driver which
> communicates
> > > > with a user mode program via IOCTLs. One IOCTL wants to make a
> user-mode
> > > > address mapping of this physical memory. How do you do this?
> > > >
> > > > Thanks In Advance,
> > > > Joe
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@ieee.org
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nfr.com
> To unsubscribe send a blank email to %%email.unsub%%
…and ask your doctor for an eye exam, too - it’s spelled
and *typed* “urinal” (“unrinal” it’s even weirder…).
(Sorry, Art - just kidding… kind of a stress relief for today… 
----- Original Message -----
From: “Art Baker”
To: “NT Developers Interest List”
Sent: Thursday, March 28, 2002 2:29 PM
Subject: [ntdev] Re: Map kernel memory to user-mode
So, has the topic of this thread changed from “memory mapping” to
“streams”?
BTW: It’s spelled “unrinal”. (“Urinol” sounds like one of those drugs
that
the big pharma companies advertise on TV. “Urinol isn’t right for
everyone.
People taking Urinol for extended periods may experience dizziness and a
complete cessation of biological activity. Ask your doctor about
Urinol.”)
-Art
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Asher Hoodin
> Sent: Thursday, March 28, 2002 10:05 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Map kernel memory to user-mode
>
>
> > from the app. Keeps things wrapped up properly, and you get a
> > protection fault if you piss outside the urinol.
>
> Thought it was more about aiming for that little blue grate in the
urinol.
>
> Asher
> ----- Original Message -----
> From:
> To: “NT Developers Interest List”
> Sent: Wednesday, March 27, 2002 7:23 AM
> Subject: [ntdev] Re: Map kernel memory to user-mode
>
>
> > Dogmatism apart, sharing memory between driver and app is what
> > Direct or Neither I/O is supposed to do, right ? Just take advantage
> > of it. Or you can do it by hand mapping the space yourself, if
that’s
> > what you feel like doing. The easiest way of course is not to have
> > apps look at driver space, but to have the driver access app space.
> >
> > Incidentally, this is where segmentation comes in great. You can
> > easily write an IoControl function to pass a segment from the app
> > to the driver, so that the driver uses that segment as a common
> > memory area to maintain state to the app and to get command info
> > from the app. Keeps things wrapped up properly, and you get a
> > protection fault if you piss outside the urinol.
> >
> > Alberto.
> >
> >
> > On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
> >
> > > Actually,
> > >
> > > > with a user mode program via IOCTLs. One IOCTL wants to make a
> user-mode
> > > > address mapping of this physical memory.
> > >
> > > You don’t. You pend an Irp that returns data as soon as it
> is available
> in
> > > the outbuffer of your DeviceIoControl. You are not supposed
> to directly
> > > access kernal mode memory from an application…or to map a user
mode
> > > address to the device driver. At least that is what you will find
NT
> Driver
> > > guys prefer you to do. This is a DOS like usage of memory, that
has
> been
> > > going on for ages (UNIX too) but is somehow banned in NT.
> Actually OSR
> has
> > > a page on their web site that talks about the actual code to do
this.
> > > Sharing Memory Between Drivers and Applications is the name of the
> Article,
> > > I dont have the actual addr.
> > >
> > > FWIW,
> > >
> > > Asher
> > >
> > > ----- Original Message -----
> > > From: “Joe Moriarty”
> > > To: “NT Developers Interest List”
> > > Sent: Tuesday, March 26, 2002 9:29 AM
> > > Subject: [ntdev] Map kernel memory to user-mode
> > >
> > >
> > > > I have a kernel virtual address (which actually points to a
block of
> > > > contiguous physical memory). I have a top level driver which
> communicates
> > > > with a user mode program via IOCTLs. One IOCTL wants to make a
> user-mode
> > > > address mapping of this physical memory. How do you do this?
> > > >
> > > > Thanks In Advance,
> > > > Joe
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@ieee.org
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nfr.com
> To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntdev as: xxxxx@criticalsoftware.com
To unsubscribe send a blank email to %%email.unsub%%
Harh! Urinol is obviously targeted at that highly prized over 50 BPH male
market segment formerly known as the ‘baby boomers’.
But I do note with absolutely no surprise at all that alberto yearns for the
good old days of far pointers. Segments? Blechhh.
-----Original Message-----
From: Art Baker [mailto:xxxxx@nfr.com]
Sent: Thursday, March 28, 2002 9:30 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Map kernel memory to user-mode
So, has the topic of this thread changed from “memory
mapping” to “streams”?
BTW: It’s spelled “unrinal”. (“Urinol” sounds like one of
those drugs that the big pharma companies advertise on TV.
“Urinol isn’t right for everyone. People taking Urinol for
extended periods may experience dizziness and a complete
cessation of biological activity. Ask your doctor about Urinol.”)
-Art
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Asher Hoodin
> Sent: Thursday, March 28, 2002 10:05 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Map kernel memory to user-mode
>
>
> > from the app. Keeps things wrapped up properly, and you get a
> > protection fault if you piss outside the urinol.
>
> Thought it was more about aiming for that little blue grate in the
> urinol.
>
> Asher
> ----- Original Message -----
> From:
> > To: “NT Developers Interest List”
> > Sent: Wednesday, March 27, 2002 7:23 AM
> > Subject: [ntdev] Re: Map kernel memory to user-mode
> >
> >
> > > Dogmatism apart, sharing memory between driver and app is what
> > > Direct or Neither I/O is supposed to do, right ? Just
> take advantage
> > > of it. Or you can do it by hand mapping the space yourself, if
> > > that’s what you feel like doing. The easiest way of
> course is not to
> > > have apps look at driver space, but to have the driver access app
> > > space.
> > >
> > > Incidentally, this is where segmentation comes in great. You can
> > > easily write an IoControl function to pass a segment from
> the app to
> > > the driver, so that the driver uses that segment as a
> common memory
> > > area to maintain state to the app and to get command info
> from the
> > > app. Keeps things wrapped up properly, and you get a protection
> > > fault if you piss outside the urinol.
> > >
> > > Alberto.
> > >
> > >
> > > On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
> > >
> > > > Actually,
> > > >
> > > > > with a user mode program via IOCTLs. One IOCTL wants
> to make a
> > user-mode
> > > > > address mapping of this physical memory.
> > > >
> > > > You don’t. You pend an Irp that returns data as soon as it
> > is available
> > in
> > > > the outbuffer of your DeviceIoControl. You are not supposed
> > to directly
> > > > access kernal mode memory from an application…or to
> map a user
> > > > mode address to the device driver. At least that is
> what you will
> > > > find NT
> > Driver
> > > > guys prefer you to do. This is a DOS like usage of
> memory, that
> > > > has
> > been
> > > > going on for ages (UNIX too) but is somehow banned in NT.
> > Actually OSR
> > has
> > > > a page on their web site that talks about the actual code to do
> > > > this. Sharing Memory Between Drivers and Applications
> is the name
> > > > of the
> > Article,
> > > > I dont have the actual addr.
> > > >
> > > > FWIW,
> > > >
> > > > Asher
> > > >
> > > > ----- Original Message -----
> > > > From: “Joe Moriarty”
> > > > To: “NT Developers Interest List”
> > > > Sent: Tuesday, March 26, 2002 9:29 AM
> > > > Subject: [ntdev] Map kernel memory to user-mode
> > > >
> > > >
> > > > > I have a kernel virtual address (which actually points to a
> > > > > block of contiguous physical memory). I have a top
> level driver
> > > > > which
> > communicates
> > > > > with a user mode program via IOCTLs. One IOCTL wants
> to make a
> > user-mode
> > > > > address mapping of this physical memory. How do you do this?
> > > > >
> > > > > Thanks In Advance,
> > > > > Joe
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as:
> xxxxx@aam-ch.com To
> > > > > unsubscribe send a blank email to %%email.unsub%%
> > > > >
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@ieee.org To
> > > > unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com To
> > > unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nfr.com
> > To unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@stratus.com To unsubscribe send a blank email to
> %%email.unsub%%
>
Miguel will understand, “mijar fora do pinico” is hard to translate
out of my native Portuguese !
Alberto.
On 28 Mar 2002, at 14:40, Miguel Monteiro wrote:
…and ask your doctor for an eye exam, too - it’s spelled
and *typed* “urinal” (“unrinal” it’s even weirder…).
(Sorry, Art - just kidding… kind of a stress relief for today… 
----- Original Message -----
From: “Art Baker”
> To: “NT Developers Interest List”
> Sent: Thursday, March 28, 2002 2:29 PM
> Subject: [ntdev] Re: Map kernel memory to user-mode
>
>
> So, has the topic of this thread changed from “memory mapping” to
> “streams”?
>
> BTW: It’s spelled “unrinal”. (“Urinol” sounds like one of those drugs
> that
> the big pharma companies advertise on TV. “Urinol isn’t right for
> everyone.
> People taking Urinol for extended periods may experience dizziness and a
> complete cessation of biological activity. Ask your doctor about
> Urinol.”)
>
> -Art
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Asher Hoodin
> > Sent: Thursday, March 28, 2002 10:05 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Map kernel memory to user-mode
> >
> >
> > > from the app. Keeps things wrapped up properly, and you get a
> > > protection fault if you piss outside the urinol.
> >
> > Thought it was more about aiming for that little blue grate in the
> urinol.
> >
> > Asher
> > ----- Original Message -----
> > From:
> > To: “NT Developers Interest List”
> > Sent: Wednesday, March 27, 2002 7:23 AM
> > Subject: [ntdev] Re: Map kernel memory to user-mode
> >
> >
> > > Dogmatism apart, sharing memory between driver and app is what
> > > Direct or Neither I/O is supposed to do, right ? Just take advantage
> > > of it. Or you can do it by hand mapping the space yourself, if
> that’s
> > > what you feel like doing. The easiest way of course is not to have
> > > apps look at driver space, but to have the driver access app space.
> > >
> > > Incidentally, this is where segmentation comes in great. You can
> > > easily write an IoControl function to pass a segment from the app
> > > to the driver, so that the driver uses that segment as a common
> > > memory area to maintain state to the app and to get command info
> > > from the app. Keeps things wrapped up properly, and you get a
> > > protection fault if you piss outside the urinol.
> > >
> > > Alberto.
> > >
> > >
> > > On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
> > >
> > > > Actually,
> > > >
> > > > > with a user mode program via IOCTLs. One IOCTL wants to make a
> > user-mode
> > > > > address mapping of this physical memory.
> > > >
> > > > You don’t. You pend an Irp that returns data as soon as it
> > is available
> > in
> > > > the outbuffer of your DeviceIoControl. You are not supposed
> > to directly
> > > > access kernal mode memory from an application…or to map a user
> mode
> > > > address to the device driver. At least that is what you will find
> NT
> > Driver
> > > > guys prefer you to do. This is a DOS like usage of memory, that
> has
> > been
> > > > going on for ages (UNIX too) but is somehow banned in NT.
> > Actually OSR
> > has
> > > > a page on their web site that talks about the actual code to do
> this.
> > > > Sharing Memory Between Drivers and Applications is the name of the
> > Article,
> > > > I dont have the actual addr.
> > > >
> > > > FWIW,
> > > >
> > > > Asher
> > > >
> > > > ----- Original Message -----
> > > > From: “Joe Moriarty”
> > > > To: “NT Developers Interest List”
> > > > Sent: Tuesday, March 26, 2002 9:29 AM
> > > > Subject: [ntdev] Map kernel memory to user-mode
> > > >
> > > >
> > > > > I have a kernel virtual address (which actually points to a
> block of
> > > > > contiguous physical memory). I have a top level driver which
> > communicates
> > > > > with a user mode program via IOCTLs. One IOCTL wants to make a
> > user-mode
> > > > > address mapping of this physical memory. How do you do this?
> > > > >
> > > > > Thanks In Advance,
> > > > > Joe
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > > > > To unsubscribe send a blank email to %%email.unsub%%
> > > > >
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@ieee.org
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com
> > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nfr.com
> > To unsubscribe send a blank email to %%email.unsub%%
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@criticalsoftware.com
> To unsubscribe send a blank email to %%email.unsub%%
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to %%email.unsub%%
>
I actually subscribe more to the Java way, that is, no pointers. Use
references instead, and let the compiler handle the dirty work ! But
there’s no reason, for example, that a compiler shouldn’t effectively
wrap a complex object as a segment, transparent to the developer-
level code.
Alberto.
===============
On 28 Mar 2002, at 9:35, Roddy, Mark wrote:
Harh! Urinol is obviously targeted at that highly prized over 50 BPH male
market segment formerly known as the ‘baby boomers’.
But I do note with absolutely no surprise at all that alberto yearns for the
good old days of far pointers. Segments? Blechhh.
> -----Original Message-----
> From: Art Baker [mailto:xxxxx@nfr.com]
> Sent: Thursday, March 28, 2002 9:30 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Map kernel memory to user-mode
>
>
> So, has the topic of this thread changed from “memory
> mapping” to “streams”?
>
> BTW: It’s spelled “unrinal”. (“Urinol” sounds like one of
> those drugs that the big pharma companies advertise on TV.
> “Urinol isn’t right for everyone. People taking Urinol for
> extended periods may experience dizziness and a complete
> cessation of biological activity. Ask your doctor about Urinol.”)
>
> -Art
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Asher Hoodin
> > Sent: Thursday, March 28, 2002 10:05 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Map kernel memory to user-mode
> >
> >
> > > from the app. Keeps things wrapped up properly, and you get a
> > > protection fault if you piss outside the urinol.
> >
> > Thought it was more about aiming for that little blue grate in the
> > urinol.
> >
> > Asher
> > ----- Original Message -----
> > From:
> > > To: “NT Developers Interest List”
> > > Sent: Wednesday, March 27, 2002 7:23 AM
> > > Subject: [ntdev] Re: Map kernel memory to user-mode
> > >
> > >
> > > > Dogmatism apart, sharing memory between driver and app is what
> > > > Direct or Neither I/O is supposed to do, right ? Just
> > take advantage
> > > > of it. Or you can do it by hand mapping the space yourself, if
> > > > that’s what you feel like doing. The easiest way of
> > course is not to
> > > > have apps look at driver space, but to have the driver access app
> > > > space.
> > > >
> > > > Incidentally, this is where segmentation comes in great. You can
> > > > easily write an IoControl function to pass a segment from
> > the app to
> > > > the driver, so that the driver uses that segment as a
> > common memory
> > > > area to maintain state to the app and to get command info
> > from the
> > > > app. Keeps things wrapped up properly, and you get a protection
> > > > fault if you piss outside the urinol.
> > > >
> > > > Alberto.
> > > >
> > > >
> > > > On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
> > > >
> > > > > Actually,
> > > > >
> > > > > > with a user mode program via IOCTLs. One IOCTL wants
> > to make a
> > > user-mode
> > > > > > address mapping of this physical memory.
> > > > >
> > > > > You don’t. You pend an Irp that returns data as soon as it
> > > is available
> > > in
> > > > > the outbuffer of your DeviceIoControl. You are not supposed
> > > to directly
> > > > > access kernal mode memory from an application…or to
> > map a user
> > > > > mode address to the device driver. At least that is
> > what you will
> > > > > find NT
> > > Driver
> > > > > guys prefer you to do. This is a DOS like usage of
> > memory, that
> > > > > has
> > > been
> > > > > going on for ages (UNIX too) but is somehow banned in NT.
> > > Actually OSR
> > > has
> > > > > a page on their web site that talks about the actual code to do
> > > > > this. Sharing Memory Between Drivers and Applications
> > is the name
> > > > > of the
> > > Article,
> > > > > I dont have the actual addr.
> > > > >
> > > > > FWIW,
> > > > >
> > > > > Asher
> > > > >
> > > > > ----- Original Message -----
> > > > > From: “Joe Moriarty”
> > > > > To: “NT Developers Interest List”
> > > > > Sent: Tuesday, March 26, 2002 9:29 AM
> > > > > Subject: [ntdev] Map kernel memory to user-mode
> > > > >
> > > > >
> > > > > > I have a kernel virtual address (which actually points to a
> > > > > > block of contiguous physical memory). I have a top
> > level driver
> > > > > > which
> > > communicates
> > > > > > with a user mode program via IOCTLs. One IOCTL wants
> > to make a
> > > user-mode
> > > > > > address mapping of this physical memory. How do you do this?
> > > > > >
> > > > > > Thanks In Advance,
> > > > > > Joe
> > > > > >
> > > > > >
> > > > > > —
> > > > > > You are currently subscribed to ntdev as:
> > xxxxx@aam-ch.com To
> > > > > > unsubscribe send a blank email to %%email.unsub%%
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as: xxxxx@ieee.org To
> > > > > unsubscribe send a blank email to %%email.unsub%%
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com To
> > > > unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@nfr.com
> > > To unsubscribe send a blank email to %%email.unsub%%
> >
> >
> > —
> > You are currently subscribed to ntdev as:
> > xxxxx@stratus.com To unsubscribe send a blank email to
> > %%email.unsub%%
> >
>
> —
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to %%email.unsub%%
>
My GOD I had NO idea that JAVA was as screwed up as BASIC!!!
–
Gary G. Little
xxxxx@broadstor.com
xxxxx@inland.net
wrote in message news:xxxxx@ntdev…
>
> I actually subscribe more to the Java way, that is, no pointers. Use
> references instead, and let the compiler handle the dirty work ! But
> there’s no reason, for example, that a compiler shouldn’t effectively
> wrap a complex object as a segment, transparent to the developer-
> level code.
>
> Alberto.
>
> ===============
>
> On 28 Mar 2002, at 9:35, Roddy, Mark wrote:
>
> > Harh! Urinol is obviously targeted at that highly prized over 50 BPH
male
> > market segment formerly known as the ‘baby boomers’.
> >
> > But I do note with absolutely no surprise at all that alberto yearns for
the
> > good old days of far pointers. Segments? Blechhh.
> >
> > > -----Original Message-----
> > > From: Art Baker [mailto:xxxxx@nfr.com]
> > > Sent: Thursday, March 28, 2002 9:30 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Map kernel memory to user-mode
> > >
> > >
> > > So, has the topic of this thread changed from “memory
> > > mapping” to “streams”?
> > >
> > > BTW: It’s spelled “unrinal”. (“Urinol” sounds like one of
> > > those drugs that the big pharma companies advertise on TV.
> > > “Urinol isn’t right for everyone. People taking Urinol for
> > > extended periods may experience dizziness and a complete
> > > cessation of biological activity. Ask your doctor about Urinol.”)
> > >
> > > -Art
> > >
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com]On Behalf Of Asher Hoodin
> > > > Sent: Thursday, March 28, 2002 10:05 AM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] Re: Map kernel memory to user-mode
> > > >
> > > >
> > > > > from the app. Keeps things wrapped up properly, and you get a
> > > > > protection fault if you piss outside the urinol.
> > > >
> > > > Thought it was more about aiming for that little blue grate in the
> > > > urinol.
> > > >
> > > > Asher
> > > > ----- Original Message -----
> > > > From:
> > > > To: “NT Developers Interest List”
> > > > Sent: Wednesday, March 27, 2002 7:23 AM
> > > > Subject: [ntdev] Re: Map kernel memory to user-mode
> > > >
> > > >
> > > > > Dogmatism apart, sharing memory between driver and app is what
> > > > > Direct or Neither I/O is supposed to do, right ? Just
> > > take advantage
> > > > > of it. Or you can do it by hand mapping the space yourself, if
> > > > > that’s what you feel like doing. The easiest way of
> > > course is not to
> > > > > have apps look at driver space, but to have the driver access app
> > > > > space.
> > > > >
> > > > > Incidentally, this is where segmentation comes in great. You can
> > > > > easily write an IoControl function to pass a segment from
> > > the app to
> > > > > the driver, so that the driver uses that segment as a
> > > common memory
> > > > > area to maintain state to the app and to get command info
> > > from the
> > > > > app. Keeps things wrapped up properly, and you get a protection
> > > > > fault if you piss outside the urinol.
> > > > >
> > > > > Alberto.
> > > > >
> > > > >
> > > > > On 27 Mar 2002, at 7:31, Asher Hoodin wrote:
> > > > >
> > > > > > Actually,
> > > > > >
> > > > > > > with a user mode program via IOCTLs. One IOCTL wants
> > > to make a
> > > > user-mode
> > > > > > > address mapping of this physical memory.
> > > > > >
> > > > > > You don’t. You pend an Irp that returns data as soon as it
> > > > is available
> > > > in
> > > > > > the outbuffer of your DeviceIoControl. You are not supposed
> > > > to directly
> > > > > > access kernal mode memory from an application…or to
> > > map a user
> > > > > > mode address to the device driver. At least that is
> > > what you will
> > > > > > find NT
> > > > Driver
> > > > > > guys prefer you to do. This is a DOS like usage of
> > > memory, that
> > > > > > has
> > > > been
> > > > > > going on for ages (UNIX too) but is somehow banned in NT.
> > > > Actually OSR
> > > > has
> > > > > > a page on their web site that talks about the actual code to do
> > > > > > this. Sharing Memory Between Drivers and Applications
> > > is the name
> > > > > > of the
> > > > Article,
> > > > > > I dont have the actual addr.
> > > > > >
> > > > > > FWIW,
> > > > > >
> > > > > > Asher
> > > > > >
> > > > > > ----- Original Message -----
> > > > > > From: “Joe Moriarty”
> > > > > > To: “NT Developers Interest List”
> > > > > > Sent: Tuesday, March 26, 2002 9:29 AM
> > > > > > Subject: [ntdev] Map kernel memory to user-mode
> > > > > >
> > > > > >
> > > > > > > I have a kernel virtual address (which actually points to a
> > > > > > > block of contiguous physical memory). I have a top
> > > level driver
> > > > > > > which
> > > > communicates
> > > > > > > with a user mode program via IOCTLs. One IOCTL wants
> > > to make a
> > > > user-mode
> > > > > > > address mapping of this physical memory. How do you do this?
> > > > > > >
> > > > > > > Thanks In Advance,
> > > > > > > Joe
> > > > > > >
> > > > > > >
> > > > > > > —
> > > > > > > You are currently subscribed to ntdev as:
> > > xxxxx@aam-ch.com To
> > > > > > > unsubscribe send a blank email to %%email.unsub%%
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > —
> > > > > > You are currently subscribed to ntdev as: xxxxx@ieee.org To
> > > > > > unsubscribe send a blank email to %%email.unsub%%
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as: xxxxx@aam-ch.com To
> > > > > unsubscribe send a blank email to %%email.unsub%%
> > > > >
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@nfr.com
> > > > To unsubscribe send a blank email to %%email.unsub%%
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
> > > xxxxx@stratus.com To unsubscribe send a blank email to
> > > %%email.unsub%%
> > >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@ieee.org
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
>
>
> My GOD I had NO idea that JAVA was as screwed up as BASIC!!!
Java is a very bad language.
It’s runtime libraries were first designed in a poor way. Later JDK releases from Sun fixed this, but without maintaining the
backward compatibility with JDK 1.0. On the other hand, MS maintains the backward source-level compatibility down to Windows 3.0
(in some respects).
Grabbing a mutex (“synchronized” keyword) for each string addition is really a great idea
very scalable.
Or let’s take the garbage collector. Sun’s garbage collector was too puny in terms of performance. MS optimized it to use another
much faster algorithm in MS’s Java VM, but… at the cost of being incompatible in writing native methods with Sun VM.
The C code of native methods for Sun VM did not know anything on garbage collector.
MS VM required the native method’s C code to explicitly call some garbage-collector-related functions to lock and unlock the object
or such. (source: MSDN Library dated 1997 or about this).
This ended with a well-known lawsuit. :-))) regardless of the fact MS produced the best Java development IDE in the world (Sun’s one
is just puny, and even NetDynamics IDE was MSVC4 clone - in the days MS had MSVC6) and the best compiler for Java.
Poor quality of memory management in Java VMs required Linux guys to rewrite their virtual memory system to maintain JVMs better 
See Linux source comments.
The practical fact of 1997-98 years:
- the web app written in server-side Java using NetDynamics IDE required 128MB of RAM and was very much slow and unstable, often
requiring the machine reboot.
- the same app rewritten in ASP worked fine on 48MB server, very fast and very reliable.
Java was first positioned for applets in web pages. Some “smart minds” even invented the dead-born idea of “network computer”. This
failed, mainly due to incompatibilities in VMs in different browsers. For now, applets are rare, while client-side scripting is
ubiquitous.
Then Java was positioned for PDAs, this for sure failed miserably due to PDA’s code size and execution speed constraints. Neither
PalmOS nor Windows CE are Java-based.
Java succeeded only for server-side business logic with EJB.
I think Java is widely used only due to portability, not due to language being good. I can ask more practical facts from my friend
who runs a company which develops e-commerce WWW software on EJB, on COM+ and on .NET.
Max
There are lots of good reasons to do this, but every time I’m asked the “how to” question,
and I dig into why, the answer is always brain-dead. For example, a recent answer was
“I want to avoid the data copy of 64K that occurs every 30 seconds
on my P4 (with a copy rate of about 1.2 GB/sec.)”
One of my early experiences was with /dev/kmem on Unix, which “ps”, etc. used
instead of having an API. The result was you were unable to change any kernel
data structures.
-DH
“Joe Moriarty” wrote in message news:xxxxx@ntdev…
>
> I have a kernel virtual address (which actually points to a block of
> contiguous physical memory). I have a top level driver which communicates
> with a user mode program via IOCTLs. One IOCTL wants to make a user-mode
> address mapping of this physical memory. How do you do this?
>
> Thanks In Advance,
> Joe
>
>
>
> One of my early experiences was with /dev/kmem on Unix, which
“ps”, etc. used
instead of having an API.
/dev/kmem is really a great stupidity of ancient BSD-style UNIXen like SunOS 4.1.3. It also required the kernel to always carry
the debug symbols with it. Stripping the kernel off the symbols lead to “ps” being unable to work.
Any modern UNIX uses /proc filesystem for this purpose.
Max