From owner-freebsd-arch Mon Oct 29 6:43:40 2001 Delivered-To: freebsd-arch@freebsd.org Received: from finch-post-12.mail.demon.net (finch-post-12.mail.demon.net [194.217.242.41]) by hub.freebsd.org (Postfix) with ESMTP id 6271837B40C; Mon, 29 Oct 2001 06:43:36 -0800 (PST) Received: from [62.49.251.130] (helo=herring.nlsystems.com) by finch-post-12.mail.demon.net with esmtp (Exim 2.12 #1) id 15yDdS-00032m-0C; Mon, 29 Oct 2001 14:43:30 +0000 Received: from herring (herring [10.0.0.2]) by herring.nlsystems.com (8.11.2/8.11.2) with ESMTP id f9TEgE742924; Mon, 29 Oct 2001 14:42:14 GMT (envelope-from dfr@nlsystems.com) Date: Mon, 29 Oct 2001 14:42:14 +0000 (GMT) From: Doug Rabson To: John Baldwin Cc: Subject: Re: syscall() ABI questions In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 29 Oct 2001, John Baldwin wrote: > I've got some questions about td->td_retval[1] and our syscall ABI. On some > archs (ia64, alpha) we preinitialie this value to 0. On other archs (i386, > sparc64, ppc) we set it to the value of the register it will be set to so that > effectively this register's value is preserved across the syscall. My question > is do our syscall ABI's actually assume that for syscalls with only one return > value that register isn't written to? NetBSD recently changed their i386 > syscall code to preinitialize to 0 rather than %edx. Anyone have the history > on this? For ia64 and alpha, it is safe to pre-initialise to zero. The register used in both cases is a scratch register. In ia64, there are actually four return value registers defined by the calling convention and we use the second one (r9) for td_retval[1] and the third one (r10) for the error flag. > > Speaking of i386, I have another question. For the fork, vfork, and rfork > syscalls, we have custom handlers that call the syscall normally and then > explicitly zero the return value if %edx is 1 (i.e., the child). However, in > vm_fork(), we already explicitly set the value in %eax to 0 for child > processes, so is this extra setting of that value in libc really needed? If > not, we can safely get rid of rfork.S, vfork.S, and fork.S in libc I think. Come to think of it, we probably can get rid of the fork wrappers. I haven't tried it though. -- Doug Rabson Mail: dfr@nlsystems.com Phone: +44 20 8348 6160 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message