From owner-freebsd-arch@FreeBSD.ORG Mon Nov 12 19:16:10 2007 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93F7E16A418; Mon, 12 Nov 2007 19:16:10 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from smtpoutm.mac.com (smtpoutm.mac.com [17.148.16.83]) by mx1.freebsd.org (Postfix) with ESMTP id 773BE13C4A7; Mon, 12 Nov 2007 19:16:10 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from mac.com (asmtp003-s [10.150.69.66]) by smtpoutm.mac.com (Xserve/smtpout020/MantshX 4.0) with ESMTP id lACJG23s015319; Mon, 12 Nov 2007 11:16:02 -0800 (PST) Received: from mini-g4.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mac.com (Xserve/asmtp003/MantshX 4.0) with ESMTP id lACJG0Ca022811 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 12 Nov 2007 11:16:00 -0800 (PST) Message-Id: From: Marcel Moolenaar To: Alexander Motin In-Reply-To: <4738A444.8040708@FreeBSD.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v912) Date: Mon, 12 Nov 2007 11:15:57 -0800 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> X-Mailer: Apple Mail (2.912) Cc: Kostik Belousov , Julian Elischer , freebsd-arch@FreeBSD.org Subject: Re: Kernel thread stack usage X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2007 19:16:10 -0000 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