armemu.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* armemu.h -- ARMulator emulation macros: ARM6 Instruction Emulator.
  2. Copyright (C) 1994 Advanced RISC Machines Ltd.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #pragma once
  15. #include "core/arm/skyeye_common/armdefs.h"
  16. /* Macros to twiddle the status flags and mode. */
  17. #define NBIT ((unsigned)1L << 31)
  18. #define ZBIT (1L << 30)
  19. #define CBIT (1L << 29)
  20. #define VBIT (1L << 28)
  21. #define QBIT (1L << 27)
  22. #define IBIT (1L << 7)
  23. #define FBIT (1L << 6)
  24. #define IFBITS (3L << 6)
  25. #define R15IBIT (1L << 27)
  26. #define R15FBIT (1L << 26)
  27. #define R15IFBITS (3L << 26)
  28. #if defined MODE32 || defined MODET
  29. #define CCBITS (0xf8000000L)
  30. #else
  31. #define CCBITS (0xf0000000L)
  32. #endif
  33. #define INTBITS (0xc0L)
  34. #if defined MODET && defined MODE32
  35. #define PCBITS (0xffffffffL)
  36. #else
  37. #define PCBITS (0xfffffffcL)
  38. #endif
  39. #define MODEBITS (0x1fL)
  40. #define R15INTBITS (3L << 26)
  41. #if defined MODET && defined MODE32
  42. #define R15PCBITS (0x03ffffffL)
  43. #else
  44. #define R15PCBITS (0x03fffffcL)
  45. #endif
  46. #define R15MODEBITS (0x3L)
  47. #ifdef MODE32
  48. #define PCMASK PCBITS
  49. #define PCWRAP(pc) (pc)
  50. #else
  51. #define PCMASK R15PCBITS
  52. #define PCWRAP(pc) ((pc) & R15PCBITS)
  53. #endif
  54. #define PC (state->Reg[15] & PCMASK)
  55. #define R15CCINTMODE (state->Reg[15] & (CCBITS | R15INTBITS | R15MODEBITS))
  56. #define R15INT (state->Reg[15] & R15INTBITS)
  57. #define R15INTPC (state->Reg[15] & (R15INTBITS | R15PCBITS))
  58. #define R15INTPCMODE (state->Reg[15] & (R15INTBITS | R15PCBITS | R15MODEBITS))
  59. #define R15INTMODE (state->Reg[15] & (R15INTBITS | R15MODEBITS))
  60. #define R15PC (state->Reg[15] & R15PCBITS)
  61. #define R15PCMODE (state->Reg[15] & (R15PCBITS | R15MODEBITS))
  62. #define R15MODE (state->Reg[15] & R15MODEBITS)
  63. // Different ways to start the next instruction.
  64. enum {
  65. SEQ = 0,
  66. NONSEQ = 1,
  67. PCINCEDSEQ = 2,
  68. PCINCEDNONSEQ = 3,
  69. PRIMEPIPE = 4,
  70. RESUME = 8
  71. };
  72. // Values for Emulate.
  73. enum {
  74. STOP = 0, // Stop
  75. CHANGEMODE = 1, // Change mode
  76. ONCE = 2, // Execute just one interation
  77. RUN = 3 // Continuous execution
  78. };
  79. #define FLUSHPIPE state->NextInstr |= PRIMEPIPE
  80. // Coprocessor support functions.
  81. extern void ARMul_CoProInit(ARMul_State*);
  82. extern void ARMul_CoProExit(ARMul_State*);
  83. extern void ARMul_CoProAttach(ARMul_State*, unsigned, ARMul_CPInits*,
  84. ARMul_CPExits*, ARMul_LDCs*, ARMul_STCs*,
  85. ARMul_MRCs*, ARMul_MCRs*, ARMul_MRRCs*, ARMul_MCRRs*,
  86. ARMul_CDPs*, ARMul_CPReads*, ARMul_CPWrites*);
  87. extern void ARMul_CoProDetach(ARMul_State*, unsigned);