[OS]Exceptions and Interrupts
来源:互联网 发布:加内特生涯数据排行 编辑:程序博客网 时间:2024/05/22 17:10
一、Identifying Interrupts
1. 中断号
0~31:提前预置好的中断号,其中15和17~31被Intel保留,用于以后的扩充。
32~255:可以由软件自由定义中断内容。
2. Exceptions的分类
Faults:记录发生exception的一条指令
Traps:记录发生exception之后的一条指令
Aborts:可以设定一些不同的位置
二、Enabling and Disabling Interrupts
一些特定的情况,会有一些设置来禁止一些中断。
1. NMI Masks Further NMIs
2. IF Masks INTR
IF = 1, 外部中断是开着的
可能会改变IF的有:
RESET signal
CLI、STI
PUSHF、POPF
3. RF Masks Debug Faults
RF bit 在EFLAGS中
4. MOV or POP to SS Masks some Interrupts and Exceptions.
MOV SS, AX
MOV ESP, StackTop
can not be interrupted.
三、Priority
四、Interrupt Descriptor Table
每个描述符的长度为8 bytes
IDTR:4 bytes-IDT base 2 bytes-IDT limit
LIDT:load IDT register
SIDT:store IDT register
五、IDT Descriptors
IDT可能包含三种不同的门描述符,都是8 bytes的
1. Task gates
2. Interrupt gates
3. Trap gates
六、Interrupt Task and Interrupt Procedures
1. Interrupt Procedures
中断或者异常的处理程序就像执行了一个call指令一样
Stack of Interrupt Procedure
为了恢复中断之前的程序状态,需要保存一系列内容
Return from an Interrupt Procedure
IRET 和 RET稍有不同的地方是,EIP加4,然后将栈上的EFLAGS弹出。
RET:弹出栈上EIP CS
IRET:弹出栈上EIP,CS,EFLAGS
Flags Usage by Interrupt Procedure
1. TF(Trap Flag,防止debugging 单步调试):无论是Interrupt gate还是Trap gate,当eflags被存到栈上以后,TF都被reset,handler执行完毕,IRET以后,eflags又被恢复
2. IF(Interrupt-enable flag,防止别的interrupt使用当前的handler):Interrupt gate会reset IF,但是Trap gate不会reset IF。
Protection in Interrupt Procedure
有两种策略:
1. 将Interrupt handlers放在统一的段中
2. handler procedures放在privilege level 0 的段中
2. Interrupt Tasks
Task gate指向一个TSS Descriptor in GDT
七、Error Code
1. Ex=1,外部事件引起当前程序的中断
2. I=1,INDEX指向一个gate descriptor in IDT;I=0,看TI
3. TI=1,INDEX指向LGT;TI=0,INDEX指向GDT
八、Exception Condiitons
Exception的分类
Faults,Traps,Aborts
0 0
- [OS]Exceptions and Interrupts
- Interrupts, hardware exceptions, and signals
- Linux Kernel Interrupts, Exceptions and System Calls
- Exceptions and Interrupts Handling of LINUX
- 【xv6学习之番外篇】Exceptions and Interrupts
- Understanding the linux kernel-ch4-Interrupts and Exceptions
- Interrupts and Exceptions (中断事件与异常事件)
- 【xv6学习之Lec8】System calls, Interrupts, and Exceptions
- interrupts & exceptions中断异常
- IPC:Interrupts and Signals
- STM32L--Interrupts and events
- Interrupts and Network Drivers
- Interrupts and Interrupt Handlers
- Notes about traps and interrupts.
- White Paper: Interrupts and USB
- Differences between interrupts and traps
- CHAPTER 29 APIC VIRTUALIZATION AND VIRTUAL INTERRUPTS
- CHAPTER 29 APIC VIRTUALIZATION AND VIRTUAL INTERRUPTS
- iphone中UITableView的用法总结
- 深入理解C++中的new操作符
- struts2源码阅读
- 初涉树链剖分 hrbust 2065
- 在知道崩溃函数偏移地址的情况下,如何定位函数名和行号
- [OS]Exceptions and Interrupts
- solr && mysql
- 日志文件归档日志
- 彩色图像目标提取、图像去噪和形态学处理
- 从系统结构来研究虚拟机的设计理念和原理
- 使用 /proc 文件系统来访问 Linux 内核的内容
- hdu2084 数塔
- [cocos2dx 3.0 (五)] 使用游戏控制台Console + 添加用户自定义控制台命令
- Jdev go to file extension