ptrace.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Common low level (register) ptrace helpers
  3. *
  4. * Copyright 2004-2011 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __ASM_GENERIC_PTRACE_H__
  9. #define __ASM_GENERIC_PTRACE_H__
  10. #ifndef __ASSEMBLY__
  11. /* Helpers for working with the instruction pointer */
  12. #ifndef GET_IP
  13. #define GET_IP(regs) ((regs)->pc)
  14. #endif
  15. #ifndef SET_IP
  16. #define SET_IP(regs, val) (GET_IP(regs) = (val))
  17. #endif
  18. static inline unsigned long instruction_pointer(struct pt_regs *regs)
  19. {
  20. return GET_IP(regs);
  21. }
  22. static inline void instruction_pointer_set(struct pt_regs *regs,
  23. unsigned long val)
  24. {
  25. SET_IP(regs, val);
  26. }
  27. #ifndef profile_pc
  28. #define profile_pc(regs) instruction_pointer(regs)
  29. #endif
  30. /* Helpers for working with the user stack pointer */
  31. #ifndef GET_USP
  32. #define GET_USP(regs) ((regs)->usp)
  33. #endif
  34. #ifndef SET_USP
  35. #define SET_USP(regs, val) (GET_USP(regs) = (val))
  36. #endif
  37. static inline unsigned long user_stack_pointer(struct pt_regs *regs)
  38. {
  39. return GET_USP(regs);
  40. }
  41. static inline void user_stack_pointer_set(struct pt_regs *regs,
  42. unsigned long val)
  43. {
  44. SET_USP(regs, val);
  45. }
  46. /* Helpers for working with the frame pointer */
  47. #ifndef GET_FP
  48. #define GET_FP(regs) ((regs)->fp)
  49. #endif
  50. #ifndef SET_FP
  51. #define SET_FP(regs, val) (GET_FP(regs) = (val))
  52. #endif
  53. static inline unsigned long frame_pointer(struct pt_regs *regs)
  54. {
  55. return GET_FP(regs);
  56. }
  57. static inline void frame_pointer_set(struct pt_regs *regs,
  58. unsigned long val)
  59. {
  60. SET_FP(regs, val);
  61. }
  62. #endif /* __ASSEMBLY__ */
  63. #endif