unwind.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef _ASM_ARC_UNWIND_H
  9. #define _ASM_ARC_UNWIND_H
  10. #ifdef CONFIG_ARC_DW2_UNWIND
  11. #include <linux/sched.h>
  12. struct arc700_regs {
  13. unsigned long r0;
  14. unsigned long r1;
  15. unsigned long r2;
  16. unsigned long r3;
  17. unsigned long r4;
  18. unsigned long r5;
  19. unsigned long r6;
  20. unsigned long r7;
  21. unsigned long r8;
  22. unsigned long r9;
  23. unsigned long r10;
  24. unsigned long r11;
  25. unsigned long r12;
  26. unsigned long r13;
  27. unsigned long r14;
  28. unsigned long r15;
  29. unsigned long r16;
  30. unsigned long r17;
  31. unsigned long r18;
  32. unsigned long r19;
  33. unsigned long r20;
  34. unsigned long r21;
  35. unsigned long r22;
  36. unsigned long r23;
  37. unsigned long r24;
  38. unsigned long r25;
  39. unsigned long r26;
  40. unsigned long r27; /* fp */
  41. unsigned long r28; /* sp */
  42. unsigned long r29;
  43. unsigned long r30;
  44. unsigned long r31; /* blink */
  45. unsigned long r63; /* pc */
  46. };
  47. struct unwind_frame_info {
  48. struct arc700_regs regs;
  49. struct task_struct *task;
  50. unsigned call_frame:1;
  51. };
  52. #define UNW_PC(frame) ((frame)->regs.r63)
  53. #define UNW_SP(frame) ((frame)->regs.r28)
  54. #define UNW_BLINK(frame) ((frame)->regs.r31)
  55. /* Rajesh FIXME */
  56. #ifdef CONFIG_FRAME_POINTER
  57. #define UNW_FP(frame) ((frame)->regs.r27)
  58. #define FRAME_RETADDR_OFFSET 4
  59. #define FRAME_LINK_OFFSET 0
  60. #define STACK_BOTTOM_UNW(tsk) STACK_LIMIT((tsk)->thread.ksp)
  61. #define STACK_TOP_UNW(tsk) ((tsk)->thread.ksp)
  62. #else
  63. #define UNW_FP(frame) ((void)(frame), 0)
  64. #endif
  65. #define STACK_LIMIT(ptr) (((ptr) - 1) & ~(THREAD_SIZE - 1))
  66. #define UNW_REGISTER_INFO \
  67. PTREGS_INFO(r0), \
  68. PTREGS_INFO(r1), \
  69. PTREGS_INFO(r2), \
  70. PTREGS_INFO(r3), \
  71. PTREGS_INFO(r4), \
  72. PTREGS_INFO(r5), \
  73. PTREGS_INFO(r6), \
  74. PTREGS_INFO(r7), \
  75. PTREGS_INFO(r8), \
  76. PTREGS_INFO(r9), \
  77. PTREGS_INFO(r10), \
  78. PTREGS_INFO(r11), \
  79. PTREGS_INFO(r12), \
  80. PTREGS_INFO(r13), \
  81. PTREGS_INFO(r14), \
  82. PTREGS_INFO(r15), \
  83. PTREGS_INFO(r16), \
  84. PTREGS_INFO(r17), \
  85. PTREGS_INFO(r18), \
  86. PTREGS_INFO(r19), \
  87. PTREGS_INFO(r20), \
  88. PTREGS_INFO(r21), \
  89. PTREGS_INFO(r22), \
  90. PTREGS_INFO(r23), \
  91. PTREGS_INFO(r24), \
  92. PTREGS_INFO(r25), \
  93. PTREGS_INFO(r26), \
  94. PTREGS_INFO(r27), \
  95. PTREGS_INFO(r28), \
  96. PTREGS_INFO(r29), \
  97. PTREGS_INFO(r30), \
  98. PTREGS_INFO(r31), \
  99. PTREGS_INFO(r63)
  100. #define UNW_DEFAULT_RA(raItem, dataAlign) \
  101. ((raItem).where == Memory && !((raItem).value * (dataAlign) + 4))
  102. extern int arc_unwind(struct unwind_frame_info *frame);
  103. extern void arc_unwind_init(void);
  104. extern void *unwind_add_table(struct module *module, const void *table_start,
  105. unsigned long table_size);
  106. extern void unwind_remove_table(void *handle, int init_only);
  107. static inline int
  108. arch_unwind_init_running(struct unwind_frame_info *info,
  109. int (*callback) (struct unwind_frame_info *info,
  110. void *arg),
  111. void *arg)
  112. {
  113. return 0;
  114. }
  115. static inline int arch_unw_user_mode(const struct unwind_frame_info *info)
  116. {
  117. return 0;
  118. }
  119. static inline void arch_unw_init_blocked(struct unwind_frame_info *info)
  120. {
  121. return;
  122. }
  123. static inline void arch_unw_init_frame_info(struct unwind_frame_info *info,
  124. struct pt_regs *regs)
  125. {
  126. return;
  127. }
  128. #else
  129. #define UNW_PC(frame) ((void)(frame), 0)
  130. #define UNW_SP(frame) ((void)(frame), 0)
  131. #define UNW_FP(frame) ((void)(frame), 0)
  132. static inline void arc_unwind_init(void)
  133. {
  134. }
  135. #define unwind_add_table(a, b, c)
  136. #define unwind_remove_table(a, b)
  137. #endif /* CONFIG_ARC_DW2_UNWIND */
  138. #endif /* _ASM_ARC_UNWIND_H */