x86_64 icon indicating copy to clipboard operation
x86_64 copied to clipboard

`EntryOptions::stack_index` panics when stack index is not set (when `Debug` is called on `EntryOptions`)

Open ChocolateLoverRaj opened this issue 5 months ago • 1 comments

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.

ChocolateLoverRaj avatar May 26 '25 00:05 ChocolateLoverRaj