how do i code interrupts with grub (32-bit)?

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
tunge
Posts: 1
Joined: Wed Jan 08, 2025 4:21 am

how do i code interrupts with grub (32-bit)?

Post by tunge »

i am attempting to write my own os with GRUB, and i just got a keyboard driver working. i don't want to check if you have typed anything in a while(true) loop, so i tried interrupts. interrupts need an idt, so i went to configure one. the wiki says i need to have a valid gdt section for each section in my idt: "Selector: A Segment Selector with multiple fields which must point to a valid code segment in your GDT." GRUB doesn't give me that info, what do i do now?
MichaelPetch
Member
Member
Posts: 799
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: how do i code interrupts with grub (32-bit)?

Post by MichaelPetch »

You have to create your own GDT and then reload all the segment registers (CS/DS/ES/FS/GS/SS) with selectors in your GDT. You can use a kernel code selector in your new GDT as the selector in your IDT entries.
Post Reply