[PATCHv2 05/11] arm64: entry: prepare ret_to_user for function call

Catalin Marinas catalin.marinas at arm.com
Thu Dec 17 13:38:11 EST 2020


On Thu, Dec 17, 2020 at 09:57:40AM -0800, Guenter Roeck wrote:
> Hi,
> 
> On Mon, Nov 30, 2020 at 11:59:44AM +0000, Mark Rutland wrote:
> > In a subsequent patch ret_to_user will need to make a C function call
> > (in some configurations) which may clobber x0-x18 at the start of the
> > finish_ret_to_user block, before enable_step_tsk consumes the flags
> > loaded into x1.
> > 
> > In preparation for this, let's load the flags into x19, which is
> > preserved across C function calls. This avoids a redundant reload of the
> > flags and ensures we operate on a consistent shapshot regardless.
> > 
> > There should be no functional change as a result of this patch. At this
> > point of the entry/exit paths we only need to preserve x28 (tsk) and the
> > sp, and x19 is free for this use.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> > Cc: Catalin Marinas <catalin.marinas at arm.com>
> > Cc: James Morse <james.morse at arm.com>
> > Cc: Will Deacon <will at kernel.org>
> 
> This patch results in:
> 
> arch/arm64/kernel/entry.S: Assembler messages:
> arch/arm64/kernel/entry.S:774: Error: immediate out of range at operand 3 -- `and x2,x19,#((1<<1)|(1<<0)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<7))'
> 
> This is with gcc 9.3.0 and binutils 2.34. Do I need a special compiler
> and/or binutils version to make it compile ?

It has been fixed in Linus' tree last night. It's a limitation of the
instruction rather than toolchain.

-- 
Catalin



More information about the linux-arm-kernel mailing list