armemu.h 19 KB

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