Chinaunix首页 | 论坛 | 博客
  • 博客访问: 56279
  • 博文数量: 47
  • 博客积分: 2095
  • 博客等级: 大尉
  • 技术积分: 560
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-01 18:42
文章分类

全部博文(47)

文章存档

2011年(1)

2008年(46)

我的朋友

分类: LINUX

2008-05-08 00:37:19

Interrupts and Exceptions

An interrupt is usually defined as an event that alters the sequence of instructions executed by a processor. Such events correspond to electrical signals generated by hardware circuits both inside and outside the CPU chip.

中断通常定义为改变处理器执行指令顺序的事件。这种事件对应CPU内部和外部的硬件电路产生的电子信号。

Interrupts are often divided into synchronous and asynchronous interrupts :

中断经常被分为同步和异步中断:

·         Synchronous interrupts are produced by the CPU control unit while executing instructions and are called synchronous because the control unit issues them only after terminating the execution of an instruction.

同步中断是CPU控制单元在执行指令时产生的,之所以叫做同步,是因为控制单元在执行完指令后才产生。

·         Asynchronous interrupts are generated by other hardware devices at arbitrary times with respect to the CPU clock signals.

异步中断是由其他硬件设备产生的,可以在CPU时钟信号的任意时刻到来。

Intel microprocessor manuals designate synchronous and asynchronous interrupts as exceptions and interrupts, respectively. We'll adopt this classification, although we'll occasionally use the term "interrupt signal" to designate both types together (synchronous as well as asynchronous).

Intel处理器手册划分同步和异步中断分别为异常和中断。

Interrupts are issued by interval timers and I/O devices; for instance, the arrival of a keystroke from a user sets off an interrupt.

中断是由间隔的定时器和I/O设备产生的;比如,用户击打键盘产生一个中断。

Exceptions, on the other hand, are caused either by programming errors or by anomalous conditions that must be handled by the kernel. In the first case, the kernel handles the exception by delivering to the current process one of the signals familiar to every Unix programmer. In the second case, the kernel performs all the steps needed to recover from the anomalous condition, such as a Page Fault or a request via an assembly language instruction such as int or sysenter for a kernel service.

而异常则是由程序错误或者内核必须处理的不寻常状态引起。在第一种情况下,内核通过将发送一个每个Unix程序员熟知的信号给当前的进程来处理异常。第二种情况,内核执行从这个不寻常状态恢复需要的每个步骤,比如页错误或者通过int汇编指令或者sysenter请求内核服务的请求。

We start by describing in the next section the motivation for introducing such signals. We then show how the well-known IRQs (Interrupt ReQuests) issued by I/O devices give rise to interrupts, and we detail how 80 x 86 processors handle interrupts and exceptions at the hardware level. Then we illustrate, in the section "Initializing the Interrupt Descriptor Table," how Linux initializes all the data structures required by the 80x86 interrupt architecture. The remaining three sections describe how Linux handles interrupt signals at the software level.

I/O设备提出的IRQ是如何产生中断的,x86处理器如何在硬件层次上处理中断和异常的,Linux如何初始化x86中断架构需要的所有数据结构,Linux如何在软件层次上处理中断。

One word of caution before moving on: in this chapter, we cover only "classic" interrupts common to all PCs; we do not cover the nonstandard interrupts of some architectures.

阅读(268) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~