现在的位置: 首页 > 综合 > 正文

iret

2013年10月14日 ⁄ 综合 ⁄ 共 1213字 ⁄ 字号 评论关闭

一下翻译的一塌糊涂,我自己都不理解。或许是原文也乱说的,或许是我的英语还很差!

原英文内容:

Interrupt Return (iret)

iret

Operation return
. routine

Description In
Real Address Mode, iret pops CS, the flags register,
and the instruction pointer from the stack and resumes the
routine that was interrupted. In Protected Mode, the setting of
the nested task flag (NT) determines the action of iret.
The IOPL flag register bits are changed when CPL equals 0 and the
new flag image is popped from the stack.

iret
returns from an interrupt procedure without a task switch if NT
equals 0. Returned code must be equally or less privileged than
the interrupt routine as indicated CS selector RPL bits popped
from the stack. If the returned code is less privileged, iret
pops SS and the stack pointer from the stack.

iret
reverses the operation of an INT or CALL that caused the task
switch if NT equals 1.The task executing iret is
updated and saved in its task segment. The code that follows iret
is executed if the task is re-entered.

iret 从中断过程中返回的时候如果NT(EFlags 的从第0位开始的第14位是NT)是0,那么就不会进行任务切换,(注:也就是说返回到同一个任务内的其他代码段)。这个时候,iret 会从stack 中弹出返回到的代码段的CS选择子,这个选择子的RPL-bits 的值所指定的特权级必须小于或等于中断过程的特权级(也就是数值上必须大于或者等于)。如果返回到的代码段的特权级小于中断过程,iret 指令从stack 中弹出值给SS和stack pointer.(应该从内核stack 中把这些先前保存起来的值弹出到相应寄存器,然后返回到本任务中的底特权级代码段中继续执行)

当NT标志被置位的时,iret执行跟INT CALL相反的操作。执行iret 指令的任务的状态会被保存到它自己的TSS段中。iret 之后的代码将在这个任务被重入的时候执行?

翻译加自己理解的主要部分,感觉对iret具体执行什么动作还是一塌糊涂!

【上篇】
【下篇】

抱歉!评论已关闭.