epoc32/include/e32rom.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/e32rom.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,1245 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\include\e32rom.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __E32ROM_H__
    1.22 +#define __E32ROM_H__
    1.23 +#include <e32cmn.h>
    1.24 +//
    1.25 +
    1.26 +#ifndef __SECURITY_INFO_DEFINED__
    1.27 +#define __SECURITY_INFO_DEFINED__
    1.28 +/**
    1.29 +@internalTechnology
    1.30 +*/
    1.31 +//This struct must be identical in size and offset to the one in e32cmn.h
    1.32 +//Functions need not be duplicated.  But must be same structurally.
    1.33 +struct SCapabilitySet
    1.34 +	{
    1.35 +	enum {ENCapW=2};
    1.36 +	TUint32 iCaps[ENCapW];
    1.37 +	inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; }
    1.38 +	inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; }
    1.39 +	};
    1.40 +
    1.41 +/**
    1.42 +@internalTechnology
    1.43 +*/
    1.44 +//This struct must be identical in size and offset to the one in e32cmn.h
    1.45 +//Functions need not be duplicated.  But must be same structurally.
    1.46 +struct SSecurityInfo
    1.47 +	{
    1.48 +	TUint32	iSecureId;
    1.49 +	TUint32	iVendorId;
    1.50 +	SCapabilitySet iCaps;	
    1.51 +	};
    1.52 +#endif
    1.53 +
    1.54 +/**
    1.55 +@internalTechnology
    1.56 +@prototype
    1.57 +*/
    1.58 +struct SDemandPagingConfig
    1.59 +	{
    1.60 +	TUint16 iMinPages;
    1.61 +	TUint16 iMaxPages;
    1.62 +	TUint16 iYoungOldRatio;
    1.63 +	TUint16 iSpare[3];
    1.64 +	};
    1.65 +
    1.66 +/**
    1.67 +@internalTechnology
    1.68 +@prototype
    1.69 +*/
    1.70 +struct SRomPageInfo
    1.71 +	{
    1.72 +	enum TAttributes
    1.73 +		{
    1.74 +		EPageable = 1<<0
    1.75 +		};
    1.76 +	enum TCompression
    1.77 +		{
    1.78 +		ENoCompression,
    1.79 +		EBytePair,
    1.80 +		};
    1.81 +	TUint32 iDataStart;
    1.82 +	TUint16 iDataSize;
    1.83 +	TUint8  iCompressionType;
    1.84 +	TUint8  iPagingAttributes;
    1.85 +	};
    1.86 +
    1.87 +/**
    1.88 +@publishedPartner
    1.89 +@released
    1.90 +
    1.91 +Defines the size of the header for a ROM image.
    1.92 +
    1.93 +@see TRomHeader
    1.94 +*/
    1.95 +const TUint KRomHeaderSize=0x200;
    1.96 +//
    1.97 +
    1.98 +
    1.99 +/**
   1.100 +@publishedPartner
   1.101 +@released
   1.102 +
   1.103 +The format of the header for a ROM image.
   1.104 +
   1.105 +This is retained as part of the ROM image.
   1.106 +It is generated by the rombuild tool, and is used by the Bootstrap and
   1.107 +the kernel.
   1.108 +*/
   1.109 +class TRomHeader
   1.110 +	{
   1.111 +public:
   1.112 +	enum { KDefaultDebugPort = -1 };
   1.113 +	enum { KNumTraceMask = 8 };  // this is also defined in e23const.h
   1.114 +
   1.115 +__ASSERT_COMPILE(KNumTraceMask==KNumTraceMaskWords);
   1.116 +
   1.117 +public:
   1.118 +    /**
   1.119 +    Reserved for a small amount of Bootstrap code, if required.
   1.120 +    The first 4 bytes of the binary image typically contains
   1.121 +    a branch instruction which jumps to code at offset 0x100.
   1.122 +    */
   1.123 +	TUint8 iJump[124]; 
   1.124 +	
   1.125 +	                                     
   1.126 +    /**
   1.127 +    The restart vector.
   1.128 +    */	                                     
   1.129 +	TLinAddr iRestartVector;
   1.130 +	
   1.131 +	
   1.132 +	/**
   1.133 +	The date and time that the ROM image was built, in microseconds.
   1.134 +	*/
   1.135 +	TInt64 iTime;
   1.136 +	
   1.137 +	
   1.138 +	/**
   1.139 +	The high order 32 bits of the ROM image build date & time.
   1.140 +	*/
   1.141 +	TUint32 iTimeHi;
   1.142 +	
   1.143 +	
   1.144 +	/**
   1.145 +	The virtual address of the base of the ROM.
   1.146 +	*/
   1.147 +	TLinAddr iRomBase;
   1.148 +	
   1.149 +	
   1.150 +	/**
   1.151 +	The size of the ROM image, in bytes.
   1.152 +	
   1.153 +	This includes the second section for sectioned ROMs.
   1.154 +	*/
   1.155 +	TUint32 iRomSize;
   1.156 +	
   1.157 +	
   1.158 +	/**
   1.159 +	The virtual address of the TRomRootDirectoryList structure.
   1.160 +
   1.161 +    @see TRomRootDirectoryList 
   1.162 +	*/
   1.163 +	TLinAddr iRomRootDirectoryList;
   1.164 +	
   1.165 +	
   1.166 +	/**
   1.167 +	The virtual address of kernel data, when in RAM.
   1.168 +	*/
   1.169 +	TLinAddr iKernDataAddress;
   1.170 +	
   1.171 +	
   1.172 +	/**
   1.173 +	The virtual address of the top of the kernel region, when in RAM.
   1.174 +	*/
   1.175 +	TLinAddr iKernelLimit;
   1.176 +	
   1.177 +	
   1.178 +	/**
   1.179 +	The virtual address of the primarys ROM file image header.
   1.180 +
   1.181 +    @see TRomImageHeader 
   1.182 +	*/
   1.183 +	TLinAddr iPrimaryFile;
   1.184 +	
   1.185 +	
   1.186 +	/**
   1.187 +	The virtual address of the secondarys ROM file image header.
   1.188 +	
   1.189 +	@see TRomImageHeader 
   1.190 +	*/
   1.191 +	TLinAddr iSecondaryFile;
   1.192 +	
   1.193 +	
   1.194 +	/**
   1.195 +	A computed constant that causes the 32-bit checksum of the image to equal
   1.196 +	the value specified by the "romchecksum" keyword.
   1.197 +	*/
   1.198 +	TUint iCheckSum;
   1.199 +	
   1.200 +	
   1.201 +	/**
   1.202 +	A unique number identifying the hardware for which this ROM image
   1.203 +	has been built.
   1.204 +
   1.205 +    Note that this is only used for testing purposes.
   1.206 +	*/
   1.207 +	TUint32 iHardware;
   1.208 +	
   1.209 +	
   1.210 +	/**
   1.211 +	A bitmask identifying which of the languages are supported by the ROM image,
   1.212 +	as specified by the "languages" keyword.
   1.213 +
   1.214 +    Note that this is only used for testing purposes.
   1.215 +	*/
   1.216 +	TInt64 iLanguage;
   1.217 +	
   1.218 +	
   1.219 +	/**
   1.220 +	Contains the flags that define the security options in force.
   1.221 +	
   1.222 +	@see TKernelConfigFlags
   1.223 +	*/
   1.224 +	TUint32 iKernelConfigFlags;
   1.225 +
   1.226 +	/**
   1.227 +	The virtual address of the TRomExceptionSearchTable structure.
   1.228 +
   1.229 +	@see TRomExceptionSearchTable
   1.230 +	*/
   1.231 +	TLinAddr iRomExceptionSearchTable;
   1.232 +	
   1.233 +	/**
   1.234 +	Current size of ROM header (Previously iUnused3)
   1.235 +	If value is 0x69966996 then header size = 0x100
   1.236 +	*/
   1.237 +	TUint32 iRomHeaderSize;
   1.238 +	
   1.239 +	
   1.240 +	/**
   1.241 +	The virtual address of the ROM section header, if the ROM is sectioned.
   1.242 +	
   1.243 +	@see TRomSectionHeader
   1.244 +	*/
   1.245 +	TLinAddr iRomSectionHeader;
   1.246 +	
   1.247 +	
   1.248 +	/**
   1.249 +	The total supervisor data size, i.e. the amount of memory mapped for
   1.250 +	the kernel data chunk.
   1.251 +	*/
   1.252 +	TInt iTotalSvDataSize;
   1.253 +	
   1.254 +	
   1.255 +	/**
   1.256 +	The virtual address of the TRomEntry for the Variant file.
   1.257 +	
   1.258 +	@see TRomEntry
   1.259 +	*/
   1.260 +	TLinAddr iVariantFile;
   1.261 +
   1.262 +	
   1.263 +	/**
   1.264 +	The virtual address of TRomEntry for the first extension file, if it exists.
   1.265 +	
   1.266 +	If there is more than one extension, then the next extension field in
   1.267 +	the extensions TRomImageHeader points to the TRomEntry for
   1.268 +	that next extension.
   1.269 +	
   1.270 +    @see TRomImageHeader::iNextExtension
   1.271 +   	@see TRomImageHeader
   1.272 +	@see TRomEntry
   1.273 +	*/
   1.274 +	TLinAddr iExtensionFile;
   1.275 +	
   1.276 +	
   1.277 +	/**
   1.278 +	The virtual adress of the first area to be relocated into RAM, as defined
   1.279 +	using the "area" keyword.
   1.280 +	*/
   1.281 +	TLinAddr iRelocInfo;
   1.282 +	
   1.283 +	
   1.284 +	/**
   1.285 +	The old position of the kernel trace mask, see iTraceMask below
   1.286 +	*/
   1.287 +	TUint32  iOldTraceMask;		// The old location of the kernel tracemask
   1.288 +	
   1.289 +	
   1.290 +	/**
   1.291 +	The virtual address of the user data area.
   1.292 +	*/
   1.293 +	TLinAddr iUserDataAddress;	// non-MMU stuff
   1.294 +
   1.295 +	
   1.296 +	/**
   1.297 +	The total size of the user data.
   1.298 +	*/
   1.299 +	TInt iTotalUserDataSize;	// non-MMU stuff
   1.300 +	
   1.301 +	
   1.302 +	/**
   1.303 +	A value that is interpreted by the Bootstrap and kernel as the debug port
   1.304 +	to be used.
   1.305 +	*/
   1.306 +	TUint32 iDebugPort;			// semantic is ASSP-specific
   1.307 +	
   1.308 +	
   1.309 +	/**
   1.310 +	The ROM version number.
   1.311 +	*/
   1.312 +	TVersion iVersion;
   1.313 +	
   1.314 +	
   1.315 +	/**
   1.316 +	The type of compression used for the image.
   1.317 +	
   1.318 +	This is a UID, or 0 if there is no compression.
   1.319 +	*/
   1.320 +	TUint32 iCompressionType;	// compression type used
   1.321 +	
   1.322 +	
   1.323 +	/**
   1.324 +	The size of the image after compression.
   1.325 +	*/
   1.326 +	TUint32 iCompressedSize;	// Size after compression
   1.327 +	
   1.328 +	
   1.329 +	/**
   1.330 +	The size of the image before compression.
   1.331 +	*/
   1.332 +	TUint32 iUncompressedSize;	// Size before compression
   1.333 +	
   1.334 +	
   1.335 +	/**
   1.336 +	*/
   1.337 +	TUint32 iDisabledCapabilities[2];   // 2==SSecurityInfo::ENCapW
   1.338 +
   1.339 +
   1.340 +	/**
   1.341 +	The initial value for the kernel trace masks.
   1.342 +	*/
   1.343 +	TUint32  iTraceMask[KNumTraceMask];  // The kernel debug trace masks
   1.344 +
   1.345 +	/**
   1.346 +	Initial values for fast-trace filter.
   1.347 +	*/
   1.348 +	TUint32 iInitialBTraceFilter[8];
   1.349 +
   1.350 +	/**
   1.351 +	Initial value for size of fast-trace buffer.
   1.352 +	*/
   1.353 +	TInt iInitialBTraceBuffer;
   1.354 +
   1.355 +	/**
   1.356 +	Initial value for size of fast-trace mode.
   1.357 +	*/
   1.358 +	TInt iInitialBTraceMode;
   1.359 +
   1.360 +	/**
   1.361 +	Offset, in bytes from ROM start, for the start of the pageable ROM area.
   1.362 +	*/
   1.363 +	TInt iPageableRomStart;
   1.364 +
   1.365 +	/**
   1.366 +	Size, in bytes, of the pageable ROM area.
   1.367 +	*/
   1.368 +	TInt iPageableRomSize;
   1.369 +
   1.370 +	/**
   1.371 +	Offset, in bytes from ROM start, for the page index. (Array of SRomPageInfo objects.)
   1.372 +	@internalTechnology
   1.373 +	@prototype
   1.374 +	*/
   1.375 +	TInt iRomPageIndex;
   1.376 +
   1.377 +	/**
   1.378 +	@internalTechnology
   1.379 +	@prototype
   1.380 +	*/
   1.381 +	SDemandPagingConfig iDemandPagingConfig;
   1.382 +
   1.383 +	/**
   1.384 +	@internalComponent
   1.385 +	*/
   1.386 +	TUint32 iSpare[40];   // spare : force size to be correct
   1.387 +
   1.388 +	};
   1.389 +
   1.390 +__ASSERT_COMPILE(sizeof(TRomHeader)==KRomHeaderSize);
   1.391 +__ASSERT_COMPILE(SCapabilitySet::ENCapW==2); // TRomHeader::iDisabledCapabilities has hard coded 2 because h2inc.pl does not parse scoped identifiers
   1.392 +
   1.393 +
   1.394 +
   1.395 +
   1.396 +/**
   1.397 +@publishedPartner
   1.398 +@released
   1.399 +
   1.400 +Contains information about a root directory.
   1.401 +
   1.402 +A variable number of these are contained in a TRomRootDirectoryList structure.
   1.403 +
   1.404 +@see TRomRootDirectoryList
   1.405 +*/
   1.406 +class TRootDirInfo
   1.407 +	{
   1.408 +public:
   1.409 +    /**
   1.410 +    The hardware variant for this root directory entry.
   1.411 +    */
   1.412 +	TUint iHardwareVariant;
   1.413 +	
   1.414 +	
   1.415 +	/**
   1.416 +	The virtual address of the root directory.
   1.417 +	
   1.418 +	@see TRomDir
   1.419 +	*/
   1.420 +	TLinAddr iAddressLin;
   1.421 +	};
   1.422 +
   1.423 +
   1.424 +
   1.425 +
   1.426 +/**
   1.427 +@publishedPartner
   1.428 +@released
   1.429 +
   1.430 +A structure that allows you to find the root directories for each hardware
   1.431 +Variant supported by the ROM.
   1.432 +
   1.433 +Usually, there is only one Variant and one root directory. However, a ROM can
   1.434 +have multiple root directories and directory trees, one for each hardware Variant
   1.435 +supported by the ROM. This ensures that the file server only sees the files
   1.436 +that are relevant to the hardware on which it is running. In this case, there
   1.437 +are multiple entries in the table describing each root directory.
   1.438 +*/
   1.439 +class TRomRootDirectoryList
   1.440 +	{
   1.441 +public:
   1.442 +    /**
   1.443 +    The number of root directory entries.
   1.444 +    */
   1.445 +	TInt iNumRootDirs;
   1.446 +	
   1.447 +	
   1.448 +	/**
   1.449 +	The root directory entries.
   1.450 +
   1.451 +    The number of entries is defined by iNumRootDirs.
   1.452 +	*/
   1.453 +	TRootDirInfo iRootDir[1];
   1.454 +	};
   1.455 +
   1.456 +
   1.457 +
   1.458 +
   1.459 +/**
   1.460 +@publishedPartner
   1.461 +@released
   1.462 +
   1.463 +The format of a ROM section header.
   1.464 +*/
   1.465 +class TRomSectionHeader
   1.466 +	{
   1.467 +public:
   1.468 +
   1.469 +    /**
   1.470 +    The ROM version number.
   1.471 +    */
   1.472 +	TVersion iVersion;
   1.473 +	
   1.474 +	
   1.475 +	/**
   1.476 +	A computed constant that causes the 32-bit checksum of the upper
   1.477 +	section to equal zero.
   1.478 +
   1.479 +	Upper sections checksum to zero so that the overall ROM checksum in
   1.480 +	the TRomHeader is unaffected by changes to this section.
   1.481 +	
   1.482 +	@see TRomHeader
   1.483 +	*/
   1.484 +	TUint iCheckSum;
   1.485 +	
   1.486 +	
   1.487 +	/**
   1.488 +	The date and time that the ROM image was built, in microseconds.
   1.489 +	*/
   1.490 +	TInt64 iTime;
   1.491 +
   1.492 +	
   1.493 +	/**
   1.494 +	A bitmask identifying which of the languages are supported by the ROM image,
   1.495 +	as specified by the "languages" keyword.
   1.496 +    */
   1.497 +	TInt64 iLanguage;
   1.498 +	};
   1.499 +//
   1.500 +
   1.501 +
   1.502 +
   1.503 +
   1.504 +/**
   1.505 +@publishedPartner
   1.506 +@released
   1.507 +
   1.508 +A structure that describes a file or a directory.
   1.509 +*/
   1.510 +class TRomEntry
   1.511 +	{
   1.512 +public:
   1.513 +    
   1.514 +     
   1.515 +    /**
   1.516 +    The size of the file.
   1.517 +    */
   1.518 +	TInt iSize;
   1.519 +	
   1.520 +	
   1.521 +	/**
   1.522 +	The virtual address of the file, or of a TRomDir structure if this entry
   1.523 +	describes another directory.
   1.524 +	
   1.525 +	@see TRomDir
   1.526 +	*/
   1.527 +	TUint32 iAddressLin;
   1.528 +
   1.529 +
   1.530 +	/**
   1.531 +	Attributes.
   1.532 +	*/
   1.533 +	TUint8 iAtt;
   1.534 +
   1.535 +
   1.536 +	/**
   1.537 +	The length of the file or directory name.
   1.538 +	*/
   1.539 +	TUint8 iNameLength;
   1.540 +
   1.541 +
   1.542 +	/**
   1.543 +	A variable length field containing the file or directory name.
   1.544 +	*/
   1.545 +	TUint8 iName[2];
   1.546 +	};
   1.547 +
   1.548 +
   1.549 +
   1.550 +
   1.551 +/**
   1.552 +@publishedPartner
   1.553 +@released
   1.554 +
   1.555 +The size of the fixed part of a TRomEntry structure.
   1.556 +*/
   1.557 +const TInt KRomEntrySize=(sizeof(TRomEntry)-2);
   1.558 +
   1.559 +
   1.560 +
   1.561 +
   1.562 +//
   1.563 +class TRomDirSortInfo;
   1.564 +
   1.565 +/**
   1.566 +@publishedPartner
   1.567 +@released
   1.568 +
   1.569 +A structure that describes the first part of a ROM directory.
   1.570 +
   1.571 +This part of a ROM directory is a sequence of variable length entries,
   1.572 +each describing a file or a subdirectory, in the order that the members
   1.573 +were specified in the original obey file; the variable length entries are
   1.574 +the TRomEntry structures that follow the iSize member.
   1.575 +
   1.576 +This part of the ROM directory is followed by a structure defined
   1.577 +by TRomDirSortInfo, which contains a pair of sorted tables suitable for
   1.578 +a binary search.
   1.579 +
   1.580 +@see TRomDirSortInfo
   1.581 +*/
   1.582 +class TRomDir
   1.583 +	{
   1.584 +public:
   1.585 +	inline const TRomDirSortInfo* SortInfo() const;
   1.586 +	inline const TRomEntry* SortedEntry(TInt aIndex) const;
   1.587 +	inline TInt SubDirCount() const;
   1.588 +	inline TInt FileCount() const;
   1.589 +	inline TInt EntryCount() const;
   1.590 +	TInt BinarySearch(const TDesC& aName, TInt aLengthLimit, TInt aMode, TBool aDir) const;
   1.591 +	const TRomDir* FindLeafDir(const TDesC& aPath) const;
   1.592 +public:
   1.593 +
   1.594 +    /**
   1.595 +    The number of bytes occupied by the set of TRomEntry structures
   1.596 +    that follow this field.
   1.597 +    
   1.598 +    @see TRomDir::iEntry
   1.599 +    */
   1.600 +	TInt iSize;
   1.601 +
   1.602 +	
   1.603 +	/**
   1.604 +	A variable number of entries, each of which describes a file or a directory.
   1.605 +	
   1.606 +	Each entry is 4-byte aligned, and may have padding to ensure that the entry
   1.607 +	is 4-bye aligned.
   1.608 +	*/
   1.609 +	TRomEntry iEntry;
   1.610 +	};
   1.611 +
   1.612 +
   1.613 +
   1.614 +
   1.615 +/**
   1.616 +@publishedPartner
   1.617 +@released
   1.618 +
   1.619 +A structure that describes the second part of a ROM directory.
   1.620 +
   1.621 +It contains a pair of sorted tables suitable for
   1.622 +a binary search. The sorted tables contain unsigned 16-bit scaled offsets,
   1.623 +which point to the start of the corresponding TRomEntry in the TRomDir.
   1.624 +
   1.625 +@see TRomDir
   1.626 +*/
   1.627 +class TRomDirSortInfo
   1.628 +	{
   1.629 +public:
   1.630 +
   1.631 +	/**
   1.632 +    The number of subdirectories in this directory.
   1.633 +	*/
   1.634 +	TUint16	iSubDirCount;		// number of subdirectories in this directory
   1.635 +	
   1.636 +	
   1.637 +	/**
   1.638 +	The number of files in this directory.
   1.639 +	*/
   1.640 +	TUint16 iFileCount;			// number of non-directory files in this directory
   1.641 +	
   1.642 +	
   1.643 +	/**
   1.644 +	The two sorted tables:
   1.645 +	
   1.646 +	1. First one is a table of 16-bit scaled offsets to the directory entries.
   1.647 +	
   1.648 +	2. Second one is a table of 16-bit scaled ofsets to the file entries.
   1.649 +	   This table starts at offset 2*iSubDirCount from the start of the first table.
   1.650 +	   
   1.651 +	If the offset is X, then the corresponding TRomEntry is at address:
   1.652 +	@code
   1.653 +	4*X +(char*)address of the first TRomEntry
   1.654 +	@endcode
   1.655 +	For example, the first entry is at offset zero.
   1.656 +	
   1.657 +	The entries are sorted in the order of the UTF-8 representation of
   1.658 +	the names in a case insensitive way (compare the C function stricmp()).
   1.659 +	In effect, this folds upper and lowercase ASCII characters but leaves all
   1.660 +	other Unicode characters unchanged.
   1.661 +	*/
   1.662 +	TUint16 iEntryOffset[1];	// offsets of each entry from TRomDir::iEntry; extend
   1.663 +								// order of offsets is directories first, then files, lexicographic order within each group
   1.664 +	};
   1.665 +
   1.666 +
   1.667 +/**
   1.668 +Gets a pointer to the start of the second part of the ROM directory,
   1.669 +as described by the TRomDirSortInfo structure.
   1.670 +
   1.671 +@return The pointer to the start of the second part of the ROM directory.
   1.672 +*/
   1.673 +inline const TRomDirSortInfo* TRomDir::SortInfo() const
   1.674 +	{ return (const TRomDirSortInfo*)( ((TLinAddr)&iEntry) + ( (iSize+sizeof(TUint32)-1) &~ (sizeof(TUint32)-1) )); }
   1.675 +
   1.676 +
   1.677 +
   1.678 +
   1.679 +/**
   1.680 +Gets the TRomEntry corresponding to the file or directory located at
   1.681 +the specified index position within the sorted tables.
   1.682 +
   1.683 +@param aIndex The index of the entry within the sorted tables.
   1.684 +              Note that for the purpose of this function, the two tables
   1.685 +              are treated as one single table.
   1.686 +              
   1.687 +@return The required TRomEntry              
   1.688 +*/
   1.689 +inline const TRomEntry* TRomDir::SortedEntry(TInt aIndex) const
   1.690 +	{
   1.691 +	const TRomDirSortInfo* s = SortInfo();
   1.692 +	return (const TRomEntry*)(((TLinAddr)&iEntry) + s->iEntryOffset[aIndex] * sizeof(TUint32));
   1.693 +	}
   1.694 +
   1.695 +
   1.696 +
   1.697 +
   1.698 +/**
   1.699 +Gets the number of subdirectories in the directory.
   1.700 +
   1.701 +@return The number of subdirectories.
   1.702 +*/
   1.703 +inline TInt TRomDir::SubDirCount() const
   1.704 +	{ return SortInfo()->iSubDirCount; }
   1.705 +
   1.706 +	
   1.707 +	
   1.708 +	
   1.709 +/**
   1.710 +Gets the number of files in the directory.
   1.711 +
   1.712 +@return The number of files.
   1.713 +*/	
   1.714 +inline TInt TRomDir::FileCount() const
   1.715 +	{ return SortInfo()->iFileCount; }
   1.716 +
   1.717 +
   1.718 +
   1.719 +
   1.720 +/**
   1.721 +Gets the total number of files and subdirectories in the directory.
   1.722 +
   1.723 +@return The total number of files and subdirectories.
   1.724 +*/	
   1.725 +inline TInt TRomDir::EntryCount() const
   1.726 +	{
   1.727 +	const TRomDirSortInfo* s = SortInfo();
   1.728 +	return s->iSubDirCount + s->iFileCount;
   1.729 +	}
   1.730 +
   1.731 +
   1.732 +
   1.733 +
   1.734 +//
   1.735 +// Header of ROM image files under the new scheme. (dlls & exes)
   1.736 +//
   1.737 +/**
   1.738 +@publishedPartner
   1.739 +@released
   1.740 +*/
   1.741 +const TUint32 KRomImageFlagPrimary			=0x80000000u;
   1.742 +
   1.743 +/**
   1.744 +@publishedPartner
   1.745 +@released
   1.746 +*/
   1.747 +const TUint32 KRomImageFlagVariant			=0x40000000u;
   1.748 +
   1.749 +/**
   1.750 +@publishedPartner
   1.751 +@released
   1.752 +*/
   1.753 +const TUint32 KRomImageFlagExtension		=0x20000000u;
   1.754 +
   1.755 +/**
   1.756 +@publishedPartner
   1.757 +@released
   1.758 +*/
   1.759 +const TUint32 KRomImageFlagDevice			=0x10000000u;
   1.760 +
   1.761 +/**
   1.762 +@publishedPartner
   1.763 +@released
   1.764 +*/
   1.765 +const TUint32 KRomImageFlagsKernelMask		=0xf0000000u;
   1.766 +
   1.767 +/**
   1.768 +@publishedPartner
   1.769 +@released
   1.770 +*/
   1.771 +const TUint32 KRomImageFlagSecondary		=0x08000000u;
   1.772 +
   1.773 +/**
   1.774 +@publishedPartner
   1.775 +@released
   1.776 +*/
   1.777 +const TUint32 KRomImageFlagData				=0x04000000u;	// image has data and is not extension or variant
   1.778 +
   1.779 +/**
   1.780 +@publishedPartner
   1.781 +@released
   1.782 +*/
   1.783 +const TUint32 KRomImageFlagDataInit			=0x02000000u;	// image or non-EXE dependencies would require data initialisation
   1.784 +
   1.785 +/**
   1.786 +@publishedPartner
   1.787 +@released
   1.788 +*/
   1.789 +const TUint32 KRomImageFlagDataPresent		=0x01000000u;	// image or any dependencies have data
   1.790 +
   1.791 +/**
   1.792 +@publishedPartner
   1.793 +@released
   1.794 +*/
   1.795 +const TUint32 KRomImageFlagExeInTree		=0x00800000u;	// image depends on EXE
   1.796 +
   1.797 +/**
   1.798 +@publishedPartner
   1.799 +@released
   1.800 +*/
   1.801 +const TUint32 KRomImageFlagDll				=0x00000001u;
   1.802 +
   1.803 +/**
   1.804 +@publishedPartner
   1.805 +@released
   1.806 +*/
   1.807 +const TUint32 KRomImageFlagFixedAddressExe	=0x00000004u;
   1.808 +
   1.809 +/**
   1.810 +@publishedPartner
   1.811 +@released
   1.812 +*/
   1.813 +const TUint32 KRomImageABIMask				=0x00000018u;
   1.814 +
   1.815 +/**
   1.816 +@publishedPartner
   1.817 +@released
   1.818 +*/
   1.819 +const TUint32 KRomImageABI_GCC98r2			=0x00000000u;	// for ARM
   1.820 +
   1.821 +/**
   1.822 +@publishedPartner
   1.823 +@released
   1.824 +*/
   1.825 +const TUint32 KRomImageABI_EABI				=0x00000008u;	// for ARM
   1.826 +
   1.827 +/**
   1.828 +@publishedPartner
   1.829 +@released
   1.830 +*/
   1.831 +const TUint32 KRomImageEptMask				=0x000000e0u;	// entry point type
   1.832 +
   1.833 +/**
   1.834 +@publishedPartner
   1.835 +@released
   1.836 +*/
   1.837 +const TInt	  KRomImageEptShift				=5;
   1.838 +
   1.839 +/**
   1.840 +@publishedPartner
   1.841 +@released
   1.842 +*/
   1.843 +const TUint32 KRomImageEpt_Eka1				=0x00000000u;
   1.844 +
   1.845 +/**
   1.846 +@publishedPartner
   1.847 +@released
   1.848 +*/
   1.849 +const TUint32 KRomImageEpt_Eka2				=0x00000020u;
   1.850 +
   1.851 +/**
   1.852 +@internalTechnology
   1.853 +@released
   1.854 +*/
   1.855 +const TUint KRomImageFlagUnpaged			=0x00000100u;
   1.856 +
   1.857 +
   1.858 +/**
   1.859 +@internalTechnology
   1.860 +@released
   1.861 +*/
   1.862 +const TUint KRomImageFlagPaged				=0x00000200u;
   1.863 +
   1.864 +
   1.865 +/**
   1.866 +@internalTechnology
   1.867 +@released
   1.868 +Flag to indicate when named symbol export data present in image
   1.869 +*/
   1.870 +const TUint KRomImageNmdExpData				=0x00000400u;
   1.871 +
   1.872 +/**
   1.873 +@internalTechnology
   1.874 +@released
   1.875 +Flag to indicate debuggability of this image.
   1.876 +*/
   1.877 +const TUint KRomImageDebuggable			=0x00000800u;
   1.878 +
   1.879 +class TDllRefTable;
   1.880 +
   1.881 +/**
   1.882 +@publishedPartner
   1.883 +@released
   1.884 +
   1.885 +The format of the header for a ROM file image.
   1.886 +
   1.887 +The structure of a file image is based on the native image file format,
   1.888 +but this can be compressed in the ROM image, as the relocation information
   1.889 +and the .idata section are discarded once the file is fixed up.
   1.890 +
   1.891 +The Import Address Table (IAT) is also removed and each reference to
   1.892 +an IAT entry is converted into a reference to the associated Export Directory
   1.893 +entry in the corresponding DLL.
   1.894 +
   1.895 +ROM file images have the following sections:
   1.896 +
   1.897 +@code
   1.898 +The header (as described by this structure)
   1.899 +.text  - code
   1.900 +.rdata - constant (read-only) data
   1.901 +.edata - the export directory
   1.902 +.data  - initialised data that is copied to RAM when the executable runs.
   1.903 +The DLL reference table (a TDllRefTable structure), which is a list of DLLs
   1.904 +used by the executable.
   1.905 +@endcode
   1.906 +
   1.907 +@see TRomImageHeader::iDllRefTable
   1.908 +@see TDllRefTable
   1.909 +*/
   1.910 +class TRomImageHeader
   1.911 +	{
   1.912 +public:
   1.913 +
   1.914 +    /**
   1.915 +    The UID1 for the file.
   1.916 +    
   1.917 +    @see TUidType
   1.918 +    */
   1.919 +	TUint32	iUid1;
   1.920 +
   1.921 +	
   1.922 +    /**
   1.923 +    The UID2 for the file.
   1.924 +
   1.925 +    @see TUidType
   1.926 +    */
   1.927 +	TUint32	iUid2;
   1.928 +
   1.929 +	
   1.930 +    /**
   1.931 +    The UID3 for the file.
   1.932 +
   1.933 +    @see TUidType
   1.934 +    */
   1.935 +	TUint32	iUid3;
   1.936 +	
   1.937 +	
   1.938 +	/**
   1.939 +	The checksum of the UIDs
   1.940 +	*/
   1.941 +	TUint32	iUidChecksum;
   1.942 +	
   1.943 +	
   1.944 +	/**
   1.945 +	The entrypoint of this executable, i.e. the offset within this file.
   1.946 +	*/
   1.947 +	TUint32 iEntryPoint;
   1.948 +	
   1.949 +	
   1.950 +	/**
   1.951 +	This executables code address.
   1.952 +	*/
   1.953 +	TUint32 iCodeAddress;
   1.954 +
   1.955 +
   1.956 +	/**
   1.957 +	This executables data address.
   1.958 +	*/
   1.959 +	TUint32 iDataAddress;
   1.960 +
   1.961 +	
   1.962 +	/**
   1.963 +	The size of the code.
   1.964 +	
   1.965 +	This includes the size of the constant data.
   1.966 +	*/
   1.967 +	TInt iCodeSize;
   1.968 +	
   1.969 +	
   1.970 +	/**
   1.971 +	The size of the executable code.
   1.972 +	
   1.973 +	This is the value of (iCodeSize - the size of the constant data).
   1.974 +	*/
   1.975 +	TInt iTextSize;
   1.976 +	
   1.977 +	
   1.978 +	/**
   1.979 +	The data size.
   1.980 +	*/
   1.981 +	TInt iDataSize;
   1.982 +	
   1.983 +	
   1.984 +	/**
   1.985 +	The size of the .bss (the zero-filled data)
   1.986 +	*/
   1.987 +	TInt iBssSize;
   1.988 +	
   1.989 +	
   1.990 +	/**
   1.991 +	The minimum size of the heap.
   1.992 +	*/
   1.993 +	TInt iHeapSizeMin;
   1.994 +	
   1.995 +	
   1.996 +	/**
   1.997 +	The maximum size of the heap.
   1.998 +	*/
   1.999 +	TInt iHeapSizeMax;
  1.1000 +	
  1.1001 +	
  1.1002 +	/**
  1.1003 +	The size of the stack.
  1.1004 +	*/
  1.1005 +	TInt iStackSize;
  1.1006 +	
  1.1007 +	
  1.1008 +	/**
  1.1009 +	The address of the DLL reference table.
  1.1010 +	
  1.1011 +	@see TDllRefTable
  1.1012 +	*/
  1.1013 +	TDllRefTable* iDllRefTable;
  1.1014 +	
  1.1015 +	
  1.1016 +	/**
  1.1017 +	The number of functions exported by this executable.
  1.1018 +	*/
  1.1019 +	TInt iExportDirCount;
  1.1020 +	
  1.1021 +	
  1.1022 +	/**
  1.1023 +	The address of the export directory, which is a simple list of functions
  1.1024 +	that can be indexed by ordinal.
  1.1025 +	*/
  1.1026 +	TUint32 iExportDir;
  1.1027 +	
  1.1028 +	
  1.1029 +	/**
  1.1030 +	Security information, details of which are internal to Symbian.
  1.1031 +	*/
  1.1032 +	SSecurityInfo iS;
  1.1033 +	
  1.1034 +	
  1.1035 +	/**
  1.1036 +	The version number of the tools used to generate this file image.
  1.1037 +	*/
  1.1038 +	TVersion iToolsVersion;
  1.1039 +	
  1.1040 +	
  1.1041 +	/**
  1.1042 +	Flags field.
  1.1043 +	*/
  1.1044 +	TUint32 iFlags;
  1.1045 +	
  1.1046 +	
  1.1047 +	/**
  1.1048 +	The priority of the process.
  1.1049 +	*/
  1.1050 +	TProcessPriority iPriority;
  1.1051 +	
  1.1052 +	
  1.1053 +	/**
  1.1054 +	The virtual base address of the data and .bss, where the process expects
  1.1055 +	its data chunk to be when it runs.
  1.1056 +	*/
  1.1057 +	TUint32 iDataBssLinearBase;
  1.1058 +	
  1.1059 +	
  1.1060 +	/**
  1.1061 +	The address of the TRomEntry for the next extension file.
  1.1062 +	
  1.1063 +	This field is only used if there is more than one extension.
  1.1064 +	The first extension is found using the TRomHeader.
  1.1065 +	
  1.1066 +	@see TRomEntry
  1.1067 +	@see TRomHeader
  1.1068 +	*/
  1.1069 +	TLinAddr iNextExtension;
  1.1070 +	
  1.1071 +	
  1.1072 +	/**
  1.1073 +	A number denoting the hardware Variant.
  1.1074 +	
  1.1075 +	It is used to determine whether this executable can run
  1.1076 +	on a given system.
  1.1077 +	*/
  1.1078 +	TUint32 iHardwareVariant;
  1.1079 +	
  1.1080 +	
  1.1081 +	/**
  1.1082 +	The total data size, including space reserved for DLLs
  1.1083 +	*/
  1.1084 +	TInt iTotalDataSize;	// data+bss + space reserved for DLLs
  1.1085 +	
  1.1086 +	
  1.1087 +	/**
  1.1088 +	The module version.
  1.1089 +	*/
  1.1090 +	TUint32 iModuleVersion;
  1.1091 +
  1.1092 +	/**
  1.1093 +	The address of the Exception Descriptor if present.
  1.1094 +	0 if no Exception descriptor
  1.1095 +	*/
  1.1096 +	TLinAddr iExceptionDescriptor;
  1.1097 +	};	
  1.1098 +	
  1.1099 +	
  1.1100 +	
  1.1101 +	
  1.1102 +//
  1.1103 +// Header for extension ROMs
  1.1104 +// Equivalent to TRomHeader
  1.1105 +//
  1.1106 +
  1.1107 +/**
  1.1108 +@publishedPartner
  1.1109 +@released
  1.1110 +
  1.1111 +The format of a ROM extension header.
  1.1112 +*/
  1.1113 +class TExtensionRomHeader
  1.1114 +	{	
  1.1115 +public:
  1.1116 +    
  1.1117 +    /**
  1.1118 +    The extension ROM image version number.
  1.1119 +    */
  1.1120 +	TVersion iVersion;
  1.1121 +	
  1.1122 +	
  1.1123 +	/**
  1.1124 +	The virtual address of the base of the extension ROM.
  1.1125 +	*/
  1.1126 +	TLinAddr iRomBase;
  1.1127 +	
  1.1128 +	
  1.1129 +	/**
  1.1130 +	The size of the extension ROM image.
  1.1131 +	*/
  1.1132 +	TUint32 iRomSize;
  1.1133 +	
  1.1134 +	
  1.1135 +	/**
  1.1136 +	The virtual address of the TRomRootDirList structure for
  1.1137 +	the combined kernel+extension ROM image.
  1.1138 +	
  1.1139 +	@see TRomRootDirList
  1.1140 +	*/
  1.1141 +	TLinAddr iRomRootDirectoryList;
  1.1142 +	
  1.1143 +	
  1.1144 +	/**
  1.1145 +	The date and time that the extension ROM image was built, in microseconds.
  1.1146 +	*/
  1.1147 +	TInt64 iTime;
  1.1148 +	
  1.1149 +	
  1.1150 +	/**
  1.1151 +	The extension ROM image checksum
  1.1152 +	*/
  1.1153 +	TUint iCheckSum;
  1.1154 +
  1.1155 +
  1.1156 +	//
  1.1157 +	/**
  1.1158 +	Copy of the kernel ROM image version number.
  1.1159 +	*/
  1.1160 +	TVersion iKernelVersion;
  1.1161 +	
  1.1162 +	
  1.1163 +	/**
  1.1164 +	Copy of the kernel ROM image build date & time.
  1.1165 +	*/
  1.1166 +	TInt64 iKernelTime;
  1.1167 +	
  1.1168 +	
  1.1169 +	/**
  1.1170 +	Copy of the kernel ROM image checksum.
  1.1171 +	*/
  1.1172 +	TUint iKernelCheckSum;
  1.1173 +	//
  1.1174 +
  1.1175 +
  1.1176 +	/**
  1.1177 +	The type of compression used for the image.
  1.1178 +	
  1.1179 +	This is a UID, or 0 if there is no compression.
  1.1180 +	*/
  1.1181 +	TUint32 iCompressionType;	// compression type used
  1.1182 +	
  1.1183 +	
  1.1184 +	/**
  1.1185 +	The size of the image after compression.
  1.1186 +	*/
  1.1187 +	TUint32 iCompressedSize;	// Size after compression
  1.1188 +	
  1.1189 +	
  1.1190 +	/**
  1.1191 +	The size of the image before compression.
  1.1192 +	*/
  1.1193 +	TUint32 iUncompressedSize;	// Size before compression
  1.1194 +	
  1.1195 +	
  1.1196 +	/**
  1.1197 +	The virtual address of the TRomExceptionSearchTable structure.
  1.1198 +
  1.1199 +	@see TRomExceptionSearchTable
  1.1200 +	*/
  1.1201 +	TLinAddr iRomExceptionSearchTable;
  1.1202 +
  1.1203 +	
  1.1204 +	/**
  1.1205 +	Reserved for future use.
  1.1206 +	*/
  1.1207 +	TUint32 iPad[32-15]; // sizeof(TExtensionRomHeader)=128
  1.1208 +	};
  1.1209 +
  1.1210 +
  1.1211 +
  1.1212 +
  1.1213 +
  1.1214 +/**
  1.1215 +@publishedPartner
  1.1216 +@released
  1.1217 +
  1.1218 +A list of DLLs that an executable needs in order to run.
  1.1219 +
  1.1220 +Each DLL referenced in this list has a pointer to a TRomImageHeader structure
  1.1221 +that describes that DLL. This allows the DLL loader to search
  1.1222 +a dependency chain, and ensure that all required DLLs are loaded.
  1.1223 +
  1.1224 +@see TRomImageHeader
  1.1225 +*/
  1.1226 +class TDllRefTable
  1.1227 +	{
  1.1228 +public:
  1.1229 +
  1.1230 +    /**
  1.1231 +    Flags field.
  1.1232 +    */
  1.1233 +	TUint16 iFlags;
  1.1234 +	
  1.1235 +	
  1.1236 +	/**
  1.1237 +	The number of referenced DLLs in this list.
  1.1238 +	*/
  1.1239 +	TUint16 iNumberOfEntries;
  1.1240 +	
  1.1241 +	
  1.1242 +	/**
  1.1243 +	A set of pointers to the TRomImageHeader structures for each referenced DLL.
  1.1244 +	*/
  1.1245 +	TRomImageHeader* iEntry[1];
  1.1246 +	};
  1.1247 +
  1.1248 +#endif