Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Nov 2007 11:15:57 -0800
From:      Marcel Moolenaar <xcllnt@mac.com>
To:        Alexander Motin <mav@FreeBSD.org>
Cc:        Kostik Belousov <kostikbel@gmail.com>, Julian Elischer <julian@elischer.org>, freebsd-arch@FreeBSD.org
Subject:   Re: Kernel thread stack usage
Message-ID:  <A8FF112D-5A5F-4370-8139-A1878D24B0D4@mac.com>
In-Reply-To: <4738A444.8040708@FreeBSD.org>
References:  <1191187393.00807485.1191175801@10.7.7.3> <1191189248.00807488.1191177603@10.7.7.3> <4736D8AF.7010209@FreeBSD.org> <20071111163815.GJ37471@deviant.kiev.zoral.com.ua> <47373C5E.2080800@elischer.org> <0414590D-0C2A-4EBD-9617-7AC193ABD1E8@mac.com> <4737696A.7050605@FreeBSD.org> <06618562-A789-4B5E-94BF-0ED8AB51A1FF@mac.com> <4737D7E3.3090500@elischer.org> <2FA48BC6-BCF3-4C16-B914-30A13C15B8AA@mac.com> <4738A444.8040708@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Nov 12, 2007, at 11:06 AM, Alexander Motin wrote:

> For i386 platform we have registers pointing current stack head. To  
> simplify my example I have used address of local variable for that.  
> Probably for ia64 we should just use one more register or algorithm  
> to take into account second stack growing upward.

Remember that taking the address of a local variable automatically
prevents that variable from being register-promoted. As such, it
increases stack pressure :-)

I think GCC has an intrinsic to get the current frame pointer. You
may want to use that instead. Granted, this would not help ia64,
but it's better than taking the address of a local variable. For
ia64 you can do as you suggest and add a second "algorithm". This
means you probably want to make it machine specific in the first
place (i.e. add a MD function that returns an approximation of the
number of bytes of stack space in use).

-- 
Marcel Moolenaar
xcllnt@mac.com





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A8FF112D-5A5F-4370-8139-A1878D24B0D4>