Mapping PCI registers for user app to use

Hi,

I am trying to map my PCI registers for use by a user application. I do
this by:

In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
(stored as VirtualAddress)
In IRP_MJ_CREATE, I do:
pDevExt->mdl = IoAllocateMdl( VirtualAddress, sizeof(ULONG)*307200,FALSE,
FALSE, NULL );
MmBuildMdlForNonPagedPool( pDevExt->mdl );

In an IOCTL call, I do:
MmMapLockedPages(pDevExt->mdl,UserMode) +
MmGetMdlBytesOffset(pDevExt->mdl)

In IRP_MJ_CLOSE, I do:
MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
IoFreeMdl(pDevExt->mdl)

The mdl is contained within my device extension and also virtualaddress is
in the device extension.
When I run my user application, with just opening and closing the handle
to my driver for the FIRST time, it is fine. But as soon as I run it
again, I get a BSOD with PAGE_FAULT.

Am I doing the above correctly?

I really appreciate any help I get.

Thanks!
Wynn

Sorry, I wrote something wrong in my original message. THe order in which
my user application calls the driver functions is actually:

CreateHandle
IOCTL
CloseHandle

Thanks,
Wynn

And just how do you expect to synchronize access to these PCI registers
between the user-mode app and any kind of kernel access? I will not even get
into cache line problems. I suppose you want to “read” data that was written
there in some kind of an asynchonous fashion with some kind of asynchonous
signalling mechanism. Forget interrupts. You have no access to any kernel
IRQL management functions such as spinlocks or the interrupt object which
means that any time you attempt to read data or write data to these
“registers” it is essentially unsynchronized and very possibly corrupt.

This is another example of DOS-think, and assuming that what one did in DOS
or that DOS-extender called 9x, you can do in NT and above. You can’t do it
that way without producing a highly unreliabel or snail slow system.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

wrote in message news:xxxxx@ntdev…
>
> Hi,
>
> I am trying to map my PCI registers for use by a user application. I do
> this by:
>
> In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> (stored as VirtualAddress)
> In IRP_MJ_CREATE, I do:
> pDevExt->mdl = IoAllocateMdl( VirtualAddress, sizeof(ULONG)*307200,FALSE,
> FALSE, NULL );
> MmBuildMdlForNonPagedPool( pDevExt->mdl );
>
> In an IOCTL call, I do:
> MmMapLockedPages(pDevExt->mdl,UserMode) +
> MmGetMdlBytesOffset(pDevExt->mdl)
>
> In IRP_MJ_CLOSE, I do:
> MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> IoFreeMdl(pDevExt->mdl)
>
> The mdl is contained within my device extension and also virtualaddress is
> in the device extension.
> When I run my user application, with just opening and closing the handle
> to my driver for the FIRST time, it is fine. But as soon as I run it
> again, I get a BSOD with PAGE_FAULT.
>
> Am I doing the above correctly?
>
> I really appreciate any help I get.
>
> Thanks!
> Wynn
>
>

Hi Gary,

I had thought about not having data synchronized and I was just trying to
get my data back fast, and I agree, this is definitely not the correct way
in doing this. I am still learning about Windows drivers and am a student
in my final year of study. Perhaps you or anyone else can help me out in
the proper way then (I will start a new post as well).

We have a PCI card that we program and there are about 307200 registers
that contain ULONG data that I need to read back to my user application -
I need to read this data FAST (about 30 times a second). The data
contains an image and I need to read it about 30 times a second. My
problem is when I try to read the data, it takes me about 1 second to read
all the registers once and pass it back to my user application. Can
anyone suggest a proper and better method and a fast method for
transferring this data? Will DMA improve the speed significantly? We are
relunctant to use DMA because programming it on the hardware would require
a lot more modifications.

Thanks,
Wynn

> transferring this data? Will DMA improve the speed significantly?

Surely yes, since it will do bursts.

OHCI1394 controller (my favourite sample of the smart realtime DMA
device with very low IRQ latency requirements) manages to pump the DV
traffic without any problems.

Max

The issue here isn’t “DOS think”, the issue here is the lack of a clean
synchronization mechanism to allow drivers to cleanly access PCI registers.
I consider this a glaring OS omission. And in a Pentium architecture, that’s
why we have segments, to create our own memory maps with protection enough !
For example, it should be simple enough to create a segment that maps a
memory mirror of the PCI I/O space (maintained by a driver) and give it
read-only permissions so that the application can see what’s going on in
real time and asynchronously. There’s a ton of sophisticated hardware in
that machine, hey, use it !

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Monday, March 31, 2003 8:23 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Mapping PCI registers for user app to use

And just how do you expect to synchronize access to these PCI registers
between the user-mode app and any kind of kernel access? I will not even get
into cache line problems. I suppose you want to “read” data that was written
there in some kind of an asynchonous fashion with some kind of asynchonous
signalling mechanism. Forget interrupts. You have no access to any kernel
IRQL management functions such as spinlocks or the interrupt object which
means that any time you attempt to read data or write data to these
“registers” it is essentially unsynchronized and very possibly corrupt.

This is another example of DOS-think, and assuming that what one did in DOS
or that DOS-extender called 9x, you can do in NT and above. You can’t do it
that way without producing a highly unreliabel or snail slow system.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

