Interupt help

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
nolag
Posts: 16
Joined: Tue Sep 21, 2010 11:57 am

Interupt help

Post 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
eddyb
Member
Member
Posts: 248
Joined: Fri Aug 01, 2008 7:52 am

Re: Interupt help

Post 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.
nolag
Posts: 16
Joined: Tue Sep 21, 2010 11:57 am

Re: Interupt help

Post 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
User avatar
hailstorm
Member
Member
Posts: 110
Joined: Wed Nov 02, 2005 12:00 am
Location: The Netherlands

Re: Interupt help

Post 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.
nolag
Posts: 16
Joined: Tue Sep 21, 2010 11:57 am

Re: Interupt help

Post 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
Post Reply