Interrupts and IRQs

advertisement
X86 Exceptions and Interrupts
Vector
No.
0H
1H
2H
3H
4H
5H
6H
7H
8H
9H
AH
BH
CH
DH
EH
FH
10H
11H
12H
13H
14H1FH
20HFFH
Description
Type
8086/88
80286
Pentium
Divide Error
Debug
NMI Interrupt
Breakpoint
Overflow (INTO instruction)
BOUND Range Exceeded
Invalid Opcode
Math Coprocessor Not
Available
Double Fault
Coprocessor Segment
Overrun
Invalid Task-state Segment
Segment Not Present
Stack-Segment Fault
General Protection
Page Fault
(Intel reserved. Do not use.)
FPU Floating-Point Error
Alignment Check
Machine Check
SIMD Floating-Point
Exception (SSE and SSE2)
Intel reserved. Do not use.
Fault
Fault/ Trap
Interrupt
Trap
Trap
Fault
Fault
Fault
User Defined (Non- reserved)
Interrupt
NOTES
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Abort
Fault
Y
Y
Y
Y
Fault
Fault
Fault
Fault
Fault
Y
Y
Y
Y
Y
Y
Y
Y
Y
Introduced in 386
Fault
Fault
Abort
Fault
Y
Y
Y
Y
Y
Introduced in 486
Introduced in Pentium
Introduced in Pentium III
Not generated by 486
and up
Table 1. Exceptions and Interrupts
See Chapter 5, Interrupt and Exception Handling, in the Intel 64 and IA-32 Architecturea Software
Developer’s Manual, Volume 3, for a list of exception mnemonics and their descriptions.
See http://www.intel.com/products/processor/manuals/ for manuals from Intel
Manual Volume 1: Basic Architecture
Manual Volume 2: Instruction Set Reference
Manual Volume 3: System Programming Guide
Types of Exceptions:
Abort - exception that does not allow the program or task to be continued.
Fault - exception that can generally be corrected and once corrected the program can continue.
The return address points to the faulting instruction.
Trap – exception is reported immediately after the execution of the trapping instruction. After the
service routine the program can continue. The return address points to the instruction after the
trapping instruction.
Hardware Interrupts
IRQ Line
IRQ0
IRQ1
IRQ2
IRQ3
IRQ4
IRQ5
IRQ6
IRQ7
Interrupt
assigned by PIC
08H
09H
0AH
0BH
0CH
0DH
0EH
0FH
Description
Timer tick, 18.2 time per second
Keyboard service required
unused on PC/XT
COM2 service required
COM1 service required
Fixed-disk service required
Floppy-disk service required
Data request from LPT1
Table 2. Eight-Level Interrupt Map (Used in original PC)
IRQ Line
IRQ0
IRQ1
IRQ2
IRQ8
IRQ9
IRQ10
IRQ11
IRQ12
IRQ13
IRQ14
IRQ15
IRQ3
IRQ4
IRQ5
IRQ6
IRQ7
Interrupt
assigned by PIC
08H
09H
0AH
70H
71H
72H
73H
74H
75H
76H
77H
0BH
0CH
0DH
0EH
0FH
Description
Timer tick, 18.2 time per second
Keyboard service required
INT from slave PIC
Real-time clock service
Software redirected to IRQ2
Reserved
Reserved
Reserved
Numeric coprocessor
Fixed-disk controller
Reserved
COM2 service required
COM1 service required
Data request from LPT2
Floppy-disk service required
Data request from LPT1
Table 3. Sixteen-Level Interrupt Map (Introduced with 286 based PC)
INTERRUPTS AS USED BY MS-DOS AND BIOS
INT 0H
Divide Error
INT 1H
Single-step
INT 2H
NMI (Non Maskable Interrupt)
INT 3H
1-byte Interrupt (breakpoint)
INT 4H
INTO detected Overflow
INT 5H
Print-Screen Key
INT 8H thru 0FH Vectored Hardware Interrupts (See Tables 2 and 3)
INT 8H - IRQ0 - timer interrupt
INT 9H - IRQ1 - keyboard interrupt
INT AH - IRQ2 - interrupt from slave PIC on PC/AT
INT BH - IRQ3 - serial port 2 (com2:)
INT CH - IRQ4 - serial port 1 (com1:)
INT DH - IRQ5 - fixed disk (LPT2 on PC/AT)
INT EH - IRQ6 - floppy disk
INT FH - IRQ7 - Printer port (lpt1:)
INT 10H Video Services
INT 11H Get Equipment List
INT 12H Memory Size
INT 13H Disk Services
INT 14H Serial I/O
INT 15H Cassette and Other Services
INT 16H Keyboard Services
INT 17H Printer
INT 18H Transfer to ROM BASIC
INT 19H Boot Strap Loader
INT 1AH Time of Day
INT 1BH Ctrl-Break Handler
INT 1CH Clock Tick
INT 1DH  6845 Video Init tables
INT 1EH  Diskette Params (BASE TABLE)
INT 1FH  Pointer to Graphics Set 2--bitmaps for high 128 chars.
INT 20H Program Termination
INT 21H DOS Service Functions
INT 22H Terminate Address
INT 23H Ctrl-C/Ctrl-Break Handler
INT 24H Critical Error Handler
INT 25H Absolute Disk Read
INT 26H Absolute Disk Write
INT 27H Terminate but Stay Resident
...
NOTE:  indicates that the vector is an address to a table of information and not a pointer to a service
routine.
Table 4 - INTERRUPTS AS USED BY MS-DOS AND BIOS
INT 21H – DOS Services - SUMMARY BY FUNCTION
00H
26H
31H
33H
4BH
4CH
4DH
59H
62H
PROGRAM CONTROL
PROGRAM TERMINATION
CREATE PSP
TERMINATE BUT STAY RESIDENT (KEEP)
GET OR SET CONTROL-BREAK FLAG
LOAD OR EXECUTE A PROGRAM (EXEC)
QUIT WITH EXIT CODE (EXIT)
GET EXIT CODE OF SUBPROGRAM
GET EXTENDED ERROR CODE (DOS 3.X)
GET PSP ADDRESS (DOS 3.X)
01H
07H
08H
0AH
0BH
0CH
KEYBOARD CONTROL
KEYBOARD INPUT WITH ECHO (CHECKS ^C)
DIRECT INPUT, NO ECHO (NO BREAK CHECK)
KEYBOARD INPUT, NO ECHO (BREAK CHECK)
BUFFERED KEYBOARD INPUT
CHECK INPUT STATUS
CLEAR INPUT BUFFER AND CALL FUNCTION
02H
06H
09H
DISPLAY
DISPLAY CHARACTER
DIRECT CONSOLE I/O (NO BREAK CHECK)
DISPLAY STRING
03H
04H
05H
44H
MISC. I/O
AUX INPUT
AUX OUTPUT
PRINT A CHARACTER
IOCTL - DEVICE CONTROL
0DH
0EH
19H
1AH
1BH
1CH
2EH
2FH
36H
54H
DISK FUNCTIONS
DISK RESET
SELECT DRIVE
GET DEFAULT DISK NUMBER
SET DISK TRANSFER AREA ADDRESS
GET DEFAULT DRIVE'S DISK INFO
GET SPECIFIC DRIVE'S DISK INFO
SET VERIFY FLAG
GET DISK TRANSFER AREA ADDRESS
GET FREE DISK SPACE
GET VERIFY FLAG
39H
3AH
3BH
47H
DIRECTORY FUNCTIONS
CREATE A SUBDIRECTORY (MKDIR)
REMOVE A DIRECTORY ENTRY (RMDIR)
CHANGE THE CURRENT DIRECTORY (CHDIR)
GET CURRENT DIRECTORY
48H
49H
4AH
58H
MEMORY FUNCTIONS
ALLOCATE MEMORY
FREE MEMORY
MODIFY BLOCK SIZE (SETBLOCK)
GET/SET ALLOCATION STRATEGY (DOS 3.X)
0FH
10H
11H
12H
13H
14H
15H
16H
17H
21H
22H
23H
24H
27H
28H
29H
FCB FILE FUNCTIONS (Obsolete)
OPEN DISK FILE (FCB)
CLOSE DISK FILE (FCB)
FIND FIRST FILENAME MATCH (FCB)
FIND NEXT MATCH (FCB)
DELETE FILE (FCB)
SEQUENTIAL FILE READ (FCB)
SEQUENTIAL FILE WRITE (FCB)
CREATE FILE (FCB)
RENAME FILE (FCB)
RANDOM FILE READ (FCB)
RANDOM FILE WRITE (FCB)
SET FILE SIZE (FCB)
SET RANDOM RECORD FIELD (FCB)
RANDOM BLOCK READ (FCB)
RANDOM BLOCK WRITE (FCB)
PARSE FILENAME (FCB)
3CH
3DH
3EH
3FH
40H
41H
42H
43H
45H
46H
4EH
4FH
56H
57H
5AH
5BH
67H
68H
HANDLE FILE FUNCTIONS
CREATE A FILE - HANDLE (CREAT)
OPEN DISK FILE - HANDLE
CLOSE A FILE - HANDLE
READ FROM FILE - HANDLE
WRITE TO FILE - HANDLE
DELETE A FILE - HANDLE
MOVE FILE POINTER (LSEEK)
GET/PUT FILE ATTRIBUTES (CHMOD)
CREATE DUPLICATE HANDLE (DUP)
FORCE DUPLICATE HANDLE
FIND FIRST FILENAME MATCH (FIND FIRST)
FIND NEXT MATCH (FIND NEXT)
RENAME A FILE
GET/SET FILE DATE AND TIME
CREATE TMEPORARY FILE (DOS 3.X)
CREATE NEW FILE (DOS 3.X)
SET HANDLE COUNT (DOS 3.3)
COMMIT FILE (DOS 3.3)
2AH
2BH
2CH
2DH
25H
35H
30H
38H
65H
66H
SYSTEM FUNCTIONS
GET DATE
SET DATE
GET TIME
SET TIME
SET INTERRUPT VECTOR
GET INTERRUPT VECTOR
GET DOS VERSION
GET COUNTRY-DEPENDENT INFORMATION
GET EXTENDED COUNTRY INFO (DOS 3.3)
GET/SET GLOBAL CODE TABLE (DOS 3.3)
5CH
5EH
5FH
NETWORK SUPPORT
LOCK/UNLOCK FILE ACCESS (DOS 3.X)
NETWORK PRINTER SUPPORT (3.1 + NET.)
NETWORK REDIRECTION (3.1 + NET.)
Download