ptrace.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. #ifndef __ASSEMBLY__
  40. #include <asm/coprocessor.h>
  41. /*
  42. * This struct defines the way the registers are stored on the
  43. * kernel stack during a system call or other kernel entry.
  44. */
  45. struct pt_regs {
  46. unsigned long pc; /* 4 */
  47. unsigned long ps; /* 8 */
  48. unsigned long depc; /* 12 */
  49. unsigned long exccause; /* 16 */
  50. unsigned long excvaddr; /* 20 */
  51. unsigned long debugcause; /* 24 */
  52. unsigned long wmask; /* 28 */
  53. unsigned long lbeg; /* 32 */
  54. unsigned long lend; /* 36 */
  55. unsigned long lcount; /* 40 */
  56. unsigned long sar; /* 44 */
  57. unsigned long windowbase; /* 48 */
  58. unsigned long windowstart; /* 52 */
  59. unsigned long syscall; /* 56 */
  60. unsigned long icountlevel; /* 60 */
  61. unsigned long scompare1; /* 64 */
  62. unsigned long threadptr; /* 68 */
  63. /* Additional configurable registers that are used by the compiler. */
  64. xtregs_opt_t xtregs_opt;
  65. /* Make sure the areg field is 16 bytes aligned. */
  66. int align[0] __attribute__ ((aligned(16)));
  67. /* current register frame.
  68. * Note: The ESF for kernel exceptions ends after 16 registers!
  69. */
  70. unsigned long areg[16];
  71. };
  72. #include <variant/core.h>
  73. # define arch_has_single_step() (1)
  74. # define task_pt_regs(tsk) ((struct pt_regs*) \
  75. (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
  76. # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
  77. # define instruction_pointer(regs) ((regs)->pc)
  78. # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
  79. (regs)->areg[1]))
  80. # ifndef CONFIG_SMP
  81. # define profile_pc(regs) instruction_pointer(regs)
  82. # else
  83. # define profile_pc(regs) \
  84. ({ \
  85. in_lock_functions(instruction_pointer(regs)) ? \
  86. return_pointer(regs) : instruction_pointer(regs); \
  87. })
  88. # endif
  89. #define user_stack_pointer(regs) ((regs)->areg[1])
  90. #else /* __ASSEMBLY__ */
  91. # include <asm/asm-offsets.h>
  92. #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)
  93. #endif /* !__ASSEMBLY__ */
  94. #endif /* _XTENSA_PTRACE_H */