I am trying to implement restarting of an ISR from the beginning when it is interrupted by a higher priority handler (in Linux on an x86). To do so, I would like to set (while in the ISR) the instruction pointer (EIP) and offset (XCS) registers to point to the ISR so that it is restarted when it executes RET (It is ok to throw away the ISR's work). What is the best way to do this without erasing information about any handler that the IST itself has interrupted?

Code:
 
           /* regs is a pointer to registers saved when the interrupt occured */
void ISR(int irq, void *dev_id, struct pt_regs *regs)
{
/* do stuff here */

/* disable all interrupts */
if (was_interrupted) {
  long eip_;
  int xcs_;
  /* find where void ISR(...) is in memory (segment and offset) 
     and set registers on the stack */
  regs->eip = ?  /* BAD: this will rewrite saved data on the stack */
  regs->xcs = ?
                 /* perhaps jump to ISR? */
  }
/* enable all interrupts */

}
Thank you.