ptrace.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * include/asm-xtensa/ptrace.h
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2001 - 2005 Tensilica Inc.
  9. */
  10. #ifndef _XTENSA_PTRACE_H
  11. #define _XTENSA_PTRACE_H
  12. #include <asm/kmem_layout.h>
  13. #include <uapi/asm/ptrace.h>
  14. /*
  15. * Kernel stack
  16. *
  17. * +-----------------------+ -------- STACK_SIZE
  18. * | register file | |
  19. * +-----------------------+ |
  20. * | struct pt_regs | |
  21. * +-----------------------+ | ------ PT_REGS_OFFSET
  22. * double : 16 bytes spill area : | ^
  23. * excetion :- - - - - - - - - - - -: | |
  24. * frame : struct pt_regs : | |
  25. * :- - - - - - - - - - - -: | |
  26. * | | | |
  27. * | memory stack | | |
  28. * | | | |
  29. * ~ ~ ~ ~
  30. * ~ ~ ~ ~
  31. * | | | |
  32. * | | | |
  33. * +-----------------------+ | | --- STACK_BIAS
  34. * | struct task_struct | | | ^
  35. * current --> +-----------------------+ | | |
  36. * | struct thread_info | | | |
  37. * +-----------------------+ --------
  38. */
  39. #define NO_SYSCALL (-1)
  40. #ifndef __ASSEMBLY__
  41. #include <asm/coprocessor.h>
  42. #include <asm/core.h>
  43. /*
  44. * This struct defines the way the registers are stored on the
  45. * kernel stack during a system call or other kernel entry.
  46. */
  47. struct pt_regs {
  48. unsigned long pc; /* 4 */
  49. unsigned long ps; /* 8 */
  50. unsigned long depc; /* 12 */
  51. unsigned long exccause; /* 16 */
  52. unsigned long excvaddr; /* 20 */
  53. unsigned long debugcause; /* 24 */
  54. unsigned long wmask; /* 28 */
  55. unsigned long lbeg; /* 32 */
  56. unsigned long lend; /* 36 */
  57. unsigned long lcount; /* 40 */
  58. unsigned long sar; /* 44 */
  59. unsigned long windowbase; /* 48 */
  60. unsigned long windowstart; /* 52 */
  61. unsigned long syscall; /* 56 */
  62. unsigned long icountlevel; /* 60 */
  63. unsigned long scompare1; /* 64 */
  64. unsigned long threadptr; /* 68 */
  65. /* Additional configurable registers that are used by the compiler. */
  66. xtregs_opt_t xtregs_opt;
  67. /* Make sure the areg field is 16 bytes aligned. */
  68. int align[0] __attribute__ ((aligned(16)));
  69. /* current register frame.
  70. * Note: The ESF for kernel exceptions ends after 16 registers!
  71. */
  72. unsigned long areg[XCHAL_NUM_AREGS];
  73. };
  74. # define arch_has_single_step() (1)
  75. # define task_pt_regs(tsk) ((struct pt_regs*) \
  76. (task_stack_page(tsk) + KERNEL_STACK_SIZE) - 1)
  77. # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
  78. # define instruction_pointer(regs) ((regs)->pc)
  79. # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
  80. (regs)->areg[1]))
  81. # ifndef CONFIG_SMP
  82. # define profile_pc(regs) instruction_pointer(regs)
  83. # else
  84. # define profile_pc(regs) \
  85. ({ \
  86. in_lock_functions(instruction_pointer(regs)) ? \
  87. return_pointer(regs) : instruction_pointer(regs); \
  88. })
  89. # endif
  90. #define user_stack_pointer(regs) ((regs)->areg[1])
  91. static inline unsigned long regs_return_value(struct pt_regs *regs)
  92. {
  93. return regs->areg[2];
  94. }
  95. #else /* __ASSEMBLY__ */
  96. # include <asm/asm-offsets.h>
  97. #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)
  98. #endif /* !__ASSEMBLY__ */
  99. #endif /* _XTENSA_PTRACE_H */