Hardware abstraction

Short description: Sets of routines in software

Hardware abstractions are sets of routines in software that provide programs with access to hardware resources through programming interfaces. The programming interface allows all devices in a particular class C of hardware devices to be accessed through identical interfaces even though C may contain different subclasses of devices that each provide a different hardware interface.

Hardware abstractions often allow programmers to write device-independent, high performance applications by providing standard operating system (OS) calls to hardware. The process of abstracting pieces of hardware is often done from the perspective of a CPU. Each type of CPU has a specific instruction set architecture or ISA. The ISA represents the primitive operations of the machine that are available for use by assembly programmers and compiler writers. One of the main functions of a compiler is to allow a programmer to write an algorithm in a high-level language without having to care about CPU-specific instructions. Then it is the job of the compiler to generate a CPU-specific executable. The same type of abstraction is made in operating systems, but OS APIs now represent the primitive operations of the machine, rather than an ISA. This allows a programmer to use OS-level operations (e.g. task creation/deletion) in their programs while retaining portability over a variety of different platforms.

## Contents

* 1 Overview
* 2 In operating systems
* 2.1 Microsoft Windows
* 2.2 AS/400
* 2.3 Android
* 3 See also
* 4 References
* 5 Further reading

## Overview

Many early computer systems did not have any form of hardware abstraction. This meant that anyone writing a program for such a system would have to know how each hardware device communicated with the rest of the system. This was a significant challenge to software developers since they then had to know how every hardware device in a system worked to ensure the software's compatibility. With hardware abstraction, rather than the program communicating directly with the hardware device, it communicates to the operating system what the device should do, which then generates a hardware-dependent instruction to the device. This meant programmers didn't need to know how specific devices worked, making their programs compatible with any device.

An example of this might be a "Joystick" abstraction. The joystick device, of which there are many physical implementations, is readable/writable through an API which many joystick-like devices might share. Most joystick-devices might report movement directions. Many joystick-devices might have sensitivity-settings that can be configured by an outside application. A Joystick abstraction hides details (e.g., register format, I2C address) of the hardware so that a programmer using the abstracted API, does not need to understand the details of the device's physical interface. This also allows code reuse since the same code can process standardized messages from any kind of implementation which supplies the "joystick" abstraction. A "nudge forward" can be from a potentiometer or from a capacitive touch sensor that recognises "swipe" gestures, as long as they both provide a signal related to "movement".

As physical limitations (e.g. resolution of sensor, temporal update frequency) may vary with hardware, an API can do little to hide that, other than by assuming a "least common denominator" model. Thus, certain deep architectural decisions from the implementation may become relevant to users of a particular instantiation of an abstraction.

A good metaphor is the abstraction of transportation. Both bicycling and driving a car are transportation. They both have commonalities (e.g., you must steer) and physical differences (e.g., use of feet). One can always specify the abstraction "drive to" and let the implementor decide whether bicycling or driving a car is best. The "wheeled terrestrial transport" function is abstracted and the details of "how to drive" are encapsulated.

Examples of "abstractions" on a PC include video input, printers, audio input and output, block devices (e.g. hard disk drives or USB flash drive), etc.

In certain computer science domains, such as operating systems or embedded systems, the abstractions have slightly different appearances (for instance, Operating Systems tend to have more standardized interfaces), but the concept of abstraction and encapsulation of complexity are common, and deep.

The hardware abstraction layer reside below the application programming interface (API) in a software stack, whereas the application layer (often written in a high level language) resides above the API and communicates with the hardware by calling functions in the API.

## In operating systems

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 Microsoft Windows, 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, but prevents direct access to the hardware.

CP/M (CP/M BIOS), DOS (DOS BIOS), Solaris, Linux, BSD, macOS, and some other portable operating systems also have a HAL, even if it is not explicitly designated as such. Some operating systems, such as Linux, have the ability to insert one while running, like Adeos. The NetBSD operating system is widely known as having a clean hardware abstraction layer which allows it to be highly portable.[1] 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, PCIe, etc., allowing drivers to also be highly portable with a minimum of code modification.

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

### Microsoft Windows

The Hardware Abstraction Layer in the architecture of Windows NT

The Windows NT kernel has a HAL in the kernel space between hardware and the executive services that are contained in the file NTOSKRNL.EXE[2][3] under %WINDOWS%\system32\hal.dll. 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 applicable to those systems. For example, the SGI Intel x86-based workstations were not IBM PC compatible workstations, but due to the HAL, Windows 2000 was able to run on them.[4][failed verification]

Since Windows Vista and Windows Server 2008, the HAL used is automatically determined during startup.[5]

### AS/400

