linux-mips
[Top] [All Lists]

Re: How to detect STACKOVEFLOW on mips

To: David VomLehn <dvomlehn@cisco.com>
Subject: Re: How to detect STACKOVEFLOW on mips
From: "Maciej W. Rozycki" <macro@linux-mips.org>
Date: Wed, 30 Jun 2010 23:13:50 +0100 (BST)
Cc: Phil Staub <phils@windriver.com>, Adam Jiang <jiang.adam@gmail.com>, linux-mips@linux-mips.org
In-reply-to: <20100630181627.GB20597@dvomlehn-lnx2.corp.sa.net>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <AANLkTimL7YMyb2ahmTgl8dqV_DNfsROjDhLEDm4jyVWE@mail.gmail.com> <4C2B543E.2010309@windriver.com> <20100630181627.GB20597@dvomlehn-lnx2.corp.sa.net>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Alpine 2.00 (LFD 1167 2008-08-23)
On Wed, 30 Jun 2010, David VomLehn wrote:

> > How about something like:
> > 
> > {
> >     long x;
> >     ...
> >     asm("move %0,$29":"=g"(x));
> >     ...
> > }
> 
> Depending on the version of gcc you are using, you should also be able
> to use __builtin_frame_address(), though I haven't tried this in the kernel.

 It works just fine with a zero argument; the usual restrictions apply to 
non-zero arguments.  Or alternatively an explicit register variable will 
do as suggested by Ralf.  Both approaches result in a bit better code than 
an explicit move; the former is portable to other platforms even. :)

  Maciej

<Prev in Thread] Current Thread [Next in Thread>