33 #include <kernel/kernboot.h> |
33 #include <kernel/kernboot.h> |
34 #include <e32def_private.h> |
34 #include <e32def_private.h> |
35 #include <e32const_private.h> |
35 #include <e32const_private.h> |
36 #include <e32des8_private.h> |
36 #include <e32des8_private.h> |
37 #include <e32event_private.h> |
37 #include <e32event_private.h> |
38 #include <kernel/heap_hybrid.h> |
38 |
39 |
39 |
40 #ifndef __MINIMUM_MACHINE_CODE__ |
40 #ifndef __MINIMUM_MACHINE_CODE__ |
41 #ifdef __MARM__ |
41 #ifdef __MARM__ |
42 #ifndef __BIG_ENDIAN__ |
42 #ifndef __BIG_ENDIAN__ |
43 |
43 |
544 inline TTimer(); |
544 inline TTimer(); |
545 ~TTimer(); |
545 ~TTimer(); |
546 TInt After(TInt aInterval, TTickCallBack aFunction, TRequestStatus& aStatus); |
546 TInt After(TInt aInterval, TTickCallBack aFunction, TRequestStatus& aStatus); |
547 TInt At(const TTimeK& aTime, TSecondCallBack aFunction, TRequestStatus& aStatus); |
547 TInt At(const TTimeK& aTime, TSecondCallBack aFunction, TRequestStatus& aStatus); |
548 TInt AfterHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus); |
548 TInt AfterHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus); |
549 TInt AgainHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus); |
|
550 TInt Inactivity(TInt aSeconds, TInactivityCallBack aFunction, TRequestStatus& aStatus); |
549 TInt Inactivity(TInt aSeconds, TInactivityCallBack aFunction, TRequestStatus& aStatus); |
551 void Cancel(DThread* aThread); |
550 void Cancel(DThread* aThread); |
552 void Abort(DThread* aThread, TInt aTypeMask); |
551 void Abort(DThread* aThread, TInt aTypeMask); |
553 void SetType(TTimerType aType); |
552 void SetType(TTimerType aType); |
554 public: |
553 public: |
587 void Cancel(); |
586 void Cancel(); |
588 TInt After(TRequestStatus& aStatus, TInt aInterval); |
587 TInt After(TRequestStatus& aStatus, TInt aInterval); |
589 TInt At(TRequestStatus& aStatus, const TTimeK& aTime); |
588 TInt At(TRequestStatus& aStatus, const TTimeK& aTime); |
590 TInt Lock(TRequestStatus& aStatus, TTimerLockSpec aLock); |
589 TInt Lock(TRequestStatus& aStatus, TTimerLockSpec aLock); |
591 void HighRes(TRequestStatus& aStatus, TInt aInterval); |
590 void HighRes(TRequestStatus& aStatus, TInt aInterval); |
592 void AgainHighRes(TRequestStatus& aStatus, TInt aInterval); |
|
593 TInt Inactivity(TRequestStatus& aStatus, TInt aSeconds); |
591 TInt Inactivity(TRequestStatus& aStatus, TInt aSeconds); |
594 void Abort(TBool aAbortAbsolute); |
592 void Abort(TBool aAbortAbsolute); |
595 virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType); |
593 virtual TInt RequestUserHandle(DThread* aThread, TOwnerType aType); |
596 private: |
594 private: |
597 inline DThread* Owner(); |
595 inline DThread* Owner(); |
743 void SuspendPendingThread(DThread* aThread); |
741 void SuspendPendingThread(DThread* aThread); |
744 void RemovePendingThread(DThread* aThread); |
742 void RemovePendingThread(DThread* aThread); |
745 void ChangePendingThreadPriority(DThread* aThread, TInt aNewPriority); |
743 void ChangePendingThreadPriority(DThread* aThread, TInt aNewPriority); |
746 void WakeUpNextThread(); |
744 void WakeUpNextThread(); |
747 public: |
745 public: |
748 TInt Wait(TInt aTimeout=0); // 0 means wait forever, -1 means poll, n>0 means n nanokernel ticks |
746 TInt Wait(); |
749 void Signal(); |
747 void Signal(); |
750 void Reset(); |
748 void Reset(); |
751 public: |
749 public: |
752 TInt iHoldCount; // number of times held by current thread |
750 TInt iHoldCount; // number of times held by current thread |
753 TInt iWaitCount; // number of waiting threads |
751 TInt iWaitCount; // number of waiting threads |
1520 ETypeSecureId= 2, |
1518 ETypeSecureId= 2, |
1521 ETypeVendorId= 3, |
1519 ETypeVendorId= 3, |
1522 }; |
1520 }; |
1523 enum TMask |
1521 enum TMask |
1524 { |
1522 { |
1525 EMaskFail = TUint32 (ETypeFail) << KCSPBitsFree, |
1523 EMaskFail = ETypeFail << KCSPBitsFree, |
1526 EMaskCapsOnly = TUint32 (ETypeCapsOnly) << KCSPBitsFree, |
1524 EMaskCapsOnly = ETypeCapsOnly << KCSPBitsFree, |
1527 EMaskSecureId = TUint32 (ETypeSecureId) << KCSPBitsFree, |
1525 EMaskSecureId = ETypeSecureId << KCSPBitsFree, |
1528 EMaskVendorId = TUint32 (ETypeVendorId) << KCSPBitsFree, |
1526 EMaskVendorId = ETypeVendorId << KCSPBitsFree, |
1529 }; |
1527 }; |
1530 TInt Set(const TSecurityPolicy& aPolicy); |
1528 TInt Set(const TSecurityPolicy& aPolicy); |
1531 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
1529 #ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
1532 inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const |
1530 inline TBool CheckPolicy(DProcess* aProcess, const char* aDiagnostic=0) const |
1533 { |
1531 { |
2260 |
2258 |
2261 |
2259 |
2262 /******************************************** |
2260 /******************************************** |
2263 * Kernel heap |
2261 * Kernel heap |
2264 ********************************************/ |
2262 ********************************************/ |
2265 class RHeapK : public RHybridHeap |
2263 class RHeapK : public RHeap |
2266 { |
2264 { |
2267 public: |
2265 public: |
2268 static RHeapK* FixedHeap(TAny* aBase, TInt aMaxLength); |
2266 static RHeapK* FixedHeap(TAny* aBase, TInt aMaxLength); |
2269 TInt CreateMutex(); |
2267 TInt CreateMutex(); |
2270 void Mutate(TInt aOffset, TInt aMaxLength); |
2268 void Mutate(TInt aOffset, TInt aMaxLength); |
2278 inline TInt TotalAllocSize() const |
2276 inline TInt TotalAllocSize() const |
2279 { return iTotalAllocSize; } |
2277 { return iTotalAllocSize; } |
2280 static void CheckThreadState(); |
2278 static void CheckThreadState(); |
2281 static void Fault(TInt aFault); |
2279 static void Fault(TInt aFault); |
2282 inline TBool CheckForSimulatedAllocFail() |
2280 inline TBool CheckForSimulatedAllocFail() |
2283 { return RHybridHeap::CheckForSimulatedAllocFail(); } |
2281 { return RHeap::CheckForSimulatedAllocFail(); } |
2284 inline DMutex* Mutex() const; /**< @internalComponent */ |
2282 inline DMutex* Mutex() const; /**< @internalComponent */ |
2285 public: |
2283 public: |
2286 friend class Monitor; |
2284 friend class Monitor; |
2287 }; |
2285 }; |
|
2286 |
|
2287 inline void RHeap::Lock() const |
|
2288 { |
|
2289 DMutex* m = *(DMutex**)&iLock; |
|
2290 if (m) |
|
2291 Kern::MutexWait(*m); |
|
2292 } |
|
2293 |
|
2294 inline void RHeap::Unlock() const |
|
2295 { |
|
2296 DMutex* m = *(DMutex**)&iLock; |
|
2297 if (m) |
|
2298 Kern::MutexSignal(*m); |
|
2299 } |
2288 |
2300 |
2289 /** |
2301 /** |
2290 @internalComponent |
2302 @internalComponent |
2291 */ |
2303 */ |
2292 inline DMutex* RHeapK::Mutex() const |
2304 inline DMutex* RHeapK::Mutex() const |
2293 { return *(DMutex**)&iLock; } |
2305 { return *(DMutex**)&iLock; } |
|
2306 |
|
2307 inline TInt RHeap::SetBrk(TInt aBrk) |
|
2308 { |
|
2309 return ((DChunk*)iChunkHandle)->Adjust(aBrk); |
|
2310 } |
2294 |
2311 |
2295 enum TSecureClockStatusFlags |
2312 enum TSecureClockStatusFlags |
2296 { |
2313 { |
2297 ESecureClockPresent = 1, // signals a trusted time source has been found |
2314 ESecureClockPresent = 1, // signals a trusted time source has been found |
2298 ESecureClockOffsetPresent = 2, // signals nonsecure offset was read from HAL |
2315 ESecureClockOffsetPresent = 2, // signals nonsecure offset was read from HAL |