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?
problems loading GDT and IDT
-
- Member
- Posts: 5562
- Joined: Mon Mar 25, 2013 7:01 pm
Re: problems loading GDT and IDT
Given the widespread availability of wrong examples on the internet, I don't expect ChatGPT to be especially reliable for OS development.maalos wrote:the code I (and chatgpt) wrote
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.maalos wrote:Can someone point out a possible cause of this issue?