From owner-freebsd-chat Mon Jul 23 16:28:23 2001 Delivered-To: freebsd-chat@freebsd.org Received: from serenity.mcc.ac.uk (serenity.mcc.ac.uk [130.88.200.93]) by hub.freebsd.org (Postfix) with ESMTP id 0265F37B405; Mon, 23 Jul 2001 16:28:18 -0700 (PDT) (envelope-from jcm@freebsd-uk.eu.org) Received: from dogma.freebsd-uk.eu.org ([130.88.200.97] ident=root) by serenity.mcc.ac.uk with esmtp (Exim 2.05 #6) id 15Op7Z-000IFe-00; Tue, 24 Jul 2001 00:28:17 +0100 Received: (from jcm@localhost) by dogma.freebsd-uk.eu.org (8.11.3/8.11.1) id f6NNSGL62328; Tue, 24 Jul 2001 00:28:16 +0100 (BST) (envelope-from jcm) Date: Tue, 24 Jul 2001 00:28:16 +0100 From: j mckitrick To: John Baldwin Cc: freebsd-chat@freebsd.org Subject: Re: stack use preference Message-ID: <20010724002816.A62305@dogma.freebsd-uk.eu.org> References: <20010723214050.A56756@dogma.freebsd-uk.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: ; from jhb@freebsd.org on Mon, Jul 23, 2001 at 02:50:08PM -0700 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org | > memory. So the question (if it still stands) is do you subtract the space | > for local vars before or after moving esp to ebp? I've seen both ways in | > Win32 and Unix code. | | After. This way you can always get to the old frame at [ebp] and the IP of the | previous frame at [ebp+4]. These constant offets are quite handy for walking | back stack traces by hand. See the descriptions of the 286+ enter and leave | instructions. Hmmm. The argument I heard for moving esp to ebp before making room for local variables is that function parameters are accessible at positive offsets from esp, and all locals are negative. I guess that puts the previous IP and stack frame at [total space req'd by local vars + 0] and [+4] respectively. jcm -- o-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-o | ~~~~~~~~~~~~ Jonathon McKitrick ~~~~~~~~~~~~~ | | "I prefer the term 'Artificial Person' myself." | o-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-o To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message