From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7922 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Moving forward with sh2/nommu Date: Thu, 11 Jun 2015 13:22:27 -0400 Message-ID: <20150611172227.GY17573@brightrain.aerifal.cx> References: <20150601151107.GA20759@brightrain.aerifal.cx> <20150610033050.GS17573@brightrain.aerifal.cx> <5579085B.5090407@landley.net> <20150611151252.GW17573@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1434043372 22563 80.91.229.3 (11 Jun 2015 17:22:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Jun 2015 17:22:52 +0000 (UTC) Cc: "D. Jeff Dionne" , ysato@users.sourceforge.jp, shumpei.kawasaki@swhwc.com To: musl@lists.openwall.com Original-X-From: musl-return-7935-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jun 11 19:22:47 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Z36Bh-0007di-VZ for gllmg-musl@m.gmane.org; Thu, 11 Jun 2015 19:22:46 +0200 Original-Received: (qmail 15940 invoked by uid 550); 11 Jun 2015 17:22:44 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 15918 invoked from network); 11 Jun 2015 17:22:43 -0000 Content-Disposition: inline In-Reply-To: <20150611151252.GW17573@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7922 Archived-At: On Thu, Jun 11, 2015 at 11:12:52AM -0400, Rich Felker wrote: > > >> 3. We need sh/vfork.s since the default vfork.c just uses fork, which > > >> won't work. I have a version locally but it doesn't make sense to > > >> commit without runtime trap number selection. > > > > > > Done and updated to use runtime selection in the (ugly) patch. > > > > If they ask for vfork() they should get vfork()...? > > Yes. The "runtime selection" is about the syscall trap number, not > whether or not to use vfork. I committed vfork to upstream musl now, > but with a SH3/4 trap number to be consistent with the code that's > upstream now. Later I'll either convert them all to trap 31 (0x1f) if > that ends up being acceptable, or merge the runtime-selection code, > but I think it makes sense to make the change across all files at > once, whichever way it's done. Ah, maybe I misunderstood. If you were asking abaout the original remark that the default vfork.c uses fork, the reason is simply that you can't write vfork() in C. The return from vfork() in the child will clobber vfork's stack frame, which may contain the return address or saved registers, and then when the parent resumes, very bad things will happen. vfork() has to be implemented in asm to ensure that any state it needs to be able to return in the parent is kept in registers rather than memory. Thus, each arch needs an arch-specific version, and we just hadn't gotten around to adding the sh version yet. Rich