Date: Mon, 29 Oct 2001 09:27:05 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Doug Rabson <dfr@nlsystems.com> Cc: arch@FreeBSD.org Subject: Re: syscall() ABI questions Message-ID: <XFMail.011029092705.jhb@FreeBSD.org> In-Reply-To: <Pine.BSF.4.33.0110291437220.41783-100000@herring.nlsystems.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 29-Oct-01 Doug Rabson wrote: > 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. %edx isn't call safe on i386, so it should be safe to 0 that one as well. I guess it is arch-specific however and we can't assume that we can set it to 0 on all archs? >> 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. I'll try it here locally then. -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011029092705.jhb>