This is already taken care of for you.
When an IRQ fires an interrupt is called.
Any time an interrupt is called the current value of eflags, cs and eip are pushed onto the stack. When you're finished with whatever the interrupt does you perform an iret which pops values for those registers back off the stack.
This is bog-standard x86 architecture stuff. If you aren't familiar with it then I suggest re-reading the Intel manuals before continuing much farther.
Data segments
Re:Data segments
Pype.Clicker wrote:you can use "call eax", but afaik "call ebx:eax" does not exist. You can however use "call <address of a far_pointer>" and store the "segment:offset" you'd like to jump to at that address ...
You can also do a "dynamic" far call by using a far ret instead
Code: Select all
pushl $<segment selector>
pushl $<offset>
lret
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Data segments
@bkilgore: no, that won't work. it can be used for a 'dynamic far jump", but you'll miss the current EIP and current CS that are pushed by the CPU when issueing CALL xxx instruction.
Re:Data segments
Pype: that's what i meant, dynamic far jump. Sorry bout that. For a dynamic far call though, why not just change that to:
Then the called code can issue an lret like normal and in this case it actually will be a far return to retaddr
Code: Select all
pushl %cs
pushl $retaddr
pushl $<segment selector>
pushl $<offset>
lret
retaddr: