[PATCH 03/11] Thumb-2: Implementation of the unified start-up and exceptions code

Anders Grafström grfstrm at users.sourceforge.net
Fri Mar 12 12:30:36 EST 2010


Catalin Marinas wrote:
> diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
> index b55cb03..9341b38 100644
> --- a/arch/arm/kernel/entry-common.S
> +++ b/arch/arm/kernel/entry-common.S
> @@ -33,14 +33,7 @@ ret_fast_syscall:
>  	/* perform architecture specific actions before user return */
>  	arch_ret_to_user r1, lr
>  
> -	@ fast_restore_user_regs
> -	ldr	r1, [sp, #S_OFF + S_PSR]	@ get calling cpsr
> -	ldr	lr, [sp, #S_OFF + S_PC]!	@ get pc
> -	msr	spsr_cxsf, r1			@ save in spsr_svc
> -	ldmdb	sp, {r1 - lr}^			@ get calling r1 - lr
> -	mov	r0, r0
> -	add	sp, sp, #S_FRAME_SIZE - S_PC
> -	movs	pc, lr				@ return & move spsr_svc into cpsr
> +	restore_user_regs fast = 1, offset = S_OFF
>   UNWIND(.fnend		)
>  
>  /*
> @@ -73,14 +66,7 @@ no_work_pending:
>  	/* perform architecture specific actions before user return */
>  	arch_ret_to_user r1, lr
>  
> -	@ slow_restore_user_regs
> -	ldr	r1, [sp, #S_PSR]		@ get calling cpsr
> -	ldr	lr, [sp, #S_PC]!		@ get pc
> -	msr	spsr_cxsf, r1			@ save in spsr_svc
> -	ldmdb	sp, {r0 - lr}^			@ get calling r0 - lr
> -	mov	r0, r0
> -	add	sp, sp, #S_FRAME_SIZE - S_PC
> -	movs	pc, lr				@ return & move spsr_svc into cpsr
> +	restore_user_regs fast = 0, offset = 0
>  ENDPROC(ret_to_user)
>  
>  /*

> diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
> +
> +	.macro	restore_user_regs, fast = 0, offset = 0
> +	ldr	r1, [sp, #\offset + S_PSR]	@ get calling cpsr
> +	ldr	lr, [sp, #\offset + S_PC]!	@ get pc
> +	msr	spsr_cxsf, r1			@ save in spsr_svc
> +	.if	\fast
> +	ldmdb	sp, {r1 - lr}^			@ get calling r1 - lr
> +	.else
> +	ldmdb	sp, {r0 - lr}^			@ get calling r0 - lr
> +	.endif
> +	add	sp, sp, #S_FRAME_SIZE - S_PC
> +	movs	pc, lr				@ return & move spsr_svc into cpsr
> +	.endm

This commit seems to have broken things for ARM720T and it looks like
the removal of the "mov r0, r0" instruction in restore_user_regs is what caused it.

The patch below makes it work again but why?

diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 7e9ed1e..516d14e 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -102,6 +102,7 @@
 	.else
 	ldmdb	sp, {r0 - lr}^			@ get calling r0 - lr
 	.endif
+	mov	r0, r0
 	add	sp, sp, #S_FRAME_SIZE - S_PC
 	movs	pc, lr				@ return & move spsr_svc into cpsr
 	.endm





More information about the linux-arm-kernel mailing list