|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * @internalComponent |
|
16 * @released |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef ROMREADER_H |
|
22 #define ROMREADER_H |
|
23 |
|
24 #include <e32image.h> |
|
25 #include "imagereader.h" |
|
26 |
|
27 class TRomRootDirectoryList; |
|
28 class TRomDir; |
|
29 class TRomImageHeader; |
|
30 class TRomEntry; |
|
31 class RomImageFSEntry; |
|
32 class RomImageHeader; |
|
33 |
|
34 const String KEpocIdentifier("EPOC"); |
|
35 const String KRomImageIdentifier("ROM"); |
|
36 |
|
37 const unsigned int KLdrOpcode = 0xe51ff004; |
|
38 const unsigned int KRomBase = 0x80000000; |
|
39 const unsigned int KRomBaseMaxLimit = 0x82000000; |
|
40 |
|
41 /** |
|
42 Class for ROM reader |
|
43 |
|
44 @internalComponent |
|
45 @released |
|
46 */ |
|
47 class RomReader : public ImageReader |
|
48 { |
|
49 private: |
|
50 RomAddrVsExeName iAddVsExeMap; |
|
51 VectorList iImageAddress; |
|
52 |
|
53 public: |
|
54 RomReader(const char* aFile, EImageType aImgType ); |
|
55 ~RomReader(void); |
|
56 |
|
57 static bool IsRomImage(const String& aWord); |
|
58 static bool IsRomExtImage(const String& aWord); |
|
59 void ReadImage(void); |
|
60 void ProcessImage(void); |
|
61 void BuildDir(TRomDir *aDir, RomImageFSEntry* aPaFSEntry); |
|
62 void BuildDir(short int *aOffsetTbl, short int aOffsetTblCount, |
|
63 TRomDir *aDir, RomImageFSEntry* aPaFSEntry); |
|
64 void GetRomDirTbl(short int** aBase, short int& aCount, TRomDir *aRomDir); |
|
65 void AddChild(RomImageFSEntry *aPa, RomImageFSEntry *aChild, TRomEntry* aRomEntry); |
|
66 void Name(String& aName, const char * aUnicodeName, const int aLen); |
|
67 |
|
68 const unsigned long int ImageCompressionType(void) const; |
|
69 const char* RomHdrPtr(void) const; |
|
70 const unsigned long int RomBase(void) const; |
|
71 const unsigned int HdrSize(void) const; |
|
72 const unsigned long int RootDirList(void) const; |
|
73 const unsigned int ImgSize() const; |
|
74 |
|
75 void PrepareExecutableList(void); |
|
76 ExeNamesVsDepListMap& GatherDependencies(void); |
|
77 void PrepareAddVsExeMap(void); |
|
78 void CollectImportExecutableNames(const RomImageFSEntry* aEntry, StringList& aImportExecutableNameList); |
|
79 unsigned int CodeSectionAddress(unsigned int& aImageAddress); |
|
80 void PrepareExeVsIdMap(void); |
|
81 const ExeVsIdDataMap& GetExeVsIdMap(void) const; |
|
82 |
|
83 void PrepareExeVsRomFsEntryMap(void); |
|
84 RomImageHeader *iImageHeader; |
|
85 TRomRootDirectoryList *iRootDirList; |
|
86 RomImageFSEntry *iRomImageRootDirEntry; |
|
87 unsigned char *iData; |
|
88 ExeVsRomFsEntryMap iExeVsRomFsEntryMap; |
|
89 |
|
90 EImageType iImgType; |
|
91 static bool iNoRomLoaderHeader; |
|
92 }; |
|
93 |
|
94 #endif //ROMREADER_H |