[][src]Static sunrise_kernel::i386::gdt::DOUBLE_FAULT_TASK

pub static DOUBLE_FAULT_TASK: SpinLock<TssStruct>

Double fault TSS

Double faulting will most likely occur after a kernel stack overflow. We can't use the regular way of handling exception, i.e. pushing some registers and handling the exception on the same stack that we were using, since it has overflowed.

We must switch the stack when it happens, and the only way to do that is via a task gate.

We setup a Tss whose esp0 points to DOUBLE_FAULT_TASK_STACK, its eip to the double fault handler, and make the double fault vector in IDT task gate to it.

When a double fault occurs, the current (faulty) cpu registers values will be backed up to MAIN_TASK, where the double fault handler can access them to work out what happened.

IOPB

Unlike the MAIN_TASK, this TSS does not have an associated IOPB.