wrote in message news:xxxxx@ntdev…
>
> Hi,
>
> I am trying to map my PCI registers for use by a user application. I do
> this by:
>
> In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> (stored as VirtualAddress)
> In IRP_MJ_CREATE, I do:
> pDevExt->mdl = IoAllocateMdl( VirtualAddress, sizeof(ULONG)*307200,FALSE,
> FALSE, NULL );
> MmBuildMdlForNonPagedPool( pDevExt->mdl );
>
> In an IOCTL call, I do:
> MmMapLockedPages(pDevExt->mdl,UserMode) +
> MmGetMdlBytesOffset(pDevExt->mdl)
>
> In IRP_MJ_CLOSE, I do:
> MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> IoFreeMdl(pDevExt->mdl)
>
> The mdl is contained within my device extension and also virtualaddress is
> in the device extension.
> When I run my user application, with just opening and closing the handle
> to my driver for the FIRST time, it is fine. But as soon as I run it
> again, I get a BSOD with PAGE_FAULT.
>
> Am I doing the above correctly?
>
> I really appreciate any help I get.
>
> Thanks!
> Wynn
>
>


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

NO Alberto, it is DOS-think … it is single threaded, single processing
thinking … it is “Well I could do it that way in DOS!” or “DOS never had
that problem!” Here you go again preaching about what SHOULD be but isn’t
and probably won’t be until you relase your own OS and the rest of us can
then poke fun at how you did it. :slight_smile:

Either in this thread or another one, I think Walter stated it fairly
clearly that DSO-think is not ncessarily bad. If this is a proprietary
system that will never ever see the inside of a Comp-USA, then go ahead and
use shared memory or ports in the users app, and do what ever is necessary
to make it work with the realization that a lot of other things may quit
working and you may have to do it all over again with the next release of
Windows or SP. But please don’t sell it to the public.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> The issue here isn’t “DOS think”, the issue here is the lack of a clean
> synchronization mechanism to allow drivers to cleanly access PCI
registers.
> I consider this a glaring OS omission. And in a Pentium architecture,
that’s
> why we have segments, to create our own memory maps with protection enough
!
> For example, it should be simple enough to create a segment that maps a
> memory mirror of the PCI I/O space (maintained by a driver) and give it
> read-only permissions so that the application can see what’s going on in
> real time and asynchronously. There’s a ton of sophisticated hardware in
> that machine, hey, use it !
>
>
> Alberto.
>
>
>
>
> -----Original Message-----
> From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> Sent: Monday, March 31, 2003 8:23 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> And just how do you expect to synchronize access to these PCI registers
> between the user-mode app and any kind of kernel access? I will not even
get
> into cache line problems. I suppose you want to “read” data that was
written
> there in some kind of an asynchonous fashion with some kind of asynchonous
> signalling mechanism. Forget interrupts. You have no access to any kernel
> IRQL management functions such as spinlocks or the interrupt object which
> means that any time you attempt to read data or write data to these
> “registers” it is essentially unsynchronized and very possibly corrupt.
>
> This is another example of DOS-think, and assuming that what one did in
DOS
> or that DOS-extender called 9x, you can do in NT and above. You can’t do
it
> that way without producing a highly unreliabel or snail slow system.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> wrote in message news:xxxxx@ntdev…
> >
> > Hi,
> >
> > I am trying to map my PCI registers for use by a user application. I do
> > this by:
> >
> > In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> > (stored as VirtualAddress)
> > In IRP_MJ_CREATE, I do:
> > pDevExt->mdl = IoAllocateMdl( VirtualAddress,
sizeof(ULONG)*307200,FALSE,
> > FALSE, NULL );
> > MmBuildMdlForNonPagedPool( pDevExt->mdl );
> >
> > In an IOCTL call, I do:
> > MmMapLockedPages(pDevExt->mdl,UserMode) +
> > MmGetMdlBytesOffset(pDevExt->mdl)
> >
> > In IRP_MJ_CLOSE, I do:
> > MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> > IoFreeMdl(pDevExt->mdl)
> >
> > The mdl is contained within my device extension and also virtualaddress
is
> > in the device extension.
> > When I run my user application, with just opening and closing the handle
> > to my driver for the FIRST time, it is fine. But as soon as I run it
> > again, I get a BSOD with PAGE_FAULT.
> >
> > Am I doing the above correctly?
> >
> > I really appreciate any help I get.
> >
> > Thanks!
> > Wynn
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>

Gary, it’s called a “spinlock”. It was invented well before either MSDOS or
Windows existed. In the hardware, it’s called a “test and set” or “compare
and replace” instruction: back in the late sixties when I was a rookie,
machines already had such instructions and SMPs were implemented on top of
them, my very first industrial-strength system was the Univac 1108 and it
had up to three shared memory processors. In fact, if you want an efficient
use of spinlocks, take a peek at http://lxr.linux.no and see for yourself !

Point being, the need to do multiprocessor synchronization doesn’t mean that
an application cannot or should not have access to I/O registers - it just
means that the access must be synchronized, and that such synchronization
should be exposed. Methinks the OS should expose that spinlock to the
public, so that if we need to access PCI registers, we can do it without
risking to leave the hardware in an inconsistent state.

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@aerosurf.net]
Sent: Tuesday, April 01, 2003 5:50 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Mapping PCI registers for user app to use

NO Alberto, it is DOS-think … it is single threaded, single processing
thinking … it is “Well I could do it that way in DOS!” or “DOS never had
that problem!” Here you go again preaching about what SHOULD be but isn’t
and probably won’t be until you relase your own OS and the rest of us can
then poke fun at how you did it. :slight_smile:

