IDT troubles

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.
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: IDT troubles

Post 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.
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: IDT troubles

Post 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.
User avatar
restingwitchface
Posts: 18
Joined: Sat Nov 02, 2024 2:58 pm
GitHub: https://github.com/NyxNeptune

Re: IDT troubles

Post 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.
Attachments
pgos.tar.gz
.tar.gz of the PGOS kernel, minus irrelevant drivers etc.
(11.89 KiB) Downloaded 112 times
she/her, please.

Don't flirt with me.
Oderint dum metuant.
GPG fingerprints:

Code: Select all

b16598566a5124946d87279fbc2d2dd299af811e (encryption)
b504ba54c5c164257156f53a32409b59258453e0 (signing)
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: IDT troubles

Post 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.
User avatar
restingwitchface
Posts: 18
Joined: Sat Nov 02, 2024 2:58 pm
GitHub: https://github.com/NyxNeptune

Re: IDT troubles

Post 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.
she/her, please.

Don't flirt with me.
Oderint dum metuant.
GPG fingerprints:

Code: Select all

b16598566a5124946d87279fbc2d2dd299af811e (encryption)
b504ba54c5c164257156f53a32409b59258453e0 (signing)
RayanMargham
Member
Member
Posts: 59
Joined: Tue Jul 05, 2022 12:37 pm

Re: IDT troubles

Post by RayanMargham »

Hey do u have a github, i might take a look
User avatar
restingwitchface
Posts: 18
Joined: Sat Nov 02, 2024 2:58 pm
GitHub: https://github.com/NyxNeptune

Re: IDT troubles

Post 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.
she/her, please.

Don't flirt with me.
Oderint dum metuant.
GPG fingerprints:

Code: Select all

b16598566a5124946d87279fbc2d2dd299af811e (encryption)
b504ba54c5c164257156f53a32409b59258453e0 (signing)
Post Reply