fn stack_index(&self) -> u16 {
self.bits.get_bits(0..3) - 1
}
Here the - 1
causes a "attempt to subtract with overflow" error.
It's very easy to reproduce a panic:
log::info!("IDT: {:#?}", idt);
Probably caused by the +1 -1 translation stuff but I don't really understand why the translation is there and how the IDT encoding works.