ptrace.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (C) 2012 Regents of the University of California
  4. */
  5. #ifndef _ASM_RISCV_PTRACE_H
  6. #define _ASM_RISCV_PTRACE_H
  7. #ifndef __ASSEMBLY__
  8. #include <linux/types.h>
  9. #define PTRACE_GETFDPIC 33
  10. #define PTRACE_GETFDPIC_EXEC 0
  11. #define PTRACE_GETFDPIC_INTERP 1
  12. /*
  13. * User-mode register state for core dumps, ptrace, sigcontext
  14. *
  15. * This decouples struct pt_regs from the userspace ABI.
  16. * struct user_regs_struct must form a prefix of struct pt_regs.
  17. */
  18. struct user_regs_struct {
  19. unsigned long pc;
  20. unsigned long ra;
  21. unsigned long sp;
  22. unsigned long gp;
  23. unsigned long tp;
  24. unsigned long t0;
  25. unsigned long t1;
  26. unsigned long t2;
  27. unsigned long s0;
  28. unsigned long s1;
  29. unsigned long a0;
  30. unsigned long a1;
  31. unsigned long a2;
  32. unsigned long a3;
  33. unsigned long a4;
  34. unsigned long a5;
  35. unsigned long a6;
  36. unsigned long a7;
  37. unsigned long s2;
  38. unsigned long s3;
  39. unsigned long s4;
  40. unsigned long s5;
  41. unsigned long s6;
  42. unsigned long s7;
  43. unsigned long s8;
  44. unsigned long s9;
  45. unsigned long s10;
  46. unsigned long s11;
  47. unsigned long t3;
  48. unsigned long t4;
  49. unsigned long t5;
  50. unsigned long t6;
  51. };
  52. struct __riscv_f_ext_state {
  53. __u32 f[32];
  54. __u32 fcsr;
  55. };
  56. struct __riscv_d_ext_state {
  57. __u64 f[32];
  58. __u32 fcsr;
  59. };
  60. struct __riscv_q_ext_state {
  61. __u64 f[64] __attribute__((aligned(16)));
  62. __u32 fcsr;
  63. /*
  64. * Reserved for expansion of sigcontext structure. Currently zeroed
  65. * upon signal, and must be zero upon sigreturn.
  66. */
  67. __u32 reserved[3];
  68. };
  69. struct __riscv_ctx_hdr {
  70. __u32 magic;
  71. __u32 size;
  72. };
  73. struct __riscv_extra_ext_header {
  74. __u32 __padding[129] __attribute__((aligned(16)));
  75. /*
  76. * Reserved for expansion of sigcontext structure. Currently zeroed
  77. * upon signal, and must be zero upon sigreturn.
  78. */
  79. __u32 reserved;
  80. struct __riscv_ctx_hdr hdr;
  81. };
  82. union __riscv_fp_state {
  83. struct __riscv_f_ext_state f;
  84. struct __riscv_d_ext_state d;
  85. struct __riscv_q_ext_state q;
  86. };
  87. struct __riscv_v_ext_state {
  88. unsigned long vstart;
  89. unsigned long vl;
  90. unsigned long vtype;
  91. unsigned long vcsr;
  92. unsigned long vlenb;
  93. void *datap;
  94. /*
  95. * In signal handler, datap will be set a correct user stack offset
  96. * and vector registers will be copied to the address of datap
  97. * pointer.
  98. */
  99. };
  100. struct __riscv_v_regset_state {
  101. unsigned long vstart;
  102. unsigned long vl;
  103. unsigned long vtype;
  104. unsigned long vcsr;
  105. unsigned long vlenb;
  106. char vreg[];
  107. };
  108. /*
  109. * According to spec: The number of bits in a single vector register,
  110. * VLEN >= ELEN, which must be a power of 2, and must be no greater than
  111. * 2^16 = 65536bits = 8192bytes
  112. */
  113. #define RISCV_MAX_VLENB (8192)
  114. #endif /* __ASSEMBLY__ */
  115. #endif /* _ASM_RISCV_PTRACE_H */