Date: Tue, 24 Jul 2001 00:28:16 +0100 From: j mckitrick <jcm@FreeBSD-uk.eu.org> To: John Baldwin <jhb@freebsd.org> Cc: freebsd-chat@freebsd.org Subject: Re: stack use preference Message-ID: <20010724002816.A62305@dogma.freebsd-uk.eu.org> In-Reply-To: <XFMail.010723145008.jhb@FreeBSD.org>; from jhb@freebsd.org on Mon, Jul 23, 2001 at 02:50:08PM -0700 References: <20010723214050.A56756@dogma.freebsd-uk.eu.org> <XFMail.010723145008.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
| > 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010724002816.A62305>