Either in this thread or another one, I think Walter stated it fairly
clearly that DSO-think is not ncessarily bad. If this is a proprietary
system that will never ever see the inside of a Comp-USA, then go ahead and
use shared memory or ports in the users app, and do what ever is necessary
to make it work with the realization that a lot of other things may quit
working and you may have to do it all over again with the next release of
Windows or SP. But please don’t sell it to the public.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> The issue here isn’t “DOS think”, the issue here is the lack of a clean
> synchronization mechanism to allow drivers to cleanly access PCI
registers.
> I consider this a glaring OS omission. And in a Pentium architecture,
that’s
> why we have segments, to create our own memory maps with protection enough
!
> For example, it should be simple enough to create a segment that maps a
> memory mirror of the PCI I/O space (maintained by a driver) and give it
> read-only permissions so that the application can see what’s going on in
> real time and asynchronously. There’s a ton of sophisticated hardware in
> that machine, hey, use it !
>
>
> Alberto.
>
>
>
>
> -----Original Message-----
> From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> Sent: Monday, March 31, 2003 8:23 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> And just how do you expect to synchronize access to these PCI registers
> between the user-mode app and any kind of kernel access? I will not even
get
> into cache line problems. I suppose you want to “read” data that was
written
> there in some kind of an asynchonous fashion with some kind of asynchonous
> signalling mechanism. Forget interrupts. You have no access to any kernel
> IRQL management functions such as spinlocks or the interrupt object which
> means that any time you attempt to read data or write data to these
> “registers” it is essentially unsynchronized and very possibly corrupt.
>
> This is another example of DOS-think, and assuming that what one did in
DOS
> or that DOS-extender called 9x, you can do in NT and above. You can’t do
it
> that way without producing a highly unreliabel or snail slow system.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> wrote in message news:xxxxx@ntdev…
> >
> > Hi,
> >
> > I am trying to map my PCI registers for use by a user application. I do
> > this by:
> >
> > In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> > (stored as VirtualAddress)
> > In IRP_MJ_CREATE, I do:
> > pDevExt->mdl = IoAllocateMdl( VirtualAddress,
sizeof(ULONG)*307200,FALSE,
> > FALSE, NULL );
> > MmBuildMdlForNonPagedPool( pDevExt->mdl );
> >
> > In an IOCTL call, I do:
> > MmMapLockedPages(pDevExt->mdl,UserMode) +
> > MmGetMdlBytesOffset(pDevExt->mdl)
> >
> > In IRP_MJ_CLOSE, I do:
> > MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> > IoFreeMdl(pDevExt->mdl)
> >
> > The mdl is contained within my device extension and also virtualaddress
is
> > in the device extension.
> > When I run my user application, with just opening and closing the handle
> > to my driver for the FIRST time, it is fine. But as soon as I run it
> > again, I get a BSOD with PAGE_FAULT.
> >
> > Am I doing the above correctly?
> >
> > I really appreciate any help I get.
> >
> > Thanks!
> > Wynn
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

Alberto, don’t you know yet that Microsoft and Bill Gates are the god of
computers and we must beg for anything we get? I realize maintaining
stability is their justification, but we can’t just call the HAL guy(s) and
get a new interface anytime we want to query or do something that wasn’t
exported. That is probably why Linux is becoming so popular and even IBM &
Sperry (I worked on the 1100/60/90 during the 1980’s) provided a lot of
source code for the OS, so if you needed to do something that wasn’t
possible with the code as written, you could modify the OS to provide the
service(s) you needed. Maybe if PC cost a few hundred thousand dollars was
could get this capability.

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Tuesday, April 01, 2003 6:15 PM
Subject: [ntdev] Re: Mapping PCI registers for user app to use

