gdb_machdep.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*-
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2021 Mitchell Horne <mhorne@FreeBSD.org>
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  17. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  20. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  21. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  22. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  23. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  24. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  25. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  26. * SUCH DAMAGE.
  27. */
  28. #ifndef _MACHINE_GDB_MACHDEP_H_
  29. #define _MACHINE_GDB_MACHDEP_H_
  30. #define GDB_BUFSZ 4096
  31. #define GDB_NREGS 33
  32. #define GDB_REG_ZERO 0
  33. #define GDB_REG_RA 1
  34. #define GDB_REG_SP 2
  35. #define GDB_REG_GP 3
  36. #define GDB_REG_TP 4
  37. #define GDB_REG_T0 5
  38. #define GDB_REG_FP 8
  39. #define GDB_REG_S1 9
  40. #define GDB_REG_A0 10
  41. #define GDB_REG_S2 18
  42. #define GDB_REG_T3 28
  43. #define GDB_REG_PC 32
  44. #define GDB_REG_CSR_BASE 65
  45. #define GDB_REG_SSTATUS (GDB_REG_CSR_BASE + 0x100)
  46. #define GDB_REG_SCAUSE (GDB_REG_CSR_BASE + 0x142)
  47. #define GDB_REG_STVAL (GDB_REG_CSR_BASE + 0x143)
  48. _Static_assert(GDB_BUFSZ >= (GDB_NREGS * 8), "buffer fits 'g' regs");
  49. static __inline size_t
  50. gdb_cpu_regsz(int regnum __unused)
  51. {
  52. return (8);
  53. }
  54. static __inline int
  55. gdb_cpu_query(void)
  56. {
  57. return (0);
  58. }
  59. static __inline void *
  60. gdb_begin_write(void)
  61. {
  62. return (NULL);
  63. }
  64. static __inline void
  65. gdb_end_write(void *arg __unused)
  66. {
  67. }
  68. static __inline void
  69. gdb_cpu_stop_reason(int type __unused, int code __unused)
  70. {
  71. }
  72. void *gdb_cpu_getreg(int, size_t *);
  73. void gdb_cpu_setreg(int, void *);
  74. int gdb_cpu_signal(int, int);
  75. #endif /* !_MACHINE_GDB_MACHDEP_H_ */