Chapter
5
I
Device Drivers
Device
Headers
A
Device Header
is
required
at
the beginning of a device driver
and looks like this:
WORD Pointer to next Device Header
(Must be set to
-1)
WORD Attributes
Bit
15
=
0
if block device
Bit
15
=
1
if character device
If bit
15
is
1:
Bit
0
=
1
if current
sti
device
Bit
1
=
1
if
current sto device
Bit
2
=
1
if current
NUL
device
Bit
3
=
1
if current CLOCK device
Bit
4
=
1
if special
Bit
5-12
Reserved; must be set to
0
Bit
14
is
the IOCTL bit
Bit
13
is the
NON
IBM FORMAT bit
WORD
WORD
Pointer to device strategy entry point
Pointer to device interrupt entry point
3
BYTES Character device name field. Character devices
set
a
device name. For block devices the
first
byte
is the number of units.
Vote that the device entry points are words. They must be offsets
from
the
same segment number used to point to
this
table. For
example, if XXX:YYY points to the
start
of this table, then
XXX:strategy and XXX:interrupt are the entry points.
Pointer
To
Next Device Header Field
The pointer to the next Device Header field
is
a
double word field
(offset followed by segment) that
is
set by MS-DOS to point
at
the next driver in the system list at the time the device driver
is
loaded.
It
is
important that this field be set to
-1
prior to load
(when
it
is on the disk as
a
file) unless there is more than one
device driver in the file.
If
there is more than one driver in the
file, the
first
word of the double word pointer should be the offset
of the next driver’s Device Header.
174