> Gary, it’s called a “spinlock”. It was invented well before either MSDOS
or
> Windows existed. In the hardware, it’s called a “test and set” or “compare
> and replace” instruction: back in the late sixties when I was a rookie,
> machines already had such instructions and SMPs were implemented on top of
> them, my very first industrial-strength system was the Univac 1108 and it
> had up to three shared memory processors. In fact, if you want an
efficient
> use of spinlocks, take a peek at http://lxr.linux.no and see for yourself
!
>
> Point being, the need to do multiprocessor synchronization doesn’t mean
that
> an application cannot or should not have access to I/O registers - it just
> means that the access must be synchronized, and that such synchronization
> should be exposed. Methinks the OS should expose that spinlock to the
> public, so that if we need to access PCI registers, we can do it without
> risking to leave the hardware in an inconsistent state.
>
> Alberto.
>
>
>
>
> -----Original Message-----
> From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> Sent: Tuesday, April 01, 2003 5:50 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> NO Alberto, it is DOS-think … it is single threaded, single processing
> thinking … it is “Well I could do it that way in DOS!” or “DOS never
had
> that problem!” Here you go again preaching about what SHOULD be but isn’t
> and probably won’t be until you relase your own OS and the rest of us can
> then poke fun at how you did it. :slight_smile:
>
> Either in this thread or another one, I think Walter stated it fairly
> clearly that DSO-think is not ncessarily bad. If this is a proprietary
> system that will never ever see the inside of a Comp-USA, then go ahead
and
> use shared memory or ports in the users app, and do what ever is necessary
> to make it work with the realization that a lot of other things may quit
> working and you may have to do it all over again with the next release of
> Windows or SP. But please don’t sell it to the public.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
> >
> > The issue here isn’t “DOS think”, the issue here is the lack of a clean
> > synchronization mechanism to allow drivers to cleanly access PCI
> registers.
> > I consider this a glaring OS omission. And in a Pentium architecture,
> that’s
> > why we have segments, to create our own memory maps with protection
enough
> !
> > For example, it should be simple enough to create a segment that maps a
> > memory mirror of the PCI I/O space (maintained by a driver) and give it
> > read-only permissions so that the application can see what’s going on in
> > real time and asynchronously. There’s a ton of sophisticated hardware in
> > that machine, hey, use it !
> >
> >
> > Alberto.
> >
> >
> >
> >
> > -----Original Message-----
> > From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> > Sent: Monday, March 31, 2003 8:23 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Mapping PCI registers for user app to use
> >
> >
> > And just how do you expect to synchronize access to these PCI registers
> > between the user-mode app and any kind of kernel access? I will not even
> get
> > into cache line problems. I suppose you want to “read” data that was
> written
> > there in some kind of an asynchonous fashion with some kind of
asynchonous
> > signalling mechanism. Forget interrupts. You have no access to any
kernel
> > IRQL management functions such as spinlocks or the interrupt object
which
> > means that any time you attempt to read data or write data to these
> > “registers” it is essentially unsynchronized and very possibly corrupt.
> >
> > This is another example of DOS-think, and assuming that what one did in
> DOS
> > or that DOS-extender called 9x, you can do in NT and above. You can’t do
> it
> > that way without producing a highly unreliabel or snail slow system.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> > http://www.wd-3.com
> >
> > wrote in message news:xxxxx@ntdev…
> > >
> > > Hi,
> > >
> > > I am trying to map my PCI registers for use by a user application. I
do
> > > this by:
> > >
> > > In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> > > (stored as VirtualAddress)
> > > In IRP_MJ_CREATE, I do:
> > > pDevExt->mdl = IoAllocateMdl( VirtualAddress,
> sizeof(ULONG)*307200,FALSE,
> > > FALSE, NULL );
> > > MmBuildMdlForNonPagedPool( pDevExt->mdl );
> > >
> > > In an IOCTL call, I do:
> > > MmMapLockedPages(pDevExt->mdl,UserMode) +
> > > MmGetMdlBytesOffset(pDevExt->mdl)
> > >
> > > In IRP_MJ_CLOSE, I do:
> > > MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> > > IoFreeMdl(pDevExt->mdl)
> > >
> > > The mdl is contained within my device extension and also
virtualaddress
> is
> > > in the device extension.
> > > When I run my user application, with just opening and closing the
handle
> > > to my driver for the FIRST time, it is fine. But as soon as I run it
> > > again, I get a BSOD with PAGE_FAULT.
> > >
> > > Am I doing the above correctly?
> > >
> > > I really appreciate any help I get.
> > >
> > > Thanks!
> > > Wynn
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Ahhh us old farts … we love the smell of burning core in the morning.


Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“David J. Craig” wrote in message
news:xxxxx@ntdev…
>
> Alberto, don’t you know yet that Microsoft and Bill Gates are the god of
> computers and we must beg for anything we get? I realize maintaining
> stability is their justification, but we can’t just call the HAL guy(s)
and
> get a new interface anytime we want to query or do something that wasn’t
> exported. That is probably why Linux is becoming so popular and even IBM
&
> Sperry (I worked on the 1100/60/90 during the 1980’s) provided a lot of
> source code for the OS, so if you needed to do something that wasn’t
> possible with the code as written, you could modify the OS to provide the
> service(s) you needed. Maybe if PC cost a few hundred thousand dollars
was
> could get this capability.
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “NT Developers Interest List”
> Sent: Tuesday, April 01, 2003 6:15 PM
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> > Gary, it’s called a “spinlock”. It was invented well before either MSDOS
> or
> > Windows existed. In the hardware, it’s called a “test and set” or
“compare
> > and replace” instruction: back in the late sixties when I was a rookie,
> > machines already had such instructions and SMPs were implemented on top
of
> > them, my very first industrial-strength system was the Univac 1108 and
it
> > had up to three shared memory processors. In fact, if you want an
> efficient
> > use of spinlocks, take a peek at http://lxr.linux.no and see for
yourself
> !
> >
> > Point being, the need to do multiprocessor synchronization doesn’t mean
> that
> > an application cannot or should not have access to I/O registers - it
just
> > means that the access must be synchronized, and that such
synchronization
> > should be exposed. Methinks the OS should expose that spinlock to the
> > public, so that if we need to access PCI registers, we can do it without
> > risking to leave the hardware in an inconsistent state.
> >
> > Alberto.
> >
> >
> >
> >
> > -----Original Message-----
> > From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> > Sent: Tuesday, April 01, 2003 5:50 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Mapping PCI registers for user app to use
> >
> >
> > NO Alberto, it is DOS-think … it is single threaded, single processing
> > thinking … it is “Well I could do it that way in DOS!” or “DOS never
> had
> > that problem!” Here you go again preaching about what SHOULD be but
isn’t
> > and probably won’t be until you relase your own OS and the rest of us
can
> > then poke fun at how you did it. :slight_smile:
> >
> > Either in this thread or another one, I think Walter stated it fairly
> > clearly that DSO-think is not ncessarily bad. If this is a proprietary
> > system that will never ever see the inside of a Comp-USA, then go ahead
> and
> > use shared memory or ports in the users app, and do what ever is
necessary
> > to make it work with the realization that a lot of other things may quit
> > working and you may have to do it all over again with the next release
of
> > Windows or SP. But please don’t sell it to the public.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> > http://www.wd-3.com
> >
> > “Moreira, Alberto” wrote in message
> > news:xxxxx@ntdev…
> > >
> > > The issue here isn’t “DOS think”, the issue here is the lack of a
clean
> > > synchronization mechanism to allow drivers to cleanly access PCI
> > registers.
> > > I consider this a glaring OS omission. And in a Pentium architecture,
> > that’s
> > > why we have segments, to create our own memory maps with protection
> enough
> > !
> > > For example, it should be simple enough to create a segment that maps
a
> > > memory mirror of the PCI I/O space (maintained by a driver) and give
it
> > > read-only permissions so that the application can see what’s going on
in
> > > real time and asynchronously. There’s a ton of sophisticated hardware
in
> > > that machine, hey, use it !
> > >
> > >
> > > Alberto.
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> > > Sent: Monday, March 31, 2003 8:23 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Mapping PCI registers for user app to use
> > >
> > >
> > > And just how do you expect to synchronize access to these PCI
registers
> > > between the user-mode app and any kind of kernel access? I will not
even
> > get
> > > into cache line problems. I suppose you want to “read” data that was
> > written
> > > there in some kind of an asynchonous fashion with some kind of
> asynchonous
> > > signalling mechanism. Forget interrupts. You have no access to any
> kernel
> > > IRQL management functions such as spinlocks or the interrupt object
> which
> > > means that any time you attempt to read data or write data to these
> > > “registers” it is essentially unsynchronized and very possibly
corrupt.
> > >
> > > This is another example of DOS-think, and assuming that what one did
in
> > DOS
> > > or that DOS-extender called 9x, you can do in NT and above. You can’t
do
> > it
> > > that way without producing a highly unreliabel or snail slow system.
> > >
> > > –
> > > Gary G. Little
> > > Have Computer, Will Travel …
> > > 909-698-3191
> > > 909-551-2105
> > > http://www.wd-3.com
> > >
> > > wrote in message news:xxxxx@ntdev…
> > > >
> > > > Hi,
> > > >
> > > > I am trying to map my PCI registers for use by a user application.
I
> do
> > > > this by:
> > > >
> > > > In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> > > > (stored as VirtualAddress)
> > > > In IRP_MJ_CREATE, I do:
> > > > pDevExt->mdl = IoAllocateMdl( VirtualAddress,
> > sizeof(ULONG)*307200,FALSE,
> > > > FALSE, NULL );
> > > > MmBuildMdlForNonPagedPool( pDevExt->mdl );
> > > >
> > > > In an IOCTL call, I do:
> > > > MmMapLockedPages(pDevExt->mdl,UserMode) +
> > > > MmGetMdlBytesOffset(pDevExt->mdl)
> > > >
> > > > In IRP_MJ_CLOSE, I do:
> > > > MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> > > > IoFreeMdl(pDevExt->mdl)
> > > >
> > > > The mdl is contained within my device extension and also
> virtualaddress
> > is
> > > > in the device extension.
> > > > When I run my user application, with just opening and closing the
> handle
> > > > to my driver for the FIRST time, it is fine. But as soon as I run
it
> > > > again, I get a BSOD with PAGE_FAULT.
> > > >
> > > > Am I doing the above correctly?
> > > >
> > > > I really appreciate any help I get.
> > > >
> > > > Thanks!
> > > > Wynn
> > > >
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
xxxxx@compuware.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > > The contents of this e-mail are intended for the named addressee only.
> It
> > > contains information that may be confidential. Unless you are the
named
> > > addressee or an authorized designee, you may not copy or use it, or
> > disclose
> > > it to anyone else. If you received it in error please notify us
> > immediately
> > > and then destroy it.
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>

