HAIL – A Language for Easy and Correct Device Access

Jun Sun, Wanghong Yuan, Mahesh Kallahalla, and Nayeem Islam


HAIL is a high-level domain-specific language that helps writing device drivers. Specifically it eases the development of device access code and help avoiding bugs in the access code.

Devlopers first write HAIL specification, which consists of four parts: (1) register map description, which describes the various device registers and bit fields, (2) address space description, which describes the mechanisms for accessing a bus, (3) device instantiation, which describes the actual instantiation of the device in the particular system, and (4) invariant specification, which describes the constraints on accessing the device.

The register map description and invariant specification in HAIL specification are usually translated from device documentation directly. The address space specification depends on the system /CPU architecture and sometimes the OS. Device instantiation is tied to the specific driver’s needs.

A HAIL compiler translates the specification into C code for accessing registers. In a simplified view, the generated code is a list of get_xxx()/set_xxx() for all registers and bit fields, put together in a C header file. Optionally the generated code can also have run-time debugging code that catches any violations of the specified invariants.

The device driver includes the generated header file and uses the get_xxx()/set_xxx() function to access the device registers, without concerning about the underlying device base addresses, bus attributes, data width, endianess and etc.. Additionally, the device driver can manipulate bit fields directly using these functions and hence avoid many explicit bit manipulations.

The diagram below illustrates the process of HAIL approach. For more details please see the paper and specification below.


Software download


The HAIL compiler binary release will come soon (we hope!) If you like to obtain one to evaluate, please let us know and we will work harder to make that happen.

Experimental patches and results

Our experiemental platform is Arcom's VIPER board. We have chose serial driver and ethernet (SMSC 91C111) as our study subjects on Linux and NetBSD. Linux kernel is a port of 2.4.26 to this board and NetBSD kernel is NetBSD 2.0 to VIPER board.

In order to successfully compile you will need additional header files required by HAIL: hail-list.h, hail-os-dep.h", and hail-invariants.h.

We also performed netperf tests over ethernet on both Linux and NetBSD. See the results for Linux and NetBSD.


For now please email your questions to the authors. In the future if there are enough interestes, we will create a mailing list. Stay tuned.


Some of the material on this web page has been copyrighted by ACM, IEEE and others. In that case permission to download or use that material is governed by the copyright policies of the respective organization. The copyright restrictions for ACM and IEEE publications are reproduced below. For other copyright holders please consult the publisher before downloading or using the information.

IEEE Copyright Notice.

"© 199x IEEE. Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from the IEEE." ACM Copyright notice. (It is acceptable to place the string "©Copyright 199x by ACM, Inc." as a hypertext link to the full copyright notice, <http://info.acm.org/pubs/toc/CRnotice.html>.)


Copyright © 199x by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Publications Dept, ACM Inc., fax +1 (212) 869-0481, or permissions@acm.org.