Impotent IDT

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
spicycupcake777
Posts: 1
Joined: Sat Jan 08, 2022 6:32 am
Libera.chat IRC: spicy_cupcake777

Impotent IDT

Post by spicycupcake777 »

Hi! I am working on a hobby OS I've named WiccanOS. I've currently been able to enter protected mode and start writing to the VGA buffer. The next step seemed to be to set up the IDT, so I started that. The IDT appears to have been set up properly because I immediately test the table by dividing by zero. The OS does not triple fault, so I am led to believe the exception is being handled somehow, but not how I intended. I have written a generic handler to catch double faults, but I intend to implement the other exceptions as I get to them after I get the double fault working. This generic handler currently writes to the VGA buffer a message saying that an unhandled exception as occurred then uses inline assembly for "cli" and "hlt." Everything seems to work fine except this message is never written to the buffer. I am not entirely certain what is wrong. I would guess that it is due to an incorrectly set up IDT, but I would expect a triple fault in that case. Any help would be appreciated.

My OS is in my signature, and here is a link to it.
My hobby OS: WiccanOS
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Impotent IDT

Post by Octocontrabass »

Your linker script does not include a wildcard to catch all possible read-only data sections, so the string may not end up in the binary. You probably want to use something like "*(.rodata .rodata.*)" here instead. (This is a common bug in tutorials.)

Also, you're hardcoding the number of sectors to load from the disk, so you might not be loading the sector containing the string. (This is another common bug.)

I also spotted some ABI violations in your interrupt handlers, but you haven't finished writing those.

Why do you have function definitions in your header files? Headers are supposed to contain declarations only, with the definitions in separate compilation units that get linked together.
Post Reply