Hark … I heareth the invocation of the Demon Gates …

:slight_smile:

Gary G. Little
Have Computer, Will Travel …
909-698-3191
909-551-2105
http://www.wd-3.com

“Moreira, Alberto” wrote in message
news:xxxxx@ntdev…
>
> Gary, it’s called a “spinlock”. It was invented well before either MSDOS
or
> Windows existed. In the hardware, it’s called a “test and set” or “compare
> and replace” instruction: back in the late sixties when I was a rookie,
> machines already had such instructions and SMPs were implemented on top of
> them, my very first industrial-strength system was the Univac 1108 and it
> had up to three shared memory processors. In fact, if you want an
efficient
> use of spinlocks, take a peek at http://lxr.linux.no and see for yourself
!
>
> Point being, the need to do multiprocessor synchronization doesn’t mean
that
> an application cannot or should not have access to I/O registers - it just
> means that the access must be synchronized, and that such synchronization
> should be exposed. Methinks the OS should expose that spinlock to the
> public, so that if we need to access PCI registers, we can do it without
> risking to leave the hardware in an inconsistent state.
>
> Alberto.
>
>
>
>
> -----Original Message-----
> From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> Sent: Tuesday, April 01, 2003 5:50 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> NO Alberto, it is DOS-think … it is single threaded, single processing
> thinking … it is “Well I could do it that way in DOS!” or “DOS never
had
> that problem!” Here you go again preaching about what SHOULD be but isn’t
> and probably won’t be until you relase your own OS and the rest of us can
> then poke fun at how you did it. :slight_smile:
>
> Either in this thread or another one, I think Walter stated it fairly
> clearly that DSO-think is not ncessarily bad. If this is a proprietary
> system that will never ever see the inside of a Comp-USA, then go ahead
and
> use shared memory or ports in the users app, and do what ever is necessary
> to make it work with the realization that a lot of other things may quit
> working and you may have to do it all over again with the next release of
> Windows or SP. But please don’t sell it to the public.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
> >
> > The issue here isn’t “DOS think”, the issue here is the lack of a clean
> > synchronization mechanism to allow drivers to cleanly access PCI
> registers.
> > I consider this a glaring OS omission. And in a Pentium architecture,
> that’s
> > why we have segments, to create our own memory maps with protection
enough
> !
> > For example, it should be simple enough to create a segment that maps a
> > memory mirror of the PCI I/O space (maintained by a driver) and give it
> > read-only permissions so that the application can see what’s going on in
> > real time and asynchronously. There’s a ton of sophisticated hardware in
> > that machine, hey, use it !
> >
> >
> > Alberto.
> >
> >
> >
> >
> > -----Original Message-----
> > From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> > Sent: Monday, March 31, 2003 8:23 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Mapping PCI registers for user app to use
> >
> >
> > And just how do you expect to synchronize access to these PCI registers
> > between the user-mode app and any kind of kernel access? I will not even
> get
> > into cache line problems. I suppose you want to “read” data that was
> written
> > there in some kind of an asynchonous fashion with some kind of
asynchonous
> > signalling mechanism. Forget interrupts. You have no access to any
kernel
> > IRQL management functions such as spinlocks or the interrupt object
which
> > means that any time you attempt to read data or write data to these
> > “registers” it is essentially unsynchronized and very possibly corrupt.
> >
> > This is another example of DOS-think, and assuming that what one did in
> DOS
> > or that DOS-extender called 9x, you can do in NT and above. You can’t do
> it
> > that way without producing a highly unreliabel or snail slow system.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> > http://www.wd-3.com
> >
> > wrote in message news:xxxxx@ntdev…
> > >
> > > Hi,
> > >
> > > I am trying to map my PCI registers for use by a user application. I
do
> > > this by:
> > >
> > > In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> > > (stored as VirtualAddress)
> > > In IRP_MJ_CREATE, I do:
> > > pDevExt->mdl = IoAllocateMdl( VirtualAddress,
> sizeof(ULONG)*307200,FALSE,
> > > FALSE, NULL );
> > > MmBuildMdlForNonPagedPool( pDevExt->mdl );
> > >
> > > In an IOCTL call, I do:
> > > MmMapLockedPages(pDevExt->mdl,UserMode) +
> > > MmGetMdlBytesOffset(pDevExt->mdl)
> > >
> > > In IRP_MJ_CLOSE, I do:
> > > MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> > > IoFreeMdl(pDevExt->mdl)
> > >
> > > The mdl is contained within my device extension and also
virtualaddress
> is
> > > in the device extension.
> > > When I run my user application, with just opening and closing the
handle
> > > to my driver for the FIRST time, it is fine. But as soon as I run it
> > > again, I get a BSOD with PAGE_FAULT.
> > >
> > > Am I doing the above correctly?
> > >
> > > I really appreciate any help I get.
> > >
> > > Thanks!
> > > Wynn
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
>

