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