Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 1998 15:36:08 -0400
From:      Andrew Heybey <ath@niksun.com>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   masking of hardware interrupts in {,icu_}vector.s
Message-ID:  <199809171936.PAA00480@stiegl.niksun.com>

next in thread | raw e-mail | index | archive | help
[I'm working with -STABLE though the vectors in -current look unchanged.]

The interrupt vectors in sys/i386/isa/vector.s (icu_vector.s in -current) mask
the current interrupt in the hardware while the interrupt handler runs.  Is
this done for any reason besides efficiency?  For example, say I wanted to
change the interrupt vector to count hardware interrupts even if the handler
was already executing.  If I dike out the parts of the INTR macro in vector.s
as follows:

#if 0
	movb	_imen + IRQ_BYTE(irq_num),%al ; \
	orb	$IRQ_BIT(irq_num),%al ; \
	movb	%al,_imen + IRQ_BYTE(irq_num) ; \
	outb	%al,$icu+ICU_IMR_OFFSET ; \
#endif
	enable_icus ; \
        /* Following line is new code to count HW interrupts. */ \
	incl	_interrupt_count + (irq_num) * 4 ; /* Count this HW intr */ \
	movl	_cpl,%eax ; \
	testb	$IRQ_BIT(irq_num),%reg ; \
	jne	2f ; \
	incb	_intr_nesting_level ; \
__CONCAT(Xresume,irq_num): ; \
	FAKE_MCOUNT(12*4(%esp)) ;	/* XXX late to avoid double count */ \
	incl	_cnt+V_INTR ;	/* tally interrupts */ \
	movl	_intr_countp + (irq_num) * 4,%eax ; \
	incl	(%eax) ; \
	movl	_cpl,%eax ; \
	pushl	%eax ; \
	pushl	_intr_unit + (irq_num) * 4 ; \
	orl	_intr_mask + (irq_num) * 4,%eax ; \
	movl	%eax,_cpl ; \
	sti ; \
	call	*_intr_handler + (irq_num) * 4 ; \
	cli ;			/* must unmask _imen and icu atomically */ \
#if 0
	movb	_imen + IRQ_BYTE(irq_num),%al ; \
	andb	$~IRQ_BIT(irq_num),%al ; \
	movb	%al,_imen + IRQ_BYTE(irq_num) ; \
	outb	%al,$icu+ICU_IMR_OFFSET ; \
#endif

What I think this means is that if the same interrupt happens again, then the 
handler won't run (because the CPL is set too high), but the vector will run 
and count the extra interrupt.

Is there anything I'm going to break by doing this?  I am going to try it to
see what happens, but I thought I would ask just in case there is magic about
the ICU and/or devices that I don't understand that would make this fail.

thanks,
andrew



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809171936.PAA00480>