author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:50:07 +0300 | |
changeset 201 | 43365a9b78a3 |
parent 109 | b3a1d9898418 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\include\u32std.h |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
/** |
|
19 |
@file |
|
20 |
@internalComponent |
|
21 |
@released |
|
22 |
*/ |
|
23 |
||
24 |
#ifndef __U32STD_H__ |
|
25 |
#define __U32STD_H__ |
|
26 |
#include <e32cmn.h> |
|
27 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
28 |
#include <e32cmn_private.h> |
|
29 |
#endif |
|
30 |
#include <e32hal.h> |
|
31 |
#include <e32lmsg.h> |
|
32 |
#include <e32event.h> |
|
33 |
#include <e32ldr.h> |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
34 |
#include <e32ldr_private.h> |
0 | 35 |
#include <e32power.h> |
36 |
#include <e32shbufcmn.h> |
|
37 |
#include <e32property.h> |
|
38 |
#include <u32property.h> |
|
39 |
#include <u32hal.h> |
|
40 |
||
41 |
#include <cpudefs.h> |
|
42 |
||
43 |
#ifdef __MARM__ |
|
44 |
#define EKA2_ENTRY_POINT_VERSION_IDENTIFIER \ |
|
45 |
asm("tst pc, #%a0" : : "i" ((TInt)0) ) |
|
46 |
#endif |
|
47 |
||
48 |
struct TUnicodeDataSet; // forward declaration |
|
49 |
struct TCollationDataSet; // forward declaration |
|
50 |
||
51 |
/* |
|
52 |
The LCharSet structure is used in Unicode builds to supply locale-specific |
|
53 |
character attribute and collation data. |
|
54 |
||
55 |
The structure is defined in both builds to avoid having to have a dummy ExecHandler::GetLocaleCharSet function |
|
56 |
with a different signature in the 8-bit build. |
|
57 |
*/ |
|
58 |
struct LCharSet |
|
59 |
{ |
|
60 |
const TUnicodeDataSet* iCharDataSet; // if non-null, character data overriding standard Unicode data |
|
61 |
const TCollationDataSet* iCollationDataSet; // if non-null, locale-specific collation data |
|
62 |
}; |
|
63 |
||
64 |
extern const LCharSet* GetLocaleCharSet(); |
|
65 |
||
66 |
/** @internalTechnology */ |
|
67 |
const TInt KNumLocaleExports = 22; |
|
68 |
||
69 |
// |
|
70 |
// The bits in the type table (non-Unicode build only) |
|
71 |
// |
|
72 |
#ifndef _UNICODE |
|
73 |
||
74 |
/** @internalTechnology */ |
|
75 |
const TUint __U=0x01; // Uppercase letter |
|
76 |
||
77 |
/** @internalTechnology */ |
|
78 |
const TUint __L=0x02; // Lowercase letter |
|
79 |
||
80 |
/** @internalTechnology */ |
|
81 |
const TUint __D=0x04; // Decimal digit |
|
82 |
||
83 |
/** @internalTechnology */ |
|
84 |
const TUint __S=0x08; // Space |
|
85 |
||
86 |
/** @internalTechnology */ |
|
87 |
const TUint __P=0x10; // Punctuation |
|
88 |
||
89 |
/** @internalTechnology */ |
|
90 |
const TUint __C=0x20; // Control character |
|
91 |
||
92 |
/** @internalTechnology */ |
|
93 |
const TUint __X=0x40; // Hex digit |
|
94 |
||
95 |
/** @internalTechnology */ |
|
96 |
const TUint __B=0x80; // A blank character |
|
97 |
||
98 |
#endif |
|
99 |
||
100 |
// |
|
101 |
// Time set mode parameters for setting system time and offset |
|
102 |
// |
|
103 |
enum TTimeSetMode |
|
104 |
{ |
|
105 |
ETimeSetTime = 1, // set the time to the value given, else leave it unchanged |
|
106 |
ETimeSetOffset = 2, // set the offset to the value given, else leave it unchanged |
|
107 |
ETimeSetAllowTimeReversal = 4, // allow time to go backwards |
|
108 |
ETimeSetNoTimeUpdate = 8, // Don't restart second queue or notify changes - not valid with ESetTime, used early in boot only |
|
109 |
ETimeSetLocalTime = 16, // Set time in local time, instead of UTC |
|
110 |
ETimeSetSecure = 32, // use when setting the secure hardware clock |
|
111 |
}; |
|
112 |
||
113 |
// |
|
114 |
enum TMatchType {EMatchNormal,EMatchFolded,EMatchCollated}; |
|
115 |
||
116 |
// |
|
117 |
// Constants for descriptor implementation code |
|
118 |
// |
|
119 |
enum TDesType {EBufC,EPtrC,EPtr,EBuf,EBufCPtr}; |
|
120 |
const TUint KMaskDesLength=0xfffffff; |
|
121 |
const TInt KShiftDesType=28; |
|
122 |
||
123 |
// |
|
124 |
// Constants for iFlags in DProcess and DThread |
|
125 |
// |
|
126 |
const TUint KThreadFlagProcessCritical = 0x00000001; // thread panic panics process |
|
127 |
const TUint KThreadFlagProcessPermanent = 0x00000002; // thread exit of any kind causes process to exit (=main) |
|
128 |
const TUint KThreadFlagSystemCritical = 0x00000004; // thread panic reboots entire system |
|
129 |
const TUint KThreadFlagSystemPermanent = 0x00000008; // thread exit of any kind reboots entire system |
|
130 |
const TUint KThreadFlagOriginal = 0x00000010; |
|
131 |
const TUint KThreadFlagLastChance = 0x00000020; |
|
132 |
const TUint KThreadFlagRealtime = 0x00000040; // thread will be panicked when using some non-realtime functions |
|
133 |
const TUint KThreadFlagRealtimeTest = 0x00000080; // non-realtime functions only warn rather than panic |
|
134 |
const TUint KThreadFlagLocalThreadDataValid = 0x00000100; // thread has valid local thread data |
|
135 |
const TUint KProcessFlagPriorityControl = 0x40000000; |
|
136 |
const TUint KProcessFlagJustInTime = 0x80000000; |
|
137 |
const TUint KProcessFlagSystemCritical = KThreadFlagSystemCritical; // process panic reboots entire system |
|
138 |
const TUint KProcessFlagSystemPermanent = KThreadFlagSystemPermanent; // process exit of any kind reboots entire system |
|
139 |
// |
|
140 |
const TUint KThreadHandle=0x40000000; |
|
141 |
// |
|
142 |
struct SPtrC8 {TInt length;const TUint8 *ptr;}; |
|
143 |
struct SBufC8 {TInt length;TUint8 buf[1];}; |
|
144 |
struct SPtr8 {TInt length;TInt maxLength;TUint8 *ptr;}; |
|
145 |
struct SBuf8 {TInt length;TInt maxLength;TUint8 buf[1];}; |
|
146 |
struct SBufCPtr8 {TInt length;TInt maxLength;SBufC8 *ptr;}; |
|
147 |
||
148 |
struct SPtrC16 {TInt length;const TUint16 *ptr;}; |
|
149 |
struct SBufC16 {TInt length;TUint16 buf[1];}; |
|
150 |
struct SPtr16 {TInt length;TInt maxLength;TUint16 *ptr;}; |
|
151 |
struct SBuf16 {TInt length;TInt maxLength;TUint16 buf[1];}; |
|
152 |
struct SBufCPtr16 {TInt length;TInt maxLength;SBufC16 *ptr;}; |
|
153 |
||
154 |
// |
|
155 |
// Flags used for IPC copy functions |
|
156 |
// |
|
157 |
const TInt KChunkShiftBy0=0; |
|
158 |
const TInt KChunkShiftBy1=KMinTInt; |
|
159 |
const TInt KIpcDirRead=0; |
|
160 |
const TInt KIpcDirWrite=0x10000000; |
|
161 |
||
162 |
class TChunkCreate |
|
163 |
{ |
|
164 |
public: |
|
165 |
// Attributes for chunk creation that are used by both euser and the kernel |
|
166 |
// by classes TChunkCreateInfo and SChunkCreateInfo, respectively. |
|
167 |
enum TChunkCreateAtt |
|
168 |
{ |
|
169 |
ENormal = 0x00000000, |
|
170 |
EDoubleEnded = 0x00000001, |
|
171 |
EDisconnected = 0x00000002, |
|
172 |
ECache = 0x00000003, |
|
173 |
EMappingMask = 0x0000000f, |
|
174 |
ELocal = 0x00000000, |
|
175 |
EGlobal = 0x00000010, |
|
176 |
EData = 0x00000000, |
|
177 |
ECode = 0x00000020, |
|
178 |
EMemoryNotOwned = 0x00000040, |
|
179 |
||
180 |
// Force local chunk to be named. Only required for thread heap |
|
181 |
// chunks, all other local chunks should be nameless. |
|
182 |
ELocalNamed = 0x000000080, |
|
183 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
// Make global chunk read only to all processes but the controlling owner |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
EReadOnly = 0x000000100, |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
186 |
|
0 | 187 |
// Paging attributes for chunks. |
188 |
EPagingUnspec = 0x00000000, |
|
189 |
EPaged = 0x80000000, |
|
190 |
EUnpaged = 0x40000000, |
|
191 |
EPagingMask = EPaged | EUnpaged, |
|
192 |
||
193 |
EChunkCreateAttMask = EMappingMask | EGlobal | ECode | |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
ELocalNamed | EReadOnly | EPagingMask, |
0 | 195 |
}; |
196 |
public: |
|
197 |
TUint iAtt; |
|
198 |
TBool iForceFixed; |
|
199 |
TInt iInitialBottom; |
|
200 |
TInt iInitialTop; |
|
201 |
TInt iMaxSize; |
|
202 |
TUint8 iClearByte; |
|
203 |
}; |
|
204 |
||
205 |
enum TChunkRestrictions |
|
206 |
{ |
|
207 |
// Keep this in sync with definitions in RChunk |
|
208 |
EChunkPreventAdjust = 0x01, // Disallow Adjust, Commit, Allocate and Decommit |
|
209 |
}; |
|
210 |
||
211 |
class TChannelDoCreate |
|
212 |
{ |
|
213 |
public: |
|
214 |
TVersion iVer; |
|
215 |
const TDesC *iName; |
|
216 |
const TDesC *iPhysicalDevice; |
|
217 |
const TDesC8 *iInfo; |
|
218 |
}; |
|
219 |
||
220 |
class TCreateSession |
|
221 |
{ |
|
222 |
public: |
|
223 |
TVersion iVer; |
|
224 |
TInt iMessageSlots; |
|
225 |
}; |
|
226 |
||
227 |
enum TObjectType |
|
228 |
{ |
|
229 |
EThread=0, |
|
230 |
EProcess, |
|
231 |
EChunk, |
|
232 |
ELibrary, |
|
233 |
ESemaphore, |
|
234 |
EMutex, |
|
235 |
ETimer, |
|
236 |
EServer, |
|
237 |
ESession, |
|
238 |
ELogicalDevice, |
|
239 |
EPhysicalDevice, |
|
240 |
ELogicalChannel, |
|
241 |
EChangeNotifier, |
|
242 |
EUndertaker, |
|
243 |
EMsgQueue, |
|
244 |
EPropertyRef, |
|
245 |
ECondVar, |
|
246 |
EShPool, |
|
247 |
EShBuf, |
|
248 |
ENumObjectTypes, // number of DObject-derived types |
|
249 |
EObjectTypeAny=-1, |
|
250 |
||
251 |
EIpcMessageD=0x20, // lookup IPC message handle, allow disconnect |
|
252 |
EIpcMessage=0x21, // lookup IPC message handle, don't allow disconnect |
|
253 |
EIpcClient=0x22, // lookup IPC message client, don't allow disconnect |
|
254 |
}; |
|
255 |
||
256 |
class TObjectOpenInfo |
|
257 |
{ |
|
258 |
public: |
|
259 |
TObjectType iObjType; |
|
260 |
TBool isReadOnly; |
|
261 |
}; |
|
262 |
||
263 |
class TChannelCreateInfo |
|
264 |
{ |
|
265 |
public: |
|
266 |
TVersion iVersion; |
|
267 |
TInt iUnit; |
|
268 |
const TDesC* iPhysicalDevice; |
|
269 |
const TDesC8* iInfo; |
|
270 |
}; |
|
271 |
||
272 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__) |
|
273 |
class TChannelCreateInfo8 |
|
274 |
{ |
|
275 |
public: |
|
276 |
TVersion iVersion; |
|
277 |
TInt iUnit; |
|
278 |
const TDesC8* iPhysicalDevice; |
|
279 |
const TDesC8* iInfo; |
|
280 |
}; |
|
281 |
#else |
|
282 |
typedef TChannelCreateInfo TChannelCreateInfo8; |
|
283 |
#endif |
|
284 |
||
285 |
const TInt KMaxThreadCreateInfo = 256; |
|
286 |
struct SThreadCreateInfo |
|
287 |
{ |
|
288 |
TAny* iHandle; |
|
289 |
TInt iType; |
|
290 |
TThreadFunction iFunction; |
|
291 |
TAny* iPtr; |
|
292 |
TAny* iSupervisorStack; |
|
293 |
TInt iSupervisorStackSize; |
|
294 |
TAny* iUserStack; |
|
295 |
TInt iUserStackSize; |
|
296 |
TInt iInitialThreadPriority; |
|
297 |
TPtrC iName; |
|
298 |
TInt iTotalSize; // Size including any extras (must be a multiple of 8 bytes) |
|
299 |
}; |
|
300 |
||
301 |
enum TThreadCreationFlags |
|
302 |
{ |
|
303 |
ETraceHeapAllocs = 0x00000001, |
|
304 |
EMonitorHeapMemory = 0x00000002, |
|
305 |
||
306 |
EThreadCreateFlagPaged = 0x00000004, |
|
307 |
EThreadCreateFlagUnpaged = 0x00000008, |
|
308 |
EThreadCreateFlagPagingUnspec = 0x00000000, |
|
309 |
EThreadCreateFlagPagingMask = EThreadCreateFlagPaged | EThreadCreateFlagUnpaged, |
|
310 |
||
311 |
EThreadCreateFlagMask = ETraceHeapAllocs | EMonitorHeapMemory | EThreadCreateFlagPagingMask, |
|
312 |
}; |
|
313 |
||
314 |
struct SStdEpocThreadCreateInfo : public SThreadCreateInfo |
|
315 |
{ |
|
316 |
SStdEpocThreadCreateInfo() |
|
317 |
: iFlags(0) // Must be clear on creation. |
|
318 |
{ |
|
319 |
}; |
|
320 |
RAllocator* iAllocator; |
|
321 |
TInt iHeapInitialSize; |
|
322 |
TInt iHeapMaxSize; |
|
323 |
TUint iFlags; |
|
324 |
}; |
|
325 |
||
326 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__) |
|
327 |
struct SThreadCreateInfo8 |
|
328 |
{ |
|
329 |
TAny* iHandle; |
|
330 |
TInt iType; |
|
331 |
TThreadFunction iFunction; |
|
332 |
TAny* iPtr; |
|
333 |
TAny* iSupervisorStack; |
|
334 |
TInt iSupervisorStackSize; |
|
335 |
TAny* iUserStack; |
|
336 |
TInt iUserStackSize; |
|
337 |
TInt iInitialThreadPriority; |
|
338 |
TPtrC8 iName; |
|
339 |
TInt iTotalSize; // size including any extras |
|
340 |
}; |
|
341 |
||
342 |
struct SStdEpocThreadCreateInfo8 : public SThreadCreateInfo8 |
|
343 |
{ |
|
344 |
SStdEpocThreadCreateInfo8() |
|
345 |
: iFlags(0) // Must be clear on creation. |
|
346 |
{ |
|
347 |
}; |
|
348 |
RAllocator* iAllocator; |
|
349 |
TInt iHeapInitialSize; |
|
350 |
TInt iHeapMaxSize; |
|
351 |
TUint iFlags; |
|
352 |
}; |
|
353 |
#else |
|
354 |
typedef SThreadCreateInfo SThreadCreateInfo8; |
|
355 |
typedef SStdEpocThreadCreateInfo SStdEpocThreadCreateInfo8; |
|
356 |
#endif |
|
357 |
||
358 |
struct SIpcCopyInfo |
|
359 |
{ |
|
360 |
TUint8* iLocalPtr; |
|
361 |
TInt iLocalLen; |
|
362 |
TInt iFlags; |
|
363 |
}; |
|
364 |
||
365 |
enum TChunkAdjust |
|
366 |
{ |
|
367 |
EChunkAdjust=0, |
|
368 |
EChunkAdjustDoubleEnded=1, |
|
369 |
EChunkCommit=2, |
|
370 |
EChunkDecommit=3, |
|
371 |
EChunkAllocate=4, |
|
372 |
EChunkUnlock=5, |
|
373 |
EChunkLock=6 |
|
374 |
}; |
|
375 |
||
376 |
enum TMemModelAttributes |
|
377 |
{ |
|
378 |
EMemModelTypeMask=0xf, // bottom 4 bits give type of memory model |
|
379 |
EMemModelTypeDirect=0, // direct memory model on hardware |
|
380 |
EMemModelTypeMoving=1, // moving memory model on hardware |
|
381 |
EMemModelTypeMultiple=2, // multiple memory model on hardware |
|
382 |
EMemModelTypeEmul=3, // emulation using single host process |
|
383 |
EMemModelTypeFlexible=4, // flexible memory model on hardware |
|
384 |
||
385 |
EMemModelAttrRomPaging=0x10, // Demand paging of XIP ROM |
|
386 |
EMemModelAttrCodePaging=0x20, // Demand paging of RAM loaded code |
|
387 |
EMemModelAttrDataPaging=0x40, // Demand paging of all RAM |
|
388 |
EMemModelAttrPagingMask=0xf0, // Mask for demand paging attributes |
|
389 |
||
390 |
EMemModelAttrNonExProt=(TInt)0x80000000,// accesses to nonexistent addresses are trapped |
|
391 |
EMemModelAttrKernProt=0x40000000, // accesses to kernel memory from user mode are trapped |
|
392 |
EMemModelAttrWriteProt=0x20000000, // addresses can be marked as read-only; writes to these are trapped |
|
393 |
EMemModelAttrVA=0x10000000, // system supports virtual addresses |
|
394 |
EMemModelAttrProcessProt=0x08000000, // accesses to other processes' memory are trapped |
|
395 |
EMemModelAttrSameVA=0x04000000, // different processes map the same virtual address to different physical addresses |
|
396 |
EMemModelAttrSupportFixed=0x02000000, // 'fixed' processes are supported |
|
397 |
EMemModelAttrSvKernProt=0x01000000, // unexpected accesses to kernel memory within an executive call are trapped |
|
398 |
EMemModelAttrIPCKernProt=0x00800000, // accesses to kernel memory via IPC are trapped |
|
399 |
EMemModelAttrIPCFullProt=0x00400000, // accesses via IPC have same protection as user mode |
|
400 |
EMemModelAttrRamCodeProt=0x00200000, // RAM-loaded code is only visible to processes which have loaded it |
|
401 |
}; |
|
402 |
||
403 |
/** @test */ |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
33
diff
changeset
|
404 |
enum TKernelHeapDebugFunction {EDbgMarkStart,EDbgMarkCheck,EDbgMarkEnd,EDbgSetAllocFail,EDbgSetBurstAllocFail,EDbgCheckFailure,EDbgGetAllocFail}; |
0 | 405 |
|
406 |
/** @test */ |
|
407 |
class TKernelHeapMarkCheckInfo |
|
408 |
{ |
|
409 |
public: |
|
410 |
TBool iCountAll; |
|
411 |
const TDesC8* iFileName; |
|
412 |
TInt iLineNum; |
|
413 |
}; |
|
414 |
// |
|
415 |
class TTrapHandler; |
|
416 |
class CActiveScheduler; |
|
417 |
class TLocale; |
|
418 |
||
419 |
// |
|
420 |
// |
|
421 |
// |
|
422 |
// Handler below is used by test prints to trucate rather than panic the caller. |
|
423 |
// |
|
424 |
#if defined(_UNICODE) && !defined(__KERNEL_MODE__) |
|
425 |
NONSHARABLE_CLASS(TestOverflowTruncate) : public TDes16Overflow |
|
426 |
{ |
|
427 |
public: |
|
428 |
virtual void Overflow(TDes16 &aDes); |
|
429 |
}; |
|
430 |
#else |
|
431 |
NONSHARABLE_CLASS(TestOverflowTruncate) : public TDes8Overflow |
|
432 |
{ |
|
433 |
public: |
|
434 |
virtual void Overflow(TDes8 &aDes); |
|
435 |
}; |
|
436 |
#endif |
|
437 |
// |
|
438 |
||
439 |
/******************************************** |
|
440 |
* Thread local storage entry |
|
441 |
********************************************/ |
|
442 |
struct STls |
|
443 |
{ |
|
444 |
TInt iHandle; |
|
445 |
TInt iDllUid; |
|
446 |
TAny* iPtr; |
|
447 |
}; |
|
448 |
||
449 |
const TInt KDllUid_Default = 0; // for ROM DLLs and direct calls to UserSvr::DllTls |
|
450 |
const TInt KDllUid_Special = -1; // used on emulator to instruct the kernel to get the DLL UID from the module handle |
|
451 |
||
452 |
/******************************************** |
|
453 |
* Entry point call values |
|
454 |
********************************************/ |
|
455 |
const TInt KModuleEntryReasonProcessInit =0; // Process start |
|
456 |
const TInt KModuleEntryReasonThreadInit =1; // Start new thread |
|
457 |
const TInt KModuleEntryReasonProcessAttach =2; // Process attach (init static data) |
|
458 |
const TInt KModuleEntryReasonProcessDetach =3; // Process detach (destroy static data) |
|
459 |
const TInt KModuleEntryReasonException =4; // Handle exception |
|
460 |
const TInt KModuleEntryReasonVariantInit0 =-3; // Call variant static constructors |
|
461 |
||
462 |
/** @publishedPartner |
|
463 |
@released |
|
464 |
*/ |
|
465 |
const TInt KModuleEntryReasonExtensionInit0 =-2; // Extension early initialisation check |
|
466 |
||
467 |
/** @publishedPartner |
|
468 |
@released |
|
469 |
*/ |
|
470 |
const TInt KModuleEntryReasonExtensionInit1 =-1; // Extension initialisation |
|
471 |
||
472 |
/** |
|
473 |
Flags returned by Exec::KernelConfigFlags() |
|
474 |
*/ |
|
475 |
enum TKernelConfigFlags |
|
476 |
{ |
|
477 |
EKernelConfigIpcV1Available = 1<<0, |
|
478 |
EKernelConfigPlatSecEnforcement = 1<<1, |
|
479 |
EKernelConfigPlatSecDiagnostics = 1<<2, |
|
480 |
EKernelConfigPlatSecProcessIsolation = 1<<3, |
|
481 |
EKernelConfigPlatSecEnforceSysBin = 1<<4, |
|
482 |
||
483 |
// paging policy values use by 2-bit code and data paging policy enums... |
|
484 |
EKernelConfigPagingPolicyNoPaging = 0, |
|
485 |
EKernelConfigPagingPolicyAlwaysPage = 1, |
|
486 |
EKernelConfigPagingPolicyDefaultUnpaged = 2, |
|
487 |
EKernelConfigPagingPolicyDefaultPaged = 3, |
|
488 |
||
489 |
EKernelConfigCodePagingPolicyShift = 5, |
|
490 |
EKernelConfigCodePagingPolicyMask = 3<<5, |
|
491 |
EKernelConfigCodePagingPolicyNoPaging = EKernelConfigPagingPolicyNoPaging<<5, |
|
492 |
EKernelConfigCodePagingPolicyAlwaysPage = EKernelConfigPagingPolicyAlwaysPage<<5, |
|
493 |
EKernelConfigCodePagingPolicyDefaultUnpaged = EKernelConfigPagingPolicyDefaultUnpaged<<5, |
|
494 |
EKernelConfigCodePagingPolicyDefaultPaged = EKernelConfigPagingPolicyDefaultPaged<<5, |
|
495 |
||
496 |
EKernelConfigPlatSecLocked = 1<<7, // Primarily used by __PLATSEC_UNLOCKED__ (q.v.) test code |
|
497 |
||
498 |
EKernelConfigCrazyScheduling = 1<<8, // Enables thread priority/timeslice craziness |
|
499 |
||
500 |
EKernelConfigDataPagingPolicyShift = 9, |
|
501 |
EKernelConfigDataPagingPolicyMask = 3<<9, |
|
502 |
EKernelConfigDataPagingPolicyNoPaging = EKernelConfigPagingPolicyNoPaging<<9, |
|
503 |
EKernelConfigDataPagingPolicyAlwaysPage = EKernelConfigPagingPolicyAlwaysPage<<9, |
|
504 |
EKernelConfigDataPagingPolicyDefaultUnpaged = EKernelConfigPagingPolicyDefaultUnpaged<<9, |
|
505 |
EKernelConfigDataPagingPolicyDefaultPaged = EKernelConfigPagingPolicyDefaultPaged<<9, |
|
506 |
||
507 |
EKernelConfigSMPUnsafeCompat = 1<<12, // Enables compatibility mode for SMP-unsafe processes |
|
508 |
EKernelConfigSMPUnsafeCPU0 = 1<<13, // Slow compatibility mode: all SMP-unsafe processes run on CPU 0 only |
|
509 |
EKernelConfigSMPCrazyInterrupts = 1<<14, // Enables CPU target rotation for HW Interrupts. |
|
510 |
||
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
511 |
EKernelConfigSMPLockKernelThreadsCore0 = 1<< 15, // locks all kernel side threads to CPU 0 |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
512 |
|
0 | 513 |
EKernelConfigDisableAPs = 1u<<30, |
514 |
||
515 |
EKernelConfigTest = 1u<<31, // Only used by test code for __PLATSEC_UNLOCKED__ |
|
516 |
}; |
|
517 |
||
518 |
/** |
|
519 |
If __PLATSEC_UNLOCKED__ is not defined, these flags must always |
|
520 |
be considered to be set. See KernelConfigFlags() in kern_priv.h. |
|
521 |
||
522 |
@see KernelConfigFlags() |
|
523 |
||
524 |
@internalTechnology |
|
525 |
*/ |
|
526 |
#ifdef __PLATSEC_UNLOCKED__ |
|
527 |
#define __PLATSEC_FORCED_FLAGS__ 0 |
|
528 |
#else |
|
529 |
#define __PLATSEC_FORCED_FLAGS__ (EKernelConfigPlatSecEnforcement|EKernelConfigPlatSecProcessIsolation|EKernelConfigPlatSecEnforceSysBin) |
|
530 |
#endif |
|
531 |
||
532 |
/** |
|
533 |
@internalTechnology |
|
534 |
*/ |
|
535 |
enum TGlobalUserData |
|
536 |
{ |
|
537 |
ELocaleDefaultCharSet, |
|
538 |
ELocalePreferredCharSet, |
|
539 |
EMaxGlobalUserData |
|
540 |
}; |
|
541 |
||
542 |
typedef void (*TGlobalDestructorFunc)(void); |
|
543 |
||
544 |
// This must not conflict with any possible valid TLS keys |
|
545 |
const TInt KGlobalDestructorTlsKey = -1; |
|
546 |
||
547 |
GLREF_C void ExitCurrentThread(TExitType, TInt, const TDesC8*); |
|
548 |
||
549 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTICS__ |
|
550 |
/** |
|
551 |
@internalTechnology |
|
552 |
*/ |
|
553 |
class TPlatSecDiagnostic |
|
554 |
{ |
|
555 |
public: |
|
556 |
enum TType |
|
557 |
{ |
|
558 |
ELoaderCapabilityViolation1, |
|
559 |
ELoaderCapabilityViolation2, |
|
560 |
EThreadCapabilityCheckFail, |
|
561 |
EProcessCapabilityCheckFail, |
|
562 |
EKernelSecureIdCheckFail, |
|
563 |
EKernelObjectPolicyCheckFail, |
|
564 |
EHandleCapabilityCheckFail, |
|
565 |
ECreatorCapabilityCheckFail, |
|
566 |
EMessageCapabilityCheckFail, |
|
567 |
EKernelProcessIsolationFail, |
|
568 |
EKernelProcessIsolationIPCFail, |
|
569 |
ECreatorPolicyCheckFail, |
|
570 |
}; |
|
571 |
public: |
|
572 |
inline TPlatSecDiagnostic(); |
|
573 |
inline TPlatSecDiagnostic(TType aType); |
|
574 |
inline TPlatSecDiagnostic(TType aType, TInt aInt1, TInt aInt2, const SCapabilitySet& aCaps); |
|
575 |
inline TPlatSecDiagnostic(TType aType, TInt aInt1, const SSecurityInfo& aCaps); |
|
576 |
inline TPlatSecDiagnostic(TType aType, TInt aInt, const TDesC8& aString, const SCapabilitySet& aCaps); |
|
577 |
inline TPlatSecDiagnostic(TType aType, const TDesC8& aString1, const TDesC8& aString2, const SCapabilitySet& aCaps); |
|
578 |
inline TPlatSecDiagnostic(TType aType, TInt aInt1, TInt aInt2); |
|
579 |
inline TPlatSecDiagnostic(TType aType, TInt aInt1); |
|
580 |
inline const TDesC8* String1(); |
|
581 |
inline const TDesC8* String2(); |
|
582 |
public: |
|
583 |
TType iType; |
|
584 |
TInt iArg1; |
|
585 |
TInt iArg2; |
|
586 |
const char* iContextText; |
|
587 |
TInt iContextTextLength; |
|
588 |
SSecurityInfo iSecurityInfo; |
|
589 |
}; |
|
590 |
||
591 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic() |
|
592 |
{} |
|
593 |
||
594 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic(TType aType) |
|
595 |
: iType(aType) |
|
596 |
{} |
|
597 |
||
598 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic(TType aType,TInt aInt1) |
|
599 |
: iType(aType), iArg1(aInt1) |
|
600 |
{} |
|
601 |
||
602 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic(TType aType, TInt aInt1, TInt aInt2, const SCapabilitySet& aCaps) |
|
603 |
: iType(aType), iArg1(aInt1), iArg2(aInt2), iContextText(0) |
|
604 |
{ |
|
605 |
iSecurityInfo.iSecureId = 0; |
|
606 |
iSecurityInfo.iVendorId = 0; |
|
607 |
iSecurityInfo.iCaps = aCaps; |
|
608 |
}; |
|
609 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic(TType aType, TInt aInt1, const SSecurityInfo& aInfo) |
|
610 |
: iType(aType), iArg1(aInt1), iArg2(ECapability_None), iContextText(0), iSecurityInfo(aInfo) |
|
611 |
{ |
|
612 |
}; |
|
613 |
||
614 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic(TType aType, TInt aInt, const TDesC8& aString, const SCapabilitySet& aCaps) |
|
615 |
: iType(aType), iArg1(aInt), iArg2((TInt)&aString), iContextText(0) |
|
616 |
{ |
|
617 |
iSecurityInfo.iSecureId = 0; |
|
618 |
iSecurityInfo.iVendorId = 0; |
|
619 |
iSecurityInfo.iCaps = aCaps; |
|
620 |
}; |
|
621 |
||
622 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic(TType aType, const TDesC8& aString1, const TDesC8& aString2, const SCapabilitySet& aCaps) |
|
623 |
: iType(aType), iArg1((TInt)&aString1), iArg2((TInt)&aString2), iContextText(0) |
|
624 |
{ |
|
625 |
iSecurityInfo.iSecureId = 0; |
|
626 |
iSecurityInfo.iVendorId = 0; |
|
627 |
iSecurityInfo.iCaps = aCaps; |
|
628 |
}; |
|
629 |
||
630 |
inline TPlatSecDiagnostic::TPlatSecDiagnostic(TType aType, TInt aInt1, TInt aInt2) |
|
631 |
: iType(aType), iArg1(aInt1), iArg2(aInt2) |
|
632 |
{ |
|
633 |
iSecurityInfo.iSecureId = 0; |
|
634 |
iSecurityInfo.iVendorId = 0; |
|
635 |
iSecurityInfo.iCaps[0] = 0; |
|
636 |
iSecurityInfo.iCaps[1] = 0; |
|
637 |
}; |
|
638 |
||
639 |
inline const TDesC8* TPlatSecDiagnostic::String1() |
|
640 |
{ return (const TDesC8*)iArg1; } |
|
641 |
||
642 |
inline const TDesC8* TPlatSecDiagnostic::String2() |
|
643 |
{ return (const TDesC8*)iArg2; } |
|
644 |
||
645 |
inline TInt PlatSec::LoaderCapabilityViolation(const TDesC8& aImporterName, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps) |
|
646 |
{ |
|
647 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::ELoaderCapabilityViolation2,aImporterName,aFileName,aMissingCaps); |
|
648 |
return EmitDiagnostic(d, NULL); |
|
649 |
} |
|
650 |
||
651 |
#ifdef __KERNEL_MODE__ |
|
652 |
||
653 |
inline TInt PlatSec::CapabilityCheckFail(const DProcess* aViolatingProcess, TCapability aCapability, const char* aContextText) |
|
654 |
{ |
|
655 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EProcessCapabilityCheckFail,(TInt)aViolatingProcess,(TInt)aCapability); |
|
656 |
return EmitDiagnostic(d,aContextText); |
|
657 |
} |
|
658 |
||
659 |
inline TInt PlatSec::CapabilityCheckFail(const DThread* aViolatingThread, TCapability aCapability, const char* aContextText) |
|
660 |
{ |
|
661 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EThreadCapabilityCheckFail,(TInt)aViolatingThread,(TInt)aCapability); |
|
662 |
return EmitDiagnostic(d,aContextText); |
|
663 |
} |
|
664 |
||
665 |
inline TInt PlatSec::SecureIdCheckFail(const DProcess* aViolatingProcess, TSecureId aSid, const char* aContextText) |
|
666 |
{ |
|
667 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EKernelSecureIdCheckFail,(TInt)aViolatingProcess,(TInt)aSid); |
|
668 |
return EmitDiagnostic(d,aContextText); |
|
669 |
} |
|
670 |
||
671 |
inline TInt PlatSec::PolicyCheckFail(const DProcess* aProcess, const SSecurityInfo& aMissingSecurityInfo, const char* aContextText) |
|
672 |
{ |
|
673 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EKernelObjectPolicyCheckFail,(TInt)aProcess,(const SSecurityInfo&)aMissingSecurityInfo); |
|
674 |
return EmitDiagnostic(d,aContextText); |
|
675 |
} |
|
676 |
||
677 |
inline TInt PlatSec::PolicyCheckFail(const DThread* aThread, const SSecurityInfo& aMissingSecurityInfo, const char* aContextText) |
|
678 |
{ |
|
679 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EKernelObjectPolicyCheckFail,(TInt)aThread,(const SSecurityInfo&)aMissingSecurityInfo); |
|
680 |
return EmitDiagnostic(d,aContextText); |
|
681 |
} |
|
682 |
||
683 |
inline TInt PlatSec::ProcessIsolationFail(const char* aContextText) |
|
684 |
{ |
|
685 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EKernelProcessIsolationFail); |
|
686 |
return EmitDiagnostic(d,aContextText); |
|
687 |
} |
|
688 |
||
689 |
inline TInt PlatSec::ProcessIsolationIPCFail(RMessageK* aMessage, const char* aContextText) |
|
690 |
{ |
|
691 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EKernelProcessIsolationIPCFail,(TInt)aMessage); |
|
692 |
return EmitDiagnostic(d,aContextText); |
|
693 |
} |
|
694 |
||
695 |
#else // !__KERNEL_MODE__ |
|
696 |
||
697 |
inline TInt PlatSec::LoaderCapabilityViolation(RProcess aLoadingProcess, const TDesC8& aFileName, const SCapabilitySet& aMissingCaps) |
|
698 |
{ |
|
699 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::ELoaderCapabilityViolation1,aLoadingProcess.Handle(),aFileName,aMissingCaps); |
|
700 |
return EmitDiagnostic(d, NULL); |
|
701 |
} |
|
702 |
||
703 |
inline TInt PlatSec::CreatorCapabilityCheckFail(TCapability aCapability, const char* aContextText) |
|
704 |
{ |
|
705 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::ECreatorCapabilityCheckFail,(TInt)0,aCapability); |
|
706 |
return EmitDiagnostic(d,aContextText); |
|
707 |
} |
|
708 |
||
709 |
inline TInt PlatSec::CreatorCapabilityCheckFail(const TCapabilitySet& aMissingCaps, const char* aContextText) |
|
710 |
{ |
|
711 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::ECreatorCapabilityCheckFail,(TInt)0,ECapability_None,(const SCapabilitySet&)aMissingCaps); |
|
712 |
return EmitDiagnostic(d,aContextText); |
|
713 |
} |
|
714 |
||
715 |
inline TInt PlatSec::CapabilityCheckFail(TInt aHandle, TCapability aCapability, const char* aContextText) |
|
716 |
{ |
|
717 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EHandleCapabilityCheckFail,aHandle,aCapability); |
|
718 |
return EmitDiagnostic(d,aContextText); |
|
719 |
} |
|
720 |
||
721 |
inline TInt PlatSec::CapabilityCheckFail(TInt aHandle, const TCapabilitySet& aMissingCaps, const char* aContextText) |
|
722 |
{ |
|
723 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EHandleCapabilityCheckFail,aHandle,ECapability_None,(const SCapabilitySet&)aMissingCaps); |
|
724 |
return EmitDiagnostic(d,aContextText); |
|
725 |
} |
|
726 |
||
727 |
inline TInt PlatSec::PolicyCheckFail(TInt aHandle, const SSecurityInfo& aMissingSecurityInfo, const char* aContextText) |
|
728 |
{ |
|
729 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EHandleCapabilityCheckFail,aHandle,(const SSecurityInfo&)aMissingSecurityInfo); |
|
730 |
return EmitDiagnostic(d,aContextText); |
|
731 |
} |
|
732 |
||
733 |
inline TInt PlatSec::CapabilityCheckFail(RMessagePtr2 aMessage, TCapability aCapability, const char* aContextText) |
|
734 |
{ |
|
735 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EMessageCapabilityCheckFail,(TInt)aMessage.Handle(),aCapability); |
|
736 |
return EmitDiagnostic(d,aContextText); |
|
737 |
} |
|
738 |
||
739 |
inline TInt PlatSec::CapabilityCheckFail(RMessagePtr2 aMessage, const TCapabilitySet& aMissingCaps, const char* aContextText) |
|
740 |
{ |
|
741 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EMessageCapabilityCheckFail,(TInt)aMessage.Handle(),ECapability_None,(const SCapabilitySet&)aMissingCaps); |
|
742 |
return EmitDiagnostic(d,aContextText); |
|
743 |
} |
|
744 |
||
745 |
inline TInt PlatSec::PolicyCheckFail(RMessagePtr2 aMessage, const SSecurityInfo& aMissing, const char* aContextText) |
|
746 |
{ |
|
747 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::EMessageCapabilityCheckFail,(TInt)aMessage.Handle(),(const SSecurityInfo&)aMissing); |
|
748 |
return EmitDiagnostic(d,aContextText); |
|
749 |
} |
|
750 |
||
751 |
inline TInt PlatSec::CreatorPolicyCheckFail(const SSecurityInfo& aMissing, const char* aContextText) |
|
752 |
{ |
|
753 |
TPlatSecDiagnostic d(TPlatSecDiagnostic::ECreatorPolicyCheckFail,(TInt)0,(const SSecurityInfo&)aMissing); |
|
754 |
return EmitDiagnostic(d,aContextText); |
|
755 |
} |
|
756 |
||
757 |
#endif //__KERNEL_MODE__ |
|
758 |
#endif // !__REMOVE_PLATSEC_DIAGNOSTICS__ |
|
759 |
||
760 |
const TInt KTlsArrayGranularity=2; |
|
761 |
||
762 |
#ifdef __CPU_HAS_CP15_THREAD_ID_REG |
|
763 |
||
764 |
#define __USERSIDE_THREAD_DATA__ |
|
765 |
||
766 |
class TLocalThreadData |
|
767 |
{ |
|
768 |
public: |
|
769 |
void Close(); |
|
770 |
#ifndef __KERNEL_MODE__ |
|
771 |
TAny* DllTls(TInt aHandle, TInt aDllUid); |
|
772 |
TInt DllSetTls(TInt aHandle, TInt aDllUid, TAny* aPtr); |
|
773 |
void DllFreeTls(TInt aHandle); |
|
774 |
#endif |
|
775 |
public: |
|
776 |
RAllocator* iHeap; ///< The thread's current heap |
|
777 |
CActiveScheduler* iScheduler; ///< The thread's current active scheduler |
|
778 |
TTrapHandler* iTrapHandler; ///< The thread's current trap handler |
|
779 |
private: |
|
780 |
RAllocator* iTlsHeap; ///< The heap that the DLL TLS data is stored on |
|
781 |
RArray<STls> iTls; ///< DLL TLS data |
|
782 |
}; |
|
783 |
||
784 |
const TInt KLocalThreadDataSize = _ALIGN_UP(sizeof(TLocalThreadData), 8); |
|
785 |
||
786 |
#endif |
|
787 |
||
788 |
#ifdef __WINS__ |
|
789 |
||
790 |
enum TWin32RuntimeReason |
|
791 |
{ |
|
792 |
// Same values as passed to DllMain |
|
793 |
EWin32RuntimeProcessAttach = 1, |
|
794 |
EWin32RuntimeThreadAttach = 2, |
|
795 |
EWin32RuntimeThreadDetach = 3, |
|
796 |
EWin32RuntimeProcessDetach = 4, |
|
797 |
}; |
|
798 |
||
799 |
typedef TBool (*TWin32RuntimeHook)(TWin32RuntimeReason); |
|
800 |
||
801 |
#endif |
|
802 |
||
803 |
struct SAtomicOpInfo64 |
|
804 |
{ |
|
805 |
TAny* iA; |
|
806 |
TAny* iQ; |
|
807 |
TUint64 i1; |
|
808 |
TUint64 i2; |
|
809 |
TUint64 i3; |
|
810 |
}; |
|
811 |
||
812 |
struct SAtomicOpInfo32 |
|
813 |
{ |
|
814 |
TAny* iA; |
|
815 |
union |
|
816 |
{ |
|
817 |
TAny* iQ; |
|
818 |
TUint32 i0; |
|
819 |
}; |
|
820 |
TUint32 i1; |
|
821 |
TUint32 i2; |
|
822 |
}; |
|
823 |
||
824 |
#endif //__U32STD_H__ |