ptrace.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Author: Hanlu Li <lihanlu@loongson.cn>
  4. * Huacai Chen <chenhuacai@loongson.cn>
  5. *
  6. * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  7. */
  8. #ifndef _UAPI_ASM_PTRACE_H
  9. #define _UAPI_ASM_PTRACE_H
  10. #include <linux/types.h>
  11. /*
  12. * For PTRACE_{POKE,PEEK}USR. 0 - 31 are GPRs,
  13. * 32 is syscall's original ARG0, 33 is PC, 34 is BADVADDR.
  14. */
  15. #define GPR_BASE 0
  16. #define GPR_NUM 32
  17. #define GPR_END (GPR_BASE + GPR_NUM - 1)
  18. #define ARG0 (GPR_END + 1)
  19. #define PC (GPR_END + 2)
  20. #define BADVADDR (GPR_END + 3)
  21. #define NUM_FPU_REGS 32
  22. struct user_pt_regs {
  23. /* Main processor registers. */
  24. unsigned long regs[32];
  25. /* Original syscall arg0. */
  26. unsigned long orig_a0;
  27. /* Special CSR registers. */
  28. unsigned long csr_era;
  29. unsigned long csr_badv;
  30. unsigned long reserved[10];
  31. } __attribute__((aligned(8)));
  32. struct user_fp_state {
  33. __u64 fpr[32];
  34. __u64 fcc;
  35. __u32 fcsr;
  36. };
  37. struct user_lsx_state {
  38. /* 32 registers, 128 bits width per register. */
  39. __u64 vregs[32*2];
  40. };
  41. struct user_lasx_state {
  42. /* 32 registers, 256 bits width per register. */
  43. __u64 vregs[32*4];
  44. };
  45. struct user_lbt_state {
  46. __u64 scr[4];
  47. __u32 eflags;
  48. __u32 ftop;
  49. };
  50. struct user_watch_state {
  51. __u64 dbg_info;
  52. struct {
  53. #if __BITS_PER_LONG == 32
  54. __u32 addr;
  55. __u32 mask;
  56. #else
  57. __u64 addr;
  58. __u64 mask;
  59. #endif
  60. __u32 ctrl;
  61. __u32 pad;
  62. } dbg_regs[8];
  63. };
  64. struct user_watch_state_v2 {
  65. __u64 dbg_info;
  66. struct {
  67. #if __BITS_PER_LONG == 32
  68. __u32 addr;
  69. __u32 mask;
  70. #else
  71. __u64 addr;
  72. __u64 mask;
  73. #endif
  74. __u32 ctrl;
  75. __u32 pad;
  76. } dbg_regs[14];
  77. };
  78. #define PTRACE_SYSEMU 0x1f
  79. #define PTRACE_SYSEMU_SINGLESTEP 0x20
  80. #endif /* _UAPI_ASM_PTRACE_H */