From owner-freebsd-amd64@FreeBSD.ORG Thu Apr 22 10:24:55 2004 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D78F16A4CF for ; Thu, 22 Apr 2004 10:24:55 -0700 (PDT) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0044E43D2D for ; Thu, 22 Apr 2004 10:24:55 -0700 (PDT) (envelope-from peter@evilpete.dyndns.org) Received: from fw.wemm.org (canning.wemm.org [192.203.228.65]) by canning.wemm.org (Postfix) with ESMTP id 88FB52A8D5 for ; Thu, 22 Apr 2004 10:24:54 -0700 (PDT) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (overcee.wemm.org [10.0.0.3]) by fw.wemm.org (Postfix) with ESMTP id 231BFE259 for ; Thu, 22 Apr 2004 10:24:57 -0700 (PDT) (envelope-from peter@overcee.wemm.org) Received: from overcee.wemm.org (localhost [127.0.0.1]) by overcee.wemm.org (8.12.11/8.12.11) with ESMTP id i3MHO2RQ066512; Thu, 22 Apr 2004 10:24:02 -0700 (PDT) (envelope-from peter@overcee.wemm.org) Received: from localhost (localhost [[UNIX: localhost]]) by overcee.wemm.org (8.12.11/8.12.11/Submit) id i3MHO2bV066511; Thu, 22 Apr 2004 10:24:02 -0700 (PDT) (envelope-from peter) From: Peter Wemm To: netch@lucky.net Date: Thu, 22 Apr 2004 10:24:02 -0700 User-Agent: KMail/1.6.1 References: <20040422050128.GQ34647@lucky.net> <200404212258.01563.peter@wemm.org> <20040422082455.GV34647@lucky.net> In-Reply-To: <20040422082455.GV34647@lucky.net> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200404221024.02535.peter@wemm.org> cc: amd64@freebsd.org Subject: Re: va_list q X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2004 17:24:55 -0000 On Thursday 22 April 2004 01:24 am, Valentin Nechayev wrote: > Wed, Apr 21, 2004 at 22:58:01, peter wrote about "Re: va_list q": > > amd64 needs to use the same code that is in the #ifdef __powerpc__. > > Its what we use in src/usr.sbin/pppd FWIW. > > Thanks, I couldn't find vfmtmsg() and thought it was introduced > after. > > > On powerpc and amd64, the argument passing ABI is so complicated > > that the sequence counters can't be fit in the spare bits in a > > pointer like on the other platforms. So on those two (and some > > other) platforms, gcc implements va_list as a pointer to an > > external structure. > > > > As an aside, this breaks code that assums it can copy va_lists by > > assignment. On powerpc and amd64, you *must* use va_copy(), or you > > simply copy the pointer, not the actual argument passing state. > > I'll copy hack from system sources. But is it better to use > va_copy()? You can't use va_copy here. The problem is what type do you give to va_arg() to pull a va_list off a va_list. gcc is inconsistent with this. But if this was copying args, you'd have to use va_copy. But it isn't. :-) > > -netch- -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5