Page 2 of 2
Re: IDT troubles
Posted: Sun Nov 03, 2024 6:08 pm
by Octocontrabass
It's hard to guess what might be wrong without seeing the relevant code. Maybe your display driver isn't interrupt-safe? Maybe your stack setup is incorrect and corrupting memory? Maybe you forgot a line of debugging code that traps the CPU in an infinite loop?
You could attach a debugger to QEMU's built-in GDB stub, set a breakpoint, and step through your code.
You could try "info registers" in the QEMU monitor to see what the CPU is doing when it halts.
Re: IDT troubles
Posted: Sun Nov 03, 2024 6:46 pm
by MichaelPetch
I'm actually curious why you aren't getting some other kind of exception after v=00.You have:
Code: Select all
for (idx = 0; idx < 256; idx++) {
entries[idx] = fill_idt_entry(0,0,0);
}
entries[0xDE] = fill_idt_entry((uint32_t) isr1, 0xCE, 1);
This sets all the entries to 0 and only 0xde (222) to an interrupt handler. What about the entries[0]? Where does it get set to a handler? Right now it is set to 0.
Re: IDT troubles
Posted: Sun Nov 03, 2024 6:51 pm
by restingwitchface
> You could attach a debugger to QEMU's built-in GDB stub, set a breakpoint, and step through your code.
> You could try "info registers" in the QEMU monitor to see what the CPU is doing when it halts.
I'll try that in a moment. GDB is personally my go-to debugger, not sure why I forgot it has QEMU support!
> I'm actually curious why you aren't getting some other kind of exception after v=00.
As I mentioned later in the thread, I set up ISRs at 0, 6, 8, 11, 13 too.
Attached is a .tar.gz of the relevant part of my kernel code, as well as the resulting kernel and intermediate binaries (you should be able to build them yourself if you have i686-elf-{gcc,elf,as} installed to a directory in your PATH). Thanks for the help so far. You should be able to reproduce my errors with make run.
Re: IDT troubles
Posted: Sun Nov 03, 2024 7:10 pm
by Octocontrabass
Code: Select all
extern uint32_t _isr0;
entries[0] = fill_idt_entry(_isr0, 0x8E, 1);
You're filling your IDT with the first four bytes of your ISRs instead of their addresses.
Re: IDT troubles
Posted: Sun Nov 03, 2024 7:13 pm
by restingwitchface
Oops!! I knew it'd be obvious in hindsight... It works well now, thanks for bearing with me. Sometime in the future you might see more of this little project.
Re: IDT troubles
Posted: Thu Nov 07, 2024 5:06 pm
by RayanMargham
Hey do u have a github, i might take a look
Re: IDT troubles
Posted: Fri Nov 08, 2024 3:25 pm
by restingwitchface
1. My GitHub account is directly next to my posts, in my user summary or whatnot.
2. My issue has already been resolved.
3. I have already stated I don't want to upload it to GitHub yet.