Merge tag 'v3.15-rc1' into perf/urgent
[sfrench/cifs-2.6.git] / arch / arm / include / asm / assembler.h
index 380ac4f20000c8c33d1744da3898d71e3f4b7c68..b974184f9941883339c0480df1290a6a6f66a4ae 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/ptrace.h>
 #include <asm/domain.h>
 #include <asm/opcodes-virt.h>
+#include <asm/asm-offsets.h>
 
 #define IOMEM(x)       (x)
 
        restore_irqs_notrace \oldcpsr
        .endm
 
+/*
+ * Get current thread_info.
+ */
+       .macro  get_thread_info, rd
+ ARM(  mov     \rd, sp, lsr #13        )
+ THUMB(        mov     \rd, sp                 )
+ THUMB(        lsr     \rd, \rd, #13           )
+       mov     \rd, \rd, lsl #13
+       .endm
+
+/*
+ * Increment/decrement the preempt count.
+ */
+#ifdef CONFIG_PREEMPT_COUNT
+       .macro  inc_preempt_count, ti, tmp
+       ldr     \tmp, [\ti, #TI_PREEMPT]        @ get preempt count
+       add     \tmp, \tmp, #1                  @ increment it
+       str     \tmp, [\ti, #TI_PREEMPT]
+       .endm
+
+       .macro  dec_preempt_count, ti, tmp
+       ldr     \tmp, [\ti, #TI_PREEMPT]        @ get preempt count
+       sub     \tmp, \tmp, #1                  @ decrement it
+       str     \tmp, [\ti, #TI_PREEMPT]
+       .endm
+
+       .macro  dec_preempt_count_ti, ti, tmp
+       get_thread_info \ti
+       dec_preempt_count \ti, \tmp
+       .endm
+#else
+       .macro  inc_preempt_count, ti, tmp
+       .endm
+
+       .macro  dec_preempt_count, ti, tmp
+       .endm
+
+       .macro  dec_preempt_count_ti, ti, tmp
+       .endm
+#endif
+
 #define USER(x...)                             \
 9999:  x;                                      \
        .pushsection __ex_table,"a";            \