Professional Documents
Culture Documents
אסמבלר- הרצאה 8 - בקר פסיקות
אסמבלר- הרצאה 8 - בקר פסיקות
אסמבלר- הרצאה 8 - בקר פסיקות
Yehezkel C.
Software Layers
Pentium pinout
Yehezkel C.
Yehezkel C.
Yehezkel C.
:
- Non Maskable interrupt - NMI .1
.
.
Programmable
Interrupt Controller
- INTR .2 . disable
(enable) -
IRET ) IRETD 386(.
:
- INTA .3 vector type number
.data bus -
12
12
13
Yehezkel C.
13
Timing Diagram
8259 - PIC
Vector Intr
14
14
Yehezkel C.
15
Yehezkel C.
15
Inside - PIC
ISR
IRR
IR0
IR1
IMR0
Priority
Decoder
IR2
IR3
IR4
IMR
.
.
IR5
IR6
IR7
IMR7
16
16
Yehezkel C.
17
- INTR
Interrupt
Request
INT
. Data
Bus
8
Pointer
. 4 . 12 . 3
Acknowledge
.6 .5
Interrupt
.type
. Interrupt
number
- INTA.
.
.
EOI
CLEAR
Yehezkel C.
17
;IRR=0
IRR=1
ISR=1
2
2
15
...
..
. .
NMI
INTA
11110101
11110101
11110101
11110101
DATA BUS
18
Yehezkel C.
18
" . .
19
Yehezkel C.
19
IRQ 0 System timer
Keyboard
Reserved
)Serial Comm.(com2
)Serial Comm.(com1
)Parallel port(LPT2
IRQ 1
IRQ 2
IRQ 3
IRQ 4
IRQ 5
PIC1
Keyboard
Reserved
)Serial Comm.(com2
)Serial Comm.(com1
)Parallel port(LPT2
Processor
IRQ 12 Reserved
PIC2
IRQ 12 Reserved
ISR
PIC2
ISR
IRQ 15 Reserved
IRQ 15 Reserved
PIC
Yehezkel C.
20
-Cascade 3
PIC
-
IRQ
2PIC
8-15
PIC
PIC
--
21
.1
.2
.6
.7
.8
Yehezkel C.
22
Yehezkel C.
21
.3
.4
.5
22
IRQ 8
20
PIC1
Processor
IRQ 8
IRQ 1
IRQ 2
IRQ 3
IRQ 4
IRQ 5
23
IRQ3
.IRR
INT.
.INTA
CPU ) (3
ISR 1 ) IRR (3 .0
INTA
DATA BUS IRQ
Non
specific EOI <=) .ISR -
.(ISR
IRET ISR ,CS ,IP
.
Yehezkel C.
23
Initialization Sequence
8259 :
.1 . Initialization command words - ICW
.2 . Operation command word - OCW
: ICW 4 :
ICW1 , ICW2, ICW4
. ICW3
: OCW 3 :
.ICW
24
Yehezkel C.
24
25
Yehezkel C.
25
Fully Nested mode
,Default IRQ :
IRQ0 IRQ7
-.
IF Non-Specific End of Interrupt EOI -
Automatic End of Interrupt
26
Yehezkel C.
26
Non-Specific Rotating
. EOI
ISR-
.
.
. Inta EOI ISR
.
NonSpecific Rotating ISR -
.
Specific Rotating
EOI ISR
.
27
Yehezkel C.
27
IRR
-
IR4IR6-
IRR
-
IR4IR6-
Priority
Priority
ISR
ISR
Priority
Priority
ISR
ISR
IRR
0
28
Yehezkel C.
28
NS_EOI
IRR
29
Yehezkel C.
29
IR4 IRR
IR4 IRR
IR6
IR6
5L
6H
Priority
ISR
NonSpecfic ISR
NonSpecfic ISR
EOI
EOI
4L
5H
Priority
6 31
0
1C.
Yehezkel
Priority
ISR
Priority
Specfic ISR
30
Yehezkel C.
EOI
30
Specfic ISR
EOI
Priority
31
ISR-
Special Mask
.
interrupt - Pulling
.STATUS -
Sti
.
W2 W1 W0
Out PIC_Cntrl_Add, al
iret
ISR3 endp
33
Yehezkel C.
33
32
Yehezkel C.
32
A0=0
Bit(s) Function
7:5
Interrupt Vector Addresses for MCS-80/85 Mode.
MSB
4 Must be set to 1 for ICW1
1
Level Triggered Interrupts
3
0
Edge Triggered Interrupts
1
Call Address Interval of 4
2
0
Call Address Interval of 8
1
Single PIC
1
0
Cascaded PICs
1
Will be Sending ICW4
0 LSB
0
Don't need ICW4
35
Yehezkel C.
35
34
Yehezkel C.
34
A0=1
Bit
7
6
5
4
3
2
1
0
8086/8080Mode
I7
I6
I5
I4
I3
37
Yehezkel C.
MCS80/85Mode
A15
A14
A13
A12
A11
A10
A9
A8
37
36
Yehezkel C.
36
320h
C8h
IR0
323h
2Ch :
IR1
IR2
39
Yehezkel C.
39
Yehezkel C.
38
Cascade -
Bit
7
6
5
4
3
2
1
0
38
A0=1
Function
IR7
IR6
IR5
IR4
IR3
IR2
IR1
IR0
is
is
is
is
is
is
is
is
connected
connected
connected
connected
connected
connected
connected
connected
to
to
to
to
to
to
to
to
a
a
a
a
a
a
a
a
Slave
Slave
Slave
Slave
Slave
Slave
Slave
Slave
Function
Reserved. Set
Reserved. Set
Reserved. Set
Reserved. Set
Reserved. Set
Slave ID
to 0
to 0
to 0
to 0
to 0
000
001
010
011
100
101
110
111
41
Slave
Slave
Slave
Slave
Slave
Slave
Slave
Slave
0
1
2
3
4
5
6
7
Yehezkel C.
41
40
A0=1
Master
.
Slave
Function
Reserved. Set to 0
Reserved. Set to 0
Reserved. Set to 0
1
Special Fully Nested Mode
0
Not Special Fully Nested Mode
0x
Non - Buffered Mode
10
Buffered Mode - Slave
11
Buffered Mode - Master
1
Auto EOI
0
Normal EOI
1
8086/8080 Mode
0
MCS-80/85
4
3:2
1
0
43
Yehezkel C.
40
ICW3
Yehezkel C.
43
42
Yehezkel C.
42
45
PIC 2
Mask IRQ15
Mask IRQ14
Mask IRQ13
Mask IRQ12
Mask IRQ11
Mask IRQ10
Mask IRQ9
Mask IRQ8
Intr_vect_table
Org 65*4
Vect_int
Intr_vect_table
PIC 1
Mask IRQ7
Mask IRQ6
Mask IRQ5
Mask IRQ4
Mask IRQ3
Mask IRQ2
Mask IRQ1
Mask IRQ0
Yehezkel C.
45
- Hardware Interrupts
old CS:EIP points past last completed instruction.
- Traps (INT 30, ... )
old CS:EIP points past instruction causing exception
- Faults (page fault, GPF, ... )
old CS:EIP points to instruction causing exception
- Aborts (hardware errors, bad system table vals...)
uncertain CS:EIP, serious problems, CPU confused
50
Yehezkel C.
44
Bit(s) Function
7
Must be set to 0
6:5
00
Reserved
01
Reserved
10
Reset Special Mask
11
Set Special Mask
4
Must be set to 0
3
Must be set to 1
1
Poll Command
2
0
No Poll Command
1:0
00
Reserved
01
Reserved
10
Next Read Returns Interrupt Request Register
11
Next Read Returns In-Service Register
Yehezkel C.
label dword
ends
47
segment at 0
4
3
2:0
47
46
Function
000
Rotate in Auto EOI Mode (Clear)
001
Non Specific EOI
010
Reserved
011
Specific EOI
100
Rotate in Auto EOI Mode (Set)
101
Rotate on Non-Specific EOI
110
Set Priority Command (Use Bits 2:0)
111
Rotate on Specific EOI (Use Bits 2:0)
Must be set to 0
Must be set to 0
000
Act on IRQ 0 or 8
001
Act on IRQ 1 or 9
010
Act on IRQ 2 or 10
011
Act on IRQ 3 or 11
100
Act on IRQ 4 or 12
101
Act on IRQ 5 or 13
110
Act on IRQ 6 or 14
111
Act on IRQ 7 or 15
Yehezkel C.
;main program
PC_PIC = 20h
NSEOI_OCW2=?????????
;Change Interrupt Vectors
46
49
Exceptions
Three types of exceptions
Depending on the way they are reported
Whether or not the interrupted instruction is restarted
Faults
Traps
Aborts
Faults and traps are reported at instruction boundaries
Aborts report severe errors
Hardware errors
Inconsistent values in system tables
Faults
Instruction boundary before the instruction during which the
Traps
Instruction boundary immediately after the instruction during
From S. Danidamudi, Introduction to Assembly Language Programming, Second Edition, Springer, 2005.
53
52
Interrupt Name
Address
Owner
Interrupt Name
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
20
21
22
23
24
25
26
27
Divide by Zero
Single Step
Nonmaskable
Breakpoint
Overflow
Print Screen
Invalid Opcode
Reserved
IRQ0 - System Timer
IRQ1 - Keyboard
IRQ2 - Reserved
IRQ3 - COM2
IRQ4 - COM1
IRQ5 - Reserved
IRQ6 - Diskette
IRQ7 - Printer
Video
Equipment Determination
Memory Size Determination
Fixed Disk/Diskette
Asynchronous Communication
System Services
Keyboard
Printer
Resident BASIC
Bootstrap Loader
Real-Time Clock Services
Keyboard Break
User Timer Tick
Video Parameters
Diskette Parameters
Video Graphics Characters
Program Terminate
General DOS Functions
Terminate Address
Ctrl+Break Handler Address
Critical Error Handler
Absolute Disk Read
Absolute Disk Write
Terminate and Stay Resident
1756:00D2
0070:06F4
1993:26D2
0070:06F4
0070:06F4
F000:FF54
F000:EB43
F000:EAEB
15BE:0000
15BE:001D
0A08:0057
0A08:006F
D60B:0095
0A08:009F
0A08:00B7
0070:06F4
15BE:0100
F000:F84D
F000:F841
15BE:0174
F000:E739
0C4C:19A0
F000:E82E
F000:EFD2
F000:E000
0C4C:1990
F000:FE6E
0070:06EE
1465:00D6
F000:F0A4
0000:0522
C000:5A52
0255:003A
15BE:01A1
18B9:02B1
1993:26BA
18B9:0155
0C4C:19DE
0C4C:1A27
0255:004C
NC
Unknown
DOS
Unknown
Unknown
BIOS
BIOS
BIOS
FAXTSR
FAXTSR
DOS
DOS
BIOS
DOS
DOS
Unknown
FAXTSR
BIOS
BIOS
FAXTSR
BIOS
SMARTDRV
BIOS
BIOS
BIOS
SMARTDRV
BIOS
Unknown
CASMGR
BIOS
Device Driver
BIOS
DOS System Area
FAXTSR
COMMAND
DOS
COMMAND
SMARTDRV
SMARTDRV
DOS System Area
28
29
2A
2B
2C
2D
2E
2F
....
40
41
42
43
44
45
46
....
70
71
72
73
74
75
76
77
....
F8
F9
FA
FB
FC
FD
FE
FF
DOS Idle
15BE:0222
DOS Internal - FAST PUTCHAR 0255:0052
Microsoft Networks
15BE:073E
Reserved for DOS
0116:10DA
Reserved for DOS
0116:10DA
Reserved for DOS
0116:10DA
DOS - Execute Command
0ACD:013F
Multiplex (Process Interface) 15BE:079E
FAXTSR
DOS System Area
FAXTSR
DOS System Area
DOS System Area
DOS System Area
COMMAND
FAXTSR
F000:EC59
F000:E13D
F000:F065
C000:5652
F000:EA97
F000:EA97
F000:E401
BIOS
BIOS
BIOS
BIOS
BIOS
BIOS
BIOS
0A08:0052
F000:EED2
0A08:00CF
0A08:00E7
0A08:00FF
F000:EEDB
0A08:0117
F000:8E8D
DOS
BIOS
DOS
DOS
DOS
BIOS
DOS
BIOS
0040:0000
7A0E:7E00
0080:7C00
972F:0001
8304:F81C
EF40:7C00
F729:F80B
0002:F000
Device Driver
Unknown
SSCDROM
Unknown
Unknown
BIOS
SSCDROM
SMARTDRV
CPU Interrupts
External Interrupts
57
Address
Owner