armemu.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  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. #ifndef __ARMEMU_H__
  15. #define __ARMEMU_H__
  16. #include "core/arm/skyeye_common/armdefs.h"
  17. //#include "skyeye.h"
  18. //extern ARMword isize;
  19. /* Shift Opcodes. */
  20. #define LSL 0
  21. #define LSR 1
  22. #define ASR 2
  23. #define ROR 3
  24. /* Macros to twiddle the status flags and mode. */
  25. #define NBIT ((unsigned)1L << 31)
  26. #define ZBIT (1L << 30)
  27. #define CBIT (1L << 29)
  28. #define VBIT (1L << 28)
  29. #define QBIT (1L << 27)
  30. #define IBIT (1L << 7)
  31. #define FBIT (1L << 6)
  32. #define IFBITS (3L << 6)
  33. #define R15IBIT (1L << 27)
  34. #define R15FBIT (1L << 26)
  35. #define R15IFBITS (3L << 26)
  36. #ifdef MODET /* Thumb support. */
  37. /* ??? This bit is actually in the low order bit of the PC in the hardware.
  38. It isn't clear if the simulator needs to model that or not. */
  39. #define TBIT (1L << 5)
  40. #define TFLAG state->TFlag
  41. #define SETT state->TFlag = 1
  42. #define CLEART state->TFlag = 0
  43. #define ASSIGNT(res) state->TFlag = res
  44. #define INSN_SIZE (TFLAG ? 2 : 4)
  45. #else
  46. #define INSN_SIZE 4
  47. #endif
  48. /*add armv6 CPSR feature*/
  49. #define EFLAG state->EFlag
  50. #define SETE state->EFlag = 1
  51. #define CLEARE state->EFlag = 0
  52. #define ASSIGNE(res) state->NFlag = res
  53. #define AFLAG state->AFlag
  54. #define SETA state->AFlag = 1
  55. #define CLEARA state->AFlag = 0
  56. #define ASSIGNA(res) state->NFlag = res
  57. #define QFLAG state->QFlag
  58. #define SETQ state->QFlag = 1
  59. #define CLEARQ state->AFlag = 0
  60. #define ASSIGNQ(res) state->QFlag = res
  61. /* add end */
  62. #define NFLAG state->NFlag
  63. #define SETN state->NFlag = 1
  64. #define CLEARN state->NFlag = 0
  65. #define ASSIGNN(res) state->NFlag = res
  66. #define ZFLAG state->ZFlag
  67. #define SETZ state->ZFlag = 1
  68. #define CLEARZ state->ZFlag = 0
  69. #define ASSIGNZ(res) state->ZFlag = res
  70. #define CFLAG state->CFlag
  71. #define SETC state->CFlag = 1
  72. #define CLEARC state->CFlag = 0
  73. #define ASSIGNC(res) state->CFlag = res
  74. #define VFLAG state->VFlag
  75. #define SETV state->VFlag = 1
  76. #define CLEARV state->VFlag = 0
  77. #define ASSIGNV(res) state->VFlag = res
  78. #define SFLAG state->SFlag
  79. #define SETS state->SFlag = 1
  80. #define CLEARS state->SFlag = 0
  81. #define ASSIGNS(res) state->SFlag = res
  82. #define IFLAG (state->IFFlags >> 1)
  83. #define FFLAG (state->IFFlags & 1)
  84. #define IFFLAGS state->IFFlags
  85. #define ASSIGNINT(res) state->IFFlags = (((res) >> 6) & 3)
  86. #define ASSIGNR15INT(res) state->IFFlags = (((res) >> 26) & 3) ;
  87. #define PSR_FBITS (0xff000000L)
  88. #define PSR_SBITS (0x00ff0000L)
  89. #define PSR_XBITS (0x0000ff00L)
  90. #define PSR_CBITS (0x000000ffL)
  91. #if defined MODE32 || defined MODET
  92. #define CCBITS (0xf8000000L)
  93. #else
  94. #define CCBITS (0xf0000000L)
  95. #endif
  96. #define INTBITS (0xc0L)
  97. #if defined MODET && defined MODE32
  98. #define PCBITS (0xffffffffL)
  99. #else
  100. #define PCBITS (0xfffffffcL)
  101. #endif
  102. #define MODEBITS (0x1fL)
  103. #define R15INTBITS (3L << 26)
  104. #if defined MODET && defined MODE32
  105. #define R15PCBITS (0x03ffffffL)
  106. #else
  107. #define R15PCBITS (0x03fffffcL)
  108. #endif
  109. #define R15PCMODEBITS (0x03ffffffL)
  110. #define R15MODEBITS (0x3L)
  111. #ifdef MODE32
  112. #define PCMASK PCBITS
  113. #define PCWRAP(pc) (pc)
  114. #else
  115. #define PCMASK R15PCBITS
  116. #define PCWRAP(pc) ((pc) & R15PCBITS)
  117. #endif
  118. #define PC (state->Reg[15] & PCMASK)
  119. #define R15CCINTMODE (state->Reg[15] & (CCBITS | R15INTBITS | R15MODEBITS))
  120. #define R15INT (state->Reg[15] & R15INTBITS)
  121. #define R15INTPC (state->Reg[15] & (R15INTBITS | R15PCBITS))
  122. #define R15INTPCMODE (state->Reg[15] & (R15INTBITS | R15PCBITS | R15MODEBITS))
  123. #define R15INTMODE (state->Reg[15] & (R15INTBITS | R15MODEBITS))
  124. #define R15PC (state->Reg[15] & R15PCBITS)
  125. #define R15PCMODE (state->Reg[15] & (R15PCBITS | R15MODEBITS))
  126. #define R15MODE (state->Reg[15] & R15MODEBITS)
  127. #define ECC ((NFLAG << 31) | (ZFLAG << 30) | (CFLAG << 29) | (VFLAG << 28) | (QFLAG << 27))
  128. #define EINT (IFFLAGS << 6)
  129. #define ER15INT (IFFLAGS << 26)
  130. #define EMODE (state->Mode)
  131. #define EGEBITS (state->GEFlag & 0x000F0000)
  132. #ifdef MODET
  133. #define CPSR (ECC | EGEBITS | (EFLAG << 9) | (AFLAG << 8) | EINT | (TFLAG << 5) | EMODE)
  134. #else
  135. #define CPSR (ECC | EINT | EMODE)
  136. #endif
  137. #ifdef MODE32
  138. #define PATCHR15
  139. #else
  140. #define PATCHR15 state->Reg[15] = ECC | ER15INT | EMODE | R15PC
  141. #endif
  142. #define GETSPSR(bank) (ARMul_GetSPSR (state, EMODE))
  143. #define SETPSR_F(d,s) d = ((d) & ~PSR_FBITS) | ((s) & PSR_FBITS)
  144. #define SETPSR_S(d,s) d = ((d) & ~PSR_SBITS) | ((s) & PSR_SBITS)
  145. #define SETPSR_X(d,s) d = ((d) & ~PSR_XBITS) | ((s) & PSR_XBITS)
  146. #define SETPSR_C(d,s) d = ((d) & ~PSR_CBITS) | ((s) & PSR_CBITS)
  147. #define SETR15PSR(s) \
  148. do \
  149. { \
  150. if (state->Mode == USER26MODE) \
  151. { \
  152. state->Reg[15] = ((s) & CCBITS) | R15PC | ER15INT | EMODE; \
  153. ASSIGNN ((state->Reg[15] & NBIT) != 0); \
  154. ASSIGNZ ((state->Reg[15] & ZBIT) != 0); \
  155. ASSIGNC ((state->Reg[15] & CBIT) != 0); \
  156. ASSIGNV ((state->Reg[15] & VBIT) != 0); \
  157. } \
  158. else \
  159. { \
  160. state->Reg[15] = R15PC | ((s) & (CCBITS | R15INTBITS | R15MODEBITS)); \
  161. ARMul_R15Altered (state); \
  162. } \
  163. } \
  164. while (0)
  165. #define SETABORT(i, m, d) \
  166. do \
  167. { \
  168. int SETABORT_mode = (m); \
  169. \
  170. ARMul_SetSPSR (state, SETABORT_mode, ARMul_GetCPSR (state)); \
  171. ARMul_SetCPSR (state, ((ARMul_GetCPSR (state) & ~(EMODE | TBIT)) \
  172. | (i) | SETABORT_mode)); \
  173. state->Reg[14] = temp - (d); \
  174. } \
  175. while (0)
  176. #ifndef MODE32
  177. #define VECTORS 0x20
  178. #define LEGALADDR 0x03ffffff
  179. #define VECTORACCESS(address) (address < VECTORS && ARMul_MODE26BIT && state->prog32Sig)
  180. #define ADDREXCEPT(address) (address > LEGALADDR && !state->data32Sig)
  181. #endif
  182. #define INTERNALABORT(address) \
  183. do \
  184. { \
  185. if (address < VECTORS) \
  186. state->Aborted = ARMul_DataAbortV; \
  187. else \
  188. state->Aborted = ARMul_AddrExceptnV; \
  189. } \
  190. while (0)
  191. #ifdef MODE32
  192. #define TAKEABORT ARMul_Abort (state, ARMul_DataAbortV)
  193. #else
  194. #define TAKEABORT \
  195. do \
  196. { \
  197. if (state->Aborted == ARMul_AddrExceptnV) \
  198. ARMul_Abort (state, ARMul_AddrExceptnV); \
  199. else \
  200. ARMul_Abort (state, ARMul_DataAbortV); \
  201. } \
  202. while (0)
  203. #endif
  204. #define CPTAKEABORT \
  205. do \
  206. { \
  207. if (!state->Aborted) \
  208. ARMul_Abort (state, ARMul_UndefinedInstrV); \
  209. else if (state->Aborted == ARMul_AddrExceptnV) \
  210. ARMul_Abort (state, ARMul_AddrExceptnV); \
  211. else \
  212. ARMul_Abort (state, ARMul_DataAbortV); \
  213. } \
  214. while (0);
  215. /* Different ways to start the next instruction. */
  216. #define SEQ 0
  217. #define NONSEQ 1
  218. #define PCINCEDSEQ 2
  219. #define PCINCEDNONSEQ 3
  220. #define PRIMEPIPE 4
  221. #define RESUME 8
  222. /************************************/
  223. /* shenoubang 2012-3-11 */
  224. /* for armv7 DBG DMB DSB instr*/
  225. /************************************/
  226. #define MBReqTypes_Writes 0
  227. #define MBReqTypes_All 1
  228. #define NORMALCYCLE state->NextInstr = 0
  229. #define BUSUSEDN state->NextInstr |= 1 /* The next fetch will be an N cycle. */
  230. #define BUSUSEDINCPCS \
  231. do \
  232. { \
  233. if (! state->is_v4) \
  234. { \
  235. /* A standard PC inc and an S cycle. */ \
  236. state->Reg[15] += INSN_SIZE; \
  237. state->NextInstr = (state->NextInstr & 0xff) | 2; \
  238. } \
  239. } \
  240. while (0)
  241. #define BUSUSEDINCPCN \
  242. do \
  243. { \
  244. if (state->is_v4) \
  245. BUSUSEDN; \
  246. else \
  247. { \
  248. /* A standard PC inc and an N cycle. */ \
  249. state->Reg[15] += INSN_SIZE; \
  250. state->NextInstr |= 3; \
  251. } \
  252. } \
  253. while (0)
  254. #define INCPC \
  255. do \
  256. { \
  257. /* A standard PC inc. */ \
  258. state->Reg[15] += INSN_SIZE; \
  259. state->NextInstr |= 2; \
  260. } \
  261. while (0)
  262. #define FLUSHPIPE state->NextInstr |= PRIMEPIPE
  263. /* Cycle based emulation. */
  264. #define OUTPUTCP(i,a,b)
  265. #define NCYCLE
  266. #define SCYCLE
  267. #define ICYCLE
  268. #define CCYCLE
  269. #define NEXTCYCLE(c)
  270. /* Macros to extract parts of instructions. */
  271. #define DESTReg (BITS (12, 15))
  272. #define LHSReg (BITS (16, 19))
  273. #define RHSReg (BITS ( 0, 3))
  274. #define DEST (state->Reg[DESTReg])
  275. #ifdef MODE32
  276. #ifdef MODET
  277. #define LHS ((LHSReg == 15) ? (state->Reg[15] & 0xFFFFFFFC) : (state->Reg[LHSReg]))
  278. #define RHS ((RHSReg == 15) ? (state->Reg[15] & 0xFFFFFFFC) : (state->Reg[RHSReg]))
  279. #else
  280. #define LHS (state->Reg[LHSReg])
  281. #define RHS (state->Reg[RHSReg])
  282. #endif
  283. #else
  284. #define LHS ((LHSReg == 15) ? R15PC : (state->Reg[LHSReg]))
  285. #define RHS ((RHSReg == 15) ? R15PC : (state->Reg[RHSReg]))
  286. #endif
  287. #define MULDESTReg (BITS (16, 19))
  288. #define MULLHSReg (BITS ( 0, 3))
  289. #define MULRHSReg (BITS ( 8, 11))
  290. #define MULACCReg (BITS (12, 15))
  291. #define DPImmRHS (ARMul_ImmedTable[BITS(0, 11)])
  292. #define DPSImmRHS temp = BITS(0,11) ; \
  293. rhs = ARMul_ImmedTable[temp] ; \
  294. if (temp > 255) /* There was a shift. */ \
  295. ASSIGNC (rhs >> 31) ;
  296. #ifdef MODE32
  297. #define DPRegRHS ((BITS (4,11) == 0) ? state->Reg[RHSReg] \
  298. : GetDPRegRHS (state, instr))
  299. #define DPSRegRHS ((BITS (4,11) == 0) ? state->Reg[RHSReg] \
  300. : GetDPSRegRHS (state, instr))
  301. #else
  302. #define DPRegRHS ((BITS (0, 11) < 15) ? state->Reg[RHSReg] \
  303. : GetDPRegRHS (state, instr))
  304. #define DPSRegRHS ((BITS (0, 11) < 15) ? state->Reg[RHSReg] \
  305. : GetDPSRegRHS (state, instr))
  306. #endif
  307. #define LSBase state->Reg[LHSReg]
  308. #define LSImmRHS (BITS(0,11))
  309. #ifdef MODE32
  310. #define LSRegRHS ((BITS (4, 11) == 0) ? state->Reg[RHSReg] \
  311. : GetLSRegRHS (state, instr))
  312. #else
  313. #define LSRegRHS ((BITS (0, 11) < 15) ? state->Reg[RHSReg] \
  314. : GetLSRegRHS (state, instr))
  315. #endif
  316. #define LSMNumRegs ((ARMword) ARMul_BitList[BITS (0, 7)] + \
  317. (ARMword) ARMul_BitList[BITS (8, 15)] )
  318. #define LSMBaseFirst ((LHSReg == 0 && BIT (0)) || \
  319. (BIT (LHSReg) && BITS (0, LHSReg - 1) == 0))
  320. #define SWAPSRC (state->Reg[RHSReg])
  321. #define LSCOff (BITS (0, 7) << 2)
  322. #define CPNum BITS (8, 11)
  323. /* Determine if access to coprocessor CP is permitted.
  324. The XScale has a register in CP15 which controls access to CP0 - CP13. */
  325. //chy 2003-09-03, new CP_ACCESS_ALLOWED
  326. /*
  327. #define CP_ACCESS_ALLOWED(STATE, CP) \
  328. ( ((CP) >= 14) \
  329. || (! (STATE)->is_XScale) \
  330. || (read_cp15_reg (15, 0, 1) & (1 << (CP))))
  331. */
  332. #define CP_ACCESS_ALLOWED(STATE, CP) \
  333. ( ((CP) >= 14) ) \
  334. /* Macro to rotate n right by b bits. */
  335. #define ROTATER(n, b) (((n) >> (b)) | ((n) << (32 - (b))))
  336. /* Macros to store results of instructions. */
  337. #define WRITEDEST(d) \
  338. do \
  339. { \
  340. if (DESTReg == 15) \
  341. WriteR15 (state, d); \
  342. else \
  343. DEST = d; \
  344. } \
  345. while (0)
  346. #define WRITESDEST(d) \
  347. do \
  348. { \
  349. if (DESTReg == 15) \
  350. WriteSR15 (state, d); \
  351. else \
  352. { \
  353. DEST = d; \
  354. ARMul_NegZero (state, d); \
  355. } \
  356. } \
  357. while (0)
  358. #define WRITEDESTB(d) \
  359. do \
  360. { \
  361. if (DESTReg == 15){ \
  362. WriteR15Branch (state, d); \
  363. } \
  364. else{ \
  365. DEST = d; \
  366. } \
  367. } \
  368. while (0)
  369. #define BYTETOBUS(data) ((data & 0xff) | \
  370. ((data & 0xff) << 8) | \
  371. ((data & 0xff) << 16) | \
  372. ((data & 0xff) << 24))
  373. #define BUSTOBYTE(address, data) \
  374. do \
  375. { \
  376. if (state->bigendSig) \
  377. temp = (data >> (((address ^ 3) & 3) << 3)) & 0xff; \
  378. else \
  379. temp = (data >> ((address & 3) << 3)) & 0xff; \
  380. } \
  381. while (0)
  382. #define LOADMULT(instr, address, wb) LoadMult (state, instr, address, wb)
  383. #define LOADSMULT(instr, address, wb) LoadSMult (state, instr, address, wb)
  384. #define STOREMULT(instr, address, wb) StoreMult (state, instr, address, wb)
  385. #define STORESMULT(instr, address, wb) StoreSMult (state, instr, address, wb)
  386. #define POSBRANCH ((instr & 0x7fffff) << 2)
  387. #define NEGBRANCH ((0xff000000 |(instr & 0xffffff)) << 2)
  388. /* Values for Emulate. */
  389. #define STOP 0 /* stop */
  390. #define CHANGEMODE 1 /* change mode */
  391. #define ONCE 2 /* execute just one interation */
  392. #define RUN 3 /* continuous execution */
  393. /* Stuff that is shared across modes. */
  394. extern unsigned ARMul_MultTable[]; /* Number of I cycles for a mult. */
  395. extern ARMword ARMul_ImmedTable[]; /* Immediate DP LHS values. */
  396. extern char ARMul_BitList[]; /* Number of bits in a byte table. */
  397. #define EVENTLISTSIZE 1024L
  398. /* Thumb support. */
  399. typedef enum
  400. {
  401. t_undefined, /* Undefined Thumb instruction. */
  402. t_decoded, /* Instruction decoded to ARM equivalent. */
  403. t_branch /* Thumb branch (already processed). */
  404. }
  405. tdstate;
  406. /*********************************************************************************
  407. * Check all the possible undef or unpredict behavior, Some of them probably is
  408. * out-of-updated with the newer ISA.
  409. * -- Michael.Kang
  410. ********************************************************************************/
  411. #define UNDEF_WARNING LOG_WARNING(Core_ARM11, "undefined or unpredicted behavior for arm instruction.");
  412. /* Macros to scrutinize instructions. */
  413. #define UNDEF_Test UNDEF_WARNING
  414. //#define UNDEF_Test
  415. //#define UNDEF_Shift UNDEF_WARNING
  416. #define UNDEF_Shift
  417. //#define UNDEF_MSRPC UNDEF_WARNING
  418. #define UNDEF_MSRPC
  419. //#define UNDEF_MRSPC UNDEF_WARNING
  420. #define UNDEF_MRSPC
  421. #define UNDEF_MULPCDest UNDEF_WARNING
  422. //#define UNDEF_MULPCDest
  423. #define UNDEF_MULDestEQOp1 UNDEF_WARNING
  424. //#define UNDEF_MULDestEQOp1
  425. //#define UNDEF_LSRBPC UNDEF_WARNING
  426. #define UNDEF_LSRBPC
  427. //#define UNDEF_LSRBaseEQOffWb UNDEF_WARNING
  428. #define UNDEF_LSRBaseEQOffWb
  429. //#define UNDEF_LSRBaseEQDestWb UNDEF_WARNING
  430. #define UNDEF_LSRBaseEQDestWb
  431. //#define UNDEF_LSRPCBaseWb UNDEF_WARNING
  432. #define UNDEF_LSRPCBaseWb
  433. //#define UNDEF_LSRPCOffWb UNDEF_WARNING
  434. #define UNDEF_LSRPCOffWb
  435. //#define UNDEF_LSMNoRegs UNDEF_WARNING
  436. #define UNDEF_LSMNoRegs
  437. //#define UNDEF_LSMPCBase UNDEF_WARNING
  438. #define UNDEF_LSMPCBase
  439. //#define UNDEF_LSMUserBankWb UNDEF_WARNING
  440. #define UNDEF_LSMUserBankWb
  441. //#define UNDEF_LSMBaseInListWb UNDEF_WARNING
  442. #define UNDEF_LSMBaseInListWb
  443. #define UNDEF_SWPPC UNDEF_WARNING
  444. //#define UNDEF_SWPPC
  445. #define UNDEF_CoProHS UNDEF_WARNING
  446. //#define UNDEF_CoProHS
  447. #define UNDEF_MCRPC UNDEF_WARNING
  448. //#define UNDEF_MCRPC
  449. //#define UNDEF_LSCPCBaseWb UNDEF_WARNING
  450. #define UNDEF_LSCPCBaseWb
  451. #define UNDEF_UndefNotBounced UNDEF_WARNING
  452. //#define UNDEF_UndefNotBounced
  453. #define UNDEF_ShortInt UNDEF_WARNING
  454. //#define UNDEF_ShortInt
  455. #define UNDEF_IllegalMode UNDEF_WARNING
  456. //#define UNDEF_IllegalMode
  457. #define UNDEF_Prog32SigChange UNDEF_WARNING
  458. //#define UNDEF_Prog32SigChange
  459. #define UNDEF_Data32SigChange UNDEF_WARNING
  460. //#define UNDEF_Data32SigChange
  461. /* Prototypes for exported functions. */
  462. extern unsigned ARMul_NthReg (ARMword, unsigned);
  463. /* Prototypes for exported functions. */
  464. #ifdef __cplusplus
  465. extern "C" {
  466. #endif
  467. extern ARMword ARMul_Emulate26 (ARMul_State *);
  468. extern ARMword ARMul_Emulate32 (ARMul_State *);
  469. #ifdef __cplusplus
  470. }
  471. #endif
  472. extern unsigned IntPending (ARMul_State *);
  473. extern void ARMul_CPSRAltered (ARMul_State *);
  474. extern void ARMul_R15Altered (ARMul_State *);
  475. extern ARMword ARMul_GetPC (ARMul_State *);
  476. extern ARMword ARMul_GetNextPC (ARMul_State *);
  477. extern ARMword ARMul_GetR15 (ARMul_State *);
  478. extern ARMword ARMul_GetCPSR (ARMul_State *);
  479. extern void ARMul_NegZero (ARMul_State *, ARMword);
  480. extern void ARMul_SetPC (ARMul_State *, ARMword);
  481. extern void ARMul_SetR15 (ARMul_State *, ARMword);
  482. extern void ARMul_SetCPSR (ARMul_State *, ARMword);
  483. extern ARMword ARMul_GetSPSR (ARMul_State *, ARMword);
  484. extern void ARMul_Abort26 (ARMul_State *, ARMword);
  485. extern void ARMul_Abort32 (ARMul_State *, ARMword);
  486. extern ARMword ARMul_MRC (ARMul_State *, ARMword);
  487. extern void ARMul_MRRC (ARMul_State *, ARMword, ARMword *, ARMword *);
  488. extern void ARMul_CDP (ARMul_State *, ARMword);
  489. extern void ARMul_LDC (ARMul_State *, ARMword, ARMword);
  490. extern void ARMul_STC (ARMul_State *, ARMword, ARMword);
  491. extern void ARMul_MCR (ARMul_State *, ARMword, ARMword);
  492. extern void ARMul_MCRR (ARMul_State *, ARMword, ARMword, ARMword);
  493. extern void ARMul_SetSPSR (ARMul_State *, ARMword, ARMword);
  494. extern ARMword ARMul_SwitchMode (ARMul_State *, ARMword, ARMword);
  495. extern ARMword ARMul_Align (ARMul_State *, ARMword, ARMword);
  496. extern ARMword ARMul_SwitchMode (ARMul_State *, ARMword, ARMword);
  497. extern void ARMul_MSRCpsr (ARMul_State *, ARMword, ARMword);
  498. extern void ARMul_SubOverflow (ARMul_State *, ARMword, ARMword, ARMword);
  499. extern void ARMul_AddOverflow (ARMul_State *, ARMword, ARMword, ARMword);
  500. extern void ARMul_SubCarry (ARMul_State *, ARMword, ARMword, ARMword);
  501. extern void ARMul_AddCarry (ARMul_State *, ARMword, ARMword, ARMword);
  502. extern tdstate ARMul_ThumbDecode (ARMul_State *, ARMword, ARMword, ARMword *);
  503. extern ARMword ARMul_GetReg (ARMul_State *, unsigned, unsigned);
  504. extern void ARMul_SetReg (ARMul_State *, unsigned, unsigned, ARMword);
  505. /* Coprocessor support functions. */
  506. extern unsigned ARMul_CoProInit (ARMul_State *);
  507. extern void ARMul_CoProExit (ARMul_State *);
  508. extern void ARMul_CoProAttach (ARMul_State *, unsigned, ARMul_CPInits *,
  509. ARMul_CPExits *, ARMul_LDCs *, ARMul_STCs *,
  510. ARMul_MRCs *, ARMul_MCRs *, ARMul_MRRCs *, ARMul_MCRRs *,
  511. ARMul_CDPs *, ARMul_CPReads *, ARMul_CPWrites *);
  512. extern void ARMul_CoProDetach (ARMul_State *, unsigned);
  513. extern ARMword read_cp15_reg (unsigned, unsigned, unsigned);
  514. extern unsigned DSPLDC4 (ARMul_State *, unsigned, ARMword, ARMword);
  515. extern unsigned DSPMCR4 (ARMul_State *, unsigned, ARMword, ARMword);
  516. extern unsigned DSPMRC4 (ARMul_State *, unsigned, ARMword, ARMword *);
  517. extern unsigned DSPSTC4 (ARMul_State *, unsigned, ARMword, ARMword *);
  518. extern unsigned DSPCDP4 (ARMul_State *, unsigned, ARMword);
  519. extern unsigned DSPMCR5 (ARMul_State *, unsigned, ARMword, ARMword);
  520. extern unsigned DSPMRC5 (ARMul_State *, unsigned, ARMword, ARMword *);
  521. extern unsigned DSPLDC5 (ARMul_State *, unsigned, ARMword, ARMword);
  522. extern unsigned DSPSTC5 (ARMul_State *, unsigned, ARMword, ARMword *);
  523. extern unsigned DSPCDP5 (ARMul_State *, unsigned, ARMword);
  524. extern unsigned DSPMCR6 (ARMul_State *, unsigned, ARMword, ARMword);
  525. extern unsigned DSPMRC6 (ARMul_State *, unsigned, ARMword, ARMword *);
  526. extern unsigned DSPCDP6 (ARMul_State *, unsigned, ARMword);
  527. #endif