--- zzzz-none-000/linux-2.6.39.4/arch/arm/include/asm/irqflags.h 2011-08-03 19:43:28.000000000 +0000 +++ puma6-arm-6490-729/linux-2.6.39.4/arch/arm/include/asm/irqflags.h 2021-11-10 13:23:09.000000000 +0000 @@ -4,25 +4,59 @@ #ifdef __KERNEL__ #include - /* * CPU interrupt mask handling. */ #if __LINUX_ARM_ARCH__ >= 6 +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) +#include -static inline unsigned long arch_local_irq_save(void) +#define _local_RET_IP_ ((unsigned int)__builtin_return_address(0)) + +#endif + +/* + * Save the current interrupt enable state. + */ +static inline unsigned long arch_local_save_flags(void) { unsigned long flags; + asm volatile( + " mrs %0, cpsr @ local_save_flags" + : "=r" (flags) : : "memory", "cc"); + return flags; +} + + +static inline unsigned long arch_local_irq_save(void) +{ + unsigned long flags, pc_addr __maybe_unused; asm volatile( + " mov %1, pc\n" " mrs %0, cpsr @ arch_local_irq_save\n" " cpsid i" - : "=r" (flags) : : "memory", "cc"); + : "=r" (flags), "=r" (pc_addr) + : + : "memory", "cc"); +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled(pc_addr, _local_RET_IP_, + flags & PSR_I_BIT, /* old-status */ + PSR_I_BIT /* new-status */); +#endif return flags; } static inline void arch_local_irq_enable(void) { +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + unsigned long flags = arch_local_save_flags(); + + avm_simple_profiling_irq_disabled((unsigned long)&&here, _local_RET_IP_, + flags & PSR_I_BIT, /* old-status */ + 0 /* new-status */); +here: +#endif asm volatile( " cpsie i @ arch_local_irq_enable" : @@ -32,6 +66,10 @@ static inline void arch_local_irq_disable(void) { +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + arch_local_irq_save(); + return; +#endif asm volatile( " cpsid i @ arch_local_irq_disable" : @@ -97,9 +135,9 @@ ({ \ unsigned long temp; \ __asm__ __volatile__( \ - "mrs %0, cpsr @ stf\n" \ -" bic %0, %0, #64\n" \ -" msr cpsr_c, %0" \ + " mrs %0, cpsr @ stf\n" \ + " bic %0, %0, #64\n" \ + " msr cpsr_c, %0" \ : "=r" (temp) \ : \ : "memory", "cc"); \ @@ -112,9 +150,9 @@ ({ \ unsigned long temp; \ __asm__ __volatile__( \ - "mrs %0, cpsr @ clf\n" \ -" orr %0, %0, #64\n" \ -" msr cpsr_c, %0" \ + " mrs %0, cpsr @ clf\n" \ + " orr %0, %0, #64\n" \ + " msr cpsr_c, %0" \ : "=r" (temp) \ : \ : "memory", "cc"); \ @@ -123,22 +161,16 @@ #endif /* - * Save the current interrupt enable state. - */ -static inline unsigned long arch_local_save_flags(void) -{ - unsigned long flags; - asm volatile( - " mrs %0, cpsr @ local_save_flags" - : "=r" (flags) : : "memory", "cc"); - return flags; -} - -/* - * restore saved IRQ & FIQ state + * restore saved IRQ state */ static inline void arch_local_irq_restore(unsigned long flags) { +#if defined(CONFIG_ENABLE_IRQ_PROFILING_HOOKS) + avm_simple_profiling_irq_disabled((unsigned long)&&here, _local_RET_IP_, + PSR_I_BIT, /* old-status */ + (flags & PSR_I_BIT) /* new-status */); +here: +#endif asm volatile( " msr cpsr_c, %0 @ local_irq_restore" :