From owner-freebsd-current Tue Nov 30 23:57:36 1999 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id C987114C80 for ; Tue, 30 Nov 1999 23:57:32 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id TAA04769; Wed, 1 Dec 1999 19:04:59 +1100 Date: Wed, 1 Dec 1999 18:57:06 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Dmitrij Tejblum Cc: current@FreeBSD.ORG Subject: Re: kernel: -mpreferred-stack-boundary=2 ?? In-Reply-To: <199911302306.CAA02391@tejblum.pp.ru> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 1 Dec 1999, Dmitrij Tejblum wrote: > Bruce Evans wrote: > > I would have > > expected the most generally efficient way to align doubles and the new PIII > > obkects to be aligning the stack only in functions that have such objects j > > on the stack. This requires at most one extra instruction: > > > > andl $~0xf,$esp 16-byte alignment % > > I think, it's not that simple in the usual case when the object is accessed via > (%ebp-). %ebp would have to be aligned relative to %esp, but this would require an unusal function prologue with possible complications in debuggers, and seems to require 2 or 3 more extra instructions to recover the original %esp: pushl %ebp movl %esp,%eax # extra andl $0xf,%esp # extra movl %esp,%ebp pushl %eax # extra ... # worst case: no registers saved, no local space ... # allocated, and no alloca() allowance movl -4(%ebp),%esp # extra popl %ebp ret If the caller has passed a double, then the stack alignment can be determined at compile time and the current subl-type adjustment can be used. If alloca() is not allowed for, then %esp-relative accesses can be used for auto and temporary variables, and %ebp-relative accesses for args. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message