IRQs & interrupts, amazing work...

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
Federico Tomassetti

IRQs & interrupts, amazing work...

Post by Federico Tomassetti »

Can someone give me some information about the
keyword interrupt in C?

I have to send the EOI (End of interrupt) word to the PIC
in my interrupt service routine or not? Documents I read
seems not have the same opinion about that...

any real good doc about PIC & IRQs?

last but not least: my code seems to catch interrupts but
my handler it's called continuosly, after some seconds bochs
terminate my os after some lines like theese:

....

00008864809e[CPU0 ] seg->selector.value = 0000
00008864830e[CPU0 ] seg = DS
00008864830e[CPU0 ] seg->selector.value = 0000
00008864851e[CPU0 ] seg = DS
00008864851e[CPU0 ] seg->selector.value = 0000
00008864868e[CPU0 ] seg = DS
00008864868e[CPU0 ] seg->selector.value = 0000

...at this point lines change...

00008864868e[CPU0 ] write_virtual_checks: valid bit = 0
00008864868e[CPU0 ] CS: 0010
00008864868e[CPU0 ] IP: 8566
00008864877e[CPU0 ] seg = DS
00008864877e[CPU0 ] seg->selector.value = 0000
00008864877e[CPU0 ] write_virtual_checks: valid bit = 0
00008864877e[CPU0 ] CS: 0010
00008864877e[CPU0 ] IP: 84e6
00008864885e[CPU0 ] seg = DS
00008864885e[CPU0 ] seg->selector.value = 0000

....

00008864934e[CPU0 ] seg = DS
00008864934e[CPU0 ] seg->selector.value = 0000
00008864934e[CPU0 ] write_virtual_checks: valid bit = 0
00008864934e[CPU0 ] CS: 0010
00008864934e[CPU0 ] IP: 8259
00008864934e[CPU0 ] seg = DS
00008864934e[CPU0 ] seg->selector.value = 0000
00008864934e[CPU0 ] write_virtual_checks: valid bit = 0
00008864934e[CPU0 ] CS: 0010
00008864934e[CPU0 ] IP: 8259
00008864934e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00008869259i[BIOS ] rombios.c,v 1.103.2.2 2004/02/02 22:39:22 cbothamy Exp $

Any ideas about that?
IRBMe

Re:IRQs & interrupts, amazing work...

Post by IRBMe »

Can someone give me some information about the
keyword interrupt in C?
The interrupt keyword works with Borland C, Watcom C/C++ and Microsoft C 6.0 but it DOESN'T work in VisualC++ or GCC.

To see how it's generated, look at the asm output of the compiler.
I have to send the EOI (End of interrupt) word to the PIC
in my interrupt service routine or not? Documents I read
seems not have the same opinion about that...
Using the 'interrupt' keyword in the compilers that support it? I don't know if they would generate that for you or not, although I doubt they would.

In general, yes you do. If you don't send an EOI then the PIC won't be able to generate any more interrupts. If the interrupt came from the master PIC, you need to send the EOI to the master. If it came from the slave PIC you need to send the EOI to the master AND the slave.
Last but not least: my code seems to catch interrupts but
my handler it's called continuosly
What handler? For what interrupt? I mean if it's a handler for the PIT for example, then it's normal that it repeatedly calls your ISR. If it's a handler for the keyboard and you don't read from the port then it'll regenerate the interrupt.

What code do you use to set up your interrupt handler? Do you use an asm stub for it, or try to use the 'interrupt' keyword? What compiler are you even using?
Dreamsmith

Re:IRQs & interrupts, amazing work...

Post by Dreamsmith »

IRBMe wrote:Using the 'interrupt' keyword in the compilers that support it? I don't know if they would generate that for you or not, although I doubt they would.
It won't. On compilers that support it, the interrupt attribute will really only do two things: first, it causes the compiler to exit the code with an IRET rather than RET, and second, it causes the compiler to treat all registers as "callee saved", rather than the usual subset.
Post Reply