From owner-freebsd-mips@FreeBSD.ORG Thu Feb 25 05:26:53 2010 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 754AB1065674; Thu, 25 Feb 2010 05:26:53 +0000 (UTC) (envelope-from c.jayachandran@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 437FB8FC19; Thu, 25 Feb 2010 05:26:53 +0000 (UTC) Received: by pvg3 with SMTP id 3so1193641pvg.13 for ; Wed, 24 Feb 2010 21:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=cM0Ep5pRJGVlkdEyFqJw48zAtxsSIUnMjfQ/SblQkNk=; b=sdfZkk/NZOoxiTqI9xZSrTFD6FICjq3aX9f93enNHon0KIxKIZR8Fj0dmcj9kX80EG IiIjGydDpEAOc9TTsXRwnM/tLThnWg/5YN8lxAeV2LcMEd8eK1zuDDaTwXgy7wwgg1I7 +Q4OBr95qavpnTy/I7eBHjCsW8TvGBLxkoIeM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=A3WMvJfHdra91QfN+TPmVefiMkBdPXX1pAtnSgMrM4nWn56kMqtL/BwEG+hH7FSAai /kzznFzBn3SPOm6tixPqzyzukTyPreqP1NbsHa92klBGPBFRnhh+4d6aOjg5CPvYyVos X8K/Wf8HqhHItUEGI3hUSEPYHSpOGC+PMMmcI= MIME-Version: 1.0 Received: by 10.140.83.37 with SMTP id g37mr359446rvb.75.1267075607618; Wed, 24 Feb 2010 21:26:47 -0800 (PST) In-Reply-To: <201002250236.o1P2a2oX024250@ns.mahan.org> References: <17060.1267061906@mahan.org> <201002250236.o1P2a2oX024250@ns.mahan.org> Date: Thu, 25 Feb 2010 10:56:47 +0530 Message-ID: <98a59be81002242126k5bbf5167p7cba4917c13d1256@mail.gmail.com> From: "C. Jayachandran" To: Patrick Mahan Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-mips@freebsd.org Subject: Re: Writing MIPS assembler instructions in C X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 05:26:53 -0000 On Thu, Feb 25, 2010 at 8:01 AM, Patrick Mahan wrote: > > > %[foo] can be used to refer to named parameters (input or output, > > maybe even clobbered) of inline assembly instructions rather than > > using %0, %1, etc., which can be hard to read. =A0Consider: > > > > The brackets with the input and output parameters specify what names > > to use to refer to them in the assembly listing (here they happen to > > be mostly the same as the variable names, but that's not necessary.) > > > > Ah Sooo <*whack!*>...... > > I did not even twig on that... I had gotten it in my head that %[rt] > was something special to the compiler that caused a certain behavior > to occur. > > Now my problem is I still need to force the value pointed to "addr" into > a specific register because there is a jalr to a function else where > that I only have binary access too and it expects it's a value in > that register. =A0Can I coerce this? I may be missing something here, but have you tried : __asm__ __volatile__( "ld $8, 0(%0)\n\t" "jalr $8\n" : : "r"(addr) : "$8"); } Or is there a reason this will not work? JC. JC