From: Stefano Stabellini Subject: Re: [PATCH v2 for 4.5] arm32: fix build after 063188f4b3 Date: Mon, 13 Oct 2014 18:01:27 +0100 Message-ID: References: <1413214141-370-1-git-send-email-julien.grall@linaro.org> <543C02AE.4050104@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xdj2F-0003J2-Ll for xen-devel@lists.xenproject.org; Mon, 13 Oct 2014 17:03:51 +0000 In-Reply-To: <543C02AE.4050104@linaro.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: Julien Grall Cc: ian.campbell@citrix.com, Stefano Stabellini , tim@xen.org, stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Mon, 13 Oct 2014, Julien Grall wrote: > Hi Stefano, > > On 10/13/2014 05:06 PM, Stefano Stabellini wrote: > >> +int do_smc(register_t function_id, ...); > > > > I am not sure whether this is safe: the smc calling convention on arm64 > > doesn't promise to save the x0-x17 registers. The smc calling convention > > on arm32 only promises to save r4-r15. That means that after issuing an > > smc call with just two arguments, you could still find r3 to be changed > > afterwards. > > I think you'll have to manually save/restore all the registers outside > > the safety guarantees of the smc protocol. > > The calling convention specifies: > - r0-r3 as argument/scratch register on ARM32 > - x0-x17 as argument/temporary register on ARM64 > > So we don't need to save/restore them before/after calling the SMC function. I think you are right.