sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\system\t_atomic.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#define __E32TEST_EXTENSION__
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <e32test.h>
|
sl@0
|
21 |
#include <e32atomics.h>
|
sl@0
|
22 |
#include <u32hal.h>
|
sl@0
|
23 |
#include "u32std.h"
|
sl@0
|
24 |
#include <e32svr.h>
|
sl@0
|
25 |
#include <hal.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
RTest test(_L("T_ATOMIC"));
|
sl@0
|
28 |
|
sl@0
|
29 |
#include "t_atomic.h"
|
sl@0
|
30 |
|
sl@0
|
31 |
#ifdef __EPOC32__
|
sl@0
|
32 |
RTestAtomic DD;
|
sl@0
|
33 |
#endif
|
sl@0
|
34 |
|
sl@0
|
35 |
extern "C" {
|
sl@0
|
36 |
extern const char* FuncName[];
|
sl@0
|
37 |
extern const PFV AtomicFuncPtr[];
|
sl@0
|
38 |
extern const PFV ControlFuncPtr[];
|
sl@0
|
39 |
extern const TUint FuncAttr[];
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
class TestOverflowTruncate2 : public TDes16Overflow
|
sl@0
|
43 |
{
|
sl@0
|
44 |
public:
|
sl@0
|
45 |
virtual void Overflow(TDes16 &aDes);
|
sl@0
|
46 |
};
|
sl@0
|
47 |
|
sl@0
|
48 |
void TestOverflowTruncate2::Overflow(TDes16& /*aDes*/)
|
sl@0
|
49 |
{
|
sl@0
|
50 |
}
|
sl@0
|
51 |
|
sl@0
|
52 |
void UPrintf(const char* aFmt, ...)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
// Print to a console screen.
|
sl@0
|
55 |
TestOverflowTruncate2 overflow;
|
sl@0
|
56 |
VA_LIST list;
|
sl@0
|
57 |
VA_START(list, aFmt);
|
sl@0
|
58 |
TBuf8<256> fmtBuf8((const TUint8*)aFmt);
|
sl@0
|
59 |
TBuf<256> buf;
|
sl@0
|
60 |
buf.AppendFormatList(fmtBuf8.Expand(), list, &overflow);
|
sl@0
|
61 |
test.Printf(_L("%S\n"),&buf);
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
/******************************************************************************
|
sl@0
|
65 |
* Single thread normal operation tests
|
sl@0
|
66 |
******************************************************************************/
|
sl@0
|
67 |
template<class T>
|
sl@0
|
68 |
struct TD
|
sl@0
|
69 |
{
|
sl@0
|
70 |
T i0;
|
sl@0
|
71 |
T i1;
|
sl@0
|
72 |
T i2;
|
sl@0
|
73 |
T i3;
|
sl@0
|
74 |
TInt iF;
|
sl@0
|
75 |
TInt iPadding;
|
sl@0
|
76 |
};
|
sl@0
|
77 |
|
sl@0
|
78 |
struct TDG : public TDGBase
|
sl@0
|
79 |
{
|
sl@0
|
80 |
void Set(const TD<TUint8> aTD8, TInt aOrd);
|
sl@0
|
81 |
void Set(const TD<TUint16> aTD16, TInt aOrd);
|
sl@0
|
82 |
void Set(const TD<TUint32> aTD32, TInt aOrd);
|
sl@0
|
83 |
void Set(const TD<TUint64> aTD64, TInt aOrd);
|
sl@0
|
84 |
|
sl@0
|
85 |
TInt ExecuteUser();
|
sl@0
|
86 |
TInt ExecuteKernel();
|
sl@0
|
87 |
};
|
sl@0
|
88 |
|
sl@0
|
89 |
TInt GetAtomicFuncIndex(TInt aFunc, TInt aSize, TInt aOrd)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
test_NotNegative(aFunc);
|
sl@0
|
92 |
test_Compare(aFunc,<,EAtomicFuncN);
|
sl@0
|
93 |
test_NotNegative(aOrd);
|
sl@0
|
94 |
test_Compare(aOrd,<,4);
|
sl@0
|
95 |
aFunc *= 4;
|
sl@0
|
96 |
switch(aSize)
|
sl@0
|
97 |
{
|
sl@0
|
98 |
case 1: break;
|
sl@0
|
99 |
case 2: aFunc += INDEXES_PER_SIZE; break;
|
sl@0
|
100 |
case 4: aFunc += 2*INDEXES_PER_SIZE; break;
|
sl@0
|
101 |
case 8: aFunc += 3*INDEXES_PER_SIZE; break;
|
sl@0
|
102 |
default: test_Equal(8,aSize); break;
|
sl@0
|
103 |
}
|
sl@0
|
104 |
aFunc += aOrd;
|
sl@0
|
105 |
if (AtomicFuncPtr[aFunc])
|
sl@0
|
106 |
return aFunc;
|
sl@0
|
107 |
return -1;
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
void TDG::Set(const TD<TUint8> aTD8, TInt aOrd)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
i0 = aTD8.i0;
|
sl@0
|
113 |
i1 = aTD8.i1;
|
sl@0
|
114 |
i2 = aTD8.i2;
|
sl@0
|
115 |
i3 = aTD8.i3;
|
sl@0
|
116 |
iIndex = GetAtomicFuncIndex(aTD8.iF, 1, aOrd);
|
sl@0
|
117 |
#ifdef __EXTRA_DEBUG__
|
sl@0
|
118 |
DEBUGPRINT(" 8: iF=%2d aOrd=%1d -> %d", aTD8.iF, aOrd, iIndex);
|
sl@0
|
119 |
#endif
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
void TDG::Set(const TD<TUint16> aTD16, TInt aOrd)
|
sl@0
|
123 |
{
|
sl@0
|
124 |
i0 = aTD16.i0;
|
sl@0
|
125 |
i1 = aTD16.i1;
|
sl@0
|
126 |
i2 = aTD16.i2;
|
sl@0
|
127 |
i3 = aTD16.i3;
|
sl@0
|
128 |
iIndex = GetAtomicFuncIndex(aTD16.iF, 2, aOrd);
|
sl@0
|
129 |
#ifdef __EXTRA_DEBUG__
|
sl@0
|
130 |
DEBUGPRINT("16: iF=%2d aOrd=%1d -> %d", aTD16.iF, aOrd, iIndex);
|
sl@0
|
131 |
#endif
|
sl@0
|
132 |
}
|
sl@0
|
133 |
|
sl@0
|
134 |
void TDG::Set(const TD<TUint32> aTD32, TInt aOrd)
|
sl@0
|
135 |
{
|
sl@0
|
136 |
i0 = aTD32.i0;
|
sl@0
|
137 |
i1 = aTD32.i1;
|
sl@0
|
138 |
i2 = aTD32.i2;
|
sl@0
|
139 |
i3 = aTD32.i3;
|
sl@0
|
140 |
iIndex = GetAtomicFuncIndex(aTD32.iF, 4, aOrd);
|
sl@0
|
141 |
#ifdef __EXTRA_DEBUG__
|
sl@0
|
142 |
DEBUGPRINT("32: iF=%2d aOrd=%1d -> %d", aTD32.iF, aOrd, iIndex);
|
sl@0
|
143 |
#endif
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
void TDG::Set(const TD<TUint64> aTD64, TInt aOrd)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
i0 = aTD64.i0;
|
sl@0
|
149 |
i1 = aTD64.i1;
|
sl@0
|
150 |
i2 = aTD64.i2;
|
sl@0
|
151 |
i3 = aTD64.i3;
|
sl@0
|
152 |
iIndex = GetAtomicFuncIndex(aTD64.iF, 8, aOrd);
|
sl@0
|
153 |
#ifdef __EXTRA_DEBUG__
|
sl@0
|
154 |
DEBUGPRINT("64: iF=%2d aOrd=%1d -> %d", aTD64.iF, aOrd, iIndex);
|
sl@0
|
155 |
#endif
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|
sl@0
|
158 |
TInt TDG::ExecuteUser()
|
sl@0
|
159 |
{
|
sl@0
|
160 |
return Execute();
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
#ifdef __EPOC32__
|
sl@0
|
164 |
TInt TDG::ExecuteKernel()
|
sl@0
|
165 |
{
|
sl@0
|
166 |
return DD.TDGExecuteK(*this);
|
sl@0
|
167 |
}
|
sl@0
|
168 |
#endif
|
sl@0
|
169 |
|
sl@0
|
170 |
|
sl@0
|
171 |
#define DCL_TEST_BLOCK(type,name) \
|
sl@0
|
172 |
static const TD<type> name[] =
|
sl@0
|
173 |
#define DCL_TEST1(type,func,a0) \
|
sl@0
|
174 |
{ (type)(a0), (type)(0), (type)(0), (type)(0), (EAtomicFunc##func), 0 }
|
sl@0
|
175 |
#define DCL_TEST2(type,func,a0,a1) \
|
sl@0
|
176 |
{ (type)(a0), (type)(a1), (type)(0), (type)(0), (EAtomicFunc##func), 0 }
|
sl@0
|
177 |
#define DCL_TEST3(type,func,a0,a1,a2) \
|
sl@0
|
178 |
{ (type)(a0), (type)(a1), (type)(a2), (type)(0), (EAtomicFunc##func), 0 }
|
sl@0
|
179 |
#define DCL_TEST4(type,func,a0,a1,a2,a3) \
|
sl@0
|
180 |
{ (type)(a0), (type)(a1), (type)(a2), (type)(a3), (EAtomicFunc##func), 0 }
|
sl@0
|
181 |
|
sl@0
|
182 |
DCL_TEST_BLOCK(TUint8,TestData8)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
DCL_TEST1(TUint8, LOAD, 0x00),
|
sl@0
|
185 |
DCL_TEST1(TUint8, LOAD, 0xFF),
|
sl@0
|
186 |
|
sl@0
|
187 |
DCL_TEST2(TUint8, STORE, 0xBB, 0x00),
|
sl@0
|
188 |
DCL_TEST2(TUint8, STORE, 0xBB, 0xFF),
|
sl@0
|
189 |
|
sl@0
|
190 |
DCL_TEST2(TUint8, SWP, 0xBB, 0x00),
|
sl@0
|
191 |
DCL_TEST2(TUint8, SWP, 0xBB, 0xFF),
|
sl@0
|
192 |
DCL_TEST2(TUint8, SWP, 0x55, 0x00),
|
sl@0
|
193 |
DCL_TEST2(TUint8, SWP, 0x55, 0xFF),
|
sl@0
|
194 |
|
sl@0
|
195 |
DCL_TEST2(TUint8, ADD, 0x00, 0x01),
|
sl@0
|
196 |
DCL_TEST2(TUint8, ADD, 0xFF, 0x01),
|
sl@0
|
197 |
DCL_TEST2(TUint8, ADD, 0xFE, 0x01),
|
sl@0
|
198 |
DCL_TEST2(TUint8, ADD, 0xFE, 0x02),
|
sl@0
|
199 |
DCL_TEST2(TUint8, ADD, 0xFE, 0x03),
|
sl@0
|
200 |
DCL_TEST2(TUint8, ADD, 0x12, 0x23),
|
sl@0
|
201 |
|
sl@0
|
202 |
DCL_TEST2(TUint8, AND, 0x00, 0x01),
|
sl@0
|
203 |
DCL_TEST2(TUint8, AND, 0xFF, 0x01),
|
sl@0
|
204 |
DCL_TEST2(TUint8, AND, 0xFE, 0x01),
|
sl@0
|
205 |
DCL_TEST2(TUint8, AND, 0xFE, 0xFF),
|
sl@0
|
206 |
DCL_TEST2(TUint8, AND, 0xFE, 0x03),
|
sl@0
|
207 |
DCL_TEST2(TUint8, AND, 0x5F, 0xAF),
|
sl@0
|
208 |
|
sl@0
|
209 |
DCL_TEST2(TUint8, IOR, 0x00, 0x01),
|
sl@0
|
210 |
DCL_TEST2(TUint8, IOR, 0xFF, 0x01),
|
sl@0
|
211 |
DCL_TEST2(TUint8, IOR, 0xFE, 0x01),
|
sl@0
|
212 |
DCL_TEST2(TUint8, IOR, 0x0D, 0x5F),
|
sl@0
|
213 |
DCL_TEST2(TUint8, IOR, 0x30, 0x03),
|
sl@0
|
214 |
DCL_TEST2(TUint8, IOR, 0x5F, 0xAF),
|
sl@0
|
215 |
|
sl@0
|
216 |
DCL_TEST2(TUint8, XOR, 0x00, 0x01),
|
sl@0
|
217 |
DCL_TEST2(TUint8, XOR, 0xFF, 0x01),
|
sl@0
|
218 |
DCL_TEST2(TUint8, XOR, 0xFE, 0x01),
|
sl@0
|
219 |
DCL_TEST2(TUint8, XOR, 0xFE, 0xFF),
|
sl@0
|
220 |
DCL_TEST2(TUint8, XOR, 0xFE, 0x03),
|
sl@0
|
221 |
DCL_TEST2(TUint8, XOR, 0x5F, 0xAF),
|
sl@0
|
222 |
|
sl@0
|
223 |
DCL_TEST3(TUint8, AXO, 0x00, 0xFF, 0x00),
|
sl@0
|
224 |
DCL_TEST3(TUint8, AXO, 0x00, 0xFF, 0x33),
|
sl@0
|
225 |
DCL_TEST3(TUint8, AXO, 0x00, 0xFF, 0x7D),
|
sl@0
|
226 |
DCL_TEST3(TUint8, AXO, 0x00, 0xFF, 0xBB),
|
sl@0
|
227 |
DCL_TEST3(TUint8, AXO, 0xAA, 0x00, 0x00),
|
sl@0
|
228 |
DCL_TEST3(TUint8, AXO, 0xAA, 0x00, 0x33),
|
sl@0
|
229 |
DCL_TEST3(TUint8, AXO, 0xAA, 0x00, 0x7D),
|
sl@0
|
230 |
DCL_TEST3(TUint8, AXO, 0xAA, 0x00, 0xBB),
|
sl@0
|
231 |
DCL_TEST3(TUint8, AXO, 0xAA, 0x33, 0xF0),
|
sl@0
|
232 |
DCL_TEST3(TUint8, AXO, 0xAA, 0x33, 0x0F),
|
sl@0
|
233 |
DCL_TEST3(TUint8, AXO, 0xAA, 0xCC, 0xF0),
|
sl@0
|
234 |
DCL_TEST3(TUint8, AXO, 0xAA, 0xCC, 0x0F),
|
sl@0
|
235 |
|
sl@0
|
236 |
DCL_TEST3(TUint8, CAS, 0x00, 0xFF, 0xEE),
|
sl@0
|
237 |
DCL_TEST3(TUint8, CAS, 0x00, 0x01, 0x11),
|
sl@0
|
238 |
DCL_TEST3(TUint8, CAS, 0x00, 0x00, 0xEE),
|
sl@0
|
239 |
DCL_TEST3(TUint8, CAS, 0x00, 0x00, 0x23),
|
sl@0
|
240 |
DCL_TEST3(TUint8, CAS, 0x2A, 0xFF, 0x2B),
|
sl@0
|
241 |
DCL_TEST3(TUint8, CAS, 0x2A, 0x01, 0x2B),
|
sl@0
|
242 |
DCL_TEST3(TUint8, CAS, 0x2A, 0x2A, 0x2B),
|
sl@0
|
243 |
DCL_TEST3(TUint8, CAS, 0x2A, 0x2A, 0x3B),
|
sl@0
|
244 |
|
sl@0
|
245 |
DCL_TEST4(TUint8, TAU, 0x00, 0x00, 0x02, 0x03),
|
sl@0
|
246 |
DCL_TEST4(TUint8, TAU, 0x01, 0x00, 0x02, 0x03),
|
sl@0
|
247 |
DCL_TEST4(TUint8, TAU, 0xFF, 0x00, 0x02, 0x03),
|
sl@0
|
248 |
DCL_TEST4(TUint8, TAU, 0x00, 0x01, 0x02, 0x03),
|
sl@0
|
249 |
DCL_TEST4(TUint8, TAU, 0x01, 0x01, 0x02, 0x03),
|
sl@0
|
250 |
DCL_TEST4(TUint8, TAU, 0x02, 0x01, 0x02, 0x03),
|
sl@0
|
251 |
DCL_TEST4(TUint8, TAU, 0xFF, 0x01, 0x02, 0x03),
|
sl@0
|
252 |
DCL_TEST4(TUint8, TAU, 0xFE, 0xFE, 0x23, 0x0B),
|
sl@0
|
253 |
DCL_TEST4(TUint8, TAU, 0xEE, 0xFE, 0x23, 0x0B),
|
sl@0
|
254 |
DCL_TEST4(TUint8, TAU, 0xFF, 0xFE, 0x23, 0x0B),
|
sl@0
|
255 |
DCL_TEST4(TUint8, TAU, 0x00, 0xFE, 0x23, 0x0B),
|
sl@0
|
256 |
DCL_TEST4(TUint8, TAU, 0xFE, 0xFE, 0x80, 0x7F),
|
sl@0
|
257 |
DCL_TEST4(TUint8, TAU, 0xEE, 0xFE, 0x80, 0x7F),
|
sl@0
|
258 |
DCL_TEST4(TUint8, TAU, 0xFF, 0xFE, 0x80, 0x7F),
|
sl@0
|
259 |
DCL_TEST4(TUint8, TAU, 0x00, 0xFE, 0x80, 0x7F),
|
sl@0
|
260 |
DCL_TEST4(TUint8, TAU, 0xFE, 0x80, 0x81, 0x7E),
|
sl@0
|
261 |
DCL_TEST4(TUint8, TAU, 0x7F, 0x80, 0x81, 0x7E),
|
sl@0
|
262 |
DCL_TEST4(TUint8, TAU, 0x80, 0x80, 0x81, 0x7E),
|
sl@0
|
263 |
DCL_TEST4(TUint8, TAU, 0x81, 0x80, 0x81, 0x7E),
|
sl@0
|
264 |
DCL_TEST4(TUint8, TAU, 0x00, 0x80, 0x81, 0x7E),
|
sl@0
|
265 |
DCL_TEST4(TUint8, TAU, 0x7E, 0x7F, 0x81, 0x7E),
|
sl@0
|
266 |
DCL_TEST4(TUint8, TAU, 0x7F, 0x7F, 0x81, 0x7E),
|
sl@0
|
267 |
DCL_TEST4(TUint8, TAU, 0x80, 0x7F, 0x81, 0x7E),
|
sl@0
|
268 |
DCL_TEST4(TUint8, TAU, 0x81, 0x7F, 0x81, 0x7E),
|
sl@0
|
269 |
DCL_TEST4(TUint8, TAU, 0x00, 0x7F, 0x81, 0x7E),
|
sl@0
|
270 |
|
sl@0
|
271 |
DCL_TEST4(TUint8, TAS, 0x00, 0x00, 0x02, 0x03),
|
sl@0
|
272 |
DCL_TEST4(TUint8, TAS, 0x01, 0x00, 0x02, 0x03),
|
sl@0
|
273 |
DCL_TEST4(TUint8, TAS, 0xFF, 0x00, 0x02, 0x03),
|
sl@0
|
274 |
DCL_TEST4(TUint8, TAS, 0x00, 0x01, 0x02, 0x03),
|
sl@0
|
275 |
DCL_TEST4(TUint8, TAS, 0x01, 0x01, 0x02, 0x03),
|
sl@0
|
276 |
DCL_TEST4(TUint8, TAS, 0x02, 0x01, 0x02, 0x03),
|
sl@0
|
277 |
DCL_TEST4(TUint8, TAS, 0xFF, 0x01, 0x02, 0x03),
|
sl@0
|
278 |
DCL_TEST4(TUint8, TAS, 0xFE, 0xFE, 0x23, 0x0B),
|
sl@0
|
279 |
DCL_TEST4(TUint8, TAS, 0xEE, 0xFE, 0x23, 0x0B),
|
sl@0
|
280 |
DCL_TEST4(TUint8, TAS, 0xFF, 0xFE, 0x23, 0x0B),
|
sl@0
|
281 |
DCL_TEST4(TUint8, TAS, 0x00, 0xFE, 0x23, 0x0B),
|
sl@0
|
282 |
DCL_TEST4(TUint8, TAS, 0xFE, 0xFE, 0x80, 0x7F),
|
sl@0
|
283 |
DCL_TEST4(TUint8, TAS, 0xEE, 0xFE, 0x80, 0x7F),
|
sl@0
|
284 |
DCL_TEST4(TUint8, TAS, 0xFF, 0xFE, 0x80, 0x7F),
|
sl@0
|
285 |
DCL_TEST4(TUint8, TAS, 0x00, 0xFE, 0x80, 0x7F),
|
sl@0
|
286 |
DCL_TEST4(TUint8, TAS, 0xFE, 0x80, 0x81, 0x7E),
|
sl@0
|
287 |
DCL_TEST4(TUint8, TAS, 0x7F, 0x80, 0x81, 0x7E),
|
sl@0
|
288 |
DCL_TEST4(TUint8, TAS, 0x80, 0x80, 0x81, 0x7E),
|
sl@0
|
289 |
DCL_TEST4(TUint8, TAS, 0x81, 0x80, 0x81, 0x7E),
|
sl@0
|
290 |
DCL_TEST4(TUint8, TAS, 0x00, 0x80, 0x81, 0x7E),
|
sl@0
|
291 |
DCL_TEST4(TUint8, TAS, 0x7E, 0x7F, 0x81, 0x7E),
|
sl@0
|
292 |
DCL_TEST4(TUint8, TAS, 0x7F, 0x7F, 0x81, 0x7E),
|
sl@0
|
293 |
DCL_TEST4(TUint8, TAS, 0x80, 0x7F, 0x81, 0x7E),
|
sl@0
|
294 |
DCL_TEST4(TUint8, TAS, 0x81, 0x7F, 0x81, 0x7E),
|
sl@0
|
295 |
DCL_TEST4(TUint8, TAS, 0x00, 0x7F, 0x81, 0x7E)
|
sl@0
|
296 |
};
|
sl@0
|
297 |
|
sl@0
|
298 |
DCL_TEST_BLOCK(TUint16,TestData16)
|
sl@0
|
299 |
{
|
sl@0
|
300 |
DCL_TEST1(TUint16, LOAD, 0x0055),
|
sl@0
|
301 |
DCL_TEST1(TUint16, LOAD, 0xFFAA),
|
sl@0
|
302 |
|
sl@0
|
303 |
DCL_TEST2(TUint16, STORE, 0xBBBB, 0x0055),
|
sl@0
|
304 |
DCL_TEST2(TUint16, STORE, 0xBBBB, 0xFFAA),
|
sl@0
|
305 |
|
sl@0
|
306 |
DCL_TEST2(TUint16, SWP, 0xBBCC, 0x0055),
|
sl@0
|
307 |
DCL_TEST2(TUint16, SWP, 0xBBCC, 0xFFAA),
|
sl@0
|
308 |
DCL_TEST2(TUint16, SWP, 0x55AA, 0x0033),
|
sl@0
|
309 |
DCL_TEST2(TUint16, SWP, 0x55AA, 0xFFCC),
|
sl@0
|
310 |
|
sl@0
|
311 |
DCL_TEST2(TUint16, ADD, 0x0000, 0x0001),
|
sl@0
|
312 |
DCL_TEST2(TUint16, ADD, 0xFFFF, 0x0001),
|
sl@0
|
313 |
DCL_TEST2(TUint16, ADD, 0xFFFE, 0x0001),
|
sl@0
|
314 |
DCL_TEST2(TUint16, ADD, 0xFFFE, 0x0002),
|
sl@0
|
315 |
DCL_TEST2(TUint16, ADD, 0xFFFE, 0x0003),
|
sl@0
|
316 |
DCL_TEST2(TUint16, ADD, 0x0012, 0x0023),
|
sl@0
|
317 |
DCL_TEST2(TUint16, ADD, 0x0012, 0xBCFF),
|
sl@0
|
318 |
|
sl@0
|
319 |
DCL_TEST2(TUint16, AND, 0x0000, 0x0001),
|
sl@0
|
320 |
DCL_TEST2(TUint16, AND, 0xFFFF, 0x0001),
|
sl@0
|
321 |
DCL_TEST2(TUint16, AND, 0xFFFE, 0x0001),
|
sl@0
|
322 |
DCL_TEST2(TUint16, AND, 0xFFFE, 0xFFFF),
|
sl@0
|
323 |
DCL_TEST2(TUint16, AND, 0xFFFE, 0x0F03),
|
sl@0
|
324 |
DCL_TEST2(TUint16, AND, 0xBC5F, 0x14AF),
|
sl@0
|
325 |
|
sl@0
|
326 |
DCL_TEST2(TUint16, IOR, 0x0000, 0x0001),
|
sl@0
|
327 |
DCL_TEST2(TUint16, IOR, 0xFFFF, 0x0001),
|
sl@0
|
328 |
DCL_TEST2(TUint16, IOR, 0xFFFE, 0x0001),
|
sl@0
|
329 |
DCL_TEST2(TUint16, IOR, 0x000D, 0x005F),
|
sl@0
|
330 |
DCL_TEST2(TUint16, IOR, 0x8030, 0x0803),
|
sl@0
|
331 |
DCL_TEST2(TUint16, IOR, 0x145F, 0x56AF),
|
sl@0
|
332 |
|
sl@0
|
333 |
DCL_TEST2(TUint16, XOR, 0x0000, 0x0001),
|
sl@0
|
334 |
DCL_TEST2(TUint16, XOR, 0xFFFF, 0x0001),
|
sl@0
|
335 |
DCL_TEST2(TUint16, XOR, 0xFFFE, 0x0001),
|
sl@0
|
336 |
DCL_TEST2(TUint16, XOR, 0xFFFE, 0xFFFF),
|
sl@0
|
337 |
DCL_TEST2(TUint16, XOR, 0xFFFE, 0x0003),
|
sl@0
|
338 |
DCL_TEST2(TUint16, XOR, 0x145F, 0xBCAF),
|
sl@0
|
339 |
|
sl@0
|
340 |
DCL_TEST3(TUint16, AXO, 0x0000, 0xFFFF, 0x0000),
|
sl@0
|
341 |
DCL_TEST3(TUint16, AXO, 0x0000, 0xFFFF, 0x6633),
|
sl@0
|
342 |
DCL_TEST3(TUint16, AXO, 0x0000, 0xFFFF, 0x827D),
|
sl@0
|
343 |
DCL_TEST3(TUint16, AXO, 0x0000, 0xFFFF, 0xCCBB),
|
sl@0
|
344 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0x0000, 0x0000),
|
sl@0
|
345 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0x0000, 0x6633),
|
sl@0
|
346 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0x0000, 0x827D),
|
sl@0
|
347 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0x0000, 0xCCBB),
|
sl@0
|
348 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0xCC33, 0x0FF0),
|
sl@0
|
349 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0xCC33, 0xF00F),
|
sl@0
|
350 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0x33CC, 0x0FF0),
|
sl@0
|
351 |
DCL_TEST3(TUint16, AXO, 0xAAAA, 0x33CC, 0xF00F),
|
sl@0
|
352 |
|
sl@0
|
353 |
DCL_TEST3(TUint16, CAS, 0x0000, 0x00FF, 0x99EE),
|
sl@0
|
354 |
DCL_TEST3(TUint16, CAS, 0x0000, 0x0001, 0x7711),
|
sl@0
|
355 |
DCL_TEST3(TUint16, CAS, 0x0000, 0x0000, 0x99EE),
|
sl@0
|
356 |
DCL_TEST3(TUint16, CAS, 0x0000, 0x0000, 0x1123),
|
sl@0
|
357 |
DCL_TEST3(TUint16, CAS, 0x832A, 0xFFFF, 0x832B),
|
sl@0
|
358 |
DCL_TEST3(TUint16, CAS, 0x832A, 0x0001, 0x832B),
|
sl@0
|
359 |
DCL_TEST3(TUint16, CAS, 0x832A, 0x822A, 0x832B),
|
sl@0
|
360 |
DCL_TEST3(TUint16, CAS, 0x832A, 0x832B, 0x943B),
|
sl@0
|
361 |
DCL_TEST3(TUint16, CAS, 0x832A, 0x832A, 0x832B),
|
sl@0
|
362 |
DCL_TEST3(TUint16, CAS, 0x832A, 0x832A, 0x943B),
|
sl@0
|
363 |
|
sl@0
|
364 |
DCL_TEST4(TUint16, TAU, 0x0000, 0x0000, 0x0002, 0x0003),
|
sl@0
|
365 |
DCL_TEST4(TUint16, TAU, 0x0001, 0x0000, 0x0002, 0x0003),
|
sl@0
|
366 |
DCL_TEST4(TUint16, TAU, 0xFFFF, 0x0000, 0x0002, 0x0003),
|
sl@0
|
367 |
DCL_TEST4(TUint16, TAU, 0x0000, 0x0001, 0x0002, 0x0003),
|
sl@0
|
368 |
DCL_TEST4(TUint16, TAU, 0x0001, 0x0001, 0x0002, 0x0003),
|
sl@0
|
369 |
DCL_TEST4(TUint16, TAU, 0x0002, 0x0001, 0x0002, 0x0003),
|
sl@0
|
370 |
DCL_TEST4(TUint16, TAU, 0xFFFF, 0x0001, 0x0002, 0x0003),
|
sl@0
|
371 |
DCL_TEST4(TUint16, TAU, 0xFFFE, 0xFFFE, 0x1023, 0x000B),
|
sl@0
|
372 |
DCL_TEST4(TUint16, TAU, 0xFFEE, 0xFFFE, 0x1423, 0x000B),
|
sl@0
|
373 |
DCL_TEST4(TUint16, TAU, 0xFFFF, 0xFFFE, 0x1423, 0x000B),
|
sl@0
|
374 |
DCL_TEST4(TUint16, TAU, 0x0000, 0xFFFE, 0x1423, 0x000B),
|
sl@0
|
375 |
DCL_TEST4(TUint16, TAU, 0xFFFE, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
376 |
DCL_TEST4(TUint16, TAU, 0xFFEE, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
377 |
DCL_TEST4(TUint16, TAU, 0xFFFF, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
378 |
DCL_TEST4(TUint16, TAU, 0x0000, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
379 |
DCL_TEST4(TUint16, TAU, 0xFFFE, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
380 |
DCL_TEST4(TUint16, TAU, 0x7FFF, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
381 |
DCL_TEST4(TUint16, TAU, 0x8000, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
382 |
DCL_TEST4(TUint16, TAU, 0x8001, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
383 |
DCL_TEST4(TUint16, TAU, 0x0000, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
384 |
DCL_TEST4(TUint16, TAU, 0x7FFE, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
385 |
DCL_TEST4(TUint16, TAU, 0x7FFF, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
386 |
DCL_TEST4(TUint16, TAU, 0x8000, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
387 |
DCL_TEST4(TUint16, TAU, 0x8001, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
388 |
DCL_TEST4(TUint16, TAU, 0x0000, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
389 |
|
sl@0
|
390 |
DCL_TEST4(TUint16, TAS, 0x0000, 0x0000, 0x0002, 0x0003),
|
sl@0
|
391 |
DCL_TEST4(TUint16, TAS, 0x0001, 0x0000, 0x0002, 0x0003),
|
sl@0
|
392 |
DCL_TEST4(TUint16, TAS, 0xFFFF, 0x0000, 0x0002, 0x0003),
|
sl@0
|
393 |
DCL_TEST4(TUint16, TAS, 0x0000, 0x0001, 0x0002, 0x0003),
|
sl@0
|
394 |
DCL_TEST4(TUint16, TAS, 0x0001, 0x0001, 0x0002, 0x0003),
|
sl@0
|
395 |
DCL_TEST4(TUint16, TAS, 0x0002, 0x0001, 0x0002, 0x0003),
|
sl@0
|
396 |
DCL_TEST4(TUint16, TAS, 0xFFFF, 0x0001, 0x0002, 0x0003),
|
sl@0
|
397 |
DCL_TEST4(TUint16, TAS, 0xFFFE, 0xFFFE, 0x1023, 0x000B),
|
sl@0
|
398 |
DCL_TEST4(TUint16, TAS, 0xFFEE, 0xFFFE, 0x1423, 0x000B),
|
sl@0
|
399 |
DCL_TEST4(TUint16, TAS, 0xFFFF, 0xFFFE, 0x1423, 0x000B),
|
sl@0
|
400 |
DCL_TEST4(TUint16, TAS, 0x0000, 0xFFFE, 0x1423, 0x000B),
|
sl@0
|
401 |
DCL_TEST4(TUint16, TAS, 0xFFFE, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
402 |
DCL_TEST4(TUint16, TAS, 0xFFEE, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
403 |
DCL_TEST4(TUint16, TAS, 0xFFFF, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
404 |
DCL_TEST4(TUint16, TAS, 0x0000, 0xFFFE, 0x8000, 0x7FFF),
|
sl@0
|
405 |
DCL_TEST4(TUint16, TAS, 0xFFFE, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
406 |
DCL_TEST4(TUint16, TAS, 0x7FFF, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
407 |
DCL_TEST4(TUint16, TAS, 0x8000, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
408 |
DCL_TEST4(TUint16, TAS, 0x8001, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
409 |
DCL_TEST4(TUint16, TAS, 0x0000, 0x8000, 0x8001, 0x7FFE),
|
sl@0
|
410 |
DCL_TEST4(TUint16, TAS, 0x7FFE, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
411 |
DCL_TEST4(TUint16, TAS, 0x7FFF, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
412 |
DCL_TEST4(TUint16, TAS, 0x8000, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
413 |
DCL_TEST4(TUint16, TAS, 0x8001, 0x7FFF, 0x8001, 0x7FFE),
|
sl@0
|
414 |
DCL_TEST4(TUint16, TAS, 0x0000, 0x7FFF, 0x8001, 0x7FFE)
|
sl@0
|
415 |
};
|
sl@0
|
416 |
|
sl@0
|
417 |
DCL_TEST_BLOCK(TUint32,TestData32)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
DCL_TEST1(TUint32, LOAD, 0x00334455),
|
sl@0
|
420 |
DCL_TEST1(TUint32, LOAD, 0xFFCCBBAA),
|
sl@0
|
421 |
|
sl@0
|
422 |
DCL_TEST2(TUint32, STORE, 0xBBBBBBBB, 0x00334455),
|
sl@0
|
423 |
DCL_TEST2(TUint32, STORE, 0xBBBBBBBB, 0xFFCCBBAA),
|
sl@0
|
424 |
|
sl@0
|
425 |
DCL_TEST2(TUint32, SWP, 0xBB1234CC, 0x00EDCB55),
|
sl@0
|
426 |
DCL_TEST2(TUint32, SWP, 0xBB1234CC, 0xFF9876AA),
|
sl@0
|
427 |
DCL_TEST2(TUint32, SWP, 0x551971AA, 0x00112233),
|
sl@0
|
428 |
DCL_TEST2(TUint32, SWP, 0x551971AA, 0xFFEEDDCC),
|
sl@0
|
429 |
|
sl@0
|
430 |
DCL_TEST2(TUint32, ADD, 0x00000000, 0x00000001),
|
sl@0
|
431 |
DCL_TEST2(TUint32, ADD, 0xFFFFFFFF, 0x00000001),
|
sl@0
|
432 |
DCL_TEST2(TUint32, ADD, 0xFFFFFFFE, 0x00000001),
|
sl@0
|
433 |
DCL_TEST2(TUint32, ADD, 0xFFFFFFFE, 0x00000002),
|
sl@0
|
434 |
DCL_TEST2(TUint32, ADD, 0xFFFFFFFE, 0x00000003),
|
sl@0
|
435 |
DCL_TEST2(TUint32, ADD, 0x00009912, 0x00000023),
|
sl@0
|
436 |
DCL_TEST2(TUint32, ADD, 0x00009912, 0x4937BCFF),
|
sl@0
|
437 |
|
sl@0
|
438 |
DCL_TEST2(TUint32, AND, 0x00000000, 0x00000001),
|
sl@0
|
439 |
DCL_TEST2(TUint32, AND, 0xFFFFFFFF, 0x00000001),
|
sl@0
|
440 |
DCL_TEST2(TUint32, AND, 0xFFFFFFFE, 0x00000001),
|
sl@0
|
441 |
DCL_TEST2(TUint32, AND, 0xFFFFFFFE, 0xFFFFFFFF),
|
sl@0
|
442 |
DCL_TEST2(TUint32, AND, 0xFFFFFFFE, 0x00000F03),
|
sl@0
|
443 |
DCL_TEST2(TUint32, AND, 0xEDCBBC5F, 0xDCBA14AF),
|
sl@0
|
444 |
|
sl@0
|
445 |
DCL_TEST2(TUint32, IOR, 0x00000000, 0x00000001),
|
sl@0
|
446 |
DCL_TEST2(TUint32, IOR, 0xFFFFFFFF, 0x00000001),
|
sl@0
|
447 |
DCL_TEST2(TUint32, IOR, 0xFFFFFFFE, 0x00000001),
|
sl@0
|
448 |
DCL_TEST2(TUint32, IOR, 0x0000000D, 0x0000005F),
|
sl@0
|
449 |
DCL_TEST2(TUint32, IOR, 0x80000030, 0x00000803),
|
sl@0
|
450 |
DCL_TEST2(TUint32, IOR, 0x89AB145F, 0x415256AF),
|
sl@0
|
451 |
|
sl@0
|
452 |
DCL_TEST2(TUint32, XOR, 0x00000000, 0x00000001),
|
sl@0
|
453 |
DCL_TEST2(TUint32, XOR, 0xFFFFFFFF, 0x00000001),
|
sl@0
|
454 |
DCL_TEST2(TUint32, XOR, 0xFFFFFFFE, 0x00000001),
|
sl@0
|
455 |
DCL_TEST2(TUint32, XOR, 0xFFFFFFFE, 0xFFFFFFFF),
|
sl@0
|
456 |
DCL_TEST2(TUint32, XOR, 0xFFFFFFFE, 0x00000003),
|
sl@0
|
457 |
DCL_TEST2(TUint32, XOR, 0x89AB145F, 0x4152BCAF),
|
sl@0
|
458 |
|
sl@0
|
459 |
DCL_TEST3(TUint32, AXO, 0x00000000, 0xFFFFFFFF, 0x00000000),
|
sl@0
|
460 |
DCL_TEST3(TUint32, AXO, 0x00000000, 0xFFFFFFFF, 0x99CC6633),
|
sl@0
|
461 |
DCL_TEST3(TUint32, AXO, 0x00000000, 0xFFFFFFFF, 0x8000027D),
|
sl@0
|
462 |
DCL_TEST3(TUint32, AXO, 0x00000000, 0xFFFFFFFF, 0xEEDDCCBB),
|
sl@0
|
463 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x00000000, 0x00000000),
|
sl@0
|
464 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x00000000, 0x99CC6633),
|
sl@0
|
465 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x00000000, 0x8000027D),
|
sl@0
|
466 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x00000000, 0xEEDDCCBB),
|
sl@0
|
467 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x9966CC33, 0x0FF00FF0),
|
sl@0
|
468 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x9966CC33, 0xF00FF00F),
|
sl@0
|
469 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x669933CC, 0x0FF00FF0),
|
sl@0
|
470 |
DCL_TEST3(TUint32, AXO, 0xAAAAAAAA, 0x669933CC, 0xF00FF00F),
|
sl@0
|
471 |
|
sl@0
|
472 |
DCL_TEST3(TUint32, CAS, 0x00000000, 0x000000FF, 0x99ABCDEE),
|
sl@0
|
473 |
DCL_TEST3(TUint32, CAS, 0x00000000, 0x00000001, 0x7FFFF711),
|
sl@0
|
474 |
DCL_TEST3(TUint32, CAS, 0x00000000, 0x00000000, 0x99ABCDEE),
|
sl@0
|
475 |
DCL_TEST3(TUint32, CAS, 0x00000000, 0x00000000, 0x11234567),
|
sl@0
|
476 |
DCL_TEST3(TUint32, CAS, 0x8000032A, 0xFFFFFFFF, 0x8000032B),
|
sl@0
|
477 |
DCL_TEST3(TUint32, CAS, 0x8000032A, 0x00000001, 0x8000032B),
|
sl@0
|
478 |
DCL_TEST3(TUint32, CAS, 0x8000032A, 0x8000022A, 0x8000032B),
|
sl@0
|
479 |
DCL_TEST3(TUint32, CAS, 0x8000032A, 0x8000032B, 0x943BFCD1),
|
sl@0
|
480 |
DCL_TEST3(TUint32, CAS, 0x8000032A, 0x8000032A, 0x8000032B),
|
sl@0
|
481 |
DCL_TEST3(TUint32, CAS, 0x8000032A, 0x8000032A, 0x943BFCD1),
|
sl@0
|
482 |
|
sl@0
|
483 |
DCL_TEST4(TUint32, TAU, 0x00000000, 0x00000000, 0x00000002, 0x00000003),
|
sl@0
|
484 |
DCL_TEST4(TUint32, TAU, 0x00000001, 0x00000000, 0x00000002, 0x00000003),
|
sl@0
|
485 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFFF, 0x00000000, 0x00000002, 0x00000003),
|
sl@0
|
486 |
DCL_TEST4(TUint32, TAU, 0x00000000, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
487 |
DCL_TEST4(TUint32, TAU, 0x00000001, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
488 |
DCL_TEST4(TUint32, TAU, 0x00000002, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
489 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFFF, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
490 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFFE, 0xFFFFFFFE, 0x1023144F, 0x0000000B),
|
sl@0
|
491 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFEE, 0xFFFFFFFE, 0x1423144F, 0x0000000B),
|
sl@0
|
492 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFFF, 0xFFFFFFFE, 0x1423144F, 0x0000000B),
|
sl@0
|
493 |
DCL_TEST4(TUint32, TAU, 0x00000000, 0xFFFFFFFE, 0x1423144F, 0x0000000B),
|
sl@0
|
494 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFFE, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
495 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFEE, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
496 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFFF, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
497 |
DCL_TEST4(TUint32, TAU, 0x00000000, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
498 |
DCL_TEST4(TUint32, TAU, 0xFFFFFFFE, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
499 |
DCL_TEST4(TUint32, TAU, 0x7FFFFFFF, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
500 |
DCL_TEST4(TUint32, TAU, 0x80000000, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
501 |
DCL_TEST4(TUint32, TAU, 0x80000001, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
502 |
DCL_TEST4(TUint32, TAU, 0x00000000, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
503 |
DCL_TEST4(TUint32, TAU, 0x7FFFFFFE, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
504 |
DCL_TEST4(TUint32, TAU, 0x7FFFFFFF, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
505 |
DCL_TEST4(TUint32, TAU, 0x80000000, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
506 |
DCL_TEST4(TUint32, TAU, 0x80000001, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
507 |
DCL_TEST4(TUint32, TAU, 0x00000000, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
508 |
|
sl@0
|
509 |
DCL_TEST4(TUint32, TAS, 0x00000000, 0x00000000, 0x00000002, 0x00000003),
|
sl@0
|
510 |
DCL_TEST4(TUint32, TAS, 0x00000001, 0x00000000, 0x00000002, 0x00000003),
|
sl@0
|
511 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFFF, 0x00000000, 0x00000002, 0x00000003),
|
sl@0
|
512 |
DCL_TEST4(TUint32, TAS, 0x00000000, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
513 |
DCL_TEST4(TUint32, TAS, 0x00000001, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
514 |
DCL_TEST4(TUint32, TAS, 0x00000002, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
515 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFFF, 0x00000001, 0x00000002, 0x00000003),
|
sl@0
|
516 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFFE, 0xFFFFFFFE, 0x1023144F, 0x0000000B),
|
sl@0
|
517 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFEE, 0xFFFFFFFE, 0x1423144F, 0x0000000B),
|
sl@0
|
518 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFFF, 0xFFFFFFFE, 0x1423144F, 0x0000000B),
|
sl@0
|
519 |
DCL_TEST4(TUint32, TAS, 0x00000000, 0xFFFFFFFE, 0x1423144F, 0x0000000B),
|
sl@0
|
520 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFFE, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
521 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFEE, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
522 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFFF, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
523 |
DCL_TEST4(TUint32, TAS, 0x00000000, 0xFFFFFFFE, 0x80000000, 0x7FFFFFFF),
|
sl@0
|
524 |
DCL_TEST4(TUint32, TAS, 0xFFFFFFFE, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
525 |
DCL_TEST4(TUint32, TAS, 0x7FFFFFFF, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
526 |
DCL_TEST4(TUint32, TAS, 0x80000000, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
527 |
DCL_TEST4(TUint32, TAS, 0x80000001, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
528 |
DCL_TEST4(TUint32, TAS, 0x00000000, 0x80000000, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
529 |
DCL_TEST4(TUint32, TAS, 0x7FFFFFFE, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
530 |
DCL_TEST4(TUint32, TAS, 0x7FFFFFFF, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
531 |
DCL_TEST4(TUint32, TAS, 0x80000000, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
532 |
DCL_TEST4(TUint32, TAS, 0x80000001, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE),
|
sl@0
|
533 |
DCL_TEST4(TUint32, TAS, 0x00000000, 0x7FFFFFFF, 0x80000001, 0x7FFFFFFE)
|
sl@0
|
534 |
};
|
sl@0
|
535 |
|
sl@0
|
536 |
DCL_TEST_BLOCK(TUint64,TestData64)
|
sl@0
|
537 |
{
|
sl@0
|
538 |
DCL_TEST1(TUint64, LOAD, MAKE_TUINT64(0x00000000,0x00000000)),
|
sl@0
|
539 |
DCL_TEST1(TUint64, LOAD, MAKE_TUINT64(0xFEDCBA98,0x76543210)),
|
sl@0
|
540 |
|
sl@0
|
541 |
DCL_TEST2(TUint64, STORE, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
542 |
DCL_TEST2(TUint64, STORE, MAKE_TUINT64(0xFEDCBA98,0x76543210), MAKE_TUINT64(0x06931471,0x80559945)),
|
sl@0
|
543 |
|
sl@0
|
544 |
DCL_TEST2(TUint64, SWP, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
545 |
DCL_TEST2(TUint64, SWP, MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
546 |
DCL_TEST2(TUint64, SWP, MAKE_TUINT64(0xDEADBEEF,0xBAD0BEEF), MAKE_TUINT64(0x06931471,0x80559945)),
|
sl@0
|
547 |
DCL_TEST2(TUint64, SWP, MAKE_TUINT64(0xFEDCBA98,0x76543210), MAKE_TUINT64(0x06931471,0x80559945)),
|
sl@0
|
548 |
|
sl@0
|
549 |
DCL_TEST2(TUint64, ADD, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
550 |
DCL_TEST2(TUint64, ADD, MAKE_TUINT64(0x00000000,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
551 |
DCL_TEST2(TUint64, ADD, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
552 |
DCL_TEST2(TUint64, ADD, MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
553 |
|
sl@0
|
554 |
DCL_TEST2(TUint64, AND, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
555 |
DCL_TEST2(TUint64, AND, MAKE_TUINT64(0x00000000,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
556 |
DCL_TEST2(TUint64, AND, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
557 |
DCL_TEST2(TUint64, AND, MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
558 |
|
sl@0
|
559 |
DCL_TEST2(TUint64, IOR, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
560 |
DCL_TEST2(TUint64, IOR, MAKE_TUINT64(0x00000000,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
561 |
DCL_TEST2(TUint64, IOR, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
562 |
DCL_TEST2(TUint64, IOR, MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
563 |
DCL_TEST2(TUint64, IOR, MAKE_TUINT64(0x11111111,0x22222222), MAKE_TUINT64(0x44444444,0x55555555)),
|
sl@0
|
564 |
|
sl@0
|
565 |
DCL_TEST2(TUint64, XOR, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
566 |
DCL_TEST2(TUint64, XOR, MAKE_TUINT64(0x00000000,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
567 |
DCL_TEST2(TUint64, XOR, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
568 |
DCL_TEST2(TUint64, XOR, MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xFCD1CC9F,0xDB27CC8B)),
|
sl@0
|
569 |
DCL_TEST2(TUint64, XOR, MAKE_TUINT64(0x11111111,0x22222222), MAKE_TUINT64(0x44444444,0x77777777)),
|
sl@0
|
570 |
|
sl@0
|
571 |
DCL_TEST3(TUint64, AXO, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000001)),
|
sl@0
|
572 |
DCL_TEST3(TUint64, AXO, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
573 |
DCL_TEST3(TUint64, AXO, MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
574 |
DCL_TEST3(TUint64, AXO, MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
575 |
DCL_TEST3(TUint64, AXO, MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0xFACEFEED,0xFEEDFACE), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
576 |
DCL_TEST3(TUint64, AXO, MAKE_TUINT64(0xBAD8BEEF,0xDEADDEAD), MAKE_TUINT64(0xFACEFEED,0xFEEDFACE), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
577 |
|
sl@0
|
578 |
DCL_TEST3(TUint64, CAS, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
579 |
DCL_TEST3(TUint64, CAS, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000001,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
580 |
DCL_TEST3(TUint64, CAS, MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
581 |
DCL_TEST3(TUint64, CAS, MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0x00000001,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
582 |
DCL_TEST3(TUint64, CAS, MAKE_TUINT64(0x00000001,0x00000000), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
583 |
DCL_TEST3(TUint64, CAS, MAKE_TUINT64(0x00000001,0x00000000), MAKE_TUINT64(0x00000001,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED)),
|
sl@0
|
584 |
|
sl@0
|
585 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
586 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
587 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
588 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
589 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
590 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x00000000,0x00000002), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
591 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
592 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0xFFFFFFFF,0x00000000), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
593 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x80000000,0x00000000), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
594 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
595 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x80000000,0x00000002), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
596 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x7FFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
597 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x7FFFFFFF,0x00000000), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
598 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
599 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x7FFFFFFF,0x80000000), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
600 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x7FFFFFFF,0x80000002), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
601 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x7FFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
602 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x7FFFFFFF,0x7FFFFFFF), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
603 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x80000000,0x00000000), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
604 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x80000000,0x80000000), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
605 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x80000000,0x80000001), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
606 |
DCL_TEST4(TUint64, TAU, MAKE_TUINT64(0x80000000,0x80000002), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
607 |
|
sl@0
|
608 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
609 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
610 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
611 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x00000000,0x00000000), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
612 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
613 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x00000000,0x00000002), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
614 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0xFFFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
615 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0xFFFFFFFF,0x00000000), MAKE_TUINT64(0x00000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
616 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x80000000,0x00000000), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
617 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
618 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x80000000,0x00000002), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
619 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x7FFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
620 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x7FFFFFFF,0x00000000), MAKE_TUINT64(0x80000000,0x00000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
621 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
622 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x7FFFFFFF,0x80000000), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
623 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x7FFFFFFF,0x80000002), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
624 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x7FFFFFFF,0xFFFFFFFF), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
625 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x7FFFFFFF,0x7FFFFFFF), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
626 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x80000000,0x00000000), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
627 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x80000000,0x80000000), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
628 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x80000000,0x80000001), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5)),
|
sl@0
|
629 |
DCL_TEST4(TUint64, TAS, MAKE_TUINT64(0x80000000,0x80000002), MAKE_TUINT64(0x7FFFFFFF,0x80000001), MAKE_TUINT64(0xFEEDFACE,0xFACEFEED), MAKE_TUINT64(0xBAD9BEEF,0x00FAECE5))
|
sl@0
|
630 |
};
|
sl@0
|
631 |
|
sl@0
|
632 |
|
sl@0
|
633 |
|
sl@0
|
634 |
template<class T>
|
sl@0
|
635 |
void DoTestBlock(const TD<T>* aTests, TInt aCount)
|
sl@0
|
636 |
{
|
sl@0
|
637 |
const TD<T>* p = aTests;
|
sl@0
|
638 |
const TD<T>* e = aTests + aCount;
|
sl@0
|
639 |
for (; p<e; ++p)
|
sl@0
|
640 |
{
|
sl@0
|
641 |
TInt ord;
|
sl@0
|
642 |
for (ord=EOrderRelaxed; ord<=EOrderOrdered; ++ord)
|
sl@0
|
643 |
{
|
sl@0
|
644 |
TDG tdg;
|
sl@0
|
645 |
tdg.Set(*p, ord);
|
sl@0
|
646 |
if (tdg.iIndex<0)
|
sl@0
|
647 |
continue;
|
sl@0
|
648 |
#ifdef __EXTRA_DEBUG__
|
sl@0
|
649 |
TPtrC8 fname8((const TText8*)FuncName[tdg.iIndex]);
|
sl@0
|
650 |
TBuf<64> fname;
|
sl@0
|
651 |
fname.Copy(fname8);
|
sl@0
|
652 |
test.Printf(_L("%S\n"), &fname);
|
sl@0
|
653 |
#endif
|
sl@0
|
654 |
TInt res;
|
sl@0
|
655 |
res = tdg.ExecuteUser();
|
sl@0
|
656 |
if (res!=0)
|
sl@0
|
657 |
{
|
sl@0
|
658 |
tdg.Dump("ExecuteUser");
|
sl@0
|
659 |
test.Printf(_L("FAIL %d\n"),res);
|
sl@0
|
660 |
test(0);
|
sl@0
|
661 |
}
|
sl@0
|
662 |
#ifdef __EPOC32__
|
sl@0
|
663 |
#ifdef __EXTRA_DEBUG__
|
sl@0
|
664 |
test.Printf(_L("%S K\n"), &fname);
|
sl@0
|
665 |
#endif
|
sl@0
|
666 |
res = tdg.ExecuteKernel();
|
sl@0
|
667 |
if (res!=0)
|
sl@0
|
668 |
{
|
sl@0
|
669 |
tdg.Dump("ExecuteKernel");
|
sl@0
|
670 |
test.Printf(_L("FAIL %d\n"),res);
|
sl@0
|
671 |
test(0);
|
sl@0
|
672 |
}
|
sl@0
|
673 |
#endif
|
sl@0
|
674 |
}
|
sl@0
|
675 |
}
|
sl@0
|
676 |
}
|
sl@0
|
677 |
|
sl@0
|
678 |
#define DO_TEST_BLOCK(type,array) \
|
sl@0
|
679 |
DoTestBlock<type>(&(array)[0],(TInt)(sizeof(array)/sizeof(TD<type>)))
|
sl@0
|
680 |
|
sl@0
|
681 |
void TestSingleThread()
|
sl@0
|
682 |
{
|
sl@0
|
683 |
test.Next(_L("8 bit, single thread"));
|
sl@0
|
684 |
DO_TEST_BLOCK(TUint8, TestData8);
|
sl@0
|
685 |
test.Next(_L("16 bit, single thread"));
|
sl@0
|
686 |
DO_TEST_BLOCK(TUint16, TestData16);
|
sl@0
|
687 |
test.Next(_L("32 bit, single thread"));
|
sl@0
|
688 |
DO_TEST_BLOCK(TUint32, TestData32);
|
sl@0
|
689 |
test.Next(_L("64 bit, single thread"));
|
sl@0
|
690 |
DO_TEST_BLOCK(TUint64, TestData64);
|
sl@0
|
691 |
}
|
sl@0
|
692 |
|
sl@0
|
693 |
|
sl@0
|
694 |
|
sl@0
|
695 |
/******************************************************************************
|
sl@0
|
696 |
* Test invalid address handling when called from user mode
|
sl@0
|
697 |
******************************************************************************/
|
sl@0
|
698 |
const TLinAddr KSpecialAddr = 0x100u;
|
sl@0
|
699 |
const TInt KIndexRead = -1;
|
sl@0
|
700 |
const TInt KIndexReadWrite = -2;
|
sl@0
|
701 |
|
sl@0
|
702 |
struct TE
|
sl@0
|
703 |
{
|
sl@0
|
704 |
static TInt Execute(TInt aIndex, TAny* aPtr1, TAny* aPtr2, TInt aResult);
|
sl@0
|
705 |
TInt DoExecute();
|
sl@0
|
706 |
static TInt ThreadFn(TAny*);
|
sl@0
|
707 |
|
sl@0
|
708 |
TInt iIndex;
|
sl@0
|
709 |
TAny* iPtr1;
|
sl@0
|
710 |
TAny* iPtr2;
|
sl@0
|
711 |
};
|
sl@0
|
712 |
|
sl@0
|
713 |
template<class T> TInt DoLoadErrorTest(TInt aIndex, const T* aPtr)
|
sl@0
|
714 |
{
|
sl@0
|
715 |
typename TLoadFn<T>::F atomic = (typename TLoadFn<T>::F)AtomicFuncPtr[aIndex];
|
sl@0
|
716 |
atomic(aPtr);
|
sl@0
|
717 |
return 0;
|
sl@0
|
718 |
}
|
sl@0
|
719 |
|
sl@0
|
720 |
template<class T> TInt DoRmw1ErrorTest(TInt aIndex, T* aPtr)
|
sl@0
|
721 |
{
|
sl@0
|
722 |
typename TRmw1Fn<T>::F atomic = (typename TRmw1Fn<T>::F)AtomicFuncPtr[aIndex];
|
sl@0
|
723 |
T a1 = 0;
|
sl@0
|
724 |
atomic(aPtr, a1);
|
sl@0
|
725 |
return 0;
|
sl@0
|
726 |
}
|
sl@0
|
727 |
|
sl@0
|
728 |
template<class T> TInt DoRmw2ErrorTest(TInt aIndex, T* aPtr)
|
sl@0
|
729 |
{
|
sl@0
|
730 |
typename TRmw2Fn<T>::F atomic = (typename TRmw2Fn<T>::F)AtomicFuncPtr[aIndex];
|
sl@0
|
731 |
T a1 = 0;
|
sl@0
|
732 |
T a2 = 0;
|
sl@0
|
733 |
atomic(aPtr, a1, a2);
|
sl@0
|
734 |
return 0;
|
sl@0
|
735 |
}
|
sl@0
|
736 |
|
sl@0
|
737 |
template<class T> TInt DoRmw3ErrorTest(TInt aIndex, T* aPtr)
|
sl@0
|
738 |
{
|
sl@0
|
739 |
typename TRmw3Fn<T>::F atomic = (typename TRmw3Fn<T>::F)AtomicFuncPtr[aIndex];
|
sl@0
|
740 |
T a1 = 0;
|
sl@0
|
741 |
T a2 = 0;
|
sl@0
|
742 |
T a3 = 0;
|
sl@0
|
743 |
atomic(aPtr, a1, a2, a3);
|
sl@0
|
744 |
return 0;
|
sl@0
|
745 |
}
|
sl@0
|
746 |
|
sl@0
|
747 |
template<class T> TInt DoCasErrorTest(TInt aIndex, T* aPtr1, T* aPtr2)
|
sl@0
|
748 |
{
|
sl@0
|
749 |
typename TCasFn<T>::F atomic = (typename TCasFn<T>::F)AtomicFuncPtr[aIndex];
|
sl@0
|
750 |
TLinAddr a1 = (TLinAddr)aPtr1;
|
sl@0
|
751 |
TLinAddr a2 = (TLinAddr)aPtr2;
|
sl@0
|
752 |
T reg;
|
sl@0
|
753 |
T exp;
|
sl@0
|
754 |
T f;
|
sl@0
|
755 |
memset(&f, 0xbb, sizeof(T));
|
sl@0
|
756 |
if ((a1&~0xff)==KSpecialAddr)
|
sl@0
|
757 |
{
|
sl@0
|
758 |
memset(®, (a1&0xff), sizeof(T));
|
sl@0
|
759 |
aPtr1 = ®
|
sl@0
|
760 |
}
|
sl@0
|
761 |
if ((a2&~0xff)==KSpecialAddr)
|
sl@0
|
762 |
{
|
sl@0
|
763 |
memset(&exp, (a2&0xff), sizeof(T));
|
sl@0
|
764 |
aPtr2 = &exp;
|
sl@0
|
765 |
}
|
sl@0
|
766 |
TInt r = atomic(aPtr1, aPtr2, f);
|
sl@0
|
767 |
return r ? 1 : 0;
|
sl@0
|
768 |
}
|
sl@0
|
769 |
|
sl@0
|
770 |
TInt TE::DoExecute()
|
sl@0
|
771 |
{
|
sl@0
|
772 |
if (iIndex == KIndexRead)
|
sl@0
|
773 |
{
|
sl@0
|
774 |
return *(volatile TUint8*)iPtr1;
|
sl@0
|
775 |
}
|
sl@0
|
776 |
if (iIndex == KIndexReadWrite)
|
sl@0
|
777 |
{
|
sl@0
|
778 |
volatile TUint8* p = (volatile TUint8*)iPtr1;
|
sl@0
|
779 |
TUint8 x = *p;
|
sl@0
|
780 |
*p = x;
|
sl@0
|
781 |
return 0;
|
sl@0
|
782 |
}
|
sl@0
|
783 |
TUint attr = FuncAttr[iIndex];
|
sl@0
|
784 |
TInt type = ATTR_TO_TYPE(attr);
|
sl@0
|
785 |
TInt size = ATTR_TO_SIZE(attr);
|
sl@0
|
786 |
if (type==EFuncTypeInvalid)
|
sl@0
|
787 |
return KErrNotSupported;
|
sl@0
|
788 |
TInt res;
|
sl@0
|
789 |
switch (type)
|
sl@0
|
790 |
{
|
sl@0
|
791 |
case EFuncTypeLoad:
|
sl@0
|
792 |
{
|
sl@0
|
793 |
switch (size)
|
sl@0
|
794 |
{
|
sl@0
|
795 |
case 1: res = DoLoadErrorTest<TUint8>(iIndex, (TUint8*)iPtr1); break;
|
sl@0
|
796 |
case 2: res = DoLoadErrorTest<TUint16>(iIndex, (TUint16*)iPtr1); break;
|
sl@0
|
797 |
case 4: res = DoLoadErrorTest<TUint32>(iIndex, (TUint32*)iPtr1); break;
|
sl@0
|
798 |
case 8: res = DoLoadErrorTest<TUint64>(iIndex, (TUint64*)iPtr1); break;
|
sl@0
|
799 |
default: res = KErrNotSupported; break;
|
sl@0
|
800 |
}
|
sl@0
|
801 |
break;
|
sl@0
|
802 |
}
|
sl@0
|
803 |
case EFuncTypeRmw1:
|
sl@0
|
804 |
{
|
sl@0
|
805 |
switch (size)
|
sl@0
|
806 |
{
|
sl@0
|
807 |
case 1: res = DoRmw1ErrorTest<TUint8>(iIndex, (TUint8*)iPtr1); break;
|
sl@0
|
808 |
case 2: res = DoRmw1ErrorTest<TUint16>(iIndex, (TUint16*)iPtr1); break;
|
sl@0
|
809 |
case 4: res = DoRmw1ErrorTest<TUint32>(iIndex, (TUint32*)iPtr1); break;
|
sl@0
|
810 |
case 8: res = DoRmw1ErrorTest<TUint64>(iIndex, (TUint64*)iPtr1); break;
|
sl@0
|
811 |
default: res = KErrNotSupported; break;
|
sl@0
|
812 |
}
|
sl@0
|
813 |
break;
|
sl@0
|
814 |
}
|
sl@0
|
815 |
case EFuncTypeRmw2:
|
sl@0
|
816 |
{
|
sl@0
|
817 |
switch (size)
|
sl@0
|
818 |
{
|
sl@0
|
819 |
case 1: res = DoRmw2ErrorTest<TUint8>(iIndex, (TUint8*)iPtr1); break;
|
sl@0
|
820 |
case 2: res = DoRmw2ErrorTest<TUint16>(iIndex, (TUint16*)iPtr1); break;
|
sl@0
|
821 |
case 4: res = DoRmw2ErrorTest<TUint32>(iIndex, (TUint32*)iPtr1); break;
|
sl@0
|
822 |
case 8: res = DoRmw2ErrorTest<TUint64>(iIndex, (TUint64*)iPtr1); break;
|
sl@0
|
823 |
default: res = KErrNotSupported; break;
|
sl@0
|
824 |
}
|
sl@0
|
825 |
break;
|
sl@0
|
826 |
}
|
sl@0
|
827 |
case EFuncTypeRmw3:
|
sl@0
|
828 |
{
|
sl@0
|
829 |
switch (size)
|
sl@0
|
830 |
{
|
sl@0
|
831 |
case 1: res = DoRmw3ErrorTest<TUint8>(iIndex, (TUint8*)iPtr1); break;
|
sl@0
|
832 |
case 2: res = DoRmw3ErrorTest<TUint16>(iIndex, (TUint16*)iPtr1); break;
|
sl@0
|
833 |
case 4: res = DoRmw3ErrorTest<TUint32>(iIndex, (TUint32*)iPtr1); break;
|
sl@0
|
834 |
case 8: res = DoRmw3ErrorTest<TUint64>(iIndex, (TUint64*)iPtr1); break;
|
sl@0
|
835 |
default: res = KErrNotSupported; break;
|
sl@0
|
836 |
}
|
sl@0
|
837 |
break;
|
sl@0
|
838 |
}
|
sl@0
|
839 |
case EFuncTypeCas:
|
sl@0
|
840 |
{
|
sl@0
|
841 |
switch (size)
|
sl@0
|
842 |
{
|
sl@0
|
843 |
case 1: res = DoCasErrorTest<TUint8>(iIndex, (TUint8*)iPtr1, (TUint8*)iPtr2); break;
|
sl@0
|
844 |
case 2: res = DoCasErrorTest<TUint16>(iIndex, (TUint16*)iPtr1, (TUint16*)iPtr2); break;
|
sl@0
|
845 |
case 4: res = DoCasErrorTest<TUint32>(iIndex, (TUint32*)iPtr1, (TUint32*)iPtr2); break;
|
sl@0
|
846 |
case 8: res = DoCasErrorTest<TUint64>(iIndex, (TUint64*)iPtr1, (TUint64*)iPtr2); break;
|
sl@0
|
847 |
default: res = KErrNotSupported; break;
|
sl@0
|
848 |
}
|
sl@0
|
849 |
break;
|
sl@0
|
850 |
}
|
sl@0
|
851 |
default:
|
sl@0
|
852 |
res = KErrNotSupported;
|
sl@0
|
853 |
break;
|
sl@0
|
854 |
}
|
sl@0
|
855 |
return res;
|
sl@0
|
856 |
}
|
sl@0
|
857 |
|
sl@0
|
858 |
TInt TE::ThreadFn(TAny* aPtr)
|
sl@0
|
859 |
{
|
sl@0
|
860 |
return ((TE*)aPtr)->DoExecute();
|
sl@0
|
861 |
}
|
sl@0
|
862 |
|
sl@0
|
863 |
_LIT(KLitKERNEXEC,"KERN-EXEC");
|
sl@0
|
864 |
TInt TE::Execute(TInt aIndex, TAny* aPtr1, TAny* aPtr2, TInt aResult)
|
sl@0
|
865 |
{
|
sl@0
|
866 |
DEBUGPRINT("I=%3d P1=%08x P2=%08x R=%d", aIndex, aPtr1, aPtr2, aResult);
|
sl@0
|
867 |
TE te;
|
sl@0
|
868 |
te.iIndex = aIndex;
|
sl@0
|
869 |
te.iPtr1 = aPtr1;
|
sl@0
|
870 |
te.iPtr2 = aPtr2;
|
sl@0
|
871 |
RThread t;
|
sl@0
|
872 |
TInt r = t.Create(KNullDesC, &ThreadFn, 0x1000, 0, &te);
|
sl@0
|
873 |
test_KErrNone(r);
|
sl@0
|
874 |
TRequestStatus s;
|
sl@0
|
875 |
t.Logon(s);
|
sl@0
|
876 |
test_Equal(KRequestPending, s.Int());
|
sl@0
|
877 |
TBool jit = User::JustInTime();
|
sl@0
|
878 |
User::SetJustInTime(EFalse);
|
sl@0
|
879 |
t.Resume();
|
sl@0
|
880 |
User::WaitForRequest(s);
|
sl@0
|
881 |
User::SetJustInTime(jit);
|
sl@0
|
882 |
TInt xt = t.ExitType();
|
sl@0
|
883 |
TInt xr = t.ExitReason();
|
sl@0
|
884 |
const TDesC& xc = t.ExitCategory();
|
sl@0
|
885 |
DEBUGPRINT("Exit type: %d,%d,%S", xt, xr, &xc);
|
sl@0
|
886 |
TInt res = KErrNone;
|
sl@0
|
887 |
if (aResult == KErrUnknown)
|
sl@0
|
888 |
{
|
sl@0
|
889 |
if (xt==EExitPanic)
|
sl@0
|
890 |
{
|
sl@0
|
891 |
test_Equal(ECausedException, xr);
|
sl@0
|
892 |
test(xc==KLitKERNEXEC);
|
sl@0
|
893 |
res = KErrDied;
|
sl@0
|
894 |
}
|
sl@0
|
895 |
else
|
sl@0
|
896 |
test_Equal(EExitKill, xt);
|
sl@0
|
897 |
}
|
sl@0
|
898 |
else if (aResult == KErrDied)
|
sl@0
|
899 |
{
|
sl@0
|
900 |
test_Equal(EExitPanic, xt);
|
sl@0
|
901 |
test_Equal(ECausedException, xr);
|
sl@0
|
902 |
test(xc==KLitKERNEXEC);
|
sl@0
|
903 |
}
|
sl@0
|
904 |
else
|
sl@0
|
905 |
{
|
sl@0
|
906 |
test_Equal(EExitKill, xt);
|
sl@0
|
907 |
test_Equal(aResult, xr);
|
sl@0
|
908 |
}
|
sl@0
|
909 |
CLOSE_AND_WAIT(t);
|
sl@0
|
910 |
return res;
|
sl@0
|
911 |
}
|
sl@0
|
912 |
|
sl@0
|
913 |
TInt ThreadAlign(TAny*)
|
sl@0
|
914 |
{
|
sl@0
|
915 |
TUint32 array[2];
|
sl@0
|
916 |
TUint32* p = (TUint32*)(((TLinAddr)array)+1);
|
sl@0
|
917 |
*p = 5;
|
sl@0
|
918 |
return KErrNone;
|
sl@0
|
919 |
}
|
sl@0
|
920 |
|
sl@0
|
921 |
const TUint64 Zero = UI64LIT(0);
|
sl@0
|
922 |
const TUint64 BFBF = UI64LIT(0xbfbfbfbfbfbfbfbf);
|
sl@0
|
923 |
|
sl@0
|
924 |
void TestInvalidAddresses()
|
sl@0
|
925 |
{
|
sl@0
|
926 |
TAny* bad_addr[11];
|
sl@0
|
927 |
TInt c = 0;
|
sl@0
|
928 |
TInt read_only = 0;
|
sl@0
|
929 |
TInt alignmentEnd = 0;
|
sl@0
|
930 |
TInt mminfo = UserSvr::HalFunction(EHalGroupKernel, EKernelHalMemModelInfo, 0, 0);
|
sl@0
|
931 |
// TInt mmtype = mminfo & EMemModelTypeMask;
|
sl@0
|
932 |
#ifdef __EPOC32__
|
sl@0
|
933 |
if (mminfo & EMemModelAttrWriteProt)
|
sl@0
|
934 |
{
|
sl@0
|
935 |
bad_addr[c++] = (TAny*)UserSvr::RomHeaderAddress();
|
sl@0
|
936 |
bad_addr[c++] = (TAny*)&Zero;
|
sl@0
|
937 |
bad_addr[c++] = (TAny*)&BFBF;
|
sl@0
|
938 |
read_only = c;
|
sl@0
|
939 |
}
|
sl@0
|
940 |
#endif
|
sl@0
|
941 |
if (mminfo & EMemModelAttrNonExProt)
|
sl@0
|
942 |
{
|
sl@0
|
943 |
bad_addr[c++] = 0; // address 0 is read only on ARM7 cores, nonexistent on others
|
sl@0
|
944 |
if (TE::Execute(KIndexRead, 0, 0, KErrUnknown)==KErrNone)
|
sl@0
|
945 |
read_only = c; // address 0 is readable
|
sl@0
|
946 |
TLinAddr nonex = 0;
|
sl@0
|
947 |
do {
|
sl@0
|
948 |
nonex += 0x1000;
|
sl@0
|
949 |
} while (TE::Execute(KIndexRead, (TAny*)nonex, 0, KErrUnknown)==KErrNone);
|
sl@0
|
950 |
bad_addr[c++] = (TAny*)nonex;
|
sl@0
|
951 |
}
|
sl@0
|
952 |
#ifdef __EPOC32__
|
sl@0
|
953 |
if (mminfo & EMemModelAttrKernProt)
|
sl@0
|
954 |
{
|
sl@0
|
955 |
bad_addr[c++] = DD.KernelMemoryAddress();
|
sl@0
|
956 |
}
|
sl@0
|
957 |
// If alignment checking is enabled add alignment tests for 64 bit.
|
sl@0
|
958 |
TUint64A alignArray[2];
|
sl@0
|
959 |
RThread t;
|
sl@0
|
960 |
TInt r = t.Create(KNullDesC, &ThreadAlign, 0x1000, 0, NULL);
|
sl@0
|
961 |
test_KErrNone(r);
|
sl@0
|
962 |
TRequestStatus s;
|
sl@0
|
963 |
t.Logon(s);
|
sl@0
|
964 |
test_Equal(KRequestPending, s.Int());
|
sl@0
|
965 |
TBool jit = User::JustInTime();
|
sl@0
|
966 |
User::SetJustInTime(EFalse);
|
sl@0
|
967 |
t.Resume();
|
sl@0
|
968 |
User::WaitForRequest(s);
|
sl@0
|
969 |
User::SetJustInTime(jit);
|
sl@0
|
970 |
TInt xt = t.ExitType();
|
sl@0
|
971 |
TInt xr = t.ExitReason();
|
sl@0
|
972 |
const TDesC& xc = t.ExitCategory();
|
sl@0
|
973 |
if (EExitPanic == xt)
|
sl@0
|
974 |
{// Took an alignment fault so add alignment test.
|
sl@0
|
975 |
test_Equal(ECausedException, xr);
|
sl@0
|
976 |
test(xc==KLitKERNEXEC);
|
sl@0
|
977 |
alignmentEnd = c;
|
sl@0
|
978 |
bad_addr[alignmentEnd++] = (TAny*)(((TUint)&alignArray[0]) + 1);
|
sl@0
|
979 |
bad_addr[alignmentEnd++] = (TAny*)(((TUint)&alignArray[0]) + 2);
|
sl@0
|
980 |
bad_addr[alignmentEnd++] = (TAny*)(((TUint)&alignArray[0]) + 4);
|
sl@0
|
981 |
}
|
sl@0
|
982 |
|
sl@0
|
983 |
#endif
|
sl@0
|
984 |
TInt i;
|
sl@0
|
985 |
TInt allBadAddr = (alignmentEnd)? c+3 : c;
|
sl@0
|
986 |
DEBUGPRINT("%d invalid addresses", allBadAddr);
|
sl@0
|
987 |
for (i=0; i < allBadAddr; ++i)
|
sl@0
|
988 |
{
|
sl@0
|
989 |
if (i<read_only)
|
sl@0
|
990 |
{
|
sl@0
|
991 |
DEBUGPRINT("bad_addr[%d]=%08x (RO)", i, bad_addr[i]);
|
sl@0
|
992 |
}
|
sl@0
|
993 |
else
|
sl@0
|
994 |
{
|
sl@0
|
995 |
DEBUGPRINT("bad_addr[%d]=%08x", i, bad_addr[i]);
|
sl@0
|
996 |
}
|
sl@0
|
997 |
}
|
sl@0
|
998 |
if (c==0)
|
sl@0
|
999 |
return;
|
sl@0
|
1000 |
TInt ix;
|
sl@0
|
1001 |
for (ix=0; ix<TOTAL_INDEXES; ++ix)
|
sl@0
|
1002 |
{
|
sl@0
|
1003 |
TUint attr = FuncAttr[ix];
|
sl@0
|
1004 |
TUint func = ATTR_TO_FUNC(attr);
|
sl@0
|
1005 |
TUint type = ATTR_TO_TYPE(attr);
|
sl@0
|
1006 |
if (type==EFuncTypeInvalid)
|
sl@0
|
1007 |
continue;
|
sl@0
|
1008 |
if (func==TUint(EAtomicFuncCAS))
|
sl@0
|
1009 |
{
|
sl@0
|
1010 |
// both addresses OK
|
sl@0
|
1011 |
TE::Execute(ix, (TAny*)(KSpecialAddr+0), (TAny*)(KSpecialAddr+0), 1); // should do the swap
|
sl@0
|
1012 |
TE::Execute(ix, (TAny*)(KSpecialAddr+0), (TAny*)(KSpecialAddr+1), 0); // should not do the swap
|
sl@0
|
1013 |
|
sl@0
|
1014 |
// RMW address OK, expected bad
|
sl@0
|
1015 |
for (i=0; i<c; ++i)
|
sl@0
|
1016 |
{
|
sl@0
|
1017 |
TAny* p = bad_addr[i];
|
sl@0
|
1018 |
TInt res = (bad_addr[i]==(TAny*)&BFBF) ? 1 : KErrDied;
|
sl@0
|
1019 |
TE::Execute(ix, (TAny*)(KSpecialAddr+0xbf), p, res);
|
sl@0
|
1020 |
}
|
sl@0
|
1021 |
|
sl@0
|
1022 |
// RMW address bad, expected OK
|
sl@0
|
1023 |
for (i=0; i<c; ++i)
|
sl@0
|
1024 |
{
|
sl@0
|
1025 |
TAny* p = bad_addr[i];
|
sl@0
|
1026 |
#if defined(__CPU_X86)
|
sl@0
|
1027 |
TInt res = KErrDied; // on X86 location must be writeable
|
sl@0
|
1028 |
#elif defined(__CPU_ARM)
|
sl@0
|
1029 |
TInt res = (i<read_only && bad_addr[i]!=(TAny*)&BFBF) ? 0 : KErrDied;
|
sl@0
|
1030 |
// 64-bit operations on platforms that use a slow exec for 64 bit
|
sl@0
|
1031 |
// will always write to bad_addr[i] but other platforms won't.
|
sl@0
|
1032 |
if (ATTR_TO_SIZE(attr) == 8)
|
sl@0
|
1033 |
res = KErrUnknown;
|
sl@0
|
1034 |
#else
|
sl@0
|
1035 |
#error CPU?
|
sl@0
|
1036 |
#endif
|
sl@0
|
1037 |
TE::Execute(ix, p, (TAny*)(KSpecialAddr+0xbf), res);
|
sl@0
|
1038 |
}
|
sl@0
|
1039 |
|
sl@0
|
1040 |
// Both addresses bad
|
sl@0
|
1041 |
TInt j;
|
sl@0
|
1042 |
for (i=0; i<c; ++i)
|
sl@0
|
1043 |
{
|
sl@0
|
1044 |
for (j=0; j<c; ++j)
|
sl@0
|
1045 |
{
|
sl@0
|
1046 |
TE::Execute(ix, bad_addr[i], bad_addr[j], KErrDied);
|
sl@0
|
1047 |
}
|
sl@0
|
1048 |
}
|
sl@0
|
1049 |
}
|
sl@0
|
1050 |
else
|
sl@0
|
1051 |
{
|
sl@0
|
1052 |
// just run through all the bad addresses
|
sl@0
|
1053 |
for (i=0; i<c; ++i)
|
sl@0
|
1054 |
{
|
sl@0
|
1055 |
TAny* p = bad_addr[i];
|
sl@0
|
1056 |
TBool ro = (i<read_only);
|
sl@0
|
1057 |
TInt res = ((func == TUint(EAtomicFuncLOAD)) && ro) ? KErrNone : KErrDied;
|
sl@0
|
1058 |
if (func==TUint(EAtomicFuncLOAD) && ATTR_TO_SIZE(attr)==8)
|
sl@0
|
1059 |
res = KErrUnknown; // 64-bit atomic loads may or may not write as well
|
sl@0
|
1060 |
TE::Execute(ix, p, 0, res);
|
sl@0
|
1061 |
}
|
sl@0
|
1062 |
}
|
sl@0
|
1063 |
// Checks for 8 byte alignment not enabled on old gcc (arm4) as it is not eabi compliant.
|
sl@0
|
1064 |
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__EABI__)
|
sl@0
|
1065 |
if (ATTR_TO_SIZE(attr) == 8)
|
sl@0
|
1066 |
{
|
sl@0
|
1067 |
for (i = c; i < alignmentEnd; i++)
|
sl@0
|
1068 |
{// 64 bit unaligned accesses should cause exceptions if
|
sl@0
|
1069 |
// alignment checking is enabled.
|
sl@0
|
1070 |
TE::Execute(ix, bad_addr[i], 0, KErrDied);
|
sl@0
|
1071 |
}
|
sl@0
|
1072 |
}
|
sl@0
|
1073 |
#endif
|
sl@0
|
1074 |
}
|
sl@0
|
1075 |
}
|
sl@0
|
1076 |
|
sl@0
|
1077 |
|
sl@0
|
1078 |
|
sl@0
|
1079 |
/******************************************************************************
|
sl@0
|
1080 |
* Multiple thread normal operation tests
|
sl@0
|
1081 |
******************************************************************************/
|
sl@0
|
1082 |
class CThread;
|
sl@0
|
1083 |
class CThreads : public CBase
|
sl@0
|
1084 |
{
|
sl@0
|
1085 |
public:
|
sl@0
|
1086 |
static CThreads* New();
|
sl@0
|
1087 |
CThreads();
|
sl@0
|
1088 |
~CThreads();
|
sl@0
|
1089 |
CThread* NewThread(TInt aId);
|
sl@0
|
1090 |
void StartTest(TInt aIndex, TBool aKernel);
|
sl@0
|
1091 |
void StopTest();
|
sl@0
|
1092 |
void Finish();
|
sl@0
|
1093 |
TUint32 DoCasTest(TInt aIndex, TBool aKernel, TUint32 aFailLimit);
|
sl@0
|
1094 |
void DoRmwTest(TInt aIndex, TBool aKernel, TInt aTime);
|
sl@0
|
1095 |
inline TInt NumCpus() const {return iNumCpus;}
|
sl@0
|
1096 |
private:
|
sl@0
|
1097 |
TInt iNumCpus;
|
sl@0
|
1098 |
TInt iNumThreads;
|
sl@0
|
1099 |
CThread* iThreads[KMaxThreads];
|
sl@0
|
1100 |
RSemaphore iSem;
|
sl@0
|
1101 |
volatile TInt iIndex;
|
sl@0
|
1102 |
volatile TBool iKernel;
|
sl@0
|
1103 |
volatile TBool iStop;
|
sl@0
|
1104 |
volatile TUint64 iReg;
|
sl@0
|
1105 |
TInt iFailCount;
|
sl@0
|
1106 |
TInt iTimeslice;
|
sl@0
|
1107 |
private:
|
sl@0
|
1108 |
friend class CThread;
|
sl@0
|
1109 |
};
|
sl@0
|
1110 |
|
sl@0
|
1111 |
class CThread : public CBase
|
sl@0
|
1112 |
{
|
sl@0
|
1113 |
private:
|
sl@0
|
1114 |
CThread();
|
sl@0
|
1115 |
~CThread();
|
sl@0
|
1116 |
static TInt ThreadFunction(TAny*);
|
sl@0
|
1117 |
TInt Run();
|
sl@0
|
1118 |
TInt Create();
|
sl@0
|
1119 |
void Start();
|
sl@0
|
1120 |
void DoTest();
|
sl@0
|
1121 |
TUint64 Random();
|
sl@0
|
1122 |
void Kick();
|
sl@0
|
1123 |
private:
|
sl@0
|
1124 |
RThread iThread;
|
sl@0
|
1125 |
TInt iId;
|
sl@0
|
1126 |
CThreads* iThreads;
|
sl@0
|
1127 |
TRequestStatus iStatus;
|
sl@0
|
1128 |
TBool iStarted;
|
sl@0
|
1129 |
TPerThread iPerThread;
|
sl@0
|
1130 |
TUint64 iSeed;
|
sl@0
|
1131 |
private:
|
sl@0
|
1132 |
friend class CThreads;
|
sl@0
|
1133 |
};
|
sl@0
|
1134 |
|
sl@0
|
1135 |
CThreads::CThreads()
|
sl@0
|
1136 |
{
|
sl@0
|
1137 |
iNumCpus = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0);
|
sl@0
|
1138 |
iNumThreads = iNumCpus;
|
sl@0
|
1139 |
if (iNumThreads<2)
|
sl@0
|
1140 |
iNumThreads=2;
|
sl@0
|
1141 |
TInt khz;
|
sl@0
|
1142 |
TInt r = HAL::Get(HAL::ECPUSpeed, khz);
|
sl@0
|
1143 |
if (r==KErrNone)
|
sl@0
|
1144 |
iTimeslice = Max(10000000/khz, 100);
|
sl@0
|
1145 |
else if (r==KErrNotSupported)
|
sl@0
|
1146 |
iTimeslice = 227;
|
sl@0
|
1147 |
else
|
sl@0
|
1148 |
User::Panic(_L("TIMESLICE"),r);
|
sl@0
|
1149 |
}
|
sl@0
|
1150 |
|
sl@0
|
1151 |
CThreads::~CThreads()
|
sl@0
|
1152 |
{
|
sl@0
|
1153 |
TInt i;
|
sl@0
|
1154 |
for (i=0; i<iNumThreads; ++i)
|
sl@0
|
1155 |
delete iThreads[i];
|
sl@0
|
1156 |
iSem.Close();
|
sl@0
|
1157 |
}
|
sl@0
|
1158 |
|
sl@0
|
1159 |
CThreads* CThreads::New()
|
sl@0
|
1160 |
{
|
sl@0
|
1161 |
CThreads* p = new CThreads;
|
sl@0
|
1162 |
if (p)
|
sl@0
|
1163 |
{
|
sl@0
|
1164 |
TInt r;
|
sl@0
|
1165 |
r = p->iSem.CreateLocal(0);
|
sl@0
|
1166 |
TInt i;
|
sl@0
|
1167 |
for (i=0; i<p->iNumThreads && r==KErrNone; ++i)
|
sl@0
|
1168 |
{
|
sl@0
|
1169 |
p->iThreads[i] = p->NewThread(i);
|
sl@0
|
1170 |
if (!p->iThreads[i])
|
sl@0
|
1171 |
r = KErrNoMemory;
|
sl@0
|
1172 |
}
|
sl@0
|
1173 |
if (r!=KErrNone)
|
sl@0
|
1174 |
{
|
sl@0
|
1175 |
delete p;
|
sl@0
|
1176 |
return 0;
|
sl@0
|
1177 |
}
|
sl@0
|
1178 |
p->iStop = ETrue;
|
sl@0
|
1179 |
for (i=0; i<p->iNumThreads; ++i)
|
sl@0
|
1180 |
p->iThreads[i]->Start();
|
sl@0
|
1181 |
}
|
sl@0
|
1182 |
return p;
|
sl@0
|
1183 |
}
|
sl@0
|
1184 |
|
sl@0
|
1185 |
CThread* CThreads::NewThread(TInt aId)
|
sl@0
|
1186 |
{
|
sl@0
|
1187 |
CThread* t = new CThread;
|
sl@0
|
1188 |
if (t)
|
sl@0
|
1189 |
{
|
sl@0
|
1190 |
t->iId = aId;
|
sl@0
|
1191 |
t->iThreads = this;
|
sl@0
|
1192 |
TInt r = t->Create();
|
sl@0
|
1193 |
if (r!=KErrNone)
|
sl@0
|
1194 |
{
|
sl@0
|
1195 |
delete t;
|
sl@0
|
1196 |
t = 0;
|
sl@0
|
1197 |
}
|
sl@0
|
1198 |
}
|
sl@0
|
1199 |
return t;
|
sl@0
|
1200 |
}
|
sl@0
|
1201 |
|
sl@0
|
1202 |
void CThreads::StartTest(TInt aIndex, TBool aKernel)
|
sl@0
|
1203 |
{
|
sl@0
|
1204 |
iIndex = aIndex;
|
sl@0
|
1205 |
iKernel = aKernel;
|
sl@0
|
1206 |
iReg = 0;
|
sl@0
|
1207 |
iStop = EFalse;
|
sl@0
|
1208 |
#ifdef __EPOC32__
|
sl@0
|
1209 |
if (iKernel)
|
sl@0
|
1210 |
DD.Initialise(iReg);
|
sl@0
|
1211 |
#endif
|
sl@0
|
1212 |
TInt i;
|
sl@0
|
1213 |
for (i=0; i<iNumThreads; ++i)
|
sl@0
|
1214 |
iThreads[i]->Kick();
|
sl@0
|
1215 |
}
|
sl@0
|
1216 |
|
sl@0
|
1217 |
void CThreads::StopTest()
|
sl@0
|
1218 |
{
|
sl@0
|
1219 |
iStop = ETrue;
|
sl@0
|
1220 |
TInt i;
|
sl@0
|
1221 |
for (i=0; i<iNumThreads; ++i)
|
sl@0
|
1222 |
iSem.Wait();
|
sl@0
|
1223 |
#ifdef __EPOC32__
|
sl@0
|
1224 |
if (iKernel)
|
sl@0
|
1225 |
iReg = DD.Retrieve();
|
sl@0
|
1226 |
#endif
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
|
sl@0
|
1229 |
void CThreads::Finish()
|
sl@0
|
1230 |
{
|
sl@0
|
1231 |
iStop = EFalse;
|
sl@0
|
1232 |
iIndex = -1;
|
sl@0
|
1233 |
TInt i;
|
sl@0
|
1234 |
for (i=0; i<iNumThreads; ++i)
|
sl@0
|
1235 |
{
|
sl@0
|
1236 |
iThreads[i]->Kick();
|
sl@0
|
1237 |
iSem.Wait();
|
sl@0
|
1238 |
}
|
sl@0
|
1239 |
test(iFailCount==0);
|
sl@0
|
1240 |
}
|
sl@0
|
1241 |
|
sl@0
|
1242 |
TUint32 CThreads::DoCasTest(TInt aIndex, TBool aKernel, TUint32 aFailLimit)
|
sl@0
|
1243 |
{
|
sl@0
|
1244 |
TInt i;
|
sl@0
|
1245 |
test.Printf(_L("DoCasTest I=%d K=%1d F=%d\n"), aIndex, aKernel, aFailLimit);
|
sl@0
|
1246 |
TUint32 initial = User::FastCounter();
|
sl@0
|
1247 |
StartTest(aIndex, aKernel);
|
sl@0
|
1248 |
FOREVER
|
sl@0
|
1249 |
{
|
sl@0
|
1250 |
User::AfterHighRes(1000000);
|
sl@0
|
1251 |
TUint64 minf = 0;
|
sl@0
|
1252 |
--minf;
|
sl@0
|
1253 |
for (i=0; i<iNumThreads; ++i)
|
sl@0
|
1254 |
{
|
sl@0
|
1255 |
CThread* t = iThreads[i];
|
sl@0
|
1256 |
test.Printf(_L("T%1d: C=%lu R=%lu\n"), i, t->iPerThread.iDiff, t->iPerThread.iFailCount);
|
sl@0
|
1257 |
TUint64 f = t->iPerThread.iFailCount;
|
sl@0
|
1258 |
if (f<minf)
|
sl@0
|
1259 |
minf=f;
|
sl@0
|
1260 |
}
|
sl@0
|
1261 |
if (minf>=TUint64(aFailLimit))
|
sl@0
|
1262 |
break;
|
sl@0
|
1263 |
if (iNumCpus>1) // 1 second is enough for SMP, except on VMPlayer
|
sl@0
|
1264 |
break;
|
sl@0
|
1265 |
}
|
sl@0
|
1266 |
StopTest();
|
sl@0
|
1267 |
TUint32 final = User::FastCounter();
|
sl@0
|
1268 |
TUint32 time = final - initial;
|
sl@0
|
1269 |
test.Printf(_L("Time %d\n"), time);
|
sl@0
|
1270 |
TUint64 total = 0;
|
sl@0
|
1271 |
TUint64 txor = 0;
|
sl@0
|
1272 |
for (i=0; i<iNumThreads; ++i)
|
sl@0
|
1273 |
{
|
sl@0
|
1274 |
CThread* t = iThreads[i];
|
sl@0
|
1275 |
test.Printf(_L("T%1d: %lu completed %lu retries\n"), i, t->iPerThread.iDiff, t->iPerThread.iFailCount);
|
sl@0
|
1276 |
total += t->iPerThread.iDiff;
|
sl@0
|
1277 |
txor ^= t->iPerThread.iXor;
|
sl@0
|
1278 |
}
|
sl@0
|
1279 |
TUint size = ATTR_TO_SIZE(FuncAttr[aIndex]);
|
sl@0
|
1280 |
TUint64 expected = 0;
|
sl@0
|
1281 |
switch (size)
|
sl@0
|
1282 |
{
|
sl@0
|
1283 |
case 1: expected = Transform<TUint8>::F_iter(0, total); break;
|
sl@0
|
1284 |
case 2: expected = Transform<TUint16>::F_iter(0, total); break;
|
sl@0
|
1285 |
case 4: expected = Transform<TUint32>::F_iter(0, total); break;
|
sl@0
|
1286 |
case 8: expected = Transform<TUint64>::F_iter(0, total); break;
|
sl@0
|
1287 |
}
|
sl@0
|
1288 |
test.Printf(_L("Total iterations %lu\n"), total);
|
sl@0
|
1289 |
test.Printf(_L("Expected result %08x %08x\n"), I64HIGH(expected), I64LOW(expected));
|
sl@0
|
1290 |
test.Printf(_L("Actual result %08x %08x\n"), I64HIGH(iReg), I64LOW(iReg));
|
sl@0
|
1291 |
test.Printf(_L("Tot. XOR result %08x %08x\n"), I64HIGH(txor), I64LOW(txor));
|
sl@0
|
1292 |
// test(expected==iReg);
|
sl@0
|
1293 |
// test(expected==txor);
|
sl@0
|
1294 |
if (expected!=iReg || expected!=txor)
|
sl@0
|
1295 |
{
|
sl@0
|
1296 |
test.Printf(_L("***FAIL***\n"));
|
sl@0
|
1297 |
++iFailCount;
|
sl@0
|
1298 |
}
|
sl@0
|
1299 |
return time;
|
sl@0
|
1300 |
}
|
sl@0
|
1301 |
|
sl@0
|
1302 |
void CThreads::DoRmwTest(TInt aIndex, TBool aKernel, TInt aTime)
|
sl@0
|
1303 |
{
|
sl@0
|
1304 |
TInt i;
|
sl@0
|
1305 |
test.Printf(_L("DoRmwTest I=%d K=%1d T=%d\n"), aIndex, aKernel, aTime);
|
sl@0
|
1306 |
StartTest(aIndex, aKernel);
|
sl@0
|
1307 |
User::AfterHighRes(aTime);
|
sl@0
|
1308 |
StopTest();
|
sl@0
|
1309 |
TUint64 total = 0;
|
sl@0
|
1310 |
TUint64 txor = 0;
|
sl@0
|
1311 |
for (i=0; i<iNumThreads; ++i)
|
sl@0
|
1312 |
{
|
sl@0
|
1313 |
CThread* t = iThreads[i];
|
sl@0
|
1314 |
test.Printf(_L("T%1d: C=%10lu D=%lx X=%lx\n"), i, t->iPerThread.iCount, t->iPerThread.iDiff, t->iPerThread.iXor);
|
sl@0
|
1315 |
total += t->iPerThread.iDiff;
|
sl@0
|
1316 |
txor ^= t->iPerThread.iXor;
|
sl@0
|
1317 |
}
|
sl@0
|
1318 |
TUint size = ATTR_TO_SIZE(FuncAttr[aIndex]);
|
sl@0
|
1319 |
switch (size)
|
sl@0
|
1320 |
{
|
sl@0
|
1321 |
case 1:
|
sl@0
|
1322 |
{
|
sl@0
|
1323 |
TUint8 expected = (TUint8)total;
|
sl@0
|
1324 |
TUint8 exor = (TUint8)txor;
|
sl@0
|
1325 |
TUint8 got = (TUint8)iReg;
|
sl@0
|
1326 |
test.Printf(_L("Expected %02x Got %02x XOR %02x\n"), expected, got, exor);
|
sl@0
|
1327 |
// test(expected==got && exor==got);
|
sl@0
|
1328 |
if (expected!=got || exor!=got)
|
sl@0
|
1329 |
{
|
sl@0
|
1330 |
test.Printf(_L("***FAIL***\n"));
|
sl@0
|
1331 |
++iFailCount;
|
sl@0
|
1332 |
}
|
sl@0
|
1333 |
break;
|
sl@0
|
1334 |
}
|
sl@0
|
1335 |
case 2:
|
sl@0
|
1336 |
{
|
sl@0
|
1337 |
TUint16 expected = (TUint16)total;
|
sl@0
|
1338 |
TUint16 exor = (TUint16)txor;
|
sl@0
|
1339 |
TUint16 got = (TUint16)iReg;
|
sl@0
|
1340 |
test.Printf(_L("Expected %04x Got %04x XOR %04x\n"), expected, got, exor);
|
sl@0
|
1341 |
// test(expected==got && exor==got);
|
sl@0
|
1342 |
if (expected!=got || exor!=got)
|
sl@0
|
1343 |
{
|
sl@0
|
1344 |
test.Printf(_L("***FAIL***\n"));
|
sl@0
|
1345 |
++iFailCount;
|
sl@0
|
1346 |
}
|
sl@0
|
1347 |
break;
|
sl@0
|
1348 |
}
|
sl@0
|
1349 |
case 4:
|
sl@0
|
1350 |
{
|
sl@0
|
1351 |
TUint32 expected = (TUint32)total;
|
sl@0
|
1352 |
TUint32 exor = (TUint32)txor;
|
sl@0
|
1353 |
TUint32 got = (TUint32)iReg;
|
sl@0
|
1354 |
test.Printf(_L("Expected %08x Got %08x XOR %08x\n"), expected, got, exor);
|
sl@0
|
1355 |
// test(expected==got && exor==got);
|
sl@0
|
1356 |
if (expected!=got || exor!=got)
|
sl@0
|
1357 |
{
|
sl@0
|
1358 |
test.Printf(_L("***FAIL***\n"));
|
sl@0
|
1359 |
++iFailCount;
|
sl@0
|
1360 |
}
|
sl@0
|
1361 |
break;
|
sl@0
|
1362 |
}
|
sl@0
|
1363 |
case 8:
|
sl@0
|
1364 |
{
|
sl@0
|
1365 |
TUint64 expected = total;
|
sl@0
|
1366 |
test.Printf(_L("Expected result %08x %08x\n"), I64HIGH(expected), I64LOW(expected));
|
sl@0
|
1367 |
test.Printf(_L("Actual result %08x %08x\n"), I64HIGH(iReg), I64LOW(iReg));
|
sl@0
|
1368 |
test.Printf(_L("Tot. XOR result %08x %08x\n"), I64HIGH(txor), I64LOW(txor));
|
sl@0
|
1369 |
// test(expected==iReg && expected==txor);
|
sl@0
|
1370 |
if (expected!=iReg || expected!=txor)
|
sl@0
|
1371 |
{
|
sl@0
|
1372 |
test.Printf(_L("***FAIL***\n"));
|
sl@0
|
1373 |
++iFailCount;
|
sl@0
|
1374 |
}
|
sl@0
|
1375 |
break;
|
sl@0
|
1376 |
}
|
sl@0
|
1377 |
}
|
sl@0
|
1378 |
}
|
sl@0
|
1379 |
|
sl@0
|
1380 |
CThread::CThread()
|
sl@0
|
1381 |
{
|
sl@0
|
1382 |
}
|
sl@0
|
1383 |
|
sl@0
|
1384 |
CThread::~CThread()
|
sl@0
|
1385 |
{
|
sl@0
|
1386 |
TInt h = iThread.Handle();
|
sl@0
|
1387 |
if (h && h!=KCurrentThreadHandle)
|
sl@0
|
1388 |
{
|
sl@0
|
1389 |
if (!iStarted)
|
sl@0
|
1390 |
iThread.Kill(0);
|
sl@0
|
1391 |
User::WaitForRequest(iStatus);
|
sl@0
|
1392 |
}
|
sl@0
|
1393 |
iThread.Close();
|
sl@0
|
1394 |
}
|
sl@0
|
1395 |
|
sl@0
|
1396 |
TInt CThread::Create()
|
sl@0
|
1397 |
{
|
sl@0
|
1398 |
TInt r = iThread.Create(KNullDesC, &ThreadFunction, 0x2000, 0, this);
|
sl@0
|
1399 |
if (r==KErrNone)
|
sl@0
|
1400 |
{
|
sl@0
|
1401 |
iThread.Logon(iStatus);
|
sl@0
|
1402 |
if (iStatus.Int() != KRequestPending)
|
sl@0
|
1403 |
r = iStatus.Int();
|
sl@0
|
1404 |
}
|
sl@0
|
1405 |
return r;
|
sl@0
|
1406 |
}
|
sl@0
|
1407 |
|
sl@0
|
1408 |
void CThread::Start()
|
sl@0
|
1409 |
{
|
sl@0
|
1410 |
iThread.Resume();
|
sl@0
|
1411 |
iThreads->iSem.Wait();
|
sl@0
|
1412 |
}
|
sl@0
|
1413 |
|
sl@0
|
1414 |
void CThread::Kick()
|
sl@0
|
1415 |
{
|
sl@0
|
1416 |
TRequestStatus s;
|
sl@0
|
1417 |
TRequestStatus* pS = &s;
|
sl@0
|
1418 |
iThread.RequestComplete(pS,0);
|
sl@0
|
1419 |
}
|
sl@0
|
1420 |
|
sl@0
|
1421 |
TInt CThread::ThreadFunction(TAny* aPtr)
|
sl@0
|
1422 |
{
|
sl@0
|
1423 |
return ((CThread*)aPtr)->Run();
|
sl@0
|
1424 |
}
|
sl@0
|
1425 |
|
sl@0
|
1426 |
TInt CThread::Run()
|
sl@0
|
1427 |
{
|
sl@0
|
1428 |
#ifdef __EPOC32__
|
sl@0
|
1429 |
DD.SetCurrentThreadTimeslice(iThreads->iTimeslice);
|
sl@0
|
1430 |
#endif
|
sl@0
|
1431 |
RThread().SetPriority(EPriorityLess);
|
sl@0
|
1432 |
FOREVER
|
sl@0
|
1433 |
{
|
sl@0
|
1434 |
if (iThreads->iStop)
|
sl@0
|
1435 |
{
|
sl@0
|
1436 |
iThreads->iSem.Signal();
|
sl@0
|
1437 |
if (iThreads->iNumCpus > 1)
|
sl@0
|
1438 |
RThread().SetPriority(EPriorityAbsoluteHigh); // encourage spreading out of threads between CPUs
|
sl@0
|
1439 |
User::WaitForAnyRequest();
|
sl@0
|
1440 |
if (iThreads->iIndex<0)
|
sl@0
|
1441 |
break;
|
sl@0
|
1442 |
if (iThreads->iNumCpus > 1)
|
sl@0
|
1443 |
{
|
sl@0
|
1444 |
TUint32 tick = User::NTickCount();
|
sl@0
|
1445 |
while(User::NTickCount()-tick < 2) {} // spin to discourage putting other threads on this CPU
|
sl@0
|
1446 |
RThread().SetPriority(EPriorityLess);
|
sl@0
|
1447 |
}
|
sl@0
|
1448 |
}
|
sl@0
|
1449 |
DoTest();
|
sl@0
|
1450 |
}
|
sl@0
|
1451 |
iThreads->iSem.Signal();
|
sl@0
|
1452 |
return 0;
|
sl@0
|
1453 |
}
|
sl@0
|
1454 |
|
sl@0
|
1455 |
TUint64 CThread::Random()
|
sl@0
|
1456 |
{
|
sl@0
|
1457 |
iSeed = Transform<TUint64>::F(iSeed);
|
sl@0
|
1458 |
return iSeed;
|
sl@0
|
1459 |
}
|
sl@0
|
1460 |
|
sl@0
|
1461 |
void CThread::DoTest()
|
sl@0
|
1462 |
{
|
sl@0
|
1463 |
iPerThread.iDiff = 0;
|
sl@0
|
1464 |
iPerThread.iXor = 0;
|
sl@0
|
1465 |
iPerThread.iFailCount = 0;
|
sl@0
|
1466 |
iPerThread.iCount = 0;
|
sl@0
|
1467 |
TInt index = iThreads->iIndex;
|
sl@0
|
1468 |
TAny* p = (TAny*)&iThreads->iReg;
|
sl@0
|
1469 |
#ifdef __EPOC32__
|
sl@0
|
1470 |
TBool kernel = iThreads->iKernel;
|
sl@0
|
1471 |
if (kernel)
|
sl@0
|
1472 |
{
|
sl@0
|
1473 |
DD.SwitchExecTables(iId);
|
sl@0
|
1474 |
RTestAtomic::SetThreadInfo(iPerThread);
|
sl@0
|
1475 |
}
|
sl@0
|
1476 |
TInt iter = 0;
|
sl@0
|
1477 |
#endif
|
sl@0
|
1478 |
iSeed = iId;
|
sl@0
|
1479 |
while (!iThreads->iStop)
|
sl@0
|
1480 |
{
|
sl@0
|
1481 |
TAtomicAction action;
|
sl@0
|
1482 |
action.i0 = Random();
|
sl@0
|
1483 |
action.i1 = Random();
|
sl@0
|
1484 |
action.i2 = Random();
|
sl@0
|
1485 |
action.iIndex = index;
|
sl@0
|
1486 |
action.iThread = iId;
|
sl@0
|
1487 |
#ifdef __EPOC32__
|
sl@0
|
1488 |
if (kernel)
|
sl@0
|
1489 |
{
|
sl@0
|
1490 |
RTestAtomic::AtomicAction(action);
|
sl@0
|
1491 |
}
|
sl@0
|
1492 |
else
|
sl@0
|
1493 |
#endif
|
sl@0
|
1494 |
DoAtomicAction(p, &iPerThread, action);
|
sl@0
|
1495 |
#ifdef __EPOC32__
|
sl@0
|
1496 |
if (kernel && ++iter==1024)
|
sl@0
|
1497 |
{
|
sl@0
|
1498 |
iter = 0;
|
sl@0
|
1499 |
RTestAtomic::GetThreadInfo(iPerThread);
|
sl@0
|
1500 |
}
|
sl@0
|
1501 |
#endif
|
sl@0
|
1502 |
}
|
sl@0
|
1503 |
#ifdef __EPOC32__
|
sl@0
|
1504 |
if (kernel)
|
sl@0
|
1505 |
{
|
sl@0
|
1506 |
RTestAtomic::GetThreadInfo(iPerThread);
|
sl@0
|
1507 |
RTestAtomic::RestoreExecTable();
|
sl@0
|
1508 |
}
|
sl@0
|
1509 |
#endif
|
sl@0
|
1510 |
}
|
sl@0
|
1511 |
|
sl@0
|
1512 |
void TestMultipleThreads()
|
sl@0
|
1513 |
{
|
sl@0
|
1514 |
CThreads* p = CThreads::New();
|
sl@0
|
1515 |
test(p!=0);
|
sl@0
|
1516 |
|
sl@0
|
1517 |
TInt KRequiredRetries = 1000;
|
sl@0
|
1518 |
if (p->NumCpus()==1)
|
sl@0
|
1519 |
KRequiredRetries = 10;
|
sl@0
|
1520 |
|
sl@0
|
1521 |
TUint32 time;
|
sl@0
|
1522 |
TUint32 total_time = 0;
|
sl@0
|
1523 |
TUint32 total_time_k = 0;
|
sl@0
|
1524 |
TUint32 count = 0;
|
sl@0
|
1525 |
TInt ix;
|
sl@0
|
1526 |
for (ix=0; ix<TOTAL_INDEXES; ++ix)
|
sl@0
|
1527 |
{
|
sl@0
|
1528 |
TUint attr = FuncAttr[ix];
|
sl@0
|
1529 |
TUint func = ATTR_TO_FUNC(attr);
|
sl@0
|
1530 |
TUint type = ATTR_TO_TYPE(attr);
|
sl@0
|
1531 |
if (p->NumCpus()==1)
|
sl@0
|
1532 |
{
|
sl@0
|
1533 |
TUint ord = ATTR_TO_ORD(attr);
|
sl@0
|
1534 |
if (ord != EOrderOrdered)
|
sl@0
|
1535 |
continue;
|
sl@0
|
1536 |
}
|
sl@0
|
1537 |
if (type==EFuncTypeInvalid)
|
sl@0
|
1538 |
continue;
|
sl@0
|
1539 |
if (func!=TUint(EAtomicFuncCAS))
|
sl@0
|
1540 |
continue;
|
sl@0
|
1541 |
time = p->DoCasTest(ix, EFalse, KRequiredRetries);
|
sl@0
|
1542 |
total_time += time;
|
sl@0
|
1543 |
++count;
|
sl@0
|
1544 |
time = p->DoCasTest(ix, ETrue, KRequiredRetries);
|
sl@0
|
1545 |
total_time_k += time;
|
sl@0
|
1546 |
}
|
sl@0
|
1547 |
TUint32 avg_time = total_time / count;
|
sl@0
|
1548 |
TUint32 avg_time_k = total_time_k / count;
|
sl@0
|
1549 |
TUint32 fcf=0;
|
sl@0
|
1550 |
TInt r = HAL::Get(HAL::EFastCounterFrequency, (TInt&)fcf);
|
sl@0
|
1551 |
test_KErrNone(r);
|
sl@0
|
1552 |
test.Printf(_L("FastCounterFrequency = %u\n"), fcf);
|
sl@0
|
1553 |
TUint64 avg_time_us64(avg_time);
|
sl@0
|
1554 |
avg_time_us64*=UI64LIT(1000000);
|
sl@0
|
1555 |
avg_time_us64/=TUint64(fcf);
|
sl@0
|
1556 |
TInt avg_time_us = KMaxTInt;
|
sl@0
|
1557 |
TInt avg_time_k_us = KMaxTInt;
|
sl@0
|
1558 |
if (avg_time_us64<TUint64(KMaxTInt))
|
sl@0
|
1559 |
avg_time_us = (TInt)avg_time_us64;
|
sl@0
|
1560 |
TUint64 avg_time_k_us64(avg_time);
|
sl@0
|
1561 |
avg_time_k_us64*=UI64LIT(1000000);
|
sl@0
|
1562 |
avg_time_k_us64/=TUint64(fcf);
|
sl@0
|
1563 |
if (avg_time_k_us64<TUint64(KMaxTInt))
|
sl@0
|
1564 |
avg_time_k_us = (TInt)avg_time_k_us64;
|
sl@0
|
1565 |
|
sl@0
|
1566 |
test.Printf(_L("Average time (user) %u (%dus)\n"), avg_time, avg_time_us);
|
sl@0
|
1567 |
test.Printf(_L("Average time (kernel) %u (%dus)\n"), avg_time_k, avg_time_k_us);
|
sl@0
|
1568 |
|
sl@0
|
1569 |
TInt limit_us = (p->NumCpus()==1) ? 15*1000*1000 : 4*1000*1000;
|
sl@0
|
1570 |
|
sl@0
|
1571 |
for (ix=0; ix<TOTAL_INDEXES; ++ix)
|
sl@0
|
1572 |
{
|
sl@0
|
1573 |
TUint attr = FuncAttr[ix];
|
sl@0
|
1574 |
TUint func = ATTR_TO_FUNC(attr);
|
sl@0
|
1575 |
TUint type = ATTR_TO_TYPE(attr);
|
sl@0
|
1576 |
if (p->NumCpus()==1)
|
sl@0
|
1577 |
{
|
sl@0
|
1578 |
TUint ord = ATTR_TO_ORD(attr);
|
sl@0
|
1579 |
if (ord != EOrderOrdered)
|
sl@0
|
1580 |
continue;
|
sl@0
|
1581 |
}
|
sl@0
|
1582 |
if (type==EFuncTypeInvalid)
|
sl@0
|
1583 |
continue;
|
sl@0
|
1584 |
if (func<TUint(EAtomicFuncSWP) || func>=TUint(EAtomicFuncCAS))
|
sl@0
|
1585 |
continue;
|
sl@0
|
1586 |
if (func==TUint(EAtomicFuncIOR)) // can only test AND and IOR together
|
sl@0
|
1587 |
continue;
|
sl@0
|
1588 |
p->DoRmwTest(ix, EFalse, Min(avg_time_us,limit_us));
|
sl@0
|
1589 |
p->DoRmwTest(ix, ETrue, Min(avg_time_k_us,limit_us));
|
sl@0
|
1590 |
}
|
sl@0
|
1591 |
|
sl@0
|
1592 |
p->Finish();
|
sl@0
|
1593 |
delete p;
|
sl@0
|
1594 |
}
|
sl@0
|
1595 |
|
sl@0
|
1596 |
|
sl@0
|
1597 |
|
sl@0
|
1598 |
/******************************************************************************
|
sl@0
|
1599 |
* Main
|
sl@0
|
1600 |
******************************************************************************/
|
sl@0
|
1601 |
TInt E32Main()
|
sl@0
|
1602 |
{
|
sl@0
|
1603 |
test.Title();
|
sl@0
|
1604 |
test.Start(_L("Opening device driver"));
|
sl@0
|
1605 |
#ifdef __EPOC32__
|
sl@0
|
1606 |
TInt r;
|
sl@0
|
1607 |
r = User::LoadLogicalDevice(KAtomicTestLddName);
|
sl@0
|
1608 |
test(r==KErrNone||r==KErrAlreadyExists);
|
sl@0
|
1609 |
r = DD.Open();
|
sl@0
|
1610 |
test_KErrNone(r);
|
sl@0
|
1611 |
#endif
|
sl@0
|
1612 |
test.Next(_L("Testing atomic operations ..."));
|
sl@0
|
1613 |
test.Next(_L("Single thread, normal operation"));
|
sl@0
|
1614 |
TestSingleThread();
|
sl@0
|
1615 |
test.Next(_L("Single thread, bad addresses"));
|
sl@0
|
1616 |
TestInvalidAddresses();
|
sl@0
|
1617 |
test.Next(_L("Multiple threads"));
|
sl@0
|
1618 |
TestMultipleThreads();
|
sl@0
|
1619 |
test.End();
|
sl@0
|
1620 |
return 0;
|
sl@0
|
1621 |
}
|
sl@0
|
1622 |
|