problems loading GDT and 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
maalos
Posts: 1
Joined: Sat Dec 17, 2022 11:02 am

problems loading GDT and IDT

Post by maalos »

Hello everyone!
I've read through a bunch of pages about the GDT and the IDT trying to find out why the code I (and chatgpt) wrote doesn't work as it should.
https://github.com/maalos/meaty-skeleton is the link to the repo. The problem is that it does seem to create some GDT entries and one (division by zero) IDT/ISR entry, however it just doesn't work and the CPU triple faults every time I try to divide by zero. https://github.com/maalos/meaty-skeleto ... i386/idt.c is where the code for the IDT is. Can someone point out a possible cause of this issue? Am I just creating those entries and not loading them into the registers? If the answer is yes, then how do I do it?
Octocontrabass
Member
Member
Posts: 5562
Joined: Mon Mar 25, 2013 7:01 pm

Re: problems loading GDT and IDT

Post by Octocontrabass »

maalos wrote:the code I (and chatgpt) wrote
Given the widespread availability of wrong examples on the internet, I don't expect ChatGPT to be especially reliable for OS development.
maalos wrote:Can someone point out a possible cause of this issue?
Can you help us narrow down where the problem is first? Add "-d int", "-no-reboot", and "-accel tcg" to your QEMU command line to log the exceptions that occur leading up to the triple fault. It'll also be helpful if you can use addr2line to track down what EIP is pointing to when the exception occurs.
Post Reply