From owner-freebsd-hackers Tue Jun 30 09:37:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA19061 for freebsd-hackers-outgoing; Tue, 30 Jun 1998 09:37:27 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from bingsun1 (bingsun1.cc.binghamton.edu [128.226.1.2]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id JAA19042 for ; Tue, 30 Jun 1998 09:37:19 -0700 (PDT) (envelope-from bf20761@binghamton.edu) Received: from localhost (bf20761@localhost) by bingsun1 (SMI-8.6/8.6.9) with SMTP id MAA07825; Tue, 30 Jun 1998 12:37:01 -0400 Date: Tue, 30 Jun 1998 12:37:00 -0400 (EDT) From: zhihuizhang X-Sender: bf20761@bingsun1 Reply-To: zhihuizhang To: Chris Csanady cc: hackers Subject: Re: Interrupt Handling and inline assembly In-Reply-To: <199806292028.NAA07249@tarsier.ca.sandia.gov> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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