DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

trap(M)


trap -- handle CPU exception or interrupt

Description

The CPU can detect signals generated by itself, or by external hardware. These signals cause an interrupt or exception that requires a handler routine.

Interrupts are generated externally to the CPU. Peripherals generate interrupts when they require attention; for example, when data is ready to be read. These events are signaled on the INTR (Interrupt Request) pin of the processor and may be temporarily ignored (masked). Non-maskable interrupts are signaled on the NMI pin by events such as memory parity errors, and cannot be ignored.

Exceptions are generated by the CPU when it detects abnormal internal conditions, or by certain machine instructions. There are three types of internal exception detected by the processor:


abort
reported due to severe error, such as hardware failure or a corrupt system table. It is not possible to determine which instruction caused the error. An example would be failure of the internal cache.

fault
reported either before or during the execution of an instruction. An example is a page fault generated when a process requires a page of memory.

trap
reported immediately after the execution of a machine instruction. An example is overflow on divide.
Programmed exceptions are traps that are reported when certain machine instructions (BOUND, INT n, and INTO) cause an error condition. For example, BOUND is used by software when checking that an array index lies within given limits. These exceptions are sometimes referred to as ``software interrupts.''

The hexadecimal identification number or vector for each type of interrupt or exception is listed in the following table. The names of the vectors are defined in /usr/include/sys/trap.h. The description indicates the circumstances under which the vector might be reported in a kernel or device driver message.

Vector Name Type Description
0x00 DIVERR fault divide error
0x01 SGLSTP trap debugging
0x02 NMIFLT NMI non-maskable interrupt
0x03 BPTFLT trap breakpoint
0x04 INTOFLT trap overflow; programmed exception detected by INTO instruction
0x05 BOUNDFLT fault array range exceeded; programmed exception detected by BOUND instruction
0x06 INVOPFLT fault invalid opcode; illegal instruction possibly due to an error in the cache, bad hardware, or bad memory
0x07 NOEXTFLT fault coprocessor not available; usually caused by the device not being present
0x08 DBLFLT abort double fault (causes a DOUBLE PANIC); caused by an illegal instruction from a third-party device driver, or bad memory
0x09 EXTOVRFLT abort coprocessor extension overrun; reserved on the Pentium(TM)
0x0A INVTSSFLT fault invalid TSS (Task State Segment); usually occurs when performing i8086 emulation
0x0B SEGNPFLT fault segment not present; caused by an addressing problem due to bad memory, or conflict with a third-party device driver
0x0C STKFLT fault stack fault (system mode only); fixed stack size is being overflowed, perhaps caused by a third party device driver
0x0D GPFLT fault general protection; caused by invalid address, or parity error from bad memory
0x0E PGFLT fault page fault; page could not be brought into memory due to bad memory, or a bug in a third party device driver
0x0F     reserved
0x10 EXTERRFLT fault floating point error; caused by bad coprocessor hardware
0x11     alignment check on 486 and Pentium(TM) only; otherwise reserved
0x12     machine check on Pentium(TM) only; otherwise reserved
0x13-0x1F     reserved
0x20-0xFF INTR external interrupts on the INTR pin

 Vector      Name        Type    Description
 0x00        DIVERR      fault   divide error
 0x01        SGLSTP      trap    debugging
 0x02        NMIFLT      NMI     non-maskable interrupt
 0x03        BPTFLT      trap    breakpoint
 0x04        INTOFLT     trap    overflow; programmed
                                 exception detected by INTO
                                 instruction
 0x05        BOUNDFLT    fault   array range exceeded;
                                 programmed exception
                                 detected by BOUND
                                 instruction
 0x06        INVOPFLT    fault   invalid opcode; illegal
                                 instruction possibly due to
                                 an error in the cache, bad
                                 hardware, or bad memory
 0x07        NOEXTFLT    fault   coprocessor not available;
                                 usually caused by the
                                 device not being present
 0x08        DBLFLT      abort   double fault (causes a
                                 DOUBLE PANIC); caused by an
                                 illegal instruction from a
                                 third-party device driver,
                                 or bad memory
 0x09        EXTOVRFLT   abort   coprocessor extension
                                 overrun; reserved on the
                                 Pentium
 0x0A        INVTSSFLT   fault   invalid TSS (Task State
                                 Segment); usually occurs
                                 when performing i8086
                                 emulation
 0x0B        SEGNPFLT    fault   segment not present; caused
                                 by an addressing problem
                                 due to bad memory, or
                                 conflict with a third-party
                                 device driver
 0x0C        STKFLT      fault   stack fault (system mode
                                 only); fixed stack size is
                                 being overflowed, perhaps
                                 caused by a third party
                                 device driver
 0x0D        GPFLT       fault   general protection; caused
                                 by invalid address, or
                                 parity error from bad
                                 memory
 0x0E        PGFLT       fault   page fault; page could not
                                 be brought into memory due
                                 to bad memory, or a bug in
                                 a third party device driver
 0x0F                            reserved
 0x10        EXTERRFLT   fault   floating point error;
                                 caused by bad coprocessor
                                 hardware
 0x11                            alignment check on 486 and
                                 Pentium only; otherwise
                                 reserved
 0x12                            machine check on Pentium
                                 only; otherwise reserved
 0x13-0x1F                       reserved
 0x20-0xFF   INTR                external interrupts on the
                                 INTR pin
On single CPU machines, interrupt vectors 0x40-0x4F are assigned to interrupts from the PICs (8259 Programmable Interrupt Controllers). When output in diagnostic messages, all external interrupt vectors are given relative to 0x40 (PIC_VECTBASE). This value corresponds to the IRQ (interrupt request line) on the PICs. For example, the clock is always at IRQ 0, the first serial port at IRQ 4, and the ST506 hard disk controller at IRQ 14.

See also

messages(M)

Information about developing device drivers is available at the Driver Development Web Site (http://www.sco.com/developers/hdk/).


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003