symport/e32/include/e32rom.h
changeset 1 0a7b44b10206
child 2 806186ab5e14
equal deleted inserted replaced
0:c55016431358 1:0a7b44b10206
       
     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\e32rom.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __E32ROM_H__
       
    19 #define __E32ROM_H__
       
    20 #include <e32cmn.h>
       
    21 #include <e32def_private.h>
       
    22 
       
    23 //
       
    24 
       
    25 #ifndef __SECURITY_INFO_DEFINED__
       
    26 #define __SECURITY_INFO_DEFINED__
       
    27 /**
       
    28 @internalTechnology
       
    29 */
       
    30 //This struct must be identical in size and offset to the one in e32cmn.h
       
    31 //Functions need not be duplicated.  But must be same structurally.
       
    32 struct SCapabilitySet
       
    33 	{
       
    34 	enum {ENCapW=2};
       
    35 	TUint32 iCaps[ENCapW];
       
    36 	inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; }
       
    37 	inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; }
       
    38 	};
       
    39 
       
    40 /**
       
    41 @internalTechnology
       
    42 */
       
    43 //This struct must be identical in size and offset to the one in e32cmn.h
       
    44 //Functions need not be duplicated.  But must be same structurally.
       
    45 struct SSecurityInfo
       
    46 	{
       
    47 	TUint32	iSecureId;
       
    48 	TUint32	iVendorId;
       
    49 	SCapabilitySet iCaps;	
       
    50 	};
       
    51 #endif
       
    52 
       
    53 /**
       
    54 @internalTechnology
       
    55 @prototype
       
    56 */
       
    57 struct SDemandPagingConfig
       
    58 	{
       
    59 	TUint16 iMinPages;
       
    60 	TUint16 iMaxPages;
       
    61 	TUint16 iYoungOldRatio;
       
    62 	TUint16 iSpare[3];
       
    63 	};
       
    64 
       
    65 /**
       
    66 @internalTechnology
       
    67 @prototype
       
    68 */
       
    69 struct SRomPageInfo
       
    70 	{
       
    71 	enum TAttributes
       
    72 		{
       
    73 		EPageable = 1<<0
       
    74 		};
       
    75 	enum TCompression
       
    76 		{
       
    77 		ENoCompression,
       
    78 		EBytePair,
       
    79 		};
       
    80 	TUint32 iDataStart;
       
    81 	TUint16 iDataSize;
       
    82 	TUint8  iCompressionType;
       
    83 	TUint8  iPagingAttributes;
       
    84 	};
       
    85 
       
    86 /**
       
    87 @publishedPartner
       
    88 @released
       
    89 
       
    90 Defines the size of the header for a ROM image.
       
    91 
       
    92 @see TRomHeader
       
    93 */
       
    94 const TUint KRomHeaderSize=0x200;
       
    95 //
       
    96 
       
    97 
       
    98 /**
       
    99 @publishedPartner
       
   100 @released
       
   101 
       
   102 The format of the header for a ROM image.
       
   103 
       
   104 This is retained as part of the ROM image.
       
   105 It is generated by the rombuild tool, and is used by the Bootstrap and
       
   106 the kernel.
       
   107 */
       
   108 class TRomHeader
       
   109 	{
       
   110 public:
       
   111 	enum { KDefaultDebugPort = -1 };
       
   112 	enum { KNumTraceMask = 8 };  // this is also defined in e23const.h
       
   113 
       
   114 __ASSERT_COMPILE(KNumTraceMask==KNumTraceMaskWords);
       
   115 
       
   116 public:
       
   117     /**
       
   118     Reserved for a small amount of Bootstrap code, if required.
       
   119     The first 4 bytes of the binary image typically contains
       
   120     a branch instruction which jumps to code at offset 0x100.
       
   121     */
       
   122 	TUint8 iJump[124]; 
       
   123 	
       
   124 	                                     
       
   125     /**
       
   126     The restart vector.
       
   127     */	                                     
       
   128 	TLinAddr iRestartVector;
       
   129 	
       
   130 	
       
   131 	/**
       
   132 	The date and time that the ROM image was built, in microseconds.
       
   133 	*/
       
   134 	TInt64 iTime;
       
   135 	
       
   136 	
       
   137 	/**
       
   138 	The high order 32 bits of the ROM image build date & time.
       
   139 	*/
       
   140 	TUint32 iTimeHi;
       
   141 	
       
   142 	
       
   143 	/**
       
   144 	The virtual address of the base of the ROM.
       
   145 	*/
       
   146 	TLinAddr iRomBase;
       
   147 	
       
   148 	
       
   149 	/**
       
   150 	The size of the ROM image, in bytes.
       
   151 	
       
   152 	This includes the second section for sectioned ROMs.
       
   153 	*/
       
   154 	TUint32 iRomSize;
       
   155 	
       
   156 	
       
   157 	/**
       
   158 	The virtual address of the TRomRootDirectoryList structure.
       
   159 
       
   160     @see TRomRootDirectoryList 
       
   161 	*/
       
   162 	TLinAddr iRomRootDirectoryList;
       
   163 	
       
   164 	
       
   165 	/**
       
   166 	The virtual address of kernel data, when in RAM.
       
   167 	*/
       
   168 	TLinAddr iKernDataAddress;
       
   169 	
       
   170 	
       
   171 	/**
       
   172 	The virtual address of the top of the kernel region, when in RAM.
       
   173 	*/
       
   174 	TLinAddr iKernelLimit;
       
   175 	
       
   176 	
       
   177 	/**
       
   178 	The virtual address of the primarys ROM file image header.
       
   179 
       
   180     @see TRomImageHeader 
       
   181 	*/
       
   182 	TLinAddr iPrimaryFile;
       
   183 	
       
   184 	
       
   185 	/**
       
   186 	The virtual address of the secondarys ROM file image header.
       
   187 	
       
   188 	@see TRomImageHeader 
       
   189 	*/
       
   190 	TLinAddr iSecondaryFile;
       
   191 	
       
   192 	
       
   193 	/**
       
   194 	A computed constant that causes the 32-bit checksum of the image to equal
       
   195 	the value specified by the "romchecksum" keyword.
       
   196 	*/
       
   197 	TUint iCheckSum;
       
   198 	
       
   199 	
       
   200 	/**
       
   201 	A unique number identifying the hardware for which this ROM image
       
   202 	has been built.
       
   203 
       
   204     Note that this is only used for testing purposes.
       
   205 	*/
       
   206 	TUint32 iHardware;
       
   207 	
       
   208 	
       
   209 	/**
       
   210 	A bitmask identifying which of the languages are supported by the ROM image,
       
   211 	as specified by the "languages" keyword.
       
   212 
       
   213     Note that this is only used for testing purposes.
       
   214 	*/
       
   215 	TInt64 iLanguage;
       
   216 	
       
   217 	
       
   218 	/**
       
   219 	Contains the flags that define the security options in force.
       
   220 	
       
   221 	@see TKernelConfigFlags
       
   222 	*/
       
   223 	TUint32 iKernelConfigFlags;
       
   224 
       
   225 	/**
       
   226 	The virtual address of the TRomExceptionSearchTable structure.
       
   227 
       
   228 	@see TRomExceptionSearchTable
       
   229 	*/
       
   230 	TLinAddr iRomExceptionSearchTable;
       
   231 	
       
   232 	/**
       
   233 	Current size of ROM header (Previously iUnused3)
       
   234 	If value is 0x69966996 then header size = 0x100
       
   235 	*/
       
   236 	TUint32 iRomHeaderSize;
       
   237 	
       
   238 	
       
   239 	/**
       
   240 	The virtual address of the ROM section header, if the ROM is sectioned.
       
   241 	
       
   242 	@see TRomSectionHeader
       
   243 	*/
       
   244 	TLinAddr iRomSectionHeader;
       
   245 	
       
   246 	
       
   247 	/**
       
   248 	The total supervisor data size, i.e. the amount of memory mapped for
       
   249 	the kernel data chunk.
       
   250 	*/
       
   251 	TInt iTotalSvDataSize;
       
   252 	
       
   253 	
       
   254 	/**
       
   255 	The virtual address of the TRomEntry for the Variant file.
       
   256 	
       
   257 	@see TRomEntry
       
   258 	*/
       
   259 	TLinAddr iVariantFile;
       
   260 
       
   261 	
       
   262 	/**
       
   263 	The virtual address of TRomEntry for the first extension file, if it exists.
       
   264 	
       
   265 	If there is more than one extension, then the next extension field in
       
   266 	the extensions TRomImageHeader points to the TRomEntry for
       
   267 	that next extension.
       
   268 	
       
   269     @see TRomImageHeader::iNextExtension
       
   270    	@see TRomImageHeader
       
   271 	@see TRomEntry
       
   272 	*/
       
   273 	TLinAddr iExtensionFile;
       
   274 	
       
   275 	
       
   276 	/**
       
   277 	The virtual adress of the first area to be relocated into RAM, as defined
       
   278 	using the "area" keyword.
       
   279 	*/
       
   280 	TLinAddr iRelocInfo;
       
   281 	
       
   282 	
       
   283 	/**
       
   284 	The old position of the kernel trace mask, see iTraceMask below
       
   285 	*/
       
   286 	TUint32  iOldTraceMask;		// The old location of the kernel tracemask
       
   287 	
       
   288 	
       
   289 	/**
       
   290 	The virtual address of the user data area.
       
   291 	*/
       
   292 	TLinAddr iUserDataAddress;	// non-MMU stuff
       
   293 
       
   294 	
       
   295 	/**
       
   296 	The total size of the user data.
       
   297 	*/
       
   298 	TInt iTotalUserDataSize;	// non-MMU stuff
       
   299 	
       
   300 	
       
   301 	/**
       
   302 	A value that is interpreted by the Bootstrap and kernel as the debug port
       
   303 	to be used.
       
   304 	*/
       
   305 	TUint32 iDebugPort;			// semantic is ASSP-specific
       
   306 	
       
   307 	
       
   308 	/**
       
   309 	The ROM version number.
       
   310 	*/
       
   311 	TVersion iVersion;
       
   312 	
       
   313 	
       
   314 	/**
       
   315 	The type of compression used for the image.
       
   316 	
       
   317 	This is a UID, or 0 if there is no compression.
       
   318 	*/
       
   319 	TUint32 iCompressionType;	// compression type used
       
   320 	
       
   321 	
       
   322 	/**
       
   323 	The size of the image after compression.
       
   324 	*/
       
   325 	TUint32 iCompressedSize;	// Size after compression
       
   326 	
       
   327 	
       
   328 	/**
       
   329 	The size of the image before compression.
       
   330 	*/
       
   331 	TUint32 iUncompressedSize;	// Size before compression
       
   332 	
       
   333 	
       
   334 	/**
       
   335 	*/
       
   336 	TUint32 iDisabledCapabilities[2];   // 2==SSecurityInfo::ENCapW
       
   337 
       
   338 
       
   339 	/**
       
   340 	The initial value for the kernel trace masks.
       
   341 	*/
       
   342 	TUint32  iTraceMask[KNumTraceMask];  // The kernel debug trace masks
       
   343 
       
   344 	/**
       
   345 	Initial values for fast-trace filter.
       
   346 	*/
       
   347 	TUint32 iInitialBTraceFilter[8];
       
   348 
       
   349 	/**
       
   350 	Initial value for size of fast-trace buffer.
       
   351 	*/
       
   352 	TInt iInitialBTraceBuffer;
       
   353 
       
   354 	/**
       
   355 	Initial value for size of fast-trace mode.
       
   356 	*/
       
   357 	TInt iInitialBTraceMode;
       
   358 
       
   359 	/**
       
   360 	Offset, in bytes from ROM start, for the start of the pageable ROM area.
       
   361 	@internalTechnology
       
   362 	@prototype
       
   363 	*/
       
   364 	TInt iPageableRomStart;
       
   365 
       
   366 	/**
       
   367 	Size, in bytes , of the pageable ROM area.
       
   368 	@internalTechnology
       
   369 	@prototype
       
   370 	*/
       
   371 	TInt iPageableRomSize;
       
   372 
       
   373 	/**
       
   374 	Offset, in bytes from ROM start, for the page index. (Array of SRomPageInfo objects.)
       
   375 	@internalTechnology
       
   376 	@prototype
       
   377 	*/
       
   378 	TInt iRomPageIndex;
       
   379 
       
   380 	/**
       
   381 	@internalTechnology
       
   382 	@prototype
       
   383 	*/
       
   384 	SDemandPagingConfig iDemandPagingConfig;
       
   385 
       
   386 	/**
       
   387 	Offset, in bytes from ROM start, for the start of compressed un-paged ROM area
       
   388 	@internalTechnology
       
   389 	@prototype
       
   390 	*/
       
   391 	TUint32 iCompressedUnpagedStart;
       
   392 	
       
   393 	
       
   394 	/**
       
   395 	Size, in bytes of the un-paged part of image after compression.
       
   396 	@internalTechnology
       
   397 	@prototype
       
   398 	*/
       
   399 	TUint32 iUnpagedCompressedSize;
       
   400 	
       
   401 	
       
   402 	/**
       
   403 	Size, in bytes of the un-paged part of image before compression.
       
   404 	@internalTechnology
       
   405 	@prototype
       
   406 	*/
       
   407 	TUint32 iUnpagedUncompressedSize;
       
   408 	
       
   409 	/**
       
   410 	@internalComponent
       
   411 	*/
       
   412 	TUint32 iSpare[37];   // spare : force size to be correct
       
   413 
       
   414 	};
       
   415 
       
   416 __ASSERT_COMPILE(sizeof(TRomHeader)==KRomHeaderSize);
       
   417 __ASSERT_COMPILE(SCapabilitySet::ENCapW==2); // TRomHeader::iDisabledCapabilities has hard coded 2 because h2inc.pl does not parse scoped identifiers
       
   418 
       
   419 
       
   420 
       
   421 
       
   422 /**
       
   423 @publishedPartner
       
   424 @released
       
   425 
       
   426 Contains information about a root directory.
       
   427 
       
   428 A variable number of these are contained in a TRomRootDirectoryList structure.
       
   429 
       
   430 @see TRomRootDirectoryList
       
   431 */
       
   432 class TRootDirInfo
       
   433 	{
       
   434 public:
       
   435     /**
       
   436     The hardware variant for this root directory entry.
       
   437     */
       
   438 	TUint iHardwareVariant;
       
   439 	
       
   440 	
       
   441 	/**
       
   442 	The virtual address of the root directory.
       
   443 	
       
   444 	@see TRomDir
       
   445 	*/
       
   446 	TLinAddr iAddressLin;
       
   447 	};
       
   448 
       
   449 
       
   450 
       
   451 
       
   452 /**
       
   453 @publishedPartner
       
   454 @released
       
   455 
       
   456 A structure that allows you to find the root directories for each hardware
       
   457 Variant supported by the ROM.
       
   458 
       
   459 Usually, there is only one Variant and one root directory. However, a ROM can
       
   460 have multiple root directories and directory trees, one for each hardware Variant
       
   461 supported by the ROM. This ensures that the file server only sees the files
       
   462 that are relevant to the hardware on which it is running. In this case, there
       
   463 are multiple entries in the table describing each root directory.
       
   464 */
       
   465 class TRomRootDirectoryList
       
   466 	{
       
   467 public:
       
   468     /**
       
   469     The number of root directory entries.
       
   470     */
       
   471 	TInt iNumRootDirs;
       
   472 	
       
   473 	
       
   474 	/**
       
   475 	The root directory entries.
       
   476 
       
   477     The number of entries is defined by iNumRootDirs.
       
   478 	*/
       
   479 	TRootDirInfo iRootDir[1];
       
   480 	};
       
   481 
       
   482 
       
   483 
       
   484 
       
   485 /**
       
   486 @publishedPartner
       
   487 @released
       
   488 
       
   489 The format of a ROM section header.
       
   490 */
       
   491 class TRomSectionHeader
       
   492 	{
       
   493 public:
       
   494 
       
   495     /**
       
   496     The ROM version number.
       
   497     */
       
   498 	TVersion iVersion;
       
   499 	
       
   500 	
       
   501 	/**
       
   502 	A computed constant that causes the 32-bit checksum of the upper
       
   503 	section to equal zero.
       
   504 
       
   505 	Upper sections checksum to zero so that the overall ROM checksum in
       
   506 	the TRomHeader is unaffected by changes to this section.
       
   507 	
       
   508 	@see TRomHeader
       
   509 	*/
       
   510 	TUint iCheckSum;
       
   511 	
       
   512 	
       
   513 	/**
       
   514 	The date and time that the ROM image was built, in microseconds.
       
   515 	*/
       
   516 	TInt64 iTime;
       
   517 
       
   518 	
       
   519 	/**
       
   520 	A bitmask identifying which of the languages are supported by the ROM image,
       
   521 	as specified by the "languages" keyword.
       
   522     */
       
   523 	TInt64 iLanguage;
       
   524 	};
       
   525 //
       
   526 
       
   527 
       
   528 
       
   529 
       
   530 /**
       
   531 @publishedPartner
       
   532 @released
       
   533 
       
   534 A structure that describes a file or a directory.
       
   535 */
       
   536 class TRomEntry
       
   537 	{
       
   538 public:
       
   539     
       
   540      
       
   541     /**
       
   542     The size of the file.
       
   543     */
       
   544 	TInt iSize;
       
   545 	
       
   546 	
       
   547 	/**
       
   548 	The virtual address of the file, or of a TRomDir structure if this entry
       
   549 	describes another directory.
       
   550 	
       
   551 	@see TRomDir
       
   552 	*/
       
   553 	TUint32 iAddressLin;
       
   554 
       
   555 
       
   556 	/**
       
   557 	Attributes.
       
   558 	*/
       
   559 	TUint8 iAtt;
       
   560 
       
   561 
       
   562 	/**
       
   563 	The length of the file or directory name.
       
   564 	*/
       
   565 	TUint8 iNameLength;
       
   566 
       
   567 
       
   568 	/**
       
   569 	A variable length field containing the file or directory name.
       
   570 	*/
       
   571 	TUint8 iName[2];
       
   572 	};
       
   573 
       
   574 
       
   575 
       
   576 
       
   577 /**
       
   578 @publishedPartner
       
   579 @released
       
   580 
       
   581 The size of the fixed part of a TRomEntry structure.
       
   582 */
       
   583 const TInt KRomEntrySize=(sizeof(TRomEntry)-2);
       
   584 
       
   585 
       
   586 
       
   587 
       
   588 //
       
   589 class TRomDirSortInfo;
       
   590 
       
   591 /**
       
   592 @publishedPartner
       
   593 @released
       
   594 
       
   595 A structure that describes the first part of a ROM directory.
       
   596 
       
   597 This part of a ROM directory is a sequence of variable length entries,
       
   598 each describing a file or a subdirectory, in the order that the members
       
   599 were specified in the original obey file; the variable length entries are
       
   600 the TRomEntry structures that follow the iSize member.
       
   601 
       
   602 This part of the ROM directory is followed by a structure defined
       
   603 by TRomDirSortInfo, which contains a pair of sorted tables suitable for
       
   604 a binary search.
       
   605 
       
   606 @see TRomDirSortInfo
       
   607 */
       
   608 class TRomDir
       
   609 	{
       
   610 public:
       
   611 	inline const TRomDirSortInfo* SortInfo() const;
       
   612 	inline const TRomEntry* SortedEntry(TInt aIndex) const;
       
   613 	inline TInt SubDirCount() const;
       
   614 	inline TInt FileCount() const;
       
   615 	inline TInt EntryCount() const;
       
   616 	TInt BinarySearch(const TDesC& aName, TInt aLengthLimit, TInt aMode, TBool aDir) const;
       
   617 	const TRomDir* FindLeafDir(const TDesC& aPath) const;
       
   618 public:
       
   619 
       
   620     /**
       
   621     The number of bytes occupied by the set of TRomEntry structures
       
   622     that follow this field.
       
   623     
       
   624     @see TRomDir::iEntry
       
   625     */
       
   626 	TInt iSize;
       
   627 
       
   628 	
       
   629 	/**
       
   630 	A variable number of entries, each of which describes a file or a directory.
       
   631 	
       
   632 	Each entry is 4-byte aligned, and may have padding to ensure that the entry
       
   633 	is 4-bye aligned.
       
   634 	*/
       
   635 	TRomEntry iEntry;
       
   636 	};
       
   637 
       
   638 
       
   639 
       
   640 
       
   641 /**
       
   642 @publishedPartner
       
   643 @released
       
   644 
       
   645 A structure that describes the second part of a ROM directory.
       
   646 
       
   647 It contains a pair of sorted tables suitable for
       
   648 a binary search. The sorted tables contain unsigned 16-bit scaled offsets,
       
   649 which point to the start of the corresponding TRomEntry in the TRomDir.
       
   650 
       
   651 @see TRomDir
       
   652 */
       
   653 class TRomDirSortInfo
       
   654 	{
       
   655 public:
       
   656 
       
   657 	/**
       
   658     The number of subdirectories in this directory.
       
   659 	*/
       
   660 	TUint16	iSubDirCount;		// number of subdirectories in this directory
       
   661 	
       
   662 	
       
   663 	/**
       
   664 	The number of files in this directory.
       
   665 	*/
       
   666 	TUint16 iFileCount;			// number of non-directory files in this directory
       
   667 	
       
   668 	
       
   669 	/**
       
   670 	The two sorted tables:
       
   671 	
       
   672 	1. First one is a table of 16-bit scaled offsets to the directory entries.
       
   673 	
       
   674 	2. Second one is a table of 16-bit scaled ofsets to the file entries.
       
   675 	   This table starts at offset 2*iSubDirCount from the start of the first table.
       
   676 	   
       
   677 	If the offset is X, then the corresponding TRomEntry is at address:
       
   678 	@code
       
   679 	4*X +(char*)address of the first TRomEntry
       
   680 	@endcode
       
   681 	For example, the first entry is at offset zero.
       
   682 	
       
   683 	The entries are sorted in the order of the UTF-8 representation of
       
   684 	the names in a case insensitive way (compare the C function stricmp()).
       
   685 	In effect, this folds upper and lowercase ASCII characters but leaves all
       
   686 	other Unicode characters unchanged.
       
   687 	*/
       
   688 	TUint16 iEntryOffset[1];	// offsets of each entry from TRomDir::iEntry; extend
       
   689 								// order of offsets is directories first, then files, lexicographic order within each group
       
   690 	};
       
   691 
       
   692 
       
   693 /**
       
   694 Gets a pointer to the start of the second part of the ROM directory,
       
   695 as described by the TRomDirSortInfo structure.
       
   696 
       
   697 @return The pointer to the start of the second part of the ROM directory.
       
   698 */
       
   699 inline const TRomDirSortInfo* TRomDir::SortInfo() const
       
   700 	{ return (const TRomDirSortInfo*)( ((TLinAddr)&iEntry) + ( (iSize+sizeof(TUint32)-1) &~ (sizeof(TUint32)-1) )); }
       
   701 
       
   702 
       
   703 
       
   704 
       
   705 /**
       
   706 Gets the TRomEntry corresponding to the file or directory located at
       
   707 the specified index position within the sorted tables.
       
   708 
       
   709 @param aIndex The index of the entry within the sorted tables.
       
   710               Note that for the purpose of this function, the two tables
       
   711               are treated as one single table.
       
   712               
       
   713 @return The required TRomEntry              
       
   714 */
       
   715 inline const TRomEntry* TRomDir::SortedEntry(TInt aIndex) const
       
   716 	{
       
   717 	const TRomDirSortInfo* s = SortInfo();
       
   718 	return (const TRomEntry*)(((TLinAddr)&iEntry) + s->iEntryOffset[aIndex] * sizeof(TUint32));
       
   719 	}
       
   720 
       
   721 
       
   722 
       
   723 
       
   724 /**
       
   725 Gets the number of subdirectories in the directory.
       
   726 
       
   727 @return The number of subdirectories.
       
   728 */
       
   729 inline TInt TRomDir::SubDirCount() const
       
   730 	{ return SortInfo()->iSubDirCount; }
       
   731 
       
   732 	
       
   733 	
       
   734 	
       
   735 /**
       
   736 Gets the number of files in the directory.
       
   737 
       
   738 @return The number of files.
       
   739 */	
       
   740 inline TInt TRomDir::FileCount() const
       
   741 	{ return SortInfo()->iFileCount; }
       
   742 
       
   743 
       
   744 
       
   745 
       
   746 /**
       
   747 Gets the total number of files and subdirectories in the directory.
       
   748 
       
   749 @return The total number of files and subdirectories.
       
   750 */	
       
   751 inline TInt TRomDir::EntryCount() const
       
   752 	{
       
   753 	const TRomDirSortInfo* s = SortInfo();
       
   754 	return s->iSubDirCount + s->iFileCount;
       
   755 	}
       
   756 
       
   757 
       
   758 
       
   759 
       
   760 //
       
   761 // Header of ROM image files under the new scheme. (dlls & exes)
       
   762 //
       
   763 /**
       
   764 @publishedPartner
       
   765 @released
       
   766 */
       
   767 const TUint32 KRomImageFlagPrimary			=0x80000000u;
       
   768 
       
   769 /**
       
   770 @publishedPartner
       
   771 @released
       
   772 */
       
   773 const TUint32 KRomImageFlagVariant			=0x40000000u;
       
   774 
       
   775 /**
       
   776 @publishedPartner
       
   777 @released
       
   778 */
       
   779 const TUint32 KRomImageFlagExtension		=0x20000000u;
       
   780 
       
   781 /**
       
   782 @publishedPartner
       
   783 @released
       
   784 */
       
   785 const TUint32 KRomImageFlagDevice			=0x10000000u;
       
   786 
       
   787 /**
       
   788 @publishedPartner
       
   789 @released
       
   790 */
       
   791 const TUint32 KRomImageFlagsKernelMask		=0xf0000000u;
       
   792 
       
   793 /**
       
   794 @publishedPartner
       
   795 @released
       
   796 */
       
   797 const TUint32 KRomImageFlagSecondary		=0x08000000u;
       
   798 
       
   799 /**
       
   800 @publishedPartner
       
   801 @released
       
   802 */
       
   803 const TUint32 KRomImageFlagData				=0x04000000u;	// image has data and is not extension or variant
       
   804 
       
   805 /**
       
   806 @publishedPartner
       
   807 @released
       
   808 */
       
   809 const TUint32 KRomImageFlagDataInit			=0x02000000u;	// image or non-EXE dependencies would require data initialisation
       
   810 
       
   811 /**
       
   812 @publishedPartner
       
   813 @released
       
   814 */
       
   815 const TUint32 KRomImageFlagDataPresent		=0x01000000u;	// image or any dependencies have data
       
   816 
       
   817 /**
       
   818 @publishedPartner
       
   819 @released
       
   820 */
       
   821 const TUint32 KRomImageFlagExeInTree		=0x00800000u;	// image depends on EXE
       
   822 
       
   823 /**
       
   824 @publishedPartner
       
   825 @released
       
   826 */
       
   827 const TUint32 KRomImageFlagDll				=0x00000001u;
       
   828 
       
   829 /**
       
   830 @publishedPartner
       
   831 @released
       
   832 */
       
   833 const TUint32 KRomImageFlagFixedAddressExe	=0x00000004u;
       
   834 
       
   835 /**
       
   836 @publishedPartner
       
   837 @released
       
   838 */
       
   839 const TUint32 KRomImageABIMask				=0x00000018u;
       
   840 
       
   841 /**
       
   842 @publishedPartner
       
   843 @released
       
   844 */
       
   845 const TUint32 KRomImageABI_GCC98r2			=0x00000000u;	// for ARM
       
   846 
       
   847 /**
       
   848 @publishedPartner
       
   849 @released
       
   850 */
       
   851 const TUint32 KRomImageABI_EABI				=0x00000008u;	// for ARM
       
   852 
       
   853 /**
       
   854 @publishedPartner
       
   855 @released
       
   856 */
       
   857 const TUint32 KRomImageEptMask				=0x000000e0u;	// entry point type
       
   858 
       
   859 /**
       
   860 @publishedPartner
       
   861 @released
       
   862 */
       
   863 const TInt	  KRomImageEptShift				=5;
       
   864 
       
   865 /**
       
   866 @publishedPartner
       
   867 @released
       
   868 */
       
   869 const TUint32 KRomImageEpt_Eka1				=0x00000000u;
       
   870 
       
   871 /**
       
   872 @publishedPartner
       
   873 @released
       
   874 */
       
   875 const TUint32 KRomImageEpt_Eka2				=0x00000020u;
       
   876 
       
   877 /**
       
   878 @internalTechnology
       
   879 @released
       
   880 */
       
   881 const TUint KRomImageFlagUnpaged			=0x00000100u;
       
   882 
       
   883 
       
   884 /**
       
   885 @internalTechnology
       
   886 @released
       
   887 */
       
   888 const TUint KRomImageFlagPaged				=0x00000200u;
       
   889 
       
   890 
       
   891 /**
       
   892 @internalTechnology
       
   893 @released
       
   894 Flag to indicate when named symbol export data present in image
       
   895 */
       
   896 const TUint KRomImageNmdExpData				=0x00000400u;
       
   897 
       
   898 /**
       
   899 @internalTechnology
       
   900 @released
       
   901 Flag to indicate debuggability of this image.
       
   902 */
       
   903 const TUint KRomImageDebuggable			=0x00000800u;
       
   904 
       
   905 class TDllRefTable;
       
   906 
       
   907 /**
       
   908 @publishedPartner
       
   909 @released
       
   910 
       
   911 The format of the header for a ROM file image.
       
   912 
       
   913 The structure of a file image is based on the native image file format,
       
   914 but this can be compressed in the ROM image, as the relocation information
       
   915 and the .idata section are discarded once the file is fixed up.
       
   916 
       
   917 The Import Address Table (IAT) is also removed and each reference to
       
   918 an IAT entry is converted into a reference to the associated Export Directory
       
   919 entry in the corresponding DLL.
       
   920 
       
   921 ROM file images have the following sections:
       
   922 
       
   923 @code
       
   924 The header (as described by this structure)
       
   925 .text  - code
       
   926 .rdata - constant (read-only) data
       
   927 .edata - the export directory
       
   928 .data  - initialised data that is copied to RAM when the executable runs.
       
   929 The DLL reference table (a TDllRefTable structure), which is a list of DLLs
       
   930 used by the executable.
       
   931 @endcode
       
   932 
       
   933 @see TRomImageHeader::iDllRefTable
       
   934 @see TDllRefTable
       
   935 */
       
   936 class TRomImageHeader
       
   937 	{
       
   938 public:
       
   939 
       
   940     /**
       
   941     The UID1 for the file.
       
   942     
       
   943     @see TUidType
       
   944     */
       
   945 	TUint32	iUid1;
       
   946 
       
   947 	
       
   948     /**
       
   949     The UID2 for the file.
       
   950 
       
   951     @see TUidType
       
   952     */
       
   953 	TUint32	iUid2;
       
   954 
       
   955 	
       
   956     /**
       
   957     The UID3 for the file.
       
   958 
       
   959     @see TUidType
       
   960     */
       
   961 	TUint32	iUid3;
       
   962 	
       
   963 	
       
   964 	/**
       
   965 	The checksum of the UIDs
       
   966 	*/
       
   967 	TUint32	iUidChecksum;
       
   968 	
       
   969 	
       
   970 	/**
       
   971 	The entrypoint of this executable, i.e. the offset within this file.
       
   972 	*/
       
   973 	TUint32 iEntryPoint;
       
   974 	
       
   975 	
       
   976 	/**
       
   977 	This executables code address.
       
   978 	*/
       
   979 	TUint32 iCodeAddress;
       
   980 
       
   981 
       
   982 	/**
       
   983 	This executables data address.
       
   984 	*/
       
   985 	TUint32 iDataAddress;
       
   986 
       
   987 	
       
   988 	/**
       
   989 	The size of the code.
       
   990 	
       
   991 	This includes the size of the constant data.
       
   992 	*/
       
   993 	TInt iCodeSize;
       
   994 	
       
   995 	
       
   996 	/**
       
   997 	The size of the executable code.
       
   998 	
       
   999 	This is the value of (iCodeSize - the size of the constant data).
       
  1000 	*/
       
  1001 	TInt iTextSize;
       
  1002 	
       
  1003 	
       
  1004 	/**
       
  1005 	The data size.
       
  1006 	*/
       
  1007 	TInt iDataSize;
       
  1008 	
       
  1009 	
       
  1010 	/**
       
  1011 	The size of the .bss (the zero-filled data)
       
  1012 	*/
       
  1013 	TInt iBssSize;
       
  1014 	
       
  1015 	
       
  1016 	/**
       
  1017 	The minimum size of the heap.
       
  1018 	*/
       
  1019 	TInt iHeapSizeMin;
       
  1020 	
       
  1021 	
       
  1022 	/**
       
  1023 	The maximum size of the heap.
       
  1024 	*/
       
  1025 	TInt iHeapSizeMax;
       
  1026 	
       
  1027 	
       
  1028 	/**
       
  1029 	The size of the stack.
       
  1030 	*/
       
  1031 	TInt iStackSize;
       
  1032 	
       
  1033 	
       
  1034 	/**
       
  1035 	The address of the DLL reference table.
       
  1036 	
       
  1037 	@see TDllRefTable
       
  1038 	*/
       
  1039 	TDllRefTable* iDllRefTable;
       
  1040 	
       
  1041 	
       
  1042 	/**
       
  1043 	The number of functions exported by this executable.
       
  1044 	*/
       
  1045 	TInt iExportDirCount;
       
  1046 	
       
  1047 	
       
  1048 	/**
       
  1049 	The address of the export directory, which is a simple list of functions
       
  1050 	that can be indexed by ordinal.
       
  1051 	*/
       
  1052 	TUint32 iExportDir;
       
  1053 	
       
  1054 	
       
  1055 	/**
       
  1056 	Security information, details of which are internal to Symbian.
       
  1057 	*/
       
  1058 	SSecurityInfo iS;
       
  1059 	
       
  1060 	
       
  1061 	/**
       
  1062 	The version number of the tools used to generate this file image.
       
  1063 	*/
       
  1064 	TVersion iToolsVersion;
       
  1065 	
       
  1066 	
       
  1067 	/**
       
  1068 	Flags field.
       
  1069 	*/
       
  1070 	TUint32 iFlags;
       
  1071 	
       
  1072 	
       
  1073 	/**
       
  1074 	The priority of the process.
       
  1075 	*/
       
  1076 	TProcessPriority iPriority;
       
  1077 	
       
  1078 	
       
  1079 	/**
       
  1080 	The virtual base address of the data and .bss, where the process expects
       
  1081 	its data chunk to be when it runs.
       
  1082 	*/
       
  1083 	TUint32 iDataBssLinearBase;
       
  1084 	
       
  1085 	
       
  1086 	/**
       
  1087 	The address of the TRomEntry for the next extension file.
       
  1088 	
       
  1089 	This field is only used if there is more than one extension.
       
  1090 	The first extension is found using the TRomHeader.
       
  1091 	
       
  1092 	@see TRomEntry
       
  1093 	@see TRomHeader
       
  1094 	*/
       
  1095 	TLinAddr iNextExtension;
       
  1096 	
       
  1097 	
       
  1098 	/**
       
  1099 	A number denoting the hardware Variant.
       
  1100 	
       
  1101 	It is used to determine whether this executable can run
       
  1102 	on a given system.
       
  1103 	*/
       
  1104 	TUint32 iHardwareVariant;
       
  1105 	
       
  1106 	
       
  1107 	/**
       
  1108 	The total data size, including space reserved for DLLs
       
  1109 	*/
       
  1110 	TInt iTotalDataSize;	// data+bss + space reserved for DLLs
       
  1111 	
       
  1112 	
       
  1113 	/**
       
  1114 	The module version.
       
  1115 	*/
       
  1116 	TUint32 iModuleVersion;
       
  1117 
       
  1118 	/**
       
  1119 	The address of the Exception Descriptor if present.
       
  1120 	0 if no Exception descriptor
       
  1121 	*/
       
  1122 	TLinAddr iExceptionDescriptor;
       
  1123 	};	
       
  1124 	
       
  1125 	
       
  1126 	
       
  1127 	
       
  1128 //
       
  1129 // Header for extension ROMs
       
  1130 // Equivalent to TRomHeader
       
  1131 //
       
  1132 
       
  1133 /**
       
  1134 @publishedPartner
       
  1135 @released
       
  1136 
       
  1137 The format of a ROM extension header.
       
  1138 */
       
  1139 class TExtensionRomHeader
       
  1140 	{	
       
  1141 public:
       
  1142     
       
  1143     /**
       
  1144     The extension ROM image version number.
       
  1145     */
       
  1146 	TVersion iVersion;
       
  1147 	
       
  1148 	
       
  1149 	/**
       
  1150 	The virtual address of the base of the extension ROM.
       
  1151 	*/
       
  1152 	TLinAddr iRomBase;
       
  1153 	
       
  1154 	
       
  1155 	/**
       
  1156 	The size of the extension ROM image.
       
  1157 	*/
       
  1158 	TUint32 iRomSize;
       
  1159 	
       
  1160 	
       
  1161 	/**
       
  1162 	The virtual address of the TRomRootDirList structure for
       
  1163 	the combined kernel+extension ROM image.
       
  1164 	
       
  1165 	@see TRomRootDirList
       
  1166 	*/
       
  1167 	TLinAddr iRomRootDirectoryList;
       
  1168 	
       
  1169 	
       
  1170 	/**
       
  1171 	The date and time that the extension ROM image was built, in microseconds.
       
  1172 	*/
       
  1173 	TInt64 iTime;
       
  1174 	
       
  1175 	
       
  1176 	/**
       
  1177 	The extension ROM image checksum
       
  1178 	*/
       
  1179 	TUint iCheckSum;
       
  1180 
       
  1181 
       
  1182 	//
       
  1183 	/**
       
  1184 	Copy of the kernel ROM image version number.
       
  1185 	*/
       
  1186 	TVersion iKernelVersion;
       
  1187 	
       
  1188 	
       
  1189 	/**
       
  1190 	Copy of the kernel ROM image build date & time.
       
  1191 	*/
       
  1192 	TInt64 iKernelTime;
       
  1193 	
       
  1194 	
       
  1195 	/**
       
  1196 	Copy of the kernel ROM image checksum.
       
  1197 	*/
       
  1198 	TUint iKernelCheckSum;
       
  1199 	//
       
  1200 
       
  1201 
       
  1202 	/**
       
  1203 	The type of compression used for the image.
       
  1204 	
       
  1205 	This is a UID, or 0 if there is no compression.
       
  1206 	*/
       
  1207 	TUint32 iCompressionType;	// compression type used
       
  1208 	
       
  1209 	
       
  1210 	/**
       
  1211 	The size of the image after compression.
       
  1212 	*/
       
  1213 	TUint32 iCompressedSize;	// Size after compression
       
  1214 	
       
  1215 	
       
  1216 	/**
       
  1217 	The size of the image before compression.
       
  1218 	*/
       
  1219 	TUint32 iUncompressedSize;	// Size before compression
       
  1220 	
       
  1221 	
       
  1222 	/**
       
  1223 	The virtual address of the TRomExceptionSearchTable structure.
       
  1224 
       
  1225 	@see TRomExceptionSearchTable
       
  1226 	*/
       
  1227 	TLinAddr iRomExceptionSearchTable;
       
  1228 
       
  1229 	
       
  1230 	/**
       
  1231 	Reserved for future use.
       
  1232 	*/
       
  1233 	TUint32 iPad[32-15]; // sizeof(TExtensionRomHeader)=128
       
  1234 	};
       
  1235 
       
  1236 
       
  1237 
       
  1238 
       
  1239 
       
  1240 /**
       
  1241 @publishedPartner
       
  1242 @released
       
  1243 
       
  1244 A list of DLLs that an executable needs in order to run.
       
  1245 
       
  1246 Each DLL referenced in this list has a pointer to a TRomImageHeader structure
       
  1247 that describes that DLL. This allows the DLL loader to search
       
  1248 a dependency chain, and ensure that all required DLLs are loaded.
       
  1249 
       
  1250 @see TRomImageHeader
       
  1251 */
       
  1252 class TDllRefTable
       
  1253 	{
       
  1254 public:
       
  1255 
       
  1256     /**
       
  1257     Flags field.
       
  1258     */
       
  1259 	TUint16 iFlags;
       
  1260 	
       
  1261 	
       
  1262 	/**
       
  1263 	The number of referenced DLLs in this list.
       
  1264 	*/
       
  1265 	TUint16 iNumberOfEntries;
       
  1266 	
       
  1267 	
       
  1268 	/**
       
  1269 	A set of pointers to the TRomImageHeader structures for each referenced DLL.
       
  1270 	*/
       
  1271 	TRomImageHeader* iEntry[1];
       
  1272 	};
       
  1273 
       
  1274 #endif
       
  1275