x86_64 icon indicating copy to clipboard operation
x86_64 copied to clipboard

TryFrom implementation for ExceptionVector

Open mrjbom opened this issue 1 year ago • 2 comments

There is currently no way to create an instance of idt::ExceptionVector having an interrupt number. At the same time it would be convenient for the user to use this enum to handle interrupts.

As for the implementation, I couldn't think of what type of error it should return.

mrjbom avatar Oct 20 '24 22:10 mrjbom

Thank you for your contribution!

There is currently no way to create an instance of idt::ExceptionVector having an interrupt number. At the same time it would be convenient for the user to use this enum to handle interrupts.

As for the implementation, I couldn't think of what type of error it should return.

Let's use a simple error type that wraps the invalid u8. Feel free to use PcidTooBig as inspiration: https://github.com/rust-osdev/x86_64/blob/323d46c46554f4c47b3e63b4b7c3facbc4bc46b8/src/instructions/tlb.rs#L78-L88

Freax13 avatar Oct 21 '24 17:10 Freax13

Made Error as enum for more details

mrjbom avatar Oct 21 '24 19:10 mrjbom

I rebased this PR onto the lastest master branch to fix CI.

Freax13 avatar Nov 16 '24 11:11 Freax13