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