Oh, no, another 1100 jock ! Wow, those were great times. Indeed Sperry
distributed the OS source code to many, that’s why there were so many local
extensions at customer sites to accomodate special requirements. Believe it
or not, I could once write 1100 machine code, and Exec 8 was all written in
assembler.

I first worked with 1100s in 1970, the 1108 was it, not even the 1106
existed yet. The OS was still called Exec 8, and was never able to call it
anything else ! But I was mostly a communications guy in those times, and I
worked with DCPs a lot more than I worked with the 1100 proper. During the
mid-to-late seventies and even early eighties there was a lot of debate at
Sperry about the role of I/O vis-a-vis the trusted component of the
operating system, and I came to adopt one of the viewpoints of that time,
which is, I/O does not belong in the trusted kernel.

Also, I became fond of interrupt-less machines after working with the DCP
and previously having dabbled a bit on the 494, so, even today, I believe
that interrupts are for peripheral processors and not for the CPU.

Incidentally, I would very much like to put my hands on a 494 System
Description, I wonder if there’s any of those still available anywhere in
the planet ?

Alberto.

-----Original Message-----
From: David J. Craig [mailto:xxxxx@yoshimuni.com]
Sent: Tuesday, April 01, 2003 6:49 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Mapping PCI registers for user app to use

Alberto, don’t you know yet that Microsoft and Bill Gates are the god of
computers and we must beg for anything we get? I realize maintaining
stability is their justification, but we can’t just call the HAL guy(s) and
get a new interface anytime we want to query or do something that wasn’t
exported. That is probably why Linux is becoming so popular and even IBM &
Sperry (I worked on the 1100/60/90 during the 1980’s) provided a lot of
source code for the OS, so if you needed to do something that wasn’t
possible with the code as written, you could modify the OS to provide the
service(s) you needed. Maybe if PC cost a few hundred thousand dollars was
could get this capability.

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Tuesday, April 01, 2003 6:15 PM
Subject: [ntdev] Re: Mapping PCI registers for user app to use

