From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 for 4.5] arm32: fix build after 063188f4b3 Date: Wed, 15 Oct 2014 08:31:10 +0100 Message-ID: <1413358270.10417.70.camel@citrix.com> References: <1413214141-370-1-git-send-email-julien.grall@linaro.org> <1413278157.1497.13.camel@citrix.com> <543D1A86.8010001@linaro.org> <1413291439.10417.48.camel@citrix.com> <543D1FD5.6080002@linaro.org> <543D3D9F020000780003EBF4@mail.emea.novell.com> <20141014190909.GA34461@deinos.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XeJ3E-0007z1-ND for xen-devel@lists.xenproject.org; Wed, 15 Oct 2014 07:31:16 +0000 In-Reply-To: <20141014190909.GA34461@deinos.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: xen-devel@lists.xenproject.org, Julien Grall , stefano.stabellini@citrix.com, Jan Beulich List-Id: xen-devel@lists.xenproject.org On Tue, 2014-10-14 at 21:09 +0200, Tim Deegan wrote: > At 14:13 +0100 on 14 Oct (1413292415), Jan Beulich wrote: > > >>> On 14.10.14 at 15:06, wrote: > > > On 10/14/2014 01:57 PM, Ian Campbell wrote: > > >> On Tue, 2014-10-14 at 13:43 +0100, Julien Grall wrote: > > >>> On 10/14/2014 10:15 AM, Ian Campbell wrote: > > >>>> On Mon, 2014-10-13 at 16:29 +0100, Julien Grall wrote: > > >>>>> +int do_smc(register_t function_id, ...); > > >>>> > > >>>> Are you sure that the variadic function calling convention is the same > > >>>> as for a regular function call? I'm not entirely clear having read > > >>>> AAPCS, it says they are marshalled according to "the standard base". > > >>> > > >>> All the parameters fits in a register, so the compiler will effectively > > >>> use the first registers to pass arguments. > > >> > > >> Does it? Even with variadic functions? It's not unheard of for an ABI to > > >> fallback to pushing things onto the stack for such cases, since it works > > >> out far easier in stdargs.h. > > > > > > You are right, it looks like it's compiler depend how variadic function > > > will be called. > > > > Now that should never happen - there ought to be an ABI that all > > compilers abide by. > > Indeed. It may depend on compiler _flags_ but it muct be one of the > standard layouts. By my reading of the AAPCS, calls with up to four > word-sized integer/pointer arguments (even variadic) will use > registers -- "marshalled as for the base standard" just means "not > using any of the optional rules for FP arguments". OK, so that's good. I think smc calls can potentially take more than 4 arguments, but I don't think we have any such right now. Using call_smc will help protect us against stumbling over this in the future... > All of which reminds me of this (from last year): It reminded me of the stack misalignment issue we used to have on one of the arm subarchs, which broke variadics iirc... > https://www.mikeash.com/pyblog/friday-qa-2013-06-28-anatomy-of-a-compiler-bug.html Interesting read thanks! Ian.