Browse code

Use #pragma once instead of include guards.

Naram Qashat authored on 2014/09/08 14:47:36
Showing 1 changed files
... ...
@@ -16,8 +16,7 @@
16 16
 	along with the this software.  If not, see <http://www.gnu.org/licenses/>.
17 17
 */
18 18
 
19
-#ifndef __CP15_H__
20
-#define __CP15_H__
19
+#pragma once
21 20
 
22 21
 #include "armcpu.h"
23 22
 
... ...
@@ -110,5 +109,3 @@ public:
110 109
 
111 110
 extern armcp15_t cp15;
112 111
 void maskPrecalc();
113
-
114
-#endif /* __CP15_H__*/
Browse code

Updating in_2sf to use a newish version of DeSmuME, 0.9.9 from SVN. Somewhat cleaned up as well, but not everything because it's a pain in the ass.

Naram Qashat authored on 2013/04/18 17:22:55
Showing 1 changed files
... ...
@@ -21,8 +21,19 @@
21 21
 
22 22
 #include "armcpu.h"
23 23
 
24
+const uint32_t CP15_ACCESS_WRITE = 0;
25
+const uint32_t CP15_ACCESS_READ = 2;
26
+const uint32_t CP15_ACCESS_EXECUTE = 4;
27
+const uint32_t CP15_ACCESS_WRITEUSR = CP15_ACCESS_WRITE;
28
+const uint32_t CP15_ACCESS_WRITESYS = 1;
29
+const uint32_t CP15_ACCESS_READUSR = CP15_ACCESS_READ;
30
+const uint32_t CP15_ACCESS_READSYS = 3;
31
+const uint32_t CP15_ACCESS_EXECUSR = CP15_ACCESS_EXECUTE;
32
+const uint32_t CP15_ACCESS_EXECSYS = 5;
33
+
24 34
 struct armcp15_t
25 35
 {
36
+public:
26 37
 	uint32_t IDCode;
27 38
 	uint32_t cacheType;
28 39
 	uint32_t TCMSize;
... ...
@@ -66,24 +77,38 @@ struct armcp15_t
66 77
 	uint32_t regionExecuteSet_SYS[8];
67 78
 
68 79
 	armcpu_t *cpu;
69
-};
70 80
 
71
-armcp15_t *armcp15_new(armcpu_t *c);
72
-//bool armcp15_dataProcess(armcp15_t *armcp15, uint8_t CRd, uint8_t CRn, uint8_t CRm, uint8_t opcode1, uint8_t opcode2);
73
-//bool armcp15_load(armcp15_t *armcp15, uint8_t CRd, uint8_t adr);
74
-//bool armcp15_store(armcp15_t *armcp15, uint8_t CRd, uint8_t adr);
75
-bool armcp15_moveCP2ARM(armcp15_t *armcp15, uint32_t * R, uint8_t CRn, uint8_t CRm, uint8_t opcode1, uint8_t opcode2);
76
-bool armcp15_moveARM2CP(armcp15_t *armcp15, uint32_t val, uint8_t CRn, uint8_t CRm, uint8_t opcode1, uint8_t opcode2);
77
-//bool armcp15_isAccessAllowed(armcp15_t *armcp15,uint32_t address,uint32_t access);
81
+	void setSingleRegionAccess(uint32_t dAccess, uint32_t iAccess, unsigned char num, uint32_t mask, uint32_t set);
82
+	void maskPrecalc();
83
+
84
+public:
85
+	armcp15_t() : IDCode(0), cacheType(0), TCMSize(0), ctrl(0), DCConfig(0), ICConfig(0), writeBuffCtrl(0), und(0), DaccessPerm(0), IaccessPerm(0), protectBaseSize0(0), protectBaseSize1(0), protectBaseSize2(0),
86
+		protectBaseSize3(0), protectBaseSize4(0), protectBaseSize5(0), protectBaseSize6(0), protectBaseSize7(0), cacheOp(0), DcacheLock(0), IcacheLock(0), ITCMRegion(0), DTCMRegion(0), processID(0), RAM_TAG(0),
87
+		testState(0), cacheDbg(0), cpu(nullptr)
88
+	{
89
+		memset(&this->regionWriteMask_USR[0], 0, sizeof(this->regionWriteMask_USR));
90
+		memset(&this->regionWriteMask_SYS[0], 0, sizeof(this->regionWriteMask_SYS));
91
+		memset(&this->regionReadMask_USR[0], 0, sizeof(this->regionReadMask_USR));
92
+		memset(&this->regionReadMask_SYS[0], 0, sizeof(this->regionReadMask_SYS));
93
+		memset(&this->regionExecuteMask_USR[0], 0, sizeof(this->regionExecuteMask_USR));
94
+		memset(&this->regionExecuteMask_SYS[0], 0, sizeof(this->regionExecuteMask_SYS));
95
+		memset(&this->regionWriteSet_USR[0], 0, sizeof(this->regionWriteSet_USR));
96
+		memset(&this->regionWriteSet_SYS[0], 0, sizeof(this->regionWriteSet_SYS));
97
+		memset(&this->regionReadSet_USR[0], 0, sizeof(this->regionReadSet_USR));
98
+		memset(&this->regionReadSet_SYS[0], 0, sizeof(this->regionReadSet_SYS));
99
+		memset(&this->regionExecuteSet_USR[0], 0, sizeof(this->regionExecuteSet_USR));
100
+		memset(&this->regionExecuteSet_SYS[0], 0, sizeof(this->regionExecuteSet_SYS));
101
+	}
102
+	bool reset(armcpu_t *c);
103
+	bool dataProcess(uint8_t CRd, uint8_t CRn, uint8_t CRm, uint8_t opcode1, uint8_t opcode2);
104
+	bool load(uint8_t CRd, uint8_t adr);
105
+	bool store(uint8_t CRd, uint8_t adr);
106
+	bool moveCP2ARM(uint32_t *R, uint8_t CRn, uint8_t CRm, uint8_t opcode1, uint8_t opcode2);
107
+	bool moveARM2CP(uint32_t val, uint8_t CRn, uint8_t CRm, uint8_t opcode1, uint8_t opcode2);
108
+	bool isAccessAllowed(uint32_t address,uint32_t access);
109
+};
78 110
 
79
-static const uint32_t CP15_ACCESS_WRITE = 0;
80
-static const uint32_t CP15_ACCESS_READ = 2;
81
-static const uint32_t CP15_ACCESS_EXECUTE = 4;
82
-static const uint32_t CP15_ACCESS_WRITEUSR = CP15_ACCESS_WRITE;
83
-static const uint32_t CP15_ACCESS_WRITESYS = 1;
84
-static const uint32_t CP15_ACCESS_READUSR = CP15_ACCESS_READ;
85
-static const uint32_t CP15_ACCESS_READSYS = 3;
86
-static const uint32_t CP15_ACCESS_EXECUSR = CP15_ACCESS_EXECUTE;
87
-static const uint32_t CP15_ACCESS_EXECSYS = 5;
111
+extern armcp15_t cp15;
112
+void maskPrecalc();
88 113
 
89 114
 #endif /* __CP15_H__*/
Browse code

Import actual code.

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