Non-Maskable interrupt
Encyclopedia
A non-maskable interrupt (NMI) is a computer processor
interrupt
that cannot be ignored by standard interrupt masking techniques in the system. It is typically used to signal attention for non-recoverable hardware error
s. (Some NMIs may be masked, but only by using proprietary methods specific to the particular NMI.)
In modern architectures, NMIs are typically used to handle non-recoverable errors, which need immediate attention. Therefore, such interrupts should not be masked in the normal operation of the system. These errors include non-recoverable internal system chipset errors, corruption in system memory such as parity
and ECC errors, and data corruption detected on system and peripheral buses.
On some systems, an NMI can be triggered by the computer's user. Such applications include hardware and software debugging
interfaces, and system reset buttons.
Debugging NMIs are typically used to diagnose and fix faulty code. In such cases an NMI is used to execute an interrupt handler
that transfers control to a special monitor program. From this program a developer can inspect the machine's memory, and examine the internal state of the program at the instant of its interruption. Such NMIs also allow computers which appear to be hung
to be debugged or diagnosed.
, the 8087 coprocessor
on the x86 when used in the IBM PC or its compatibles (even though Intel recommended connecting it to a normal interrupt, causing the error pin on the 287 when used in the IBM PC/AT to be connected to a normal interrupt rather than directly to the 286 error pin, for which the handler jumps to the NMI handler, and later causing Intel, in the 486, to add the MS-DOS compatibility mode to it), and the Low Battery signal on the HP 95LX
.
In the original IBM PC
, an NMI was triggered if a parity error was detected in system memory, or reported by an external device. In either case, the PC would display an error message and halt. Some later PC clones
used an NMI to conceal the hardware differences from that of a standard PC. On such computers, an NMI would be generated when a program attempted to access incompatible hardware. A BIOS
interrupt handler
would then translate the program's request to match the hardware that was actually present. The SMM
in the 386SL is a better way to do this.
Some 8-bit home computer
s used the NMI line to permit a "warm start" if the system had locked up. Typically, this would restore the control registers to known good values stored in ROM
, without destroying whatever data that the user might currently have loaded. On the Commodore
8-bit machines, the RESTORE key was hooked up directly to the NMI line on the 6510
CPU, but the reset would take place only if RUN/STOP was also being held down when RESTORE was struck (this combination being the Commodore
version of a three finger salute). Commodore
also connected the MOS Technology
6526 CIA #2 in the C64
and C128
to the processor's NMI line, which was part of the means by which software emulation of the 6551 ACIA was accomplished. Atari
's 8-bit line used a SYSTEM RESET button for this same purpose.
Debugging NMIs have appeared in a number of forms, including the Apple Macintosh's "programmers' button", and certain key combinations on SUN
workstations. With the introduction of Windows 2000
, Microsoft
allowed the use of an NMI to cause a system to either break into a debugger
, or dump the contents of memory to disk and reboot.
Debugging NMIs have also been used by devices that allow leisure users and gamers to manipulate running programs. Devices which added a button to generate an NMI, such as Romantic Robot's Multiface
, were a popular accessory for 1980s 8-bit and 16-bit home computers. These peripherals had a small amount of ROM
and an NMI button. Pressing the button transferred control to the software in the peripheral's ROM, allowing the suspended program to be saved to disk (very useful for tape-based games with no disk support, but also for saving games in progress), screenshots to be saved or printed, or values in memory to be manipulated—a cheating technique to acquire extra lives, for example.
Not all computers provide a mechanism for triggering NMIs; however, many machines (typically rackmount servers) provide a physical button specifically for this purpose. Other machines may expose this functionality via an expansion card.
Miles Gordon Technology
's DISCiPLE
and +D products for the ZX Spectrum
featured an NMI-producing "magic button".
On the Nintendo Entertainment System
, an NMI is generated during each vertical blanking interval
. Because these NMIs (often referred to as "vblank interrupts") occur at frequent, regular intervals, code that manipulates game graphics and audio is often executed inside of the NMI handler routine. Clearing the 7th bit of the PPU's $2000 register
disables vblank interrupts, and setting it enables them.
Central processing unit
The central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...
interrupt
Interrupt
In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
that cannot be ignored by standard interrupt masking techniques in the system. It is typically used to signal attention for non-recoverable hardware error
Error
The word error entails different meanings and usages relative to how it is conceptually applied. The concrete meaning of the Latin word "error" is "wandering" or "straying". Unlike an illusion, an error or a mistake can sometimes be dispelled through knowledge...
s. (Some NMIs may be masked, but only by using proprietary methods specific to the particular NMI.)
Overview
An NMI is often used when response time is critical, and when an interrupt should never be disabled in the normal operation of the system. Such uses include the reporting of non-recoverable hardware errors, methods for system debugging and profiling, and special case handling such as system resets.In modern architectures, NMIs are typically used to handle non-recoverable errors, which need immediate attention. Therefore, such interrupts should not be masked in the normal operation of the system. These errors include non-recoverable internal system chipset errors, corruption in system memory such as parity
Parity bit
A parity bit is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code....
and ECC errors, and data corruption detected on system and peripheral buses.
On some systems, an NMI can be triggered by the computer's user. Such applications include hardware and software debugging
Debugging
Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge...
interfaces, and system reset buttons.
Debugging NMIs are typically used to diagnose and fix faulty code. In such cases an NMI is used to execute an interrupt handler
Interrupt handler
An interrupt handler, also known as an interrupt service routine , is a callback subroutine in microcontroller firmware, operating system or device driver whose execution is triggered by the reception of an interrupt...
that transfers control to a special monitor program. From this program a developer can inspect the machine's memory, and examine the internal state of the program at the instant of its interruption. Such NMIs also allow computers which appear to be hung
Hang (computing)
In computing, a hang or freeze occurs when either a single computer program, or the whole system ceases to respond to inputs. In the most commonly encountered scenario, a workstation with a graphical user interface, all windows belonging to the frozen program become static, and though the mouse...
to be debugged or diagnosed.
History
In older architectures, NMIs were used for interrupts which were typically never disabled because of the required response time. They were hidden signals. Examples include the floppy disk controller on the Amstrad PCWAmstrad PCW
The Amstrad PCW series was a range of personal computers produced by British company Amstrad from 1985 to 1998, and also sold under licence in Europe as the "Joyce" by the German electronics company Schneider in the early years of the series' life. When it was launched, the cost of a PCW system was...
, the 8087 coprocessor
Coprocessor
A coprocessor is a computer processor used to supplement the functions of the primary processor . Operations performed by the coprocessor may be floating point arithmetic, graphics, signal processing, string processing, or encryption. By offloading processor-intensive tasks from the main processor,...
on the x86 when used in the IBM PC or its compatibles (even though Intel recommended connecting it to a normal interrupt, causing the error pin on the 287 when used in the IBM PC/AT to be connected to a normal interrupt rather than directly to the 286 error pin, for which the handler jumps to the NMI handler, and later causing Intel, in the 486, to add the MS-DOS compatibility mode to it), and the Low Battery signal on the HP 95LX
HP 95LX
The HP 95LX was the first MS-DOS pocket computer or personal digital assistant, introduced by Hewlett-Packard in April 1991 in collaboration with Lotus Development Corporation....
.
In the original IBM PC
IBM PC
The IBM Personal Computer, commonly known as the IBM PC, is the original version and progenitor of the IBM PC compatible hardware platform. It is IBM model number 5150, and was introduced on August 12, 1981...
, an NMI was triggered if a parity error was detected in system memory, or reported by an external device. In either case, the PC would display an error message and halt. Some later PC clones
IBM PC compatible
IBM PC compatible computers are those generally similar to the original IBM PC, XT, and AT. Such computers used to be referred to as PC clones, or IBM clones since they almost exactly duplicated all the significant features of the PC architecture, facilitated by various manufacturers' ability to...
used an NMI to conceal the hardware differences from that of a standard PC. On such computers, an NMI would be generated when a program attempted to access incompatible hardware. A BIOS
BIOS
In IBM PC compatible computers, the basic input/output system , also known as the System BIOS or ROM BIOS , is a de facto standard defining a firmware interface....
interrupt handler
Interrupt handler
An interrupt handler, also known as an interrupt service routine , is a callback subroutine in microcontroller firmware, operating system or device driver whose execution is triggered by the reception of an interrupt...
would then translate the program's request to match the hardware that was actually present. The SMM
System Management Mode
System Management Mode is an operating mode in which all normal execution is suspended, and special separate software is executed in high-privilege mode. It was first released with the Intel 386SL...
in the 386SL is a better way to do this.
Some 8-bit home computer
Home computer
Home computers were a class of microcomputers entering the market in 1977, and becoming increasingly common during the 1980s. They were marketed to consumers as affordable and accessible computers that, for the first time, were intended for the use of a single nontechnical user...
s used the NMI line to permit a "warm start" if the system had locked up. Typically, this would restore the control registers to known good values stored in ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...
, without destroying whatever data that the user might currently have loaded. On the Commodore
Commodore International
Commodore is the commonly used name for Commodore Business Machines , the U.S.-based home computer manufacturer and electronics manufacturer headquartered in West Chester, Pennsylvania, which also housed Commodore's corporate parent company, Commodore International Limited...
8-bit machines, the RESTORE key was hooked up directly to the NMI line on the 6510
MOS Technology 6510
thumb|300px|Image of the internals of a [[Commodore 64]] showing the 6510 CPU . The chip on the right is the [[MOS Technology SID|6581 SID]]...
CPU, but the reset would take place only if RUN/STOP was also being held down when RESTORE was struck (this combination being the Commodore
Commodore International
Commodore is the commonly used name for Commodore Business Machines , the U.S.-based home computer manufacturer and electronics manufacturer headquartered in West Chester, Pennsylvania, which also housed Commodore's corporate parent company, Commodore International Limited...
version of a three finger salute). Commodore
Commodore International
Commodore is the commonly used name for Commodore Business Machines , the U.S.-based home computer manufacturer and electronics manufacturer headquartered in West Chester, Pennsylvania, which also housed Commodore's corporate parent company, Commodore International Limited...
also connected the MOS Technology
MOS Technology
MOS Technology, Inc., also known as CSG , was a semiconductor design and fabrication company based in Norristown, Pennsylvania, in the United States. It is most famous for its 6502 microprocessor, and various designs for Commodore International's range of home computers.-History:MOS Technology, Inc...
6526 CIA #2 in the C64
Commodore 64
The Commodore 64 is an 8-bit home computer introduced by Commodore International in January 1982.Volume production started in the spring of 1982, with machines being released on to the market in August at a price of US$595...
and C128
Commodore 128
The Commodore 128 home/personal computer was the last 8-bit machine commercially released by Commodore Business Machines...
to the processor's NMI line, which was part of the means by which software emulation of the 6551 ACIA was accomplished. Atari
Atari
Atari is a corporate and brand name owned by several entities since its inception in 1972. It is currently owned by Atari Interactive, a wholly owned subsidiary of the French publisher Atari, SA . The original Atari, Inc. was founded in 1972 by Nolan Bushnell and Ted Dabney. It was a pioneer in...
's 8-bit line used a SYSTEM RESET button for this same purpose.
Debugging NMIs have appeared in a number of forms, including the Apple Macintosh's "programmers' button", and certain key combinations on SUN
Sun Microsystems
Sun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...
workstations. With the introduction of Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...
, Microsoft
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
allowed the use of an NMI to cause a system to either break into a debugger
Debugger
A debugger or debugging tool is a computer program that is used to test and debug other programs . The code to be examined might alternatively be running on an instruction set simulator , a technique that allows great power in its ability to halt when specific conditions are encountered but which...
, or dump the contents of memory to disk and reboot.
Debugging NMIs have also been used by devices that allow leisure users and gamers to manipulate running programs. Devices which added a button to generate an NMI, such as Romantic Robot's Multiface
Multiface
The Multiface was a hardware peripheral released by Romantic Robot UK Ltd. for several 1980s home computers. The primary function of the device was to dump the computer's memory to external storage, and featured an iconic 'red button' that could be pressed at any time in order to activate it...
, were a popular accessory for 1980s 8-bit and 16-bit home computers. These peripherals had a small amount of ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...
and an NMI button. Pressing the button transferred control to the software in the peripheral's ROM, allowing the suspended program to be saved to disk (very useful for tape-based games with no disk support, but also for saving games in progress), screenshots to be saved or printed, or values in memory to be manipulated—a cheating technique to acquire extra lives, for example.
Not all computers provide a mechanism for triggering NMIs; however, many machines (typically rackmount servers) provide a physical button specifically for this purpose. Other machines may expose this functionality via an expansion card.
Miles Gordon Technology
Miles Gordon Technology
Miles Gordon Technology, known as MGT, was a small British company, initially specialising in high-quality add-ons for the Sinclair ZX Spectrum home computer. It was named for its founders, Alan Miles and Bruce Gordon and was founded in Cambridge, England in June 1986, by the two ex-Sinclair...
's DISCiPLE
DISCiPLE
The DISCiPLE was a floppy disk interface for the Sinclair ZX Spectrum home computer. Designed by Miles Gordon Technology, it was marketed by Rockfort Products and launched in 1986....
and +D products for the ZX Spectrum
ZX Spectrum
The ZX Spectrum is an 8-bit personal home computer released in the United Kingdom in 1982 by Sinclair Research Ltd...
featured an NMI-producing "magic button".
On the Nintendo Entertainment System
Nintendo Entertainment System
The Nintendo Entertainment System is an 8-bit video game console that was released by Nintendo in North America during 1985, in Europe during 1986 and Australia in 1987...
, an NMI is generated during each vertical blanking interval
Vertical blanking interval
The vertical blanking interval , also known as the vertical interval or VBLANK, is the time difference between the last line of one frame or field of a raster display, and the beginning of the first line of the next frame. It is present in analog television, VGA, DVI and other signals. During the...
. Because these NMIs (often referred to as "vblank interrupts") occur at frequent, regular intervals, code that manipulates game graphics and audio is often executed inside of the NMI handler routine. Clearing the 7th bit of the PPU's $2000 register
Processor register
In computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly...
disables vblank interrupts, and setting it enables them.
See also
- Advanced Programmable Interrupt ControllerAdvanced Programmable Interrupt ControllerIn computing, an Advanced Programmable Interrupt Controller is a more complex Programmable Interrupt Controller than Intel's original types such as the 8259A...
(APIC) - Inter-processor interruptInter-Processor InterruptAn inter-processor interrupt is a special type of interrupt by which one processor may interrupt another processor in a multiprocessor system. IPIs are typically used to implement a cache coherency synchronization point.- Windows :...
(IPI) - InterruptInterruptIn computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....
- Interrupt handlerInterrupt handlerAn interrupt handler, also known as an interrupt service routine , is a callback subroutine in microcontroller firmware, operating system or device driver whose execution is triggered by the reception of an interrupt...
- Interrupt latencyInterrupt latencyIn real-time operating systems, interrupt latency is the time between the generation of an interrupt by a device and the servicing of the device which generated the interrupt. For many operating systems, devices are serviced as soon as the device's interrupt handler is executed...
- Programmable Interrupt ControllerProgrammable Interrupt ControllerIn computing, a programmable interrupt controller is a device that is used to combine several sources of interrupt onto one or more CPU lines, while allowing priority levels to be assigned to its interrupt outputs. When the device has multiple interrupt outputs to assert, it will assert them in...
(PIC)