irqflags.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * IRQ flags handling
  3. */
  4. #ifndef _ASM_IRQFLAGS_H
  5. #define _ASM_IRQFLAGS_H
  6. #ifndef __ASSEMBLY__
  7. /*
  8. * Get definitions for arch_local_save_flags(x), etc.
  9. */
  10. #include <asm/hw_irq.h>
  11. #else
  12. #ifdef CONFIG_TRACE_IRQFLAGS
  13. #ifdef CONFIG_IRQSOFF_TRACER
  14. /*
  15. * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
  16. * which is the stack frame here, we need to force a stack frame
  17. * in case we came from user space.
  18. */
  19. #define TRACE_WITH_FRAME_BUFFER(func) \
  20. mflr r0; \
  21. stdu r1, -32(r1); \
  22. std r0, 16(r1); \
  23. stdu r1, -32(r1); \
  24. bl func; \
  25. ld r1, 0(r1); \
  26. ld r1, 0(r1);
  27. #else
  28. #define TRACE_WITH_FRAME_BUFFER(func) \
  29. bl func;
  30. #endif
  31. /*
  32. * Most of the CPU's IRQ-state tracing is done from assembly code; we
  33. * have to call a C function so call a wrapper that saves all the
  34. * C-clobbered registers.
  35. */
  36. #define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on)
  37. #define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off)
  38. #define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
  39. cmpdi en,0; \
  40. bne 95f; \
  41. stb en,PACASOFTIRQEN(r13); \
  42. TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) \
  43. b skip; \
  44. 95: TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) \
  45. li en,1;
  46. #define TRACE_AND_RESTORE_IRQ(en) \
  47. TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
  48. stb en,PACASOFTIRQEN(r13); \
  49. 96:
  50. #else
  51. #define TRACE_ENABLE_INTS
  52. #define TRACE_DISABLE_INTS
  53. #define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip)
  54. #define TRACE_AND_RESTORE_IRQ(en) \
  55. stb en,PACASOFTIRQEN(r13)
  56. #endif
  57. #endif
  58. #endif