2961
|
1 /* Copyright (C) 2006 yopyop
|
|
2 yopyop156@ifrance.com
|
|
3 yopyop156.ifrance.com
|
|
4
|
|
5 This file is part of DeSmuME
|
|
6
|
|
7 DeSmuME is free software; you can redistribute it and/or modify
|
|
8 it under the terms of the GNU General Public License as published by
|
|
9 the Free Software Foundation; either version 2 of the License, or
|
|
10 (at your option) any later version.
|
|
11
|
|
12 DeSmuME is distributed in the hope that it will be useful,
|
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 GNU General Public License for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with DeSmuME; if not, write to the Free Software
|
|
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20 */
|
|
21
|
|
22 #ifndef __CP15_H__
|
|
23 #define __CP15_H__
|
|
24
|
|
25 #include "armcpu.h"
|
|
26
|
|
27 typedef struct
|
|
28 {
|
|
29 u32 IDCode;
|
|
30 u32 cacheType;
|
|
31 u32 TCMSize;
|
|
32 u32 ctrl;
|
|
33 u32 DCConfig;
|
|
34 u32 ICConfig;
|
|
35 u32 writeBuffCtrl;
|
|
36 u32 und;
|
|
37 u32 DaccessPerm;
|
|
38 u32 IaccessPerm;
|
|
39 u32 protectBaseSize0;
|
|
40 u32 protectBaseSize1;
|
|
41 u32 protectBaseSize2;
|
|
42 u32 protectBaseSize3;
|
|
43 u32 protectBaseSize4;
|
|
44 u32 protectBaseSize5;
|
|
45 u32 protectBaseSize6;
|
|
46 u32 protectBaseSize7;
|
|
47 u32 cacheOp;
|
|
48 u32 DcacheLock;
|
|
49 u32 IcacheLock;
|
|
50 u32 ITCMRegion;
|
|
51 u32 DTCMRegion;
|
|
52 u32 processID;
|
|
53 u32 RAM_TAG;
|
|
54 u32 testState;
|
|
55 u32 cacheDbg;
|
|
56 /* calculated bitmasks for the regions to decide rights uppon */
|
|
57 /* calculation is done in the MCR instead of on mem access for performance */
|
|
58 u32 regionWriteMask_USR[8] ;
|
|
59 u32 regionWriteMask_SYS[8] ;
|
|
60 u32 regionReadMask_USR[8] ;
|
|
61 u32 regionReadMask_SYS[8] ;
|
|
62 u32 regionExecuteMask_USR[8] ;
|
|
63 u32 regionExecuteMask_SYS[8] ;
|
|
64 u32 regionWriteSet_USR[8] ;
|
|
65 u32 regionWriteSet_SYS[8] ;
|
|
66 u32 regionReadSet_USR[8] ;
|
|
67 u32 regionReadSet_SYS[8] ;
|
|
68 u32 regionExecuteSet_USR[8] ;
|
|
69 u32 regionExecuteSet_SYS[8] ;
|
|
70
|
|
71 armcpu_t * cpu;
|
|
72
|
|
73 } armcp15_t;
|
|
74
|
|
75 armcp15_t *armcp15_new(armcpu_t *c);
|
|
76 BOOL armcp15_dataProcess(armcp15_t *armcp15, u8 CRd, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2);
|
|
77 BOOL armcp15_load(armcp15_t *armcp15, u8 CRd, u8 adr);
|
|
78 BOOL armcp15_store(armcp15_t *armcp15, u8 CRd, u8 adr);
|
|
79 BOOL armcp15_moveCP2ARM(armcp15_t *armcp15, u32 * R, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2);
|
|
80 BOOL armcp15_moveARM2CP(armcp15_t *armcp15, u32 val, u8 CRn, u8 CRm, u8 opcode1, u8 opcode2);
|
|
81 INLINE BOOL armcp15_isAccessAllowed(armcp15_t *armcp15,u32 address,u32 access) ;
|
|
82
|
|
83
|
|
84 #define CP15_ACCESS_WRITE 0
|
|
85 #define CP15_ACCESS_READ 2
|
|
86 #define CP15_ACCESS_EXECUTE 4
|
|
87 #define CP15_ACCESS_WRITEUSR CP15_ACCESS_WRITE
|
|
88 #define CP15_ACCESS_WRITESYS 1
|
|
89 #define CP15_ACCESS_READUSR CP15_ACCESS_READ
|
|
90 #define CP15_ACCESS_READSYS 3
|
|
91 #define CP15_ACCESS_EXECUSR CP15_ACCESS_EXECUTE
|
|
92 #define CP15_ACCESS_EXECSYS 5
|
|
93
|
|
94 #endif /* __CP15_H__*/
|