From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12173 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Wasm support patch 2 (static syscalls) Date: Tue, 28 Nov 2017 13:55:21 -0500 Message-ID: <20171128185521.GC1627@brightrain.aerifal.cx> References: <20171128125948.GK15263@port70.net> <20171128140531.GM15263@port70.net> <20171128175221.GP15263@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1511895334 17558 195.159.176.226 (28 Nov 2017 18:55:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Nov 2017 18:55:34 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-12189-gllmg-musl=m.gmane.org@lists.openwall.com Tue Nov 28 19:55:30 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eJl2W-000469-Fo for gllmg-musl@m.gmane.org; Tue, 28 Nov 2017 19:55:28 +0100 Original-Received: (qmail 22427 invoked by uid 550); 28 Nov 2017 18:55:33 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 22407 invoked from network); 28 Nov 2017 18:55:33 -0000 Content-Disposition: inline In-Reply-To: <20171128175221.GP15263@port70.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:12173 Archived-At: On Tue, Nov 28, 2017 at 06:52:22PM +0100, Szabolcs Nagy wrote: > * John Starks [2017-11-28 16:51:19 +0000]: > > What if you redefine the syscall numbers in wasm to be function > > pointers to the actual syscalls, e.g. #define SYS_unlink > > ((long)&__syscall_unlink). Then __syscall and friends can just > > apply the arguments to the function pointer. This should play nice > > with the linker and probably optimizes well. > > you have to be able to cast it to the right type of > function pointer then and pass the right amount of > arguments. To make this formally correct, I think all the __syscall_x functions should just take 6 (or 7?) arguments and always be called with a dummy arg of 0 in the additional slots. This can be done in the wasm syscall_arch.h with no changes to musl code. Rich