ptrace-ppc32.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (c) 2007 Benjamin Herrenschmidt, IBM Coproration
  3. * Extracted from ptrace.c and ptrace32.c
  4. *
  5. * This file is subject to the terms and conditions of the GNU General
  6. * Public License. See the file README.legal in the main directory of
  7. * this archive for more details.
  8. */
  9. #ifndef _POWERPC_PTRACE_PPC32_H
  10. #define _POWERPC_PTRACE_PPC32_H
  11. /*
  12. * Set of msr bits that gdb can change on behalf of a process.
  13. */
  14. #if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
  15. #define MSR_DEBUGCHANGE 0
  16. #else
  17. #define MSR_DEBUGCHANGE (MSR_SE | MSR_BE)
  18. #endif
  19. /*
  20. * Max register writeable via put_reg
  21. */
  22. #define PT_MAX_PUT_REG PT_MQ
  23. /*
  24. * Munging of MSR on return from get_regs
  25. *
  26. * Nothing to do on ppc32
  27. */
  28. #define PT_MUNGE_MSR(msr, task) (msr)
  29. #ifdef CONFIG_SPE
  30. /*
  31. * For get_evrregs/set_evrregs functions 'data' has the following layout:
  32. *
  33. * struct {
  34. * u32 evr[32];
  35. * u64 acc;
  36. * u32 spefscr;
  37. * }
  38. */
  39. /*
  40. * Get contents of SPE register state in task TASK.
  41. */
  42. static inline int get_evrregs(unsigned long *data, struct task_struct *task)
  43. {
  44. int i;
  45. if (!access_ok(VERIFY_WRITE, data, 35 * sizeof(unsigned long)))
  46. return -EFAULT;
  47. /* copy SPEFSCR */
  48. if (__put_user(task->thread.spefscr, &data[34]))
  49. return -EFAULT;
  50. /* copy SPE registers EVR[0] .. EVR[31] */
  51. for (i = 0; i < 32; i++, data++)
  52. if (__put_user(task->thread.evr[i], data))
  53. return -EFAULT;
  54. /* copy ACC */
  55. if (__put_user64(task->thread.acc, (unsigned long long *)data))
  56. return -EFAULT;
  57. return 0;
  58. }
  59. /*
  60. * Write contents of SPE register state into task TASK.
  61. */
  62. static inline int set_evrregs(struct task_struct *task, unsigned long *data)
  63. {
  64. int i;
  65. if (!access_ok(VERIFY_READ, data, 35 * sizeof(unsigned long)))
  66. return -EFAULT;
  67. /* copy SPEFSCR */
  68. if (__get_user(task->thread.spefscr, &data[34]))
  69. return -EFAULT;
  70. /* copy SPE registers EVR[0] .. EVR[31] */
  71. for (i = 0; i < 32; i++, data++)
  72. if (__get_user(task->thread.evr[i], data))
  73. return -EFAULT;
  74. /* copy ACC */
  75. if (__get_user64(task->thread.acc, (unsigned long long*)data))
  76. return -EFAULT;
  77. return 0;
  78. }
  79. #endif /* CONFIG_SPE */
  80. #endif /* _POWERPC_PTRACE_PPC32_H */