underscoretanner wrote:
As the title suggests my IDT malfunctions producing an invalid opcode exception when it should actually be reporting a division by zero exception.
I don't see anything in your code that should produce #DE. If you're talking about this line:
Code:
putc('A' / 0);
That is a constant expression, and the compiler will attempt to fold it to a constant value. Since the division is happening at compile time instead of at run time, there will be no #DE here. (Of course, since division by zero is undefined behavior in C, the compiler may do all sorts of wacky things, including assuming this line of code must be unreachable and removing all code paths that lead to it.)
With that said, you probably still shouldn't be getting #UD from this. Now would be a great time to look into using a debugger, although it might be possible to locate the cause just by analyzing a disassembly of your kernel.