<s>
Device	B-Application
drivers	I-Application
are	O
programs	O
which	O
allow	O
software	O
or	O
higher-level	O
computer	B-Application
programs	I-Application
to	O
interact	O
with	O
a	O
hardware	B-Architecture
device	O
.	O
</s>
<s>
These	O
software	O
components	O
act	O
as	O
a	O
link	O
between	O
the	O
devices	O
and	O
the	O
operating	B-General_Concept
systems	I-General_Concept
,	O
communicating	O
with	O
each	O
of	O
these	O
systems	O
and	O
executing	O
commands	O
.	O
</s>
<s>
They	O
provide	O
an	O
abstraction	B-Architecture
layer	I-Architecture
for	O
the	O
software	O
above	O
and	O
also	O
mediate	O
the	O
communication	O
between	O
the	O
operating	B-General_Concept
system	I-General_Concept
kernel	O
and	O
the	O
devices	O
below	O
.	O
</s>
<s>
Usually	O
the	O
operating	B-General_Concept
systems	I-General_Concept
comes	O
with	O
a	O
support	O
for	O
the	O
common	O
device	B-Application
drivers	I-Application
and	O
usually	O
the	O
hardware	B-Architecture
vendors	O
provide	O
the	B-Application
device	I-Application
driver	I-Application
for	O
their	O
hardware	B-Architecture
devices	O
for	O
most	O
platforms	O
.	O
</s>
<s>
The	O
aggressive	O
scaling	O
of	O
the	O
hardware	B-Architecture
devices	O
and	O
the	O
complex	O
software	O
components	O
has	O
made	O
the	B-Application
device	I-Application
driver	I-Application
development	O
process	O
cumbersome	O
and	O
complex	O
.	O
</s>
<s>
When	O
the	O
size	O
and	O
functionality	O
of	O
the	O
drivers	O
started	O
increasing	O
the	O
device	B-Application
drivers	I-Application
became	O
a	O
key	O
factor	O
in	O
defining	O
the	O
reliability	O
of	O
the	O
system	O
.	O
</s>
<s>
This	O
has	O
created	O
an	O
incentive	O
towards	O
automatic	O
synthesis	O
and	O
verification	O
of	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
This	O
article	O
sheds	O
some	O
light	O
into	O
some	O
approaches	O
in	O
synthesis	O
and	O
verification	O
of	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
Device	B-Application
drivers	I-Application
are	O
the	O
principal	O
failing	O
component	O
in	O
most	O
systems	O
.	O
</s>
<s>
The	O
Berkeley	B-Operating_System
Open	I-Operating_System
Infrastructure	I-Operating_System
for	I-Operating_System
Network	I-Operating_System
Computing	I-Operating_System
(	O
BOINC	B-Operating_System
)	O
project	O
found	O
that	O
OS	O
crashes	O
are	O
predominantly	O
caused	O
by	O
poorly	O
written	O
device	B-Application
driver	I-Application
code	O
.	O
</s>
<s>
In	O
Windows	B-Application
XP	I-Application
,	O
drivers	O
account	O
for	O
85%	O
of	O
the	O
reported	O
failures	O
.	O
</s>
<s>
In	O
the	O
Linux	B-Application
kernel	O
2.4.1	O
device	B-Application
driver	I-Application
code	O
accounts	O
for	O
about	O
70%	O
of	O
the	O
code	O
size	O
.	O
</s>
<s>
These	O
findings	O
resulted	O
in	O
various	O
methodologies	O
and	O
techniques	O
for	O
verification	O
of	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
An	O
alternative	O
was	O
to	O
develop	O
techniques	O
which	O
can	O
synthesize	O
device	B-Application
drivers	I-Application
robustly	O
.	O
</s>
<s>
Less	O
human	O
interaction	O
in	O
the	O
development	O
process	O
and	O
proper	O
specification	B-Application
of	O
the	O
device	O
and	O
operating	B-General_Concept
systems	I-General_Concept
can	O
lead	O
to	O
more	O
reliable	O
drivers	O
.	O
</s>
<s>
The	O
other	O
motivation	O
for	O
driver	O
synthesis	O
,	O
is	O
the	O
large	O
number	O
of	O
flavors	O
of	O
operating	B-General_Concept
systems	I-General_Concept
and	O
device	O
combinations	O
.	O
</s>
<s>
Each	O
of	O
these	O
has	O
its	O
own	O
set	O
of	O
input/output	O
control	O
and	O
specifications	B-Application
which	O
makes	O
support	O
of	O
hardware	B-Architecture
devices	O
on	O
each	O
of	O
the	O
operating	B-General_Concept
systems	I-General_Concept
difficult	O
.	O
</s>
<s>
So	O
the	O
ability	O
to	O
use	O
a	O
device	O
with	O
an	O
operating	B-General_Concept
system	I-General_Concept
requires	O
the	O
availability	O
of	O
corresponding	O
device	B-Application
driver	I-Application
combination	O
.	O
</s>
<s>
Hardware	B-Architecture
vendors	O
usually	O
supply	O
the	O
drivers	O
for	O
Windows	O
,	O
Linux	B-Application
and	O
Mac	O
OS	O
but	O
due	O
to	O
the	O
high	O
development	O
or	O
porting	O
costs	O
and	O
technical	B-General_Concept
support	I-General_Concept
difficulties	O
they	O
are	O
unable	O
to	O
provide	O
drivers	O
on	O
all	O
platforms	O
.	O
</s>
<s>
An	O
automated	O
synthesis	O
technique	O
can	O
help	O
the	O
vendors	O
in	O
providing	O
drivers	O
to	O
support	O
any	O
devices	O
on	O
any	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
There	O
are	O
two	O
challenges	O
that	O
limit	O
testing	O
the	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
The	O
wave	O
of	O
verification	O
of	O
device	B-Application
drivers	I-Application
was	O
initiated	O
by	O
Microsoft	O
through	O
their	O
SLAM	B-Application
project	I-Application
as	O
early	O
as	O
the	O
year	O
2000	O
.	O
</s>
<s>
The	O
motivation	O
for	O
the	O
project	O
was	O
that	O
500,000	O
crashes	O
reported	O
a	O
day	O
were	O
found	O
to	O
be	O
caused	O
by	O
one	O
video	O
driver	O
,	O
leading	O
to	O
concern	O
about	O
the	O
great	O
vulnerability	O
in	O
using	O
complex	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
Many	O
type-safe	B-Language
languages	O
allow	O
memory	B-Application
safety	I-Application
violations	O
resulting	O
from	O
unsafe	O
type	O
casting	O
to	O
be	O
detected	O
by	O
compiler	O
.	O
</s>
<s>
Metacompilers	B-Language
constructed	O
for	O
this	O
purpose	O
may	O
extend	O
the	O
compilers	O
with	O
lightweight	O
,	O
system	O
specific	O
checkers	O
and	O
optimizers	O
.	O
</s>
<s>
This	O
automates	O
the	O
reasoning	O
about	O
the	O
program	O
behavior	O
with	O
respect	O
to	O
the	O
given	O
correct	O
specifications	B-Application
.	O
</s>
<s>
Model	O
checking	O
and	O
symbolic	O
execution	O
are	O
used	O
to	O
verify	O
the	O
safety-critical	O
properties	O
of	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
The	O
output	O
is	O
the	O
proof	O
that	O
the	O
program	O
is	O
correct	O
or	O
a	O
demonstration	O
that	O
there	O
exists	O
a	O
violation	O
of	O
the	O
specification	B-Application
by	O
means	O
of	O
a	O
counterexample	O
in	O
the	O
form	O
of	O
a	O
specific	O
execution	O
path	O
.	O
</s>
<s>
The	O
tool	O
SDV	O
(	O
Static	O
Driver	O
Verifier	O
)	O
from	O
Microsoft	O
uses	O
static	O
analysis	O
for	O
windows	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
The	O
back	O
end	O
analysis	O
engine	O
SLAM	B-Application
used	O
model	O
checking	O
and	O
symbolic	O
execution	O
for	O
compile	O
time	O
static	O
verification	O
.	O
</s>
<s>
The	O
rules	O
that	O
are	O
to	O
be	O
observed	O
by	O
the	O
drivers	O
for	O
each	O
API	O
are	O
specified	O
in	O
a	O
C	O
like	O
language	O
SLIC	O
(	O
Specification	B-Application
Language	O
for	O
Interface	O
Checking	O
)	O
.	O
</s>
<s>
The	O
model	O
checker	O
BLAST	B-Application
(	O
Berkeley	O
Lazy	O
Abstraction	O
Software	O
verification	O
Tool	O
)	O
is	O
used	O
to	O
find	O
memory	B-Application
safety	I-Application
and	O
incorrect	O
locking	O
errors	O
in	O
Linux	B-Application
kernel	O
code	O
.	O
</s>
<s>
It	O
is	O
also	O
used	O
to	O
determine	O
if	O
a	O
change	O
in	O
the	O
source	O
code	O
affects	O
the	O
proof	O
of	O
property	O
in	O
the	O
previous	O
version	O
and	O
is	O
demonstrated	O
on	O
a	O
Windows	O
device	B-Application
driver	I-Application
.	O
</s>
<s>
Avinux	O
is	O
another	O
tool	O
that	O
facilitates	O
the	O
automatic	O
analysis	O
of	O
Linux	B-Application
device	O
drives	O
and	O
is	O
built	O
on	O
top	O
of	O
bounded	O
model	O
checker	O
CBMC	O
.	O
</s>
<s>
Safe	O
Drive	O
is	O
a	O
low	O
overhead	O
system	O
for	O
detecting	O
and	O
recovering	O
from	O
type	B-Language
safety	I-Language
violations	O
in	O
device	B-Application
drivers	I-Application
.	O
</s>
<s>
With	O
only	O
4%	O
changes	O
to	O
the	O
source	O
code	O
of	O
Linux	B-Application
network	O
drivers	O
they	O
were	O
able	O
to	O
implement	O
SafeDrive	O
and	O
give	O
better	O
protection	O
and	O
recovery	O
to	O
Linux	B-Application
kernel	O
.	O
</s>
<s>
A	O
similar	O
project	O
using	O
hardware	B-Architecture
to	O
isolate	O
the	O
device	B-Application
drivers	I-Application
from	O
the	O
main	O
kernel	O
is	O
Nook	O
.	O
</s>
<s>
They	O
place	O
device	B-Application
drivers	I-Application
in	O
separate	O
hardware	B-Architecture
protection	O
domain	O
called	O
"	O
nooks	O
"	O
and	O
they	O
have	O
separate	O
permission	O
setting	O
for	O
each	O
pages	O
making	O
sure	O
that	O
a	O
driver	O
does	O
not	O
modify	O
pages	O
which	O
are	O
not	O
in	O
its	O
domain	O
but	O
can	O
read	O
all	O
kernel	O
data	O
since	O
they	O
share	O
the	O
same	O
address	O
space	O
.	O
</s>
<s>
Another	O
similar	O
work	O
in	O
this	O
area	O
is	O
on	O
automatic	O
recovery	O
of	O
operating	B-General_Concept
systems	I-General_Concept
due	O
to	O
driver	O
faults	O
.	O
</s>
<s>
MINIX	O
3	O
is	O
an	O
operating	B-General_Concept
system	I-General_Concept
which	O
can	O
isolate	O
major	O
faults	O
,	O
defects	O
are	O
detected	O
and	O
failing	O
components	O
are	O
replaced	O
on	O
the	O
fly	O
.	O
</s>
<s>
An	O
alternative	O
to	O
verification	O
and	O
isolation	O
of	O
faults	O
is	O
to	O
deploy	O
techniques	O
in	O
device	B-Application
driver	I-Application
development	O
process	O
to	O
make	O
it	O
more	O
robust	O
.	O
</s>
<s>
Given	O
a	O
device	O
specification	B-Application
and	O
operating	B-General_Concept
system	I-General_Concept
functions	O
,	O
one	O
method	O
is	O
to	O
synthesize	O
device	B-Application
driver	I-Application
for	O
that	O
device	O
.	O
</s>
<s>
All	O
the	O
synthesis	O
methods	O
rely	O
on	O
some	O
form	O
of	O
specification	B-Application
from	O
the	O
hardware	B-Architecture
device	O
manufacturers	O
and	O
operating	B-General_Concept
system	I-General_Concept
functions	O
.	O
</s>
<s>
Hardware	B-Architecture
operating	O
code	O
is	O
usually	O
low	O
level	O
and	O
is	O
prone	O
to	O
errors	O
.	O
</s>
<s>
The	O
code	O
development	O
engineer	O
rely	O
on	O
the	O
hardware	B-Architecture
documentation	O
which	O
typically	O
contains	O
imprecise	O
or	O
inaccurate	O
information	O
.	O
</s>
<s>
There	O
are	O
several	O
Interface	O
Definition	O
Languages	O
(	O
IDL	O
)	O
to	O
express	O
the	O
hardware	B-Architecture
functionalities	O
.	O
</s>
<s>
The	O
same	O
applies	O
to	O
hardware	B-Architecture
functionalities	O
as	O
well	O
.	O
</s>
<s>
In	O
this	O
section	O
we	O
discuss	O
writing	O
device	B-Application
drivers	I-Application
in	O
domain	O
specific	O
languages	O
which	O
helps	O
to	O
abstract	O
the	O
low	O
level	O
coding	O
and	O
use	O
specific	O
compilers	O
to	O
generate	O
the	O
code	O
.	O
</s>
<s>
The	O
hardware	B-Architecture
components	O
are	O
expressed	O
as	O
I/O	O
ports	O
and	O
memory-mapped	O
registers	O
.	O
</s>
<s>
These	O
specifications	B-Application
are	O
then	O
converted	O
to	O
a	O
set	O
of	O
C	O
macros	O
which	O
can	O
be	O
called	O
from	O
the	O
driver	O
code	O
and	O
thus	O
eliminates	O
the	O
error	O
induced	O
by	O
programmer	O
while	O
writing	O
low	O
level	O
functions	O
.	O
</s>
<s>
For	O
a	O
device	B-Application
driver	I-Application
generation	O
,	O
one	O
have	O
to	O
first	O
write	O
the	O
driver	O
functionalities	O
in	O
these	O
interface	O
specification	B-Application
languages	O
and	O
then	O
use	O
a	O
compiler	O
which	O
will	O
generate	O
the	O
low	O
level	O
driver	O
code	O
.	O
</s>
<s>
HAIL	O
(	O
Hardware	B-Architecture
Access	O
Interface	O
Language	O
)	O
is	O
another	O
domain-specific	O
device	B-Application
driver	I-Application
specification	B-Application
language	O
.	O
</s>
<s>
Invariant	O
specification	B-Application
,	O
which	O
constraints	O
accessing	O
the	O
device	O
.	O
</s>
<s>
The	O
HAIL	O
compiler	O
takes	O
these	O
inputs	O
and	O
translates	O
the	O
specification	B-Application
into	O
C	O
code	O
.	O
</s>
<s>
In	O
hardware	B-Architecture
software	O
co-design	O
,	O
the	O
designer	O
specifies	O
the	O
structure	O
and	O
behavior	O
of	O
the	O
system	O
using	O
finite	O
state	O
machines	O
which	O
communicate	O
among	O
themselves	O
.	O
</s>
<s>
Then	O
a	O
series	O
of	O
testing	O
,	O
simulation	O
and	O
formal	O
verification	O
are	O
done	O
on	O
these	O
state	O
machines	O
before	O
deciding	O
which	O
components	O
go	O
into	O
the	O
hardware	B-Architecture
and	O
which	O
of	O
these	O
into	O
the	O
software	O
.	O
</s>
<s>
The	O
hardware	B-Architecture
is	O
usually	O
done	O
in	O
field	O
programmable	O
gate	O
arrays	O
(	O
FPGAs	O
)	O
or	O
application	O
specific	O
integrated	O
circuits	O
(	O
ASICs	O
)	O
,	O
whereas	O
the	O
software	O
part	O
is	O
translated	O
into	O
low-level	O
programming	O
language	O
.	O
</s>
<s>
The	O
device	O
is	O
modeled	O
using	O
any	O
Hardware	B-Architecture
Description	O
Language	O
(	O
HDL	O
)	O
and	O
the	O
software	O
developer	O
does	O
not	O
have	O
access	O
to	O
the	O
HDL	O
specifications	B-Application
.	O
</s>
<s>
The	O
hardware	B-Architecture
developers	O
put	O
forth	O
the	O
device	O
interface	O
in	O
the	O
data	O
sheet	O
for	O
the	O
device	O
.	O
</s>
<s>
Final	O
step	O
involves	O
generating	O
the	O
code	O
from	O
these	O
specifications	B-Application
.	O
</s>
<s>
The	O
tool	O
Termite	O
takes	O
three	O
specifications	B-Application
to	O
generate	O
the	O
driver	O
.	O
</s>
<s>
Device	O
specification	B-Application
:	O
The	O
device	O
register	O
,	O
memory	O
and	O
interrupt	O
services	O
specification	B-Application
obtained	O
from	O
the	O
device	O
data	O
sheet	O
.	O
</s>
<s>
Device	O
class	O
specification	B-Application
:	O
This	O
can	O
be	O
obtained	O
from	O
the	O
relevant	O
device	O
I/O	O
protocol	O
standard	O
.	O
</s>
<s>
OS	O
specification	B-Application
:	O
This	O
describes	O
the	O
OS	O
interface	O
with	O
the	O
driver	O
.	O
</s>
<s>
Given	O
these	O
specifications	B-Application
Termite	O
will	O
generate	O
the	O
driver	O
implementation	O
that	O
translates	O
any	O
valid	O
sequence	O
of	O
OS	O
request	O
into	O
a	O
sequence	O
of	O
device	O
commands	O
.	O
</s>
<s>
Due	O
to	O
formal	B-Application
specification	I-Application
of	O
the	O
interfaces	O
,	O
Termite	O
can	O
generate	O
the	O
driver	O
code	O
which	O
holds	O
the	O
safety	O
and	O
liveness	O
properties	O
.	O
</s>
<s>
To	O
reverse	O
engineer	O
a	O
driver	O
,	O
it	O
wiretaps	O
the	O
hardware	B-Architecture
I/O	O
operations	O
by	O
executing	O
the	O
driver	O
using	O
symbolic	O
and	O
concrete	O
executions	O
.	O
</s>
<s>
Using	O
these	O
methods	O
,	O
the	O
researchers	O
have	O
ported	O
some	O
Windows	O
drivers	O
for	O
network	O
interfaces	O
to	O
other	O
Linux	B-Application
and	O
embedded	O
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
The	O
complete	O
automation	O
of	O
device	B-Application
driver	I-Application
synthesis	O
is	O
still	O
in	O
its	O
early	O
stages	O
and	O
has	O
a	O
promising	O
future	O
research	O
direction	O
.	O
</s>
<s>
Progress	O
will	O
be	O
facilitated	O
if	O
the	O
many	O
languages	O
available	O
today	O
for	O
interface	O
specification	B-Application
can	O
eventually	O
consolidate	O
into	O
a	O
single	O
format	O
,	O
which	O
is	O
supported	O
universally	O
by	O
device	O
vendors	O
and	O
operating	B-General_Concept
systems	I-General_Concept
teams	O
.	O
</s>
<s>
The	O
payoff	O
from	O
such	O
a	O
standardization	O
effort	O
could	O
be	O
the	O
realization	O
of	O
completely	O
automated	O
synthesis	O
of	O
reliable	O
device	B-Application
drivers	I-Application
in	O
the	O
future	O
.	O
</s>
