Returning from an abort
Posted: Mon Feb 23, 2009 9:23 pm
Hi all, new guy here.
I guess I'll start off with a question about abortive exceptions on x86 architecture, specifically the double-fault. Normally, when a double-fault exception occurs, the faulting code section cannot be restarted because the return address pushed onto the stack is undefined (is it pushed onto the stack? I don't know specifically.) Even so, if I set up the double-fault exception handler to be called through a task gate, will the valid CS and EIP of the faulting instruction be saved in the code section's TSS? Can I retrieve those registers and "fudge" a return to the faulting code section? And even if that's possible, does an abort create some internal state in the processor that prevents a return absolutely?
If not, I think I can patch any contributory exception or page fault handlers to immediately IRET to handling code outside the context of an interrupt, so that no double faults will ever occur. I'm hoping that can work.
Now, I know that it is always a good idea to avoid any type of aborts, but the nature of my purposes necessarily involves general protection exceptions following from contributory exceptions (I'm more or less stacking two independent kernels on top of one another hierarchically, with the ring 0 kernel mediating the ring 1 kernel.) Just in case you wanted to know why I'd have to ask this question.
Thanks,
Cone
I guess I'll start off with a question about abortive exceptions on x86 architecture, specifically the double-fault. Normally, when a double-fault exception occurs, the faulting code section cannot be restarted because the return address pushed onto the stack is undefined (is it pushed onto the stack? I don't know specifically.) Even so, if I set up the double-fault exception handler to be called through a task gate, will the valid CS and EIP of the faulting instruction be saved in the code section's TSS? Can I retrieve those registers and "fudge" a return to the faulting code section? And even if that's possible, does an abort create some internal state in the processor that prevents a return absolutely?
If not, I think I can patch any contributory exception or page fault handlers to immediately IRET to handling code outside the context of an interrupt, so that no double faults will ever occur. I'm hoping that can work.
Now, I know that it is always a good idea to avoid any type of aborts, but the nature of my purposes necessarily involves general protection exceptions following from contributory exceptions (I'm more or less stacking two independent kernels on top of one another hierarchically, with the ring 0 kernel mediating the ring 1 kernel.) Just in case you wanted to know why I'd have to ask this question.
Thanks,
Cone