The "iret" Instruction
The "iret" Instruction
..
Last edited by Perica on Sun Dec 03, 2006 8:44 pm, edited 2 times in total.
Re:The "iret" Instruction!!
...
0x12345678 <---------- stack pointer before int
An interrupt occurs!
...
0x12345678
(dword) EFLAGS
(dword) CS
(dword) EIP <-----------stack pointer after int
0x12345678 <---------- stack pointer before int
An interrupt occurs!
...
0x12345678
(dword) EFLAGS
(dword) CS
(dword) EIP <-----------stack pointer after int
Re:The "iret" Instruction!!
As Drizzt said, the interrupt causes the CPU to Push the
EFLAGS,CP and EIP in that order onto the stack. The iret instruction is an Interrupt Return instruction that causes the CPU to restore the EFLAGS,CP and EIP values to the ones previously stored on the stack(it pops them off the stack in reverse order EIP,CP then EFLAGS). This effectively returns the CPU to the program at the point in its code when the interrupt occurred. Hope this helps.
EFLAGS,CP and EIP in that order onto the stack. The iret instruction is an Interrupt Return instruction that causes the CPU to restore the EFLAGS,CP and EIP values to the ones previously stored on the stack(it pops them off the stack in reverse order EIP,CP then EFLAGS). This effectively returns the CPU to the program at the point in its code when the interrupt occurred. Hope this helps.