> Gary, it’s called a “spinlock”. It was invented well before either MSDOS
or
> Windows existed. In the hardware, it’s called a “test and set” or “compare
> and replace” instruction: back in the late sixties when I was a rookie,
> machines already had such instructions and SMPs were implemented on top of
> them, my very first industrial-strength system was the Univac 1108 and it
> had up to three shared memory processors. In fact, if you want an
efficient
> use of spinlocks, take a peek at http://lxr.linux.no and see for yourself
!
>
> Point being, the need to do multiprocessor synchronization doesn’t mean
that
> an application cannot or should not have access to I/O registers - it just
> means that the access must be synchronized, and that such synchronization
> should be exposed. Methinks the OS should expose that spinlock to the
> public, so that if we need to access PCI registers, we can do it without
> risking to leave the hardware in an inconsistent state.
>
> Alberto.
>
>
>
>
> -----Original Message-----
> From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> Sent: Tuesday, April 01, 2003 5:50 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> NO Alberto, it is DOS-think … it is single threaded, single processing
> thinking … it is “Well I could do it that way in DOS!” or “DOS never
had
> that problem!” Here you go again preaching about what SHOULD be but isn’t
> and probably won’t be until you relase your own OS and the rest of us can
> then poke fun at how you did it. :slight_smile:
>
> Either in this thread or another one, I think Walter stated it fairly
> clearly that DSO-think is not ncessarily bad. If this is a proprietary
> system that will never ever see the inside of a Comp-USA, then go ahead
and
> use shared memory or ports in the users app, and do what ever is necessary
> to make it work with the realization that a lot of other things may quit
> working and you may have to do it all over again with the next release of
> Windows or SP. But please don’t sell it to the public.
>
> –
> Gary G. Little
> Have Computer, Will Travel …
> 909-698-3191
> 909-551-2105
> http://www.wd-3.com
>
> “Moreira, Alberto” wrote in message
> news:xxxxx@ntdev…
> >
> > The issue here isn’t “DOS think”, the issue here is the lack of a clean
> > synchronization mechanism to allow drivers to cleanly access PCI
> registers.
> > I consider this a glaring OS omission. And in a Pentium architecture,
> that’s
> > why we have segments, to create our own memory maps with protection
enough
> !
> > For example, it should be simple enough to create a segment that maps a
> > memory mirror of the PCI I/O space (maintained by a driver) and give it
> > read-only permissions so that the application can see what’s going on in
> > real time and asynchronously. There’s a ton of sophisticated hardware in
> > that machine, hey, use it !
> >
> >
> > Alberto.
> >
> >
> >
> >
> > -----Original Message-----
> > From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> > Sent: Monday, March 31, 2003 8:23 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Mapping PCI registers for user app to use
> >
> >
> > And just how do you expect to synchronize access to these PCI registers
> > between the user-mode app and any kind of kernel access? I will not even
> get
> > into cache line problems. I suppose you want to “read” data that was
> written
> > there in some kind of an asynchonous fashion with some kind of
asynchonous
> > signalling mechanism. Forget interrupts. You have no access to any
kernel
> > IRQL management functions such as spinlocks or the interrupt object
which
> > means that any time you attempt to read data or write data to these
> > “registers” it is essentially unsynchronized and very possibly corrupt.
> >
> > This is another example of DOS-think, and assuming that what one did in
> DOS
> > or that DOS-extender called 9x, you can do in NT and above. You can’t do
> it
> > that way without producing a highly unreliabel or snail slow system.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> > http://www.wd-3.com
> >
> > wrote in message news:xxxxx@ntdev…
> > >
> > > Hi,
> > >
> > > I am trying to map my PCI registers for use by a user application. I
do
> > > this by:
> > >
> > > In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> > > (stored as VirtualAddress)
> > > In IRP_MJ_CREATE, I do:
> > > pDevExt->mdl = IoAllocateMdl( VirtualAddress,
> sizeof(ULONG)*307200,FALSE,
> > > FALSE, NULL );
> > > MmBuildMdlForNonPagedPool( pDevExt->mdl );
> > >
> > > In an IOCTL call, I do:
> > > MmMapLockedPages(pDevExt->mdl,UserMode) +
> > > MmGetMdlBytesOffset(pDevExt->mdl)
> > >
> > > In IRP_MJ_CLOSE, I do:
> > > MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> > > IoFreeMdl(pDevExt->mdl)
> > >
> > > The mdl is contained within my device extension and also
virtualaddress
> is
> > > in the device extension.
> > > When I run my user application, with just opening and closing the
handle
> > > to my driver for the FIRST time, it is fine. But as soon as I run it
> > > again, I get a BSOD with PAGE_FAULT.
> > >
> > > Am I doing the above correctly?
> > >
> > > I really appreciate any help I get.
> > >
> > > Thanks!
> > > Wynn
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


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

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it.

They did have the interprocessor interrupt because if you had a 3 or 4 CPU
system, some of the IO devices were not available to every CPU. Each pair
of CPUs shared the IO controllers under them, but had to do a interprocessor
interrupt to send a IO request to an IO controller belonging to the other
pair. I haven’t see any of the Sperry docs for years, but the Air Force is
still using them for supply & base level mainframe system processing. I
know the system I used to work on has been put on Unix systems independent
of the mainframes. Since the system is for the aircrews, they had the
priority to get themselves their own systems interconnected within the
various bases and some connection up to their Major Air Command HQ and HQ
USAF. I am not sure if they still track sonic booms with that system, but
probably they still do.

----- Original Message -----
From: “Moreira, Alberto”
To: “NT Developers Interest List”
Sent: Wednesday, April 02, 2003 10:14 AM
Subject: [ntdev] Re: Mapping PCI registers for user app to use

