sim-main.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* Moxie Simulator definition.
  2. Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. This file is part of GDB, the GNU debugger.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef SIM_MAIN_H
  15. #define SIM_MAIN_H
  16. #include "sim-basics.h"
  17. #include "sim-base.h"
  18. typedef struct
  19. {
  20. int regs[20];
  21. } regstacktype;
  22. typedef union
  23. {
  24. struct
  25. {
  26. int regs[16];
  27. int pc;
  28. /* System registers. For sh-dsp this also includes A0 / X0 / X1 / Y0 / Y1
  29. which are located in fregs. Probably should include pc too - to avoid
  30. alignment repercussions. */
  31. union {
  32. struct {
  33. int mach;
  34. int macl;
  35. int pr;
  36. int dummy3, dummy4;
  37. int fpul; /* A1 for sh-dsp - but only for movs etc. */
  38. int fpscr; /* dsr for sh-dsp */
  39. /* sh3e / sh-dsp */
  40. union fregs_u {
  41. float f[16];
  42. double d[8];
  43. int i[16];
  44. } fregs[2];
  45. };
  46. int sregs[39];
  47. };
  48. /* Control registers; on the SH4, ldc / stc is privileged, except when
  49. accessing gbr. */
  50. union
  51. {
  52. struct
  53. {
  54. int sr;
  55. int gbr;
  56. int vbr;
  57. int ssr;
  58. int spc;
  59. int mod;
  60. /* sh-dsp */
  61. int rs;
  62. int re;
  63. /* sh3 */
  64. int bank[8];
  65. int dbr; /* debug base register */
  66. int sgr; /* saved gr15 */
  67. int ldst; /* load/store flag (boolean) */
  68. int tbr;
  69. int ibcr; /* sh2a bank control register */
  70. int ibnr; /* sh2a bank number register */
  71. };
  72. int cregs[16];
  73. };
  74. unsigned char *insn_end;
  75. int ticks;
  76. int stalls;
  77. int memstalls;
  78. int cycles;
  79. int insts;
  80. int prevlock;
  81. int thislock;
  82. int exception;
  83. int end_of_registers;
  84. int msize;
  85. #define PROFILE_FREQ 1
  86. #define PROFILE_SHIFT 2
  87. int profile;
  88. unsigned short *profile_hist;
  89. unsigned char *memory;
  90. int xyram_select, xram_start, yram_start;
  91. unsigned char *xmem;
  92. unsigned char *ymem;
  93. unsigned char *xmem_offset;
  94. unsigned char *ymem_offset;
  95. unsigned long bfd_mach;
  96. regstacktype *regstack;
  97. } asregs;
  98. int asints[40];
  99. } saved_state_type;
  100. /* TODO: Move into sim_cpu. */
  101. extern saved_state_type saved_state;
  102. struct _sim_cpu {
  103. sim_cpu_base base;
  104. };
  105. #endif