Re: [PATCH v4 03/17] arm64: kvm: stop treating register x18 as caller save

Sami Tolvanen
2019-11-04T21:44:50Z

On Mon, Nov 4, 2019 at 3:51 AM Mark Rutland <mark.rutland@arm.com> wrote:
> > --- a/arch/arm64/kvm/hyp/entry.S
> > +++ b/arch/arm64/kvm/hyp/entry.S
> > @@ -23,6 +23,7 @@
> > .pushsection .hyp.text, "ax"
> >
>
> Could we please add a note here, e.g.
>
> /*
> * We treat x18 as callee-saved as the host may use it as a platform
> * register (e.g. for shadow call stack).
> */
>
> ... as that will avoid anyone trying to optimize this away in future
> after reading the AAPCS.

Sure, that's a good idea.

> > .macro restore_callee_saved_regs ctxt
> > + // We assume \ctxt is not x18-x28
>
> Probably worth s/assume/require/ here.

Agreed, I'll change this in v5.

Sami