Hello,
-----Message d'origine-----
De : ros-dev-bounces(a)reactos.org
[mailto:ros-dev-bounces@reactos.org] De la part de Rick Parrish
Envoyé : vendredi 25 août 2006 07:13
À : ReactOS Development List
Objet : [ros-dev] serial.sys
This email is directed mostly to Herve and anyone else familiar with
SERIAL.SYS and how it works.
Two years ago I implemented a small (5 kilobyte) WDM driver that
"wrapped" SERIAL.SYS. It's an ugly hack that (almost) works.
What I did
was "hook" the interrupt service routine by directly
modifying the IDT.
It works most of the time but occassionally I get BSOD (and I
don't know
why).
Yeah, that's a ugly hack which shouldn't exist!
The driver installed ISR reads the MSR (modem status
register) of the
UART. The RDTSC instruction is used to generate a timestamp
of when the
MSR changed. Both pieces of data are stored in a FIFO - on every
interrupt. A user mode program can later retrieve the information at
regular time intervals.
So, basically, you need to know when MSR change, right?
What I'd like to do is merge the functionality
directly into
SERIAL.SYS
(eg. work with the OS instead of around it). The extra functionality
would be exposed through IOCTL or some other means but would
not break
ordinary serial COMM functionality.
I don't think adding some custom IOCTLs is the right thing to do.
http://www.wd-3.com/archive/SerialFilter.htm tells you how to monitor for
MSR changes.
Having this part done, adding a FIFO and getting the timestamp (please use
KeQueryTickCount() instead of reading RDTSC!) should be too hard.
Here are my questions:
1. how robust is the current SERIAL.SYS driver (I see a few
"FIXME"s in
the comments) ?
Current serial.sys is stable for reading from the serial port.
Writing works but is synchronous (ie never returns STATUS_PENDING and you
can't use overlapped I/O in Win32)
Flow handling is not implemented (XON/XOFF)
Stopping/removing a serial port when running the system is not implemented
yet
A few other things, which are probably not important, except one (according
to
http://www.wd-3.com/archive/SerialFilter.htm):
The WaitMask can be set with IOCTL_SERIAL_SET_WAIT_MASK, but
IOCTL_SERIAL_WAIT_ON_MASK is not implemented yet.
I can take a look at it if you want.
2. does ReactOS support or require code-signing of
drivers? (probably
not yet)
ReactOS neither support nor require code-signing for drivers.
3. Can I run the "Genuine" Reactos
SERIAL.SYS on "Genuine" Windows
2K/XP? I think so (setting WFP aside).
It has never been tested on Windows 2000/XP, but nothing should prevent it
from running, except some bugs/missing functionality of course ;)
I think that you have two possibilities:
1) First, try to create the filter driver and make it working on Windows.
Then, you might be interested to enhance ReactOS serial.sys to have your
driver also working on ReactOS.
2) Implement IOCTL_SERIAL_WAIT_ON_MASK in ReactOS and then, try to create
your driver on ReactOS. Once it works in ReactOS, make it work on Windows.
Regards,
Hervé