Page 1 of 1

Interupt help

Posted: Sun Sep 26, 2010 10:28 am
by nolag
Hi all I just started an OS and I got printing to the screen done, and I want to work on interrupts. I see the tutorial, http://wiki.osdev.org/Interrupt_Service_Routines, but I am wondering how the CPU would know to call the segment of the code labeled _isr_wrapper.

Thanks in advance for any help
nolag

Re: Interupt help

Posted: Sun Sep 26, 2010 10:55 am
by eddyb
nolag wrote:Hi all I just started an OS and I got printing to the screen done, and I want to work on interrupts. I see the tutorial, http://wiki.osdev.org/Interrupt_Service_Routines, but I am wondering how the CPU would know to call the segment of the code labeled _isr_wrapper.

Thanks in advance for any help
nolag
"For the system to know which interrupt service routine to call when a certain interrupt occurs, offsets to the ISR's are stored in the Interrupt Descriptor Table when you're in Protected mode, or in the Interrupt Vector Table when you're in Real Mode." << the answer was in that very article.

Re: Interupt help

Posted: Sun Sep 26, 2010 11:05 am
by nolag
Yes, but what I don't understand is do I need to execute that code first or just jump to the area it is defined and it will know? Sorry I did not make myself clear. Because GDT tutorial shows how to set one up, and then it tells me to jump to it to get to protected mode but I don't see anything executing the GDT until that point is that how it should be?

Sorry I know its a newb question and I understand most things better than this I feel silly.

Thanks for your help, I appreciate it

Re: Interupt help

Posted: Sun Sep 26, 2010 11:56 am
by hailstorm
The best description for protected mode is that it is a table driven operating mode. In the global descriptor table you define your code and data segments and in interrupt descriptor table you define the entries for your isr's. Each entry in the IDT contains a selector for the code segment that contains the ISR and ofcourse the offset of the ISR. On interrupt, the cpu fetches the entry from the IDT and jumps to the ISR. It is as simple as that, don't make it more complicated than that. It just knows where it has to go because you defined the IDT and loaded the idt-pointer.

Re: Interupt help

Posted: Mon Sep 27, 2010 12:41 pm
by nolag
Thank you for your help. I will try again with it some time this week. I some times have a habbit of overcomplicating things :oops:.

Thanks again
nolag