Date: Tue, 30 Jun 1998 12:37:00 -0400 (EDT) From: zhihuizhang <bf20761@binghamton.edu> To: Chris Csanady <cc@tarsier.ca.sandia.gov> Cc: hackers <freebsd-hackers@FreeBSD.ORG> Subject: Re: Interrupt Handling and inline assembly Message-ID: <Pine.SOL.L3.93.980630122938.4629A-100000@bingsun2> In-Reply-To: <199806292028.NAA07249@tarsier.ca.sandia.gov>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 29 Jun 1998, Chris Csanady wrote: > > > > >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? > > > >(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". > > Take a look at at the gcc info files. These are register constraints, > and are described in detail in gcc / C Extensions / Extended Asm. > > Chris > I have looked into the Info file (because of network problem, I could not access the site yesterday). I still am a little confused with the usage of %n and n (where n are 0...9). Also, the setbits() above seems to be contradictory to what is said in the Info document: When the assembler instruction has a read-write operand, or an operand in which only some of the bits are to be changed, you must logically split its function into two separate operands, one input operand and one write-only output operand. The connection between them is expressed by constraints which say they need to be in the same location when the instruction executes. You can use the same C expression for both operands, or different expressions. For example, here we write the (fictitious) `combine' instruction with `bar' as its read-only source operand and `foo' as its read-write destination: asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar)); Obviously, (* addr) in the setbits() is a read-write operand. Thanks for your help. 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?Pine.SOL.L3.93.980630122938.4629A-100000>