Page 1 of 1

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

Posted: Wed Jan 08, 2025 4:31 am
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?

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

Posted: Wed Jan 08, 2025 9:22 am
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.