ptrace.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 <uapi/asm/ptrace.h>
  13. #ifndef __ASSEMBLY__
  14. #include <asm/coprocessor.h>
  15. /*
  16. * This struct defines the way the registers are stored on the
  17. * kernel stack during a system call or other kernel entry.
  18. */
  19. struct pt_regs {
  20. unsigned long pc; /* 4 */
  21. unsigned long ps; /* 8 */
  22. unsigned long depc; /* 12 */
  23. unsigned long exccause; /* 16 */
  24. unsigned long excvaddr; /* 20 */
  25. unsigned long debugcause; /* 24 */
  26. unsigned long wmask; /* 28 */
  27. unsigned long lbeg; /* 32 */
  28. unsigned long lend; /* 36 */
  29. unsigned long lcount; /* 40 */
  30. unsigned long sar; /* 44 */
  31. unsigned long windowbase; /* 48 */
  32. unsigned long windowstart; /* 52 */
  33. unsigned long syscall; /* 56 */
  34. unsigned long icountlevel; /* 60 */
  35. unsigned long scompare1; /* 64 */
  36. unsigned long threadptr; /* 68 */
  37. /* Additional configurable registers that are used by the compiler. */
  38. xtregs_opt_t xtregs_opt;
  39. /* Make sure the areg field is 16 bytes aligned. */
  40. int align[0] __attribute__ ((aligned(16)));
  41. /* current register frame.
  42. * Note: The ESF for kernel exceptions ends after 16 registers!
  43. */
  44. unsigned long areg[16];
  45. };
  46. #include <variant/core.h>
  47. # define arch_has_single_step() (1)
  48. # define task_pt_regs(tsk) ((struct pt_regs*) \
  49. (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
  50. # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
  51. # define instruction_pointer(regs) ((regs)->pc)
  52. # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
  53. (regs)->areg[1]))
  54. # ifndef CONFIG_SMP
  55. # define profile_pc(regs) instruction_pointer(regs)
  56. # else
  57. # define profile_pc(regs) \
  58. ({ \
  59. in_lock_functions(instruction_pointer(regs)) ? \
  60. return_pointer(regs) : instruction_pointer(regs); \
  61. })
  62. # endif
  63. #define user_stack_pointer(regs) ((regs)->areg[1])
  64. #else /* __ASSEMBLY__ */
  65. # include <asm/asm-offsets.h>
  66. #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)
  67. #endif /* !__ASSEMBLY__ */
  68. #endif /* _XTENSA_PTRACE_H */