Re: [PATCH v2 02/17] arm64/lib: copy_page: avoid x18 register in assembler code

From: Sami Tolvanen
Date: Fri Oct 25 2019 - 17:40:25 EST


On Fri, Oct 25, 2019 at 2:41 AM Mark Rutland <mark.rutland@xxxxxxx> wrote:
> > diff --git a/arch/arm64/lib/copy_page.S b/arch/arm64/lib/copy_page.S
> > index bbb8562396af..8b562264c165 100644
> > --- a/arch/arm64/lib/copy_page.S
> > +++ b/arch/arm64/lib/copy_page.S
> > @@ -34,45 +34,45 @@ alternative_else_nop_endif
> > ldp x14, x15, [x1, #96]
> > ldp x16, x17, [x1, #112]
> >
> > - mov x18, #(PAGE_SIZE - 128)
> > + add x0, x0, #256
> > add x1, x1, #128
> > 1:
> > - subs x18, x18, #128
> > + tst x0, #(PAGE_SIZE - 1)
> >
> > alternative_if ARM64_HAS_NO_HW_PREFETCH
> > prfm pldl1strm, [x1, #384]
> > alternative_else_nop_endif
> >
> > - stnp x2, x3, [x0]
> > + stnp x2, x3, [x0, #-256]
> > ldp x2, x3, [x1]
> > - stnp x4, x5, [x0, #16]
> > + stnp x4, x5, [x0, #-240]
> > ldp x4, x5, [x1, #16]
>
> For legibility, could we make the offset and bias explicit in the STNPs
> so that these line up? e.g.
>
> stnp x4, x5, [x0, #16 - 256]
> ldp x4, x5, [x1, #16]
>
> ... that'd make it much easier to see by eye that this is sound, much as
> I trust my mental arithmetic. ;)

Sure, that makes sense. I'll change this in v3.

Sami