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. A HAL 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. 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 thanks to the HAL, Windows NT was able to run on them.
BSD, Mac OS X, Linux, Solaris, and some other portable operating systems also have a HAL, even if it's not explicitly designated as one. Some systems, such as Linux, have the ability to insert one while running, like Adeos. Usually, the term HAL is considered close to the nanokernels, though is not exact.
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 for a virtual machine; the Licensed Internal Code, or LIC, for those systems translates this virtual machine code into native code for the processor on which it's 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 microcontrollers.