Issues with interrupts that push error codes

using combination ofhttps://littleosbook.github.io/andhttps://github.com/cfenollosa/os-tutorial

While my project is a little different, the same error occurs in the source code athttps://github.com/cfenollosa/os-tutorial/tree/master/19-interrupts-irqs

I've also implemented the fixes from lesson 23 in my own project, but it did not resolve the issue. I will dl the source code from lesson 23 and check if the issue still persists, I think that it will.

The issue at hand:

- When testing interrupts that push an error code (in other words, no dummy "push byte 0") it triggers a general Protection Fault in an infinite loop

For example this asm code:

; 8: Double Fault Exception (With Error Code!)

isr8:

push byte 8

jmp isr_common_stub

triggers the general protection fault exception (and calls the appropriate C function in an infinite loop)

but if I add the line "push byte 0" before push byte 8, then everything works as expected. Similarly, the ISRs that push the dummy byte 0 all seem to work fine in testing.

bochs log looks like this03362384261e[CPU0 ] fetch_raw_descriptor: GDT: index (207) 40 > limit (17)

03362494000e[CPU0 ] fetch_raw_descriptor: GDT: index (207) 40 > limit (17)

03362603739e[CPU0 ] fetch_raw_descriptor: GDT: index (207) 40 > limit (17)

03362713478e[CPU0 ] fetch_raw_descriptor: GDT: index (207) 40 > limit (17)

03362823217e[CPU0 ] fetch_raw_descriptor: GDT: index (207) 40 > limit (17)

would love help interpreting it

any insight would be helpful. I can post my code too, but I was kind of thinking that maybe the information provided could lead me in a direction.

Posted May 4, 2022, 1:57 AM UTC · edited

43
Loading comments…