Hardware abstraction layer

From Wikipedia, the free encyclopedia

A hardware abstraction layer (HAL) is an abstraction layer, implemented in software, between the physical hardware of a computer and the software that runs on that computer. Its function is to hide differences in hardware from most of the operating system kernel, so that most of the kernel-mode code does not need to be changed to run on systems with different hardware. On a PC, HAL can basically be considered to be the driver for the motherboard and allows instructions from higher level computer languages to communicate with lower level components, such as directly with hardware.

The Windows NT-based operating systems have a HAL in the kernel.[1][2] This allows portability of the Windows NT kernel-mode code to a variety of processors, with different memory management unit architectures, and a variety of systems with different I/O bus architectures; most of that code runs without change on those systems, when compiled for the instruction set for those systems. For example, the SGI Intel x86-based workstations were not IBM PC compatible workstations, but due to the HAL, Windows NT was able to run on them.

BSD, Mac OS X, Linux, CP/M, MS-DOS, Solaris, and some other portable operating systems also have a HAL, even if it's not explicitly designated as such. Some systems, such as Linux, have the ability to insert one while running, like Adeos. The NetBSD operating system kernel is widely known as having a clean hardware abstraction layer which allows it to be highly portable. As part of this system are uvm(9)/pmap(9), bus_space(9), bus_dma(9) and other subsystems. Popular buses which are used on more than one architecture are also abstracted, such as ISA, EISA, PCI, PCI-E, etc., allowing drivers to also be highly portable with a minimum of code modification.

An "extreme" example of a HAL can be found in the System/38 and AS/400 architecture. Most compilers for those systems generate an abstract machine code; the Licensed Internal Code, or LIC, translates this virtual machine code into native code for the processor on which it is running and executes the resulting native code. (The exceptions are compilers that generate the LIC itself; those compilers are not available outside IBM.) This was so successful that application software and operating system software above the LIC layer that were compiled on the original S/38 run without modification and without recompilation on the latest AS/400 systems. This despite the fact that the underlying hardware has been changed dramatically; at least three different types of processors have been in use.

Hardware abstraction layers are of an even lower level in computer languages than application programming interfaces (API) because they interact directly with hardware instead of a system kernel, therefore HALs require less processing time than APIs. Higher level languages often use HALs and APIs to communicate with lower level components.

Operating systems having a defined HAL are easily portable across different hardware. This is especially important for embedded systems that run on dozens of different platforms.

[edit] References

  1. ^ Windows NT Hardware Abstraction Layer (HAL). Microsoft (October 31, 2006). Retrieved on 2007-08-25.
  2. ^ Helen Custer, Inside Windows NT, Microsoft Press, 1993.

[edit] See also