From owner-freebsd-hackers Sat Aug 25 6: 4:37 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from ringworld.nanolink.com (discworld.nanolink.com [217.75.135.248]) by hub.freebsd.org (Postfix) with SMTP id E3AB437B409 for ; Sat, 25 Aug 2001 06:04:30 -0700 (PDT) (envelope-from roam@ringlet.net) Received: (qmail 6911 invoked by uid 1000); 25 Aug 2001 13:03:02 -0000 Date: Sat, 25 Aug 2001 16:03:02 +0300 From: Peter Pentchev To: Valentin Nechayev Cc: John Baldwin , David O'Brien , freebsd-hackers@FreeBSD.ORG, Steve Roome Subject: Re: function calls/rets in assembly Message-ID: <20010825160302.A559@ringworld.oblivion.bg> Mail-Followup-To: Valentin Nechayev , John Baldwin , David O'Brien , freebsd-hackers@FreeBSD.ORG, Steve Roome References: <20010824110805.C88259@dragon.nuxi.com> <20010825154427.B761@iv.nn.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010825154427.B761@iv.nn.kiev.ua>; from netch@iv.nn.kiev.ua on Sat, Aug 25, 2001 at 03:44:27PM +0300 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Aug 25, 2001 at 03:44:27PM +0300, Valentin Nechayev wrote: > Fri, Aug 24, 2001 at 11:36:45, jhb (John Baldwin) wrote about "Re: function calls/rets in assembly": > > > > printasint: > > > pushl %ebp > > > movl %esp,%ebp > > > subl $8,%esp > > > addl $-8,%esp > [...] > > > Because this code is broken and obfuscated? :) > > > > We save %esp in %ebp (the only thing that keeps it from breaking) then > > for some > > reason allocate two quadwords on the stack unnecessarily, one using an add > > instruction, one using a sub. > > Because gcc has `-mpreferred-stack-boundary=4' default. > Please read info gcc to realize what this option means. > If you want to avoid this, compile with `-mpreferred-stack-boundary=2', > as FreeBSD kernel is compiled. The only illogical thing here is > that it doesn't gather two %esp moving instructions (one for frame of > this function, one for frame for called function) to single one. [snip] > > Well, now you should add wanted options to /etc/make.conf and avoid > seeing of such nightmares. I wonder if a mentioning of -mpreferred-stack-boundary should be added to tuning(7).. G'luck, Peter -- No language can express every thought unambiguously, least of all this one. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message