An "extreme" example of a HAL can be found in the System/38 and AS/400 architectures, currently implemented in the IBM i operating system. 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.[6] (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, despite the fact that the underlying hardware has been changed dramatically; at least three different types of processors have been in use.[6]

### Android

Android introduced a HAL known as the "vendor interface" (codenamed "Project Treble") on version 8.0 "Oreo". It abstracts low-level code from the Android OS framework, and they must be made forward compatible to support future versions of Android to ease the development of firmware updates.[7] Before Project Treble Android relied on various non-standardized legacy HALs.[8]

Halium is an Android-based HAL used by several mobile operating systems such as Ubuntu Touch and LuneOS to run on smartphones with Android pre-installed.

## See also

* Basic Input/Output System (BIOS)
* Unified Extensible Firmware Interface (UEFI)
* Firmware
* Advanced Configuration and Power Interface (ACPI)
* Device tree
* Board support package (BSP)
* DeviceKit
* Haiku Device Kit
* HAL
* Hardware-dependent software (HDS)
* Nanokernel
* Picokernel
* Protection ring

## References

1. ↑ "Portability and supported hardware platforms". The NetBSD Foundation. http://www.netbsd.org/about/portability.html.
2. ↑ "Windows NT Hardware Abstraction Layer (HAL)". Microsoft. 2006-10-31. http://support.microsoft.com/kb/99588.
3. ↑ Inside Windows NT, Microsoft Press, 1993, Bibcode: 1993iwn..book.....C
4. ↑ "Changing hardware abstraction layer in Windows 2000 / XP – Smallvoid.com" (in en-US). 15 January 2001. http://smallvoid.com/article/winnt-hardware-abstraction-layer.html.
5. ↑ Windows Internals: Including Windows Server 2008 and Windows Vista (5 ed.). Redmond, Washington, USA: Microsoft Press. 2008. p. 65. ISBN 978-0-7356-2530-3.
6. ↑ 6.0 6.1 Inside the AS/400: Featuring the AS/400e Series (2 ed.). Loveland, Colorado, USA: Duke Press. 1997. ISBN 978-1-882419-66-1.
7. ↑ "Google's "Project Treble" solves one of Android's many update roadblocks". 12 May 2017. https://arstechnica.com/gadgets/2017/05/google-hopes-to-fix-android-updates-no-really-with-project-treble/.
8. ↑ "Conventional & legacy HALs". https://source.android.com/devices/architecture/hal-types#legacy.

## Further reading

* "Advanced RISC Computing Specification". MIPS Technologies. p. 23. http://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf.
* Operating System Concepts (6 ed.). 2002. ISBN 0-471-41743-2.

* v
* t
* e

Operating systems

General|

* Advocacy
* Comparison
* Forensic engineering
* History
* Hobbyist development
* List
* Timeline
* Usage share

Kernel|

| Architectures|

* Exokernel
* Hybrid
* Microkernel
* Monolithic
* vkernel
* Rump kernel
* Unikernel

|

Components|

* Device driver
* Loadable kernel module
* Microkernel
* User space

Process management|

| Concepts|

* Context switch
* Interrupt
* IPC
* Process
* Process control block
* Real-time
* Thread
* Time-sharing

|

Scheduling
algorithms|

* Computer multitasking
* Fixed-priority preemptive
* Multilevel feedback queue
* Preemptive
* Round-robin
* Shortest job next

Memory management and
resource protection|

* Bus error
* General protection fault
* Memory protection
* Paging
* Protection ring
* Segmentation fault
* Virtual memory

Storage access and
file systems|

* Boot loader
* Defragmentation
* Device file
* File attribute
* Inode
* Journal
* Partition
* Virtual file system
* Virtual tape library

List|

* Acorn
* Arthur
* ARX
* MOS
* RISC iX
* RISC OS
* Amiga Inc.
* AmigaOS
* AmigaOS 1.0-3.9 (Motorola 68000)
* AmigaOS 4 (PowerPC)
* Amiga Unix, a.k.a. Amix
* Amstrad
* AMSDOS
* Contiki
* SymbOS
* Android
* Apple Inc.
* Apple II family
* Apple III
* Apple DOS
* Apple Lisa
* Apple SOS
* Apple Pascal
* ProDOS
* GS/OS
* GNO/ME
* Contiki
* Apple Macintosh
* Classic Mac OS
* A/UX
* Copland
* MkLinux
* Pink
* Rhapsody
* macOS (formerly Mac OS X and OS X)
* macOS Server (formerly Mac OS X Server and OS X Server)
* Apple Network Server
* Apple MessagePad
* Newton OS
* iPhone and iPod Touch
* iOS (formerly iPhone OS)
* iPad
* iPadOS
* Apple Watch
* watchOS
* Apple TV
* tvOS
* Darwin
* iPod
* iPod software (unnamed embedded OS)
* A/ROSE
* Apollo Computer
* Domain/OS
* Atari
* Atari DOS
* Atari TOS
* Atari MultiTOS
* BAE Systems XTS-400
* Be Inc.
* BeOS
* BeIA
* BeOS r5.1d0
* Bell Labs Non-Unix
* BESYS
* Plan 9 from Bell Labs
* Inferno)
* Burroughs Corporation
* Burroughs MCP
* BSD
* Control Data Corporation
* Chippewa Operating System
* Kronos
* NOS (Network Operating System)
* SCOPE)
* Convergent Technologies Operating System
* Cosmos
* Cromemco
* Cromemco DOS
* Cromix
* Data General
* AOS (for 16-bit)
* DG/UX
* RDOS (Real-time DOS)
* Datapoint (CTOS for Z-80)
* DDC-I Inc.
* HeartOS
* Digital Research, Inc.
* CP/M
* CP/M Plus
* CP/M-68K
* CP/M-8000
* CP/M-86
* CP/M-86 Plus
* Concurrent CP/M
* Concurrent CP/M-86
* Concurrent CP/M 8-16
* Concurrent CP/M-68K
* Concurrent DOS
* Concurrent PC DOS
* Concurrent DOS 8-16
* Concurrent DOS 286
* Concurrent DOS XM
* Concurrent DOS 386
* Concurrent DOS 386/MGE
* Concurrent DOS 68K
* DR-DOS
* FlexOS
* FlexOS 186
* FlexOS 286
* FlexOS 68K
* Multiuser DOS
* Datapac Multiuser DOS
* Datapac System Manager, a derivative of Datapac Multiuser DOS
* IMS Multiuser DOS
* MP/M
* MP/M II
* MP/M-86
* MP/M 8-16
* PalmDOS 1.0
* Personal CP/M
* Digital Equipment Corporation
* Batch-11/DOS-11
* OS/8
* RSTS/E
* RSX-11
* RT-11
* TOPS-10
* TOPS-20
* TENEX
* Digital UNIX
* Ultrix
* VMS
* WAITS
* DOS
* ENEA AB OSE
* Fujitsu Towns OS
* General Electric, Honeywell, Bull
* Real-Time Multiprogramming Operating System
* GCOS
* Multics
* Genode
* GNU
* Google
* Android
* Chromium OS
* Chrome OS
* Goobuntu
* Fuchsia)
* Green Hills Software
* INTEGRITY
* INTEGRITY-178B
* µ-velOSity
* Haiku
* Harmony
* Heathkit, Zenith Data Systems
* HDOS
* HT-11
* Hewlett-Packare
* HP-UX
* Multi-Programming Executive
* Honeywell CP-6
* Huawei Harmony OS
* Intel Corporation
* ISIS
* IBM
* Pre-360
* BESYS
* CTSS
* GM OS & GM-NAA I/O
* IBSYS
* SHARE Operating System
* University of Michigan Executive System (UMES)
* OS/360 and successors
* OS/360 and successors
* MVS
* OS/390
* Phoenix/MVS
* z/OS)
* DOS
* DOS/360 and successors on IBM S/360, S/370, and successor mainframes
* BOS/360
* TOS/360
* DOS/VS
* DOS/VSE
* VSE/SP
* VSE/ESA
* z/VSE)
* VM/CMS
* CP/CMS
* CP-40
* CP-67
* VM/370
* VM/XA
* VM/ESA Virtual Machine
* z/VM)
* TPF line
* Airline Control Program ACP
* Transaction Processing Facility)
* Unix-like
* AIX
* UTS (Mainframe UNIX)
* Linux on z Systems
* Others on IBM S/360, S/370, and successor mainframes
* TSS/360
* MUSIC/SP
* ORVYL and WYLBUR
* IBM PC
* PC DOS
* OS/2
* OS/2 Warp
* eComStation)
* Other hardware
* IBM Series 1
* EDX
* RPS
* CPS
* IBM 1130 DM2
* IBM 1800 MPX & TSX
* IBM 8100
* DPCX
* DPPX)
* System 3 DMS
* IBM System 34, 36, 38
* OS/400
* illumos
* IncludeOS
* iOS
* audioOS
* iPadOS
* tvOS
* Linux
* MINIX
* MorphOS
* MUSIC/SP
* Nemesis
* NeXTSTEP
* NOS
* ORVYL
* OS/2
* OS-9
* OSv
* Pick
* QNX
* ReactOS
* RISC OS
* Solaris
* Tandem
* NonStop
* TPF
* TRIPOS
* Unix
* Visi On
* VS/9
* webOS
* Windows
* Xerox 500 series (530 RTB, 560)
* Xinu
* z/OS

Miscellaneous concepts|

* API
* Computer network
* HAL
* Live CD
* Live USB
* OS shell
* CLI
* GUI
* NUI
* TUI
* VUI
* ZUI
* PXE

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Hardware abstraction. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Hardware_abstraction&oldid=201911"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template