iret
iret
IRET(interrupt return)中斷返回,中斷服務程序的最後一條指令。
目錄
彙編指令IRET
【指令格式】IRET
【指令功能】IRET(interrupt return)中斷返回,中斷服務程序的最後一條指令。IRET指令將推入堆棧的段地址和偏移地址彈出,使程序返回到原來發生中斷的地方。其作用是從中斷中恢復中斷前的狀態,具體作用有如下三點:
1.恢復IP(instruction pointer):IP←((SP)+1:(SP)),SP←SP+2
2.恢復CS(code segment):CS←((SP)+1:(SP)), SP←SP+2
FR←((SP)+1:(SP)),SP←SP+2
4.恢復ESP(返回許可權發生變化)
5.恢復SS(返回許可權發生變化)
以上操作按順序進行。
【指令手冊原文】
the IRET instruction pops the return instruction pointer, return code segment selector, and EFLAGS image from the stack to the EIP, CS, and EFLAGS registers, respectively, and then resumes execution of the interrupted program or procedure. If the return is to another privilege level, the IRET instruction also pops the stack pointer and SS from the stack, before resuming program execution.
IRET指令影響所有標誌位。