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