]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/arm/kernel/entry-header.S
Merge branch 'for-next' of git://git.pengutronix.de/git/ukl/linux into devel-stable
[karo-tx-linux.git] / arch / arm / kernel / entry-header.S
index b02e1394dc54679cfc85dec2310b8a70eea53060..de23a9beed1333d86d1143a7b31613ff7376440d 100644 (file)
        .endm
 
 #ifndef CONFIG_THUMB2_KERNEL
-       .macro  svc_exit, rpsr
+       .macro  svc_exit, rpsr, irq = 0
+       .if     \irq != 0
+       @ IRQs already off
+#ifdef CONFIG_TRACE_IRQFLAGS
+       @ The parent context IRQs must have been enabled to get here in
+       @ the first place, so there's no point checking the PSR I bit.
+       bl      trace_hardirqs_on
+#endif
+       .else
+       @ IRQs off again before pulling preserved data off the stack
+       disable_irq_notrace
+#ifdef CONFIG_TRACE_IRQFLAGS
+       tst     \rpsr, #PSR_I_BIT
+       bleq    trace_hardirqs_on
+       tst     \rpsr, #PSR_I_BIT
+       blne    trace_hardirqs_off
+#endif
+       .endif
        msr     spsr_cxsf, \rpsr
 #if defined(CONFIG_CPU_V6)
        ldr     r0, [sp]
        mov     pc, \reg
        .endm
 #else  /* CONFIG_THUMB2_KERNEL */
-       .macro  svc_exit, rpsr
+       .macro  svc_exit, rpsr, irq = 0
+       .if     \irq != 0
+       @ IRQs already off
+#ifdef CONFIG_TRACE_IRQFLAGS
+       @ The parent context IRQs must have been enabled to get here in
+       @ the first place, so there's no point checking the PSR I bit.
+       bl      trace_hardirqs_on
+#endif
+       .else
+       @ IRQs off again before pulling preserved data off the stack
+       disable_irq_notrace
+#ifdef CONFIG_TRACE_IRQFLAGS
+       tst     \rpsr, #PSR_I_BIT
+       bleq    trace_hardirqs_on
+       tst     \rpsr, #PSR_I_BIT
+       blne    trace_hardirqs_off
+#endif
+       .endif
        ldr     lr, [sp, #S_SP]                 @ top of the stack
        ldrd    r0, r1, [sp, #S_LR]             @ calling lr and pc
        clrex                                   @ clear the exclusive monitor
        .endm
 #endif /* !CONFIG_THUMB2_KERNEL */
 
+/*
+ * Context tracking subsystem.  Used to instrument transitions
+ * between user and kernel mode.
+ */
+       .macro ct_user_exit, save = 1
+#ifdef CONFIG_CONTEXT_TRACKING
+       .if     \save
+       stmdb   sp!, {r0-r3, ip, lr}
+       bl      user_exit
+       ldmia   sp!, {r0-r3, ip, lr}
+       .else
+       bl      user_exit
+       .endif
+#endif
+       .endm
+
+       .macro ct_user_enter, save = 1
+#ifdef CONFIG_CONTEXT_TRACKING
+       .if     \save
+       stmdb   sp!, {r0-r3, ip, lr}
+       bl      user_enter
+       ldmia   sp!, {r0-r3, ip, lr}
+       .else
+       bl      user_enter
+       .endif
+#endif
+       .endm
+
 /*
  * These are the registers used in the syscall handler, and allow us to
  * have in theory up to 7 arguments to a function - r0 to r6.