> Oh, no, another 1100 jock ! Wow, those were great times. Indeed Sperry
> distributed the OS source code to many, that’s why there were so many
local
> extensions at customer sites to accomodate special requirements. Believe
it
> or not, I could once write 1100 machine code, and Exec 8 was all written
in
> assembler.
>
> I first worked with 1100s in 1970, the 1108 was it, not even the 1106
> existed yet. The OS was still called Exec 8, and was never able to call it
> anything else ! But I was mostly a communications guy in those times, and
I
> worked with DCPs a lot more than I worked with the 1100 proper. During the
> mid-to-late seventies and even early eighties there was a lot of debate at
> Sperry about the role of I/O vis-a-vis the trusted component of the
> operating system, and I came to adopt one of the viewpoints of that time,
> which is, I/O does not belong in the trusted kernel.
>
> Also, I became fond of interrupt-less machines after working with the DCP
> and previously having dabbled a bit on the 494, so, even today, I believe
> that interrupts are for peripheral processors and not for the CPU.
>
> Incidentally, I would very much like to put my hands on a 494 System
> Description, I wonder if there’s any of those still available anywhere in
> the planet ?
>
>
> Alberto.
>
>
>
> -----Original Message-----
> From: David J. Craig [mailto:xxxxx@yoshimuni.com]
> Sent: Tuesday, April 01, 2003 6:49 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> Alberto, don’t you know yet that Microsoft and Bill Gates are the god of
> computers and we must beg for anything we get? I realize maintaining
> stability is their justification, but we can’t just call the HAL guy(s)
and
> get a new interface anytime we want to query or do something that wasn’t
> exported. That is probably why Linux is becoming so popular and even IBM
&
> Sperry (I worked on the 1100/60/90 during the 1980’s) provided a lot of
> source code for the OS, so if you needed to do something that wasn’t
> possible with the code as written, you could modify the OS to provide the
> service(s) you needed. Maybe if PC cost a few hundred thousand dollars
was
> could get this capability.
>
> ----- Original Message -----
> From: “Moreira, Alberto”
> To: “NT Developers Interest List”
> Sent: Tuesday, April 01, 2003 6:15 PM
> Subject: [ntdev] Re: Mapping PCI registers for user app to use
>
>
> > Gary, it’s called a “spinlock”. It was invented well before either MSDOS
> or
> > Windows existed. In the hardware, it’s called a “test and set” or
“compare
> > and replace” instruction: back in the late sixties when I was a rookie,
> > machines already had such instructions and SMPs were implemented on top
of
> > them, my very first industrial-strength system was the Univac 1108 and
it
> > had up to three shared memory processors. In fact, if you want an
> efficient
> > use of spinlocks, take a peek at http://lxr.linux.no and see for
yourself
> !
> >
> > Point being, the need to do multiprocessor synchronization doesn’t mean
> that
> > an application cannot or should not have access to I/O registers - it
just
> > means that the access must be synchronized, and that such
synchronization
> > should be exposed. Methinks the OS should expose that spinlock to the
> > public, so that if we need to access PCI registers, we can do it without
> > risking to leave the hardware in an inconsistent state.
> >
> > Alberto.
> >
> >
> >
> >
> > -----Original Message-----
> > From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> > Sent: Tuesday, April 01, 2003 5:50 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: Mapping PCI registers for user app to use
> >
> >
> > NO Alberto, it is DOS-think … it is single threaded, single processing
> > thinking … it is “Well I could do it that way in DOS!” or “DOS never
> had
> > that problem!” Here you go again preaching about what SHOULD be but
isn’t
> > and probably won’t be until you relase your own OS and the rest of us
can
> > then poke fun at how you did it. :slight_smile:
> >
> > Either in this thread or another one, I think Walter stated it fairly
> > clearly that DSO-think is not ncessarily bad. If this is a proprietary
> > system that will never ever see the inside of a Comp-USA, then go ahead
> and
> > use shared memory or ports in the users app, and do what ever is
necessary
> > to make it work with the realization that a lot of other things may quit
> > working and you may have to do it all over again with the next release
of
> > Windows or SP. But please don’t sell it to the public.
> >
> > –
> > Gary G. Little
> > Have Computer, Will Travel …
> > 909-698-3191
> > 909-551-2105
> > http://www.wd-3.com
> >
> > “Moreira, Alberto” wrote in message
> > news:xxxxx@ntdev…
> > >
> > > The issue here isn’t “DOS think”, the issue here is the lack of a
clean
> > > synchronization mechanism to allow drivers to cleanly access PCI
> > registers.
> > > I consider this a glaring OS omission. And in a Pentium architecture,
> > that’s
> > > why we have segments, to create our own memory maps with protection
> enough
> > !
> > > For example, it should be simple enough to create a segment that maps
a
> > > memory mirror of the PCI I/O space (maintained by a driver) and give
it
> > > read-only permissions so that the application can see what’s going on
in
> > > real time and asynchronously. There’s a ton of sophisticated hardware
in
> > > that machine, hey, use it !
> > >
> > >
> > > Alberto.
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Gary G. Little [mailto:xxxxx@aerosurf.net]
> > > Sent: Monday, March 31, 2003 8:23 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: Mapping PCI registers for user app to use
> > >
> > >
> > > And just how do you expect to synchronize access to these PCI
registers
> > > between the user-mode app and any kind of kernel access? I will not
even
> > get
> > > into cache line problems. I suppose you want to “read” data that was
> > written
> > > there in some kind of an asynchonous fashion with some kind of
> asynchonous
> > > signalling mechanism. Forget interrupts. You have no access to any
> kernel
> > > IRQL management functions such as spinlocks or the interrupt object
> which
> > > means that any time you attempt to read data or write data to these
> > > “registers” it is essentially unsynchronized and very possibly
corrupt.
> > >
> > > This is another example of DOS-think, and assuming that what one did
in
> > DOS
> > > or that DOS-extender called 9x, you can do in NT and above. You can’t
do
> > it
> > > that way without producing a highly unreliabel or snail slow system.
> > >
> > > –
> > > Gary G. Little
> > > Have Computer, Will Travel …
> > > 909-698-3191
> > > 909-551-2105
> > > http://www.wd-3.com
> > >
> > > wrote in message news:xxxxx@ntdev…
> > > >
> > > > Hi,
> > > >
> > > > I am trying to map my PCI registers for use by a user application.
I
> do
> > > > this by:
> > > >
> > > > In IRP_MJ_PNP, I call MmMapIoSpace to get a virtual address mapping
> > > > (stored as VirtualAddress)
> > > > In IRP_MJ_CREATE, I do:
> > > > pDevExt->mdl = IoAllocateMdl( VirtualAddress,
> > sizeof(ULONG)*307200,FALSE,
> > > > FALSE, NULL );
> > > > MmBuildMdlForNonPagedPool( pDevExt->mdl );
> > > >
> > > > In an IOCTL call, I do:
> > > > MmMapLockedPages(pDevExt->mdl,UserMode) +
> > > > MmGetMdlBytesOffset(pDevExt->mdl)
> > > >
> > > > In IRP_MJ_CLOSE, I do:
> > > > MmUnmapLockedPages(VIrtualAddress,pDevExt->mdl)
> > > > IoFreeMdl(pDevExt->mdl)
> > > >
> > > > The mdl is contained within my device extension and also
> virtualaddress
> > is
> > > > in the device extension.
> > > > When I run my user application, with just opening and closing the
> handle
> > > > to my driver for the FIRST time, it is fine. But as soon as I run
it
> > > > again, I get a BSOD with PAGE_FAULT.
> > > >
> > > > Am I doing the above correctly?
> > > >
> > > > I really appreciate any help I get.
> > > >
> > > > Thanks!
> > > > Wynn
> > > >
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as:
xxxxx@compuware.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> > >
> > >
> > > The contents of this e-mail are intended for the named addressee only.
> It
> > > contains information that may be confidential. Unless you are the
named
> > > addressee or an authorized designee, you may not copy or use it, or
> > disclose
> > > it to anyone else. If you received it in error please notify us
> > immediately
> > > and then destroy it.
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@compuware.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
It
> > contains information that may be confidential. Unless you are the named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compuware.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>