Re: [PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-26 Thread Anton Vorontsov
On Wed, Sep 26, 2012 at 03:05:24PM -0700, Stephen Boyd wrote:
> > Just move the macros into header file as we would want to use them for
> > KGDB FIQ entry code.
> >
> > The following macros were moved:
> >
> >  - svc_entry
> >  - usr_entry
> >  - kuser_cmpxchg_check
> >  - vector_stub
> >
> > To make kuser_cmpxchg_check actually work across different files, we
> > also have to make kuser_cmpxchg64_fixup global.
> >
> > Signed-off-by: Anton Vorontsov 
> 
> Why can't we put the fiq entry code from the next patch into
> entry-armv.S? Sorry if this has been asked before but I don't see any
> reasoning in the commit text.

Thanks for taking a look!

This is a prerequisite to just logically separate KGDB FIQ code from the
entry code.

Or to put it the other way around: KGDB FIQ is just another user of the
FIQs, nothing quite special in it to put it alongside the entry code. :-)

But if Russell or other folks feel that having KGDB FIQ asm code in
entry-armv.S makes sense, I'd definitely do this.

Thanks,
Anton.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-26 Thread Stephen Boyd
On 09/24/12 14:27, Anton Vorontsov wrote:
> Just move the macros into header file as we would want to use them for
> KGDB FIQ entry code.
>
> The following macros were moved:
>
>  - svc_entry
>  - usr_entry
>  - kuser_cmpxchg_check
>  - vector_stub
>
> To make kuser_cmpxchg_check actually work across different files, we
> also have to make kuser_cmpxchg64_fixup global.
>
> Signed-off-by: Anton Vorontsov 

Why can't we put the fiq entry code from the next patch into
entry-armv.S? Sorry if this has been asked before but I don't see any
reasoning in the commit text.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-26 Thread Stephen Boyd
On 09/24/12 14:27, Anton Vorontsov wrote:
 Just move the macros into header file as we would want to use them for
 KGDB FIQ entry code.

 The following macros were moved:

  - svc_entry
  - usr_entry
  - kuser_cmpxchg_check
  - vector_stub

 To make kuser_cmpxchg_check actually work across different files, we
 also have to make kuser_cmpxchg64_fixup global.

 Signed-off-by: Anton Vorontsov anton.voront...@linaro.org

Why can't we put the fiq entry code from the next patch into
entry-armv.S? Sorry if this has been asked before but I don't see any
reasoning in the commit text.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-26 Thread Anton Vorontsov
On Wed, Sep 26, 2012 at 03:05:24PM -0700, Stephen Boyd wrote:
  Just move the macros into header file as we would want to use them for
  KGDB FIQ entry code.
 
  The following macros were moved:
 
   - svc_entry
   - usr_entry
   - kuser_cmpxchg_check
   - vector_stub
 
  To make kuser_cmpxchg_check actually work across different files, we
  also have to make kuser_cmpxchg64_fixup global.
 
  Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
 
 Why can't we put the fiq entry code from the next patch into
 entry-armv.S? Sorry if this has been asked before but I don't see any
 reasoning in the commit text.

Thanks for taking a look!

This is a prerequisite to just logically separate KGDB FIQ code from the
entry code.

Or to put it the other way around: KGDB FIQ is just another user of the
FIQs, nothing quite special in it to put it alongside the entry code. :-)

But if Russell or other folks feel that having KGDB FIQ asm code in
entry-armv.S makes sense, I'd definitely do this.

Thanks,
Anton.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-24 Thread Anton Vorontsov
Just move the macros into header file as we would want to use them for
KGDB FIQ entry code.

The following macros were moved:

 - svc_entry
 - usr_entry
 - kuser_cmpxchg_check
 - vector_stub

To make kuser_cmpxchg_check actually work across different files, we
also have to make kuser_cmpxchg64_fixup global.

Signed-off-by: Anton Vorontsov 
---
 arch/arm/kernel/entry-armv.S   | 167 +---
 arch/arm/kernel/entry-header.S | 170 +
 2 files changed, 171 insertions(+), 166 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098..0f15368 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -136,57 +136,6 @@ common_invalid:
b   bad_mode
 ENDPROC(__und_invalid)
 
-/*
- * SVC mode handlers
- */
-
-#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
-#define SPFIX(code...) code
-#else
-#define SPFIX(code...)
-#endif
-
-   .macro  svc_entry, stack_hole=0
- UNWIND(.fnstart   )
- UNWIND(.save {r0 - pc})
-   sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
-#ifdef CONFIG_THUMB2_KERNEL
- SPFIX(str r0, [sp])   @ temporarily saved
- SPFIX(mov r0, sp  )
- SPFIX(tst r0, #4  )   @ test original stack alignment
- SPFIX(ldr r0, [sp])   @ restored
-#else
- SPFIX(tst sp, #4  )
-#endif
- SPFIX(subeq   sp, sp, #4  )
-   stmia   sp, {r1 - r12}
-
-   ldmia   r0, {r3 - r5}
-   add r7, sp, #S_SP - 4   @ here for interlock avoidance
-   mov r6, #-1 @  ""  ""  ""   ""
-   add r2, sp, #(S_FRAME_SIZE + \stack_hole - 4)
- SPFIX(addeq   r2, r2, #4  )
-   str r3, [sp, #-4]!  @ save the "real" r0 copied
-   @ from the exception stack
-
-   mov r3, lr
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r2 - sp_svc
-   @  r3 - lr_svc
-   @  r4 - lr_, already fixed up for correct return/restart
-   @  r5 - spsr_
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   stmia   r7, {r2 - r6}
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
.align  5
 __dabt_svc:
svc_entry
@@ -348,71 +297,8 @@ ENDPROC(__pabt_svc)
 
 /*
  * User mode handlers
- *
- * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
  */
 
-#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7)
-#error "sizeof(struct pt_regs) must be a multiple of 8"
-#endif
-
-   .macro  usr_entry
- UNWIND(.fnstart   )
- UNWIND(.cantunwind)   @ don't unwind the user space
-   sub sp, sp, #S_FRAME_SIZE
- ARM(  stmib   sp, {r1 - r12}  )
- THUMB(stmia   sp, {r0 - r12}  )
-
-   ldmia   r0, {r3 - r5}
-   add r0, sp, #S_PC   @ here for interlock avoidance
-   mov r6, #-1 @  ""  "" """"
-
-   str r3, [sp]@ save the "real" r0 copied
-   @ from the exception stack
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r4 - lr_, already fixed up for correct return/restart
-   @  r5 - spsr_
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   @ Also, separately save sp_usr and lr_usr
-   @
-   stmia   r0, {r4 - r6}
- ARM(  stmdb   r0, {sp, lr}^   )
- THUMB(store_user_sp_lr r0, r1, S_SP - S_PC)
-
-   @
-   @ Enable the alignment trap while in kernel mode
-   @
-   alignment_trap r0
-
-   @
-   @ Clear FP to mark the first stack frame
-   @
-   zero_fp
-
-#ifdef CONFIG_IRQSOFF_TRACER
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
-   .macro  kuser_cmpxchg_check
-#if !defined(CONFIG_CPU_32v6K) && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
-#ifndef CONFIG_MMU
-#warning "NPTL on non MMU needs fixing"
-#else
-   @ Make sure our user space atomic helper is restarted
-   @ if it was interrupted in a critical region.  Here we
-   @ perform a quick test inline since it should be false
-   @ 99.% of the time.  The rest is done out of line.
-   cmp r4, #TASK_SIZE
-   blhskuser_cmpxchg64_fixup
-#endif
-#endif
-   .endm
-
.align  5
 __dabt_usr:
usr_entry
@@ -846,6 +732,7 @@ __kuser_cmpxchg64:  @ 0x0f60
ldmfd   sp!, {r4, r5, r6, pc}
 
.text
+   .global kuser_cmpxchg64_fixup
 kuser_cmpxchg64_fixup:
@ Called from kuser_cmpxchg_fixup.
@ r4 = address of interrupted insn (must be preserved).
@@ -976,58 +863,6 @@ __kuser_helper_end:
 
  THUMB(.thumb  )
 
-/*
- * 

[PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-24 Thread Anton Vorontsov
Just move the macros into header file as we would want to use them for
KGDB FIQ entry code.

The following macros were moved:

 - svc_entry
 - usr_entry
 - kuser_cmpxchg_check
 - vector_stub

To make kuser_cmpxchg_check actually work across different files, we
also have to make kuser_cmpxchg64_fixup global.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 arch/arm/kernel/entry-armv.S   | 167 +---
 arch/arm/kernel/entry-header.S | 170 +
 2 files changed, 171 insertions(+), 166 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098..0f15368 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -136,57 +136,6 @@ common_invalid:
b   bad_mode
 ENDPROC(__und_invalid)
 
-/*
- * SVC mode handlers
- */
-
-#if defined(CONFIG_AEABI)  (__LINUX_ARM_ARCH__ = 5)
-#define SPFIX(code...) code
-#else
-#define SPFIX(code...)
-#endif
-
-   .macro  svc_entry, stack_hole=0
- UNWIND(.fnstart   )
- UNWIND(.save {r0 - pc})
-   sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
-#ifdef CONFIG_THUMB2_KERNEL
- SPFIX(str r0, [sp])   @ temporarily saved
- SPFIX(mov r0, sp  )
- SPFIX(tst r0, #4  )   @ test original stack alignment
- SPFIX(ldr r0, [sp])   @ restored
-#else
- SPFIX(tst sp, #4  )
-#endif
- SPFIX(subeq   sp, sp, #4  )
-   stmia   sp, {r1 - r12}
-
-   ldmia   r0, {r3 - r5}
-   add r7, sp, #S_SP - 4   @ here for interlock avoidance
-   mov r6, #-1 @ 
-   add r2, sp, #(S_FRAME_SIZE + \stack_hole - 4)
- SPFIX(addeq   r2, r2, #4  )
-   str r3, [sp, #-4]!  @ save the real r0 copied
-   @ from the exception stack
-
-   mov r3, lr
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r2 - sp_svc
-   @  r3 - lr_svc
-   @  r4 - lr_exception, already fixed up for correct return/restart
-   @  r5 - spsr_exception
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   stmia   r7, {r2 - r6}
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
.align  5
 __dabt_svc:
svc_entry
@@ -348,71 +297,8 @@ ENDPROC(__pabt_svc)
 
 /*
  * User mode handlers
- *
- * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
  */
 
-#if defined(CONFIG_AEABI)  (__LINUX_ARM_ARCH__ = 5)  (S_FRAME_SIZE  7)
-#error sizeof(struct pt_regs) must be a multiple of 8
-#endif
-
-   .macro  usr_entry
- UNWIND(.fnstart   )
- UNWIND(.cantunwind)   @ don't unwind the user space
-   sub sp, sp, #S_FRAME_SIZE
- ARM(  stmib   sp, {r1 - r12}  )
- THUMB(stmia   sp, {r0 - r12}  )
-
-   ldmia   r0, {r3 - r5}
-   add r0, sp, #S_PC   @ here for interlock avoidance
-   mov r6, #-1 @ 
-
-   str r3, [sp]@ save the real r0 copied
-   @ from the exception stack
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r4 - lr_exception, already fixed up for correct return/restart
-   @  r5 - spsr_exception
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   @ Also, separately save sp_usr and lr_usr
-   @
-   stmia   r0, {r4 - r6}
- ARM(  stmdb   r0, {sp, lr}^   )
- THUMB(store_user_sp_lr r0, r1, S_SP - S_PC)
-
-   @
-   @ Enable the alignment trap while in kernel mode
-   @
-   alignment_trap r0
-
-   @
-   @ Clear FP to mark the first stack frame
-   @
-   zero_fp
-
-#ifdef CONFIG_IRQSOFF_TRACER
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
-   .macro  kuser_cmpxchg_check
-#if !defined(CONFIG_CPU_32v6K)  !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
-#ifndef CONFIG_MMU
-#warning NPTL on non MMU needs fixing
-#else
-   @ Make sure our user space atomic helper is restarted
-   @ if it was interrupted in a critical region.  Here we
-   @ perform a quick test inline since it should be false
-   @ 99.% of the time.  The rest is done out of line.
-   cmp r4, #TASK_SIZE
-   blhskuser_cmpxchg64_fixup
-#endif
-#endif
-   .endm
-
.align  5
 __dabt_usr:
usr_entry
@@ -846,6 +732,7 @@ __kuser_cmpxchg64:  @ 0x0f60
ldmfd   sp!, {r4, r5, r6, pc}
 
.text
+   .global kuser_cmpxchg64_fixup
 kuser_cmpxchg64_fixup:
@ Called from kuser_cmpxchg_fixup.
@ r4 = address of interrupted insn (must be preserved).
@@ -976,58 +863,6 @@ __kuser_helper_end:
 
  THUMB(  

[PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-19 Thread Anton Vorontsov
Just move the macros into header file as we would want to use them for
KGDB FIQ entry code.

The following macros were moved:

 - svc_entry
 - usr_entry
 - kuser_cmpxchg_check
 - vector_stub

To make kuser_cmpxchg_check actually work across different files, we
also have to make kuser_cmpxchg64_fixup global.

Signed-off-by: Anton Vorontsov 
---
 arch/arm/kernel/entry-armv.S   | 167 +---
 arch/arm/kernel/entry-header.S | 170 +
 2 files changed, 171 insertions(+), 166 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098..0f15368 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -136,57 +136,6 @@ common_invalid:
b   bad_mode
 ENDPROC(__und_invalid)
 
-/*
- * SVC mode handlers
- */
-
-#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
-#define SPFIX(code...) code
-#else
-#define SPFIX(code...)
-#endif
-
-   .macro  svc_entry, stack_hole=0
- UNWIND(.fnstart   )
- UNWIND(.save {r0 - pc})
-   sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
-#ifdef CONFIG_THUMB2_KERNEL
- SPFIX(str r0, [sp])   @ temporarily saved
- SPFIX(mov r0, sp  )
- SPFIX(tst r0, #4  )   @ test original stack alignment
- SPFIX(ldr r0, [sp])   @ restored
-#else
- SPFIX(tst sp, #4  )
-#endif
- SPFIX(subeq   sp, sp, #4  )
-   stmia   sp, {r1 - r12}
-
-   ldmia   r0, {r3 - r5}
-   add r7, sp, #S_SP - 4   @ here for interlock avoidance
-   mov r6, #-1 @  ""  ""  ""   ""
-   add r2, sp, #(S_FRAME_SIZE + \stack_hole - 4)
- SPFIX(addeq   r2, r2, #4  )
-   str r3, [sp, #-4]!  @ save the "real" r0 copied
-   @ from the exception stack
-
-   mov r3, lr
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r2 - sp_svc
-   @  r3 - lr_svc
-   @  r4 - lr_, already fixed up for correct return/restart
-   @  r5 - spsr_
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   stmia   r7, {r2 - r6}
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
.align  5
 __dabt_svc:
svc_entry
@@ -348,71 +297,8 @@ ENDPROC(__pabt_svc)
 
 /*
  * User mode handlers
- *
- * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
  */
 
-#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7)
-#error "sizeof(struct pt_regs) must be a multiple of 8"
-#endif
-
-   .macro  usr_entry
- UNWIND(.fnstart   )
- UNWIND(.cantunwind)   @ don't unwind the user space
-   sub sp, sp, #S_FRAME_SIZE
- ARM(  stmib   sp, {r1 - r12}  )
- THUMB(stmia   sp, {r0 - r12}  )
-
-   ldmia   r0, {r3 - r5}
-   add r0, sp, #S_PC   @ here for interlock avoidance
-   mov r6, #-1 @  ""  "" """"
-
-   str r3, [sp]@ save the "real" r0 copied
-   @ from the exception stack
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r4 - lr_, already fixed up for correct return/restart
-   @  r5 - spsr_
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   @ Also, separately save sp_usr and lr_usr
-   @
-   stmia   r0, {r4 - r6}
- ARM(  stmdb   r0, {sp, lr}^   )
- THUMB(store_user_sp_lr r0, r1, S_SP - S_PC)
-
-   @
-   @ Enable the alignment trap while in kernel mode
-   @
-   alignment_trap r0
-
-   @
-   @ Clear FP to mark the first stack frame
-   @
-   zero_fp
-
-#ifdef CONFIG_IRQSOFF_TRACER
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
-   .macro  kuser_cmpxchg_check
-#if !defined(CONFIG_CPU_32v6K) && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
-#ifndef CONFIG_MMU
-#warning "NPTL on non MMU needs fixing"
-#else
-   @ Make sure our user space atomic helper is restarted
-   @ if it was interrupted in a critical region.  Here we
-   @ perform a quick test inline since it should be false
-   @ 99.% of the time.  The rest is done out of line.
-   cmp r4, #TASK_SIZE
-   blhskuser_cmpxchg64_fixup
-#endif
-#endif
-   .endm
-
.align  5
 __dabt_usr:
usr_entry
@@ -846,6 +732,7 @@ __kuser_cmpxchg64:  @ 0x0f60
ldmfd   sp!, {r4, r5, r6, pc}
 
.text
+   .global kuser_cmpxchg64_fixup
 kuser_cmpxchg64_fixup:
@ Called from kuser_cmpxchg_fixup.
@ r4 = address of interrupted insn (must be preserved).
@@ -976,58 +863,6 @@ __kuser_helper_end:
 
  THUMB(.thumb  )
 
-/*
- * 

[PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-19 Thread Anton Vorontsov
Just move the macros into header file as we would want to use them for
KGDB FIQ entry code.

The following macros were moved:

 - svc_entry
 - usr_entry
 - kuser_cmpxchg_check
 - vector_stub

To make kuser_cmpxchg_check actually work across different files, we
also have to make kuser_cmpxchg64_fixup global.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 arch/arm/kernel/entry-armv.S   | 167 +---
 arch/arm/kernel/entry-header.S | 170 +
 2 files changed, 171 insertions(+), 166 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098..0f15368 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -136,57 +136,6 @@ common_invalid:
b   bad_mode
 ENDPROC(__und_invalid)
 
-/*
- * SVC mode handlers
- */
-
-#if defined(CONFIG_AEABI)  (__LINUX_ARM_ARCH__ = 5)
-#define SPFIX(code...) code
-#else
-#define SPFIX(code...)
-#endif
-
-   .macro  svc_entry, stack_hole=0
- UNWIND(.fnstart   )
- UNWIND(.save {r0 - pc})
-   sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
-#ifdef CONFIG_THUMB2_KERNEL
- SPFIX(str r0, [sp])   @ temporarily saved
- SPFIX(mov r0, sp  )
- SPFIX(tst r0, #4  )   @ test original stack alignment
- SPFIX(ldr r0, [sp])   @ restored
-#else
- SPFIX(tst sp, #4  )
-#endif
- SPFIX(subeq   sp, sp, #4  )
-   stmia   sp, {r1 - r12}
-
-   ldmia   r0, {r3 - r5}
-   add r7, sp, #S_SP - 4   @ here for interlock avoidance
-   mov r6, #-1 @ 
-   add r2, sp, #(S_FRAME_SIZE + \stack_hole - 4)
- SPFIX(addeq   r2, r2, #4  )
-   str r3, [sp, #-4]!  @ save the real r0 copied
-   @ from the exception stack
-
-   mov r3, lr
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r2 - sp_svc
-   @  r3 - lr_svc
-   @  r4 - lr_exception, already fixed up for correct return/restart
-   @  r5 - spsr_exception
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   stmia   r7, {r2 - r6}
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
.align  5
 __dabt_svc:
svc_entry
@@ -348,71 +297,8 @@ ENDPROC(__pabt_svc)
 
 /*
  * User mode handlers
- *
- * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
  */
 
-#if defined(CONFIG_AEABI)  (__LINUX_ARM_ARCH__ = 5)  (S_FRAME_SIZE  7)
-#error sizeof(struct pt_regs) must be a multiple of 8
-#endif
-
-   .macro  usr_entry
- UNWIND(.fnstart   )
- UNWIND(.cantunwind)   @ don't unwind the user space
-   sub sp, sp, #S_FRAME_SIZE
- ARM(  stmib   sp, {r1 - r12}  )
- THUMB(stmia   sp, {r0 - r12}  )
-
-   ldmia   r0, {r3 - r5}
-   add r0, sp, #S_PC   @ here for interlock avoidance
-   mov r6, #-1 @ 
-
-   str r3, [sp]@ save the real r0 copied
-   @ from the exception stack
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r4 - lr_exception, already fixed up for correct return/restart
-   @  r5 - spsr_exception
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   @ Also, separately save sp_usr and lr_usr
-   @
-   stmia   r0, {r4 - r6}
- ARM(  stmdb   r0, {sp, lr}^   )
- THUMB(store_user_sp_lr r0, r1, S_SP - S_PC)
-
-   @
-   @ Enable the alignment trap while in kernel mode
-   @
-   alignment_trap r0
-
-   @
-   @ Clear FP to mark the first stack frame
-   @
-   zero_fp
-
-#ifdef CONFIG_IRQSOFF_TRACER
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
-   .macro  kuser_cmpxchg_check
-#if !defined(CONFIG_CPU_32v6K)  !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
-#ifndef CONFIG_MMU
-#warning NPTL on non MMU needs fixing
-#else
-   @ Make sure our user space atomic helper is restarted
-   @ if it was interrupted in a critical region.  Here we
-   @ perform a quick test inline since it should be false
-   @ 99.% of the time.  The rest is done out of line.
-   cmp r4, #TASK_SIZE
-   blhskuser_cmpxchg64_fixup
-#endif
-#endif
-   .endm
-
.align  5
 __dabt_usr:
usr_entry
@@ -846,6 +732,7 @@ __kuser_cmpxchg64:  @ 0x0f60
ldmfd   sp!, {r4, r5, r6, pc}
 
.text
+   .global kuser_cmpxchg64_fixup
 kuser_cmpxchg64_fixup:
@ Called from kuser_cmpxchg_fixup.
@ r4 = address of interrupted insn (must be preserved).
@@ -976,58 +863,6 @@ __kuser_helper_end:
 
  THUMB(  

[PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-13 Thread Anton Vorontsov
Just move the macros into header file as we would want to use them for
KGDB FIQ entry code.

The following macros were moved:

 - svc_entry
 - usr_entry
 - kuser_cmpxchg_check
 - vector_stub

To make kuser_cmpxchg_check actually work across different files, we
also have to make kuser_cmpxchg64_fixup global.

Signed-off-by: Anton Vorontsov 
---
 arch/arm/kernel/entry-armv.S   | 167 +---
 arch/arm/kernel/entry-header.S | 170 +
 2 files changed, 171 insertions(+), 166 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098..0f15368 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -136,57 +136,6 @@ common_invalid:
b   bad_mode
 ENDPROC(__und_invalid)
 
-/*
- * SVC mode handlers
- */
-
-#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
-#define SPFIX(code...) code
-#else
-#define SPFIX(code...)
-#endif
-
-   .macro  svc_entry, stack_hole=0
- UNWIND(.fnstart   )
- UNWIND(.save {r0 - pc})
-   sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
-#ifdef CONFIG_THUMB2_KERNEL
- SPFIX(str r0, [sp])   @ temporarily saved
- SPFIX(mov r0, sp  )
- SPFIX(tst r0, #4  )   @ test original stack alignment
- SPFIX(ldr r0, [sp])   @ restored
-#else
- SPFIX(tst sp, #4  )
-#endif
- SPFIX(subeq   sp, sp, #4  )
-   stmia   sp, {r1 - r12}
-
-   ldmia   r0, {r3 - r5}
-   add r7, sp, #S_SP - 4   @ here for interlock avoidance
-   mov r6, #-1 @  ""  ""  ""   ""
-   add r2, sp, #(S_FRAME_SIZE + \stack_hole - 4)
- SPFIX(addeq   r2, r2, #4  )
-   str r3, [sp, #-4]!  @ save the "real" r0 copied
-   @ from the exception stack
-
-   mov r3, lr
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r2 - sp_svc
-   @  r3 - lr_svc
-   @  r4 - lr_, already fixed up for correct return/restart
-   @  r5 - spsr_
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   stmia   r7, {r2 - r6}
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
.align  5
 __dabt_svc:
svc_entry
@@ -348,71 +297,8 @@ ENDPROC(__pabt_svc)
 
 /*
  * User mode handlers
- *
- * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
  */
 
-#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7)
-#error "sizeof(struct pt_regs) must be a multiple of 8"
-#endif
-
-   .macro  usr_entry
- UNWIND(.fnstart   )
- UNWIND(.cantunwind)   @ don't unwind the user space
-   sub sp, sp, #S_FRAME_SIZE
- ARM(  stmib   sp, {r1 - r12}  )
- THUMB(stmia   sp, {r0 - r12}  )
-
-   ldmia   r0, {r3 - r5}
-   add r0, sp, #S_PC   @ here for interlock avoidance
-   mov r6, #-1 @  ""  "" """"
-
-   str r3, [sp]@ save the "real" r0 copied
-   @ from the exception stack
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r4 - lr_, already fixed up for correct return/restart
-   @  r5 - spsr_
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   @ Also, separately save sp_usr and lr_usr
-   @
-   stmia   r0, {r4 - r6}
- ARM(  stmdb   r0, {sp, lr}^   )
- THUMB(store_user_sp_lr r0, r1, S_SP - S_PC)
-
-   @
-   @ Enable the alignment trap while in kernel mode
-   @
-   alignment_trap r0
-
-   @
-   @ Clear FP to mark the first stack frame
-   @
-   zero_fp
-
-#ifdef CONFIG_IRQSOFF_TRACER
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
-   .macro  kuser_cmpxchg_check
-#if !defined(CONFIG_CPU_32v6K) && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
-#ifndef CONFIG_MMU
-#warning "NPTL on non MMU needs fixing"
-#else
-   @ Make sure our user space atomic helper is restarted
-   @ if it was interrupted in a critical region.  Here we
-   @ perform a quick test inline since it should be false
-   @ 99.% of the time.  The rest is done out of line.
-   cmp r4, #TASK_SIZE
-   blhskuser_cmpxchg64_fixup
-#endif
-#endif
-   .endm
-
.align  5
 __dabt_usr:
usr_entry
@@ -846,6 +732,7 @@ __kuser_cmpxchg64:  @ 0x0f60
ldmfd   sp!, {r4, r5, r6, pc}
 
.text
+   .global kuser_cmpxchg64_fixup
 kuser_cmpxchg64_fixup:
@ Called from kuser_cmpxchg_fixup.
@ r4 = address of interrupted insn (must be preserved).
@@ -976,58 +863,6 @@ __kuser_helper_end:
 
  THUMB(.thumb  )
 
-/*
- * 

[PATCH 08/11] ARM: Move some macros from entry-armv to entry-header

2012-09-13 Thread Anton Vorontsov
Just move the macros into header file as we would want to use them for
KGDB FIQ entry code.

The following macros were moved:

 - svc_entry
 - usr_entry
 - kuser_cmpxchg_check
 - vector_stub

To make kuser_cmpxchg_check actually work across different files, we
also have to make kuser_cmpxchg64_fixup global.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 arch/arm/kernel/entry-armv.S   | 167 +---
 arch/arm/kernel/entry-header.S | 170 +
 2 files changed, 171 insertions(+), 166 deletions(-)

diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098..0f15368 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -136,57 +136,6 @@ common_invalid:
b   bad_mode
 ENDPROC(__und_invalid)
 
-/*
- * SVC mode handlers
- */
-
-#if defined(CONFIG_AEABI)  (__LINUX_ARM_ARCH__ = 5)
-#define SPFIX(code...) code
-#else
-#define SPFIX(code...)
-#endif
-
-   .macro  svc_entry, stack_hole=0
- UNWIND(.fnstart   )
- UNWIND(.save {r0 - pc})
-   sub sp, sp, #(S_FRAME_SIZE + \stack_hole - 4)
-#ifdef CONFIG_THUMB2_KERNEL
- SPFIX(str r0, [sp])   @ temporarily saved
- SPFIX(mov r0, sp  )
- SPFIX(tst r0, #4  )   @ test original stack alignment
- SPFIX(ldr r0, [sp])   @ restored
-#else
- SPFIX(tst sp, #4  )
-#endif
- SPFIX(subeq   sp, sp, #4  )
-   stmia   sp, {r1 - r12}
-
-   ldmia   r0, {r3 - r5}
-   add r7, sp, #S_SP - 4   @ here for interlock avoidance
-   mov r6, #-1 @ 
-   add r2, sp, #(S_FRAME_SIZE + \stack_hole - 4)
- SPFIX(addeq   r2, r2, #4  )
-   str r3, [sp, #-4]!  @ save the real r0 copied
-   @ from the exception stack
-
-   mov r3, lr
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r2 - sp_svc
-   @  r3 - lr_svc
-   @  r4 - lr_exception, already fixed up for correct return/restart
-   @  r5 - spsr_exception
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   stmia   r7, {r2 - r6}
-
-#ifdef CONFIG_TRACE_IRQFLAGS
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
.align  5
 __dabt_svc:
svc_entry
@@ -348,71 +297,8 @@ ENDPROC(__pabt_svc)
 
 /*
  * User mode handlers
- *
- * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
  */
 
-#if defined(CONFIG_AEABI)  (__LINUX_ARM_ARCH__ = 5)  (S_FRAME_SIZE  7)
-#error sizeof(struct pt_regs) must be a multiple of 8
-#endif
-
-   .macro  usr_entry
- UNWIND(.fnstart   )
- UNWIND(.cantunwind)   @ don't unwind the user space
-   sub sp, sp, #S_FRAME_SIZE
- ARM(  stmib   sp, {r1 - r12}  )
- THUMB(stmia   sp, {r0 - r12}  )
-
-   ldmia   r0, {r3 - r5}
-   add r0, sp, #S_PC   @ here for interlock avoidance
-   mov r6, #-1 @ 
-
-   str r3, [sp]@ save the real r0 copied
-   @ from the exception stack
-
-   @
-   @ We are now ready to fill in the remaining blanks on the stack:
-   @
-   @  r4 - lr_exception, already fixed up for correct return/restart
-   @  r5 - spsr_exception
-   @  r6 - orig_r0 (see pt_regs definition in ptrace.h)
-   @
-   @ Also, separately save sp_usr and lr_usr
-   @
-   stmia   r0, {r4 - r6}
- ARM(  stmdb   r0, {sp, lr}^   )
- THUMB(store_user_sp_lr r0, r1, S_SP - S_PC)
-
-   @
-   @ Enable the alignment trap while in kernel mode
-   @
-   alignment_trap r0
-
-   @
-   @ Clear FP to mark the first stack frame
-   @
-   zero_fp
-
-#ifdef CONFIG_IRQSOFF_TRACER
-   bl  trace_hardirqs_off
-#endif
-   .endm
-
-   .macro  kuser_cmpxchg_check
-#if !defined(CONFIG_CPU_32v6K)  !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
-#ifndef CONFIG_MMU
-#warning NPTL on non MMU needs fixing
-#else
-   @ Make sure our user space atomic helper is restarted
-   @ if it was interrupted in a critical region.  Here we
-   @ perform a quick test inline since it should be false
-   @ 99.% of the time.  The rest is done out of line.
-   cmp r4, #TASK_SIZE
-   blhskuser_cmpxchg64_fixup
-#endif
-#endif
-   .endm
-
.align  5
 __dabt_usr:
usr_entry
@@ -846,6 +732,7 @@ __kuser_cmpxchg64:  @ 0x0f60
ldmfd   sp!, {r4, r5, r6, pc}
 
.text
+   .global kuser_cmpxchg64_fixup
 kuser_cmpxchg64_fixup:
@ Called from kuser_cmpxchg_fixup.
@ r4 = address of interrupted insn (must be preserved).
@@ -976,58 +863,6 @@ __kuser_helper_end:
 
  THUMB(