First public contribution.
1 // Copyright (c) 1999-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\loader\t_ldrtst.h
18 #ifndef __T_LDRTST_H__
19 #define __T_LDRTST_H__
21 #define __INCLUDE_DEPENDENCY_GRAPH
40 TModuleSet(const TModuleList&, TInt aMask, TInt aVal);
41 void Add(TInt aModule);
42 void Remove(TInt aModule);
43 void Remove(const TModuleList&);
44 void Display(const TDesC& aTitle) const;
45 inline TBool Present(TInt aModule) const
46 { return iBitMap[aModule>>3]&(1<<(aModule&7)); }
49 TUint8 iBitMap[(KNumModules+7)/8];
57 void Display(const TDesC& aTitle) const;
58 TBool IsPresent(TInt aModNum) const;
59 TInt Find(TInt aModNum) const;
60 void Add(const SDllInfo& a);
63 SDllInfo iInfo[KNumModules];
69 static LoaderTest* New();
74 void TestMultipleExeInstances();
76 void TestMultipleLoads();
78 TBool IsRomAddress(TLinAddr a);
79 TBool IsRamCodeAddress(TLinAddr a);
80 TBool CheckDataAddress(TLinAddr a, TInt aDllNum, TInt aExeNum);
81 TInt DetermineDllLoadResult(TInt aDllNum, TInt aExeNum);
82 TInt DetermineDllLoadResult(TInt aDllNum, TInt aExeNum1, TInt aExeNum2);
83 TInt DetermineLoadExe2Result(TInt aExeNum);
84 void DumpModuleList(const TModuleList& aList, TInt aExeNum);
85 void DumpModuleInfo(const SDllInfo& aInfo, TInt aExeNum);
86 void CheckModuleList(TInt aRoot, const TModuleList& aList);
101 const TInt KMaxHandlesPerDll=4;
102 const TInt KMaxHandles=KMaxHandlesPerDll*KNumModules;
104 struct SModuleInstance
108 TLinAddr iEntryPointAddress;
109 TModuleHandle iModuleHandle;
114 class CGlobalModuleList;
115 class CPerProcessInfo : public CBase
118 static CPerProcessInfo* New(TInt aExeNum, CGlobalModuleList& aG);
119 virtual ~CPerProcessInfo();
120 void GetModuleSet(TModuleSet& aSet);
122 void Unlink(const SDllInfo& a, TModuleList& aList);
123 TInt Load(TInt aDllNum);
124 TInt AddModules(TInt aDllNum, TModuleList* aCList, TModuleList* aIList);
125 TInt CloseHandle(TInt aHandle);
131 TRequestStatus iStatus;
133 RLoaderTest iSession;
135 CGlobalModuleList* iGlobalList;
136 TInt iModuleNum[KMaxHandles];
137 TInt iHandleCount[KNumModules];
138 SModuleInstance* iModules[KNumModules];
141 class CGlobalModuleList : public CBase
144 static CGlobalModuleList* New(const LoaderTest&);
145 virtual ~CGlobalModuleList();
146 void Close(SModuleInstance* a);
147 void Free(SModuleInstance* a);
148 SModuleInstance* GetMI();
149 TAny* CodeSegFromHandle(TModuleHandle aModHandle);
151 TInt Load(TInt aExeNum, TInt aDllNum);
152 TInt CloseHandle(TInt aExeNum, TInt aDllNum);
162 TUint32 iMemModelAtt;
163 CPerProcessInfo* iPPInfo[KNumModules];
164 RPointerArray<SModuleInstance> iModules;
165 SModuleInstance* iModuleAlloc;
166 SModuleInstance* iFreeModules;