The "iret" Instruction

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

The "iret" Instruction

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:44 pm, edited 2 times in total.
drizzt

Re:The "iret" Instruction!!

Post by drizzt »

...
0x12345678 <---------- stack pointer before int

An interrupt occurs!

...
0x12345678
(dword) EFLAGS
(dword) CS
(dword) EIP <-----------stack pointer after int
Slasher

Re:The "iret" Instruction!!

Post by Slasher »

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.
Post Reply