Date: Wed, 01 Jul 1998 12:22:58 -0700 From: Mike Smith <mike@smith.net.au> To: zhihuizhang <bf20761@binghamton.edu> Cc: hackers <freebsd-hackers@FreeBSD.ORG> Subject: Re: Interrupt Handling and inline assembly Message-ID: <199807011922.MAA00970@dingo.cdrom.com> In-Reply-To: Your message of "Mon, 29 Jun 1998 14:42:25 EDT." <Pine.SOL.L3.93.980629141418.18359A-100000@bingsun2>
next in thread | previous in thread | raw e-mail | index | archive | help
>
> I got two questions:
>
> (1) I read in the MailingList Archive that the interrupt blocking in
> FreeBSD is software-based, we do not communicate with 8259 (which I think
> is slower) What is the advantage of doing this besides being faster? If
> we mask interrupts off (by cli or setting the IMR register in 8259), will
> interrupts be simply discarded (the device has to request interrupt
> again) or postponed by 8259?
The interrupt mask is manipulated much more often than interrupts are
taken, so it makes sense to optimise for this case. Interrupts are
always enabled, so the interrupt handler is always called. If the
interrupt is masked, the fact that the interrupt was invoked is
recorded (see ipending) and the handler returns.
When interrupt(s) are unmasked, a check is made to see if any pending
interrupts can now be serviced.
If interrupts are disabled by cli, they will be delivered at sti. What
happens with the 8259 depends on how you disable it.
> (2) I am reading the source code in cpufunc.h:
>
> static __inline void
> setbits(volatile unsigned * addr, u_int bits)
> {
> __asm __volatile("orl %1, %0" : "=m" (*addr): "ir"(bits));
> }
>
> I have read a text on inline assembly at:
>
> http://www.rt66.com/~brennan/djgpp/djgpp_asm.html
>
> But I still do not understand the meaining of "m" and "ir".
The gcc info page has more detail.
`m'
A memory operand is allowed, with any kind of address that the
machine supports in general.
`r'
A register operand is allowed provided that it is in a general
register.
`i'
An immediate integer operand (one with constant value) is allowed.
This includes symbolic constants whose values will be known only at
assembly time.
--
\\ Sometimes you're ahead, \\ Mike Smith
\\ sometimes you're behind. \\ mike@smith.net.au
\\ The race is long, and in the \\ msmith@freebsd.org
\\ end it's only with yourself. \\ msmith@cdrom.com
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?199807011922.MAA00970>
