From owner-freebsd-sparc Sun Jan 12 13:15:42 2003 Delivered-To: freebsd-sparc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D3C0337B401 for ; Sun, 12 Jan 2003 13:15:40 -0800 (PST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 79F9A43ED8 for ; Sun, 12 Jan 2003 13:15:39 -0800 (PST) (envelope-from tmoestl@gmx.net) Received: (qmail 9387 invoked by uid 0); 12 Jan 2003 21:15:38 -0000 Received: from p508e7fb6.dip.t-dialin.net (HELO galatea.local) (80.142.127.182) by mail.gmx.net (mp013-rz3) with SMTP; 12 Jan 2003 21:15:38 -0000 Received: from localhost ([127.0.0.1] helo=galatea.local) by galatea.local with esmtp (Exim 4.12 #1) id 18XpTj-0001Il-00; Sun, 12 Jan 2003 22:17:11 +0100 Received: (from tmm@localhost) by galatea.local (8.12.6/8.12.6/Submit) id h0CLH6V5005006; Sun, 12 Jan 2003 22:17:06 +0100 (CET) Date: Sun, 12 Jan 2003 22:17:06 +0100 From: Thomas Moestl To: John Polstra Cc: sparc@freebsd.org Subject: Re: Question about odd stack pointer values on sparc64 Message-ID: <20030112211706.GA278@crow.dom2ip.de> Mail-Followup-To: John Polstra , sparc@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Sun, 2003/01/12 at 12:44:44 -0800, John Polstra wrote: > Still working on getting Modula-3 going on Sparc64. I think I'm > getting close ... > > In GDB I notice that the stack pointer and frame pointer are often > (always?) odd numbers, e.g.: > > (gdb) p/x $sp > $1 = 0x7fdffffdec1 > (gdb) p/x $fp > $2 = 0x7fdffffdfb1 > > What is the reason for that? Are the low-order bits simply ignored? > Surely the stack is more aligned than that. The actual stack location is %sp + SPOFF (where SPOFF is 2047) by convention. This causes the stack pointer to always contain an odd number; 32 bit binaries do not have this offset, so their stack pointers are always even. This allows some kernel trap handlers to easily distinguish between 32 and 64 bit binaries. 2047 seems to have been chosen of all odd numbers to enlarge the range of "interesting" %fp-relative locations addressable using immediates. The SPARC compliance definition (SCD) has more information on this (it's available at http://www.sparc.com/resource.htm). - Thomas -- Thomas Moestl http://www.tu-bs.de/~y0015675/ http://people.FreeBSD.org/~tmm/ PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message