ptrace.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* ptrace.h: ptrace() relevant definitions
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_PTRACE_H
  12. #define _ASM_PTRACE_H
  13. #include <asm/registers.h>
  14. #define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0)
  15. #define PT_PSR 0
  16. #define PT_ISR 1
  17. #define PT_CCR 2
  18. #define PT_CCCR 3
  19. #define PT_LR 4
  20. #define PT_LCR 5
  21. #define PT_PC 6
  22. #define PT__STATUS 7 /* exception status */
  23. #define PT_SYSCALLNO 8 /* syscall number or -1 */
  24. #define PT_ORIG_GR8 9 /* saved GR8 for signal handling */
  25. #define PT_GNER0 10
  26. #define PT_GNER1 11
  27. #define PT_IACC0H 12
  28. #define PT_IACC0L 13
  29. #define PT_GR(j) ( 14 + (j)) /* GRj for 0<=j<=63 */
  30. #define PT_FR(j) ( 78 + (j)) /* FRj for 0<=j<=63 */
  31. #define PT_FNER(j) (142 + (j)) /* FNERj for 0<=j<=1 */
  32. #define PT_MSR(j) (144 + (j)) /* MSRj for 0<=j<=2 */
  33. #define PT_ACC(j) (146 + (j)) /* ACCj for 0<=j<=7 */
  34. #define PT_ACCG(jklm) (154 + (jklm)) /* ACCGjklm for 0<=jklm<=1 (reads four regs per slot) */
  35. #define PT_FSR(j) (156 + (j)) /* FSRj for 0<=j<=0 */
  36. #define PT__GPEND 78
  37. #define PT__END 157
  38. #define PT_TBR PT_GR(0)
  39. #define PT_SP PT_GR(1)
  40. #define PT_FP PT_GR(2)
  41. #define PT_PREV_FRAME PT_GR(28) /* previous exception frame pointer (old gr28 value) */
  42. #define PT_CURR_TASK PT_GR(29) /* current task */
  43. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  44. #define PTRACE_GETREGS 12
  45. #define PTRACE_SETREGS 13
  46. #define PTRACE_GETFPREGS 14
  47. #define PTRACE_SETFPREGS 15
  48. #define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
  49. #define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
  50. #define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
  51. #ifndef __ASSEMBLY__
  52. /*
  53. * dedicate GR28; to keeping the a pointer to the current exception frame
  54. */
  55. register struct pt_regs *__frame asm("gr28");
  56. register struct pt_regs *__debug_frame asm("gr31");
  57. #ifndef container_of
  58. #define container_of(ptr, type, member) ({ \
  59. const typeof( ((type *)0)->member ) *__mptr = (ptr); \
  60. (type *)( (char *)__mptr - offsetof(type,member) );})
  61. #endif
  62. #define __debug_regs container_of(__debug_frame, struct pt_debug_regs, normal_regs)
  63. #define user_mode(regs) (!((regs)->psr & PSR_S))
  64. #define instruction_pointer(regs) ((regs)->pc)
  65. extern unsigned long user_stack(const struct pt_regs *);
  66. extern void show_regs(struct pt_regs *);
  67. #define profile_pc(regs) ((regs)->pc)
  68. #endif /* !__ASSEMBLY__ */
  69. #endif /* _ASM_PTRACE_H */