sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\include\e32rom.h sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: #ifndef __E32ROM_H__ sl@0: #define __E32ROM_H__ sl@0: #include sl@0: #include sl@0: sl@0: // sl@0: sl@0: #ifndef __SECURITY_INFO_DEFINED__ sl@0: #define __SECURITY_INFO_DEFINED__ sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: //This struct must be identical in size and offset to the one in e32cmn.h sl@0: //Functions need not be duplicated. But must be same structurally. sl@0: struct SCapabilitySet sl@0: { sl@0: enum {ENCapW=2}; sl@0: TUint32 iCaps[ENCapW]; sl@0: inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; } sl@0: inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; } sl@0: }; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: //This struct must be identical in size and offset to the one in e32cmn.h sl@0: //Functions need not be duplicated. But must be same structurally. sl@0: struct SSecurityInfo sl@0: { sl@0: TUint32 iSecureId; sl@0: TUint32 iVendorId; sl@0: SCapabilitySet iCaps; sl@0: }; sl@0: #endif sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: struct SDemandPagingConfig sl@0: { sl@0: TUint16 iMinPages; sl@0: TUint16 iMaxPages; sl@0: TUint16 iYoungOldRatio; sl@0: TUint16 iSpare[3]; // iSpare[0:1] are used for emulated rom paging, sl@0: // iSpare[2] is used for the old to oldest ratio. sl@0: }; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: struct SRomPageInfo sl@0: { sl@0: enum TAttributes sl@0: { sl@0: EPageable = 1<<0 sl@0: }; sl@0: enum TCompression // todo: compression type not exclusive to rom pages sl@0: { sl@0: ENoCompression, sl@0: EBytePair, sl@0: }; sl@0: TUint32 iDataStart; sl@0: TUint16 iDataSize; sl@0: TUint8 iCompressionType; sl@0: TUint8 iPagingAttributes; sl@0: }; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Defines the size of the header for a ROM image. sl@0: sl@0: @see TRomHeader sl@0: */ sl@0: const TUint KRomHeaderSize=0x200; sl@0: // sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: The format of the header for a ROM image. sl@0: sl@0: This is retained as part of the ROM image. sl@0: It is generated by the rombuild tool, and is used by the Bootstrap and sl@0: the kernel. sl@0: */ sl@0: class TRomHeader sl@0: { sl@0: public: sl@0: enum { KDefaultDebugPort = -1 }; sl@0: enum { KNumTraceMask = 8 }; // this is also defined in e23const.h sl@0: sl@0: __ASSERT_COMPILE(KNumTraceMask==KNumTraceMaskWords); sl@0: sl@0: public: sl@0: /** sl@0: Reserved for a small amount of Bootstrap code, if required. sl@0: The first 4 bytes of the binary image typically contains sl@0: a branch instruction which jumps to code at offset 0x100. sl@0: */ sl@0: TUint8 iJump[124]; sl@0: sl@0: sl@0: /** sl@0: The restart vector. sl@0: */ sl@0: TLinAddr iRestartVector; sl@0: sl@0: sl@0: /** sl@0: The date and time that the ROM image was built, in microseconds. sl@0: */ sl@0: TInt64 iTime; sl@0: sl@0: sl@0: /** sl@0: The high order 32 bits of the ROM image build date & time. sl@0: */ sl@0: TUint32 iTimeHi; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the base of the ROM. sl@0: */ sl@0: TLinAddr iRomBase; sl@0: sl@0: sl@0: /** sl@0: The size of the ROM image, in bytes. sl@0: sl@0: This includes the second section for sectioned ROMs. sl@0: */ sl@0: TUint32 iRomSize; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the TRomRootDirectoryList structure. sl@0: sl@0: @see TRomRootDirectoryList sl@0: */ sl@0: TLinAddr iRomRootDirectoryList; sl@0: sl@0: sl@0: /** sl@0: The virtual address of kernel data, when in RAM. sl@0: */ sl@0: TLinAddr iKernDataAddress; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the top of the kernel region, when in RAM. sl@0: */ sl@0: TLinAddr iKernelLimit; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the primarys ROM file image header. sl@0: sl@0: @see TRomImageHeader sl@0: */ sl@0: TLinAddr iPrimaryFile; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the secondarys ROM file image header. sl@0: sl@0: @see TRomImageHeader sl@0: */ sl@0: TLinAddr iSecondaryFile; sl@0: sl@0: sl@0: /** sl@0: A computed constant that causes the 32-bit checksum of the image to equal sl@0: the value specified by the "romchecksum" keyword. sl@0: */ sl@0: TUint iCheckSum; sl@0: sl@0: sl@0: /** sl@0: A unique number identifying the hardware for which this ROM image sl@0: has been built. sl@0: sl@0: Note that this is only used for testing purposes. sl@0: */ sl@0: TUint32 iHardware; sl@0: sl@0: sl@0: /** sl@0: A bitmask identifying which of the languages are supported by the ROM image, sl@0: as specified by the "languages" keyword. sl@0: sl@0: Note that this is only used for testing purposes. sl@0: */ sl@0: TInt64 iLanguage; sl@0: sl@0: sl@0: /** sl@0: Contains the flags that define the security options in force. sl@0: sl@0: @see TKernelConfigFlags sl@0: */ sl@0: TUint32 iKernelConfigFlags; sl@0: sl@0: /** sl@0: The virtual address of the TRomExceptionSearchTable structure. sl@0: sl@0: @see TRomExceptionSearchTable sl@0: */ sl@0: TLinAddr iRomExceptionSearchTable; sl@0: sl@0: /** sl@0: Current size of ROM header (Previously iUnused3) sl@0: If value is 0x69966996 then header size = 0x100 sl@0: */ sl@0: TUint32 iRomHeaderSize; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the ROM section header, if the ROM is sectioned. sl@0: sl@0: @see TRomSectionHeader sl@0: */ sl@0: TLinAddr iRomSectionHeader; sl@0: sl@0: sl@0: /** sl@0: The total supervisor data size, i.e. the amount of memory mapped for sl@0: the kernel data chunk. sl@0: */ sl@0: TInt iTotalSvDataSize; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the TRomEntry for the Variant file. sl@0: sl@0: @see TRomEntry sl@0: */ sl@0: TLinAddr iVariantFile; sl@0: sl@0: sl@0: /** sl@0: The virtual address of TRomEntry for the first extension file, if it exists. sl@0: sl@0: If there is more than one extension, then the next extension field in sl@0: the extensions TRomImageHeader points to the TRomEntry for sl@0: that next extension. sl@0: sl@0: @see TRomImageHeader::iNextExtension sl@0: @see TRomImageHeader sl@0: @see TRomEntry sl@0: */ sl@0: TLinAddr iExtensionFile; sl@0: sl@0: sl@0: /** sl@0: The virtual adress of the first area to be relocated into RAM, as defined sl@0: using the "area" keyword. sl@0: */ sl@0: TLinAddr iRelocInfo; sl@0: sl@0: sl@0: /** sl@0: The old position of the kernel trace mask, see iTraceMask below sl@0: */ sl@0: TUint32 iOldTraceMask; // The old location of the kernel tracemask sl@0: sl@0: sl@0: /** sl@0: The virtual address of the user data area. sl@0: */ sl@0: TLinAddr iUserDataAddress; // non-MMU stuff sl@0: sl@0: sl@0: /** sl@0: The total size of the user data. sl@0: */ sl@0: TInt iTotalUserDataSize; // non-MMU stuff sl@0: sl@0: sl@0: /** sl@0: A value that is interpreted by the Bootstrap and kernel as the debug port sl@0: to be used. sl@0: */ sl@0: TUint32 iDebugPort; // semantic is ASSP-specific sl@0: sl@0: sl@0: /** sl@0: The ROM version number. sl@0: */ sl@0: TVersion iVersion; sl@0: sl@0: sl@0: /** sl@0: The type of compression used for the image. sl@0: sl@0: This is a UID, or 0 if there is no compression. sl@0: */ sl@0: TUint32 iCompressionType; // compression type used sl@0: sl@0: sl@0: /** sl@0: The size of the image after compression. sl@0: */ sl@0: TUint32 iCompressedSize; // Size after compression sl@0: sl@0: sl@0: /** sl@0: The size of the image before compression. sl@0: */ sl@0: TUint32 iUncompressedSize; // Size before compression sl@0: sl@0: sl@0: /** sl@0: */ sl@0: TUint32 iDisabledCapabilities[2]; // 2==SSecurityInfo::ENCapW sl@0: sl@0: sl@0: /** sl@0: The initial value for the kernel trace masks. sl@0: */ sl@0: TUint32 iTraceMask[KNumTraceMask]; // The kernel debug trace masks sl@0: sl@0: /** sl@0: Initial values for fast-trace filter. sl@0: */ sl@0: TUint32 iInitialBTraceFilter[8]; sl@0: sl@0: /** sl@0: Initial value for size of fast-trace buffer. sl@0: */ sl@0: TInt iInitialBTraceBuffer; sl@0: sl@0: /** sl@0: Initial value for size of fast-trace mode. sl@0: */ sl@0: TInt iInitialBTraceMode; sl@0: sl@0: /** sl@0: Offset, in bytes from ROM start, for the start of the pageable ROM area. sl@0: */ sl@0: TInt iPageableRomStart; sl@0: sl@0: /** sl@0: Size, in bytes, of the pageable ROM area. sl@0: */ sl@0: TInt iPageableRomSize; sl@0: sl@0: /** sl@0: Offset, in bytes from ROM start, for the page index. (Array of SRomPageInfo objects.) sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: TInt iRomPageIndex; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: SDemandPagingConfig iDemandPagingConfig; sl@0: sl@0: /** sl@0: Offset, in bytes from ROM start, for the start of compressed un-paged ROM area sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: TUint32 iCompressedUnpagedStart; sl@0: sl@0: sl@0: /** sl@0: Size, in bytes of the un-paged part of image after compression. sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: TUint32 iUnpagedCompressedSize; sl@0: sl@0: sl@0: /** sl@0: Size, in bytes of the un-paged part of image before compression. sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: TUint32 iUnpagedUncompressedSize; sl@0: sl@0: /** sl@0: The virtual address at which the start of the HCR repository file is located in the unpaged part of the Core ROM Image. sl@0: @internalTechnology sl@0: @prototype sl@0: */ sl@0: TUint32 iHcrFileAddress; sl@0: sl@0: /** sl@0: @internalComponent sl@0: */ sl@0: TUint32 iSpare[36]; // spare : force size to be correct sl@0: sl@0: }; sl@0: sl@0: __ASSERT_COMPILE(sizeof(TRomHeader)==KRomHeaderSize); sl@0: __ASSERT_COMPILE(SCapabilitySet::ENCapW==2); // TRomHeader::iDisabledCapabilities has hard coded 2 because h2inc.pl does not parse scoped identifiers sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: Contains information about a root directory. sl@0: sl@0: A variable number of these are contained in a TRomRootDirectoryList structure. sl@0: sl@0: @see TRomRootDirectoryList sl@0: */ sl@0: class TRootDirInfo sl@0: { sl@0: public: sl@0: /** sl@0: The hardware variant for this root directory entry. sl@0: */ sl@0: TUint iHardwareVariant; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the root directory. sl@0: sl@0: @see TRomDir sl@0: */ sl@0: TLinAddr iAddressLin; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A structure that allows you to find the root directories for each hardware sl@0: Variant supported by the ROM. sl@0: sl@0: Usually, there is only one Variant and one root directory. However, a ROM can sl@0: have multiple root directories and directory trees, one for each hardware Variant sl@0: supported by the ROM. This ensures that the file server only sees the files sl@0: that are relevant to the hardware on which it is running. In this case, there sl@0: are multiple entries in the table describing each root directory. sl@0: */ sl@0: class TRomRootDirectoryList sl@0: { sl@0: public: sl@0: /** sl@0: The number of root directory entries. sl@0: */ sl@0: TInt iNumRootDirs; sl@0: sl@0: sl@0: /** sl@0: The root directory entries. sl@0: sl@0: The number of entries is defined by iNumRootDirs. sl@0: */ sl@0: TRootDirInfo iRootDir[1]; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: The format of a ROM section header. sl@0: */ sl@0: class TRomSectionHeader sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: The ROM version number. sl@0: */ sl@0: TVersion iVersion; sl@0: sl@0: sl@0: /** sl@0: A computed constant that causes the 32-bit checksum of the upper sl@0: section to equal zero. sl@0: sl@0: Upper sections checksum to zero so that the overall ROM checksum in sl@0: the TRomHeader is unaffected by changes to this section. sl@0: sl@0: @see TRomHeader sl@0: */ sl@0: TUint iCheckSum; sl@0: sl@0: sl@0: /** sl@0: The date and time that the ROM image was built, in microseconds. sl@0: */ sl@0: TInt64 iTime; sl@0: sl@0: sl@0: /** sl@0: A bitmask identifying which of the languages are supported by the ROM image, sl@0: as specified by the "languages" keyword. sl@0: */ sl@0: TInt64 iLanguage; sl@0: }; sl@0: // sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A structure that describes a file or a directory. sl@0: */ sl@0: class TRomEntry sl@0: { sl@0: public: sl@0: sl@0: sl@0: /** sl@0: The size of the file. sl@0: */ sl@0: TInt iSize; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the file, or of a TRomDir structure if this entry sl@0: describes another directory. sl@0: sl@0: @see TRomDir sl@0: */ sl@0: TUint32 iAddressLin; sl@0: sl@0: sl@0: /** sl@0: Attributes. sl@0: */ sl@0: TUint8 iAtt; sl@0: sl@0: sl@0: /** sl@0: The length of the file or directory name. sl@0: */ sl@0: TUint8 iNameLength; sl@0: sl@0: sl@0: /** sl@0: A variable length field containing the file or directory name. sl@0: */ sl@0: TUint8 iName[2]; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: The size of the fixed part of a TRomEntry structure. sl@0: */ sl@0: const TInt KRomEntrySize=(sizeof(TRomEntry)-2); sl@0: sl@0: sl@0: sl@0: sl@0: // sl@0: class TRomDirSortInfo; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A structure that describes the first part of a ROM directory. sl@0: sl@0: This part of a ROM directory is a sequence of variable length entries, sl@0: each describing a file or a subdirectory, in the order that the members sl@0: were specified in the original obey file; the variable length entries are sl@0: the TRomEntry structures that follow the iSize member. sl@0: sl@0: This part of the ROM directory is followed by a structure defined sl@0: by TRomDirSortInfo, which contains a pair of sorted tables suitable for sl@0: a binary search. sl@0: sl@0: @see TRomDirSortInfo sl@0: */ sl@0: class TRomDir sl@0: { sl@0: public: sl@0: inline const TRomDirSortInfo* SortInfo() const; sl@0: inline const TRomEntry* SortedEntry(TInt aIndex) const; sl@0: inline TInt SubDirCount() const; sl@0: inline TInt FileCount() const; sl@0: inline TInt EntryCount() const; sl@0: TInt BinarySearch(const TDesC& aName, TInt aLengthLimit, TInt aMode, TBool aDir) const; sl@0: const TRomDir* FindLeafDir(const TDesC& aPath) const; sl@0: public: sl@0: sl@0: /** sl@0: The number of bytes occupied by the set of TRomEntry structures sl@0: that follow this field. sl@0: sl@0: @see TRomDir::iEntry sl@0: */ sl@0: TInt iSize; sl@0: sl@0: sl@0: /** sl@0: A variable number of entries, each of which describes a file or a directory. sl@0: sl@0: Each entry is 4-byte aligned, and may have padding to ensure that the entry sl@0: is 4-bye aligned. sl@0: */ sl@0: TRomEntry iEntry; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A structure that describes the second part of a ROM directory. sl@0: sl@0: It contains a pair of sorted tables suitable for sl@0: a binary search. The sorted tables contain unsigned 16-bit scaled offsets, sl@0: which point to the start of the corresponding TRomEntry in the TRomDir. sl@0: sl@0: @see TRomDir sl@0: */ sl@0: class TRomDirSortInfo sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: The number of subdirectories in this directory. sl@0: */ sl@0: TUint16 iSubDirCount; // number of subdirectories in this directory sl@0: sl@0: sl@0: /** sl@0: The number of files in this directory. sl@0: */ sl@0: TUint16 iFileCount; // number of non-directory files in this directory sl@0: sl@0: sl@0: /** sl@0: The two sorted tables: sl@0: sl@0: 1. First one is a table of 16-bit scaled offsets to the directory entries. sl@0: sl@0: 2. Second one is a table of 16-bit scaled ofsets to the file entries. sl@0: This table starts at offset 2*iSubDirCount from the start of the first table. sl@0: sl@0: If the offset is X, then the corresponding TRomEntry is at address: sl@0: @code sl@0: 4*X +(char*)address of the first TRomEntry sl@0: @endcode sl@0: For example, the first entry is at offset zero. sl@0: sl@0: The entries are sorted in the order of the UTF-8 representation of sl@0: the names in a case insensitive way (compare the C function stricmp()). sl@0: In effect, this folds upper and lowercase ASCII characters but leaves all sl@0: other Unicode characters unchanged. sl@0: */ sl@0: TUint16 iEntryOffset[1]; // offsets of each entry from TRomDir::iEntry; extend sl@0: // order of offsets is directories first, then files, lexicographic order within each group sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Gets a pointer to the start of the second part of the ROM directory, sl@0: as described by the TRomDirSortInfo structure. sl@0: sl@0: @return The pointer to the start of the second part of the ROM directory. sl@0: */ sl@0: inline const TRomDirSortInfo* TRomDir::SortInfo() const sl@0: { return (const TRomDirSortInfo*)( ((TLinAddr)&iEntry) + ( (iSize+sizeof(TUint32)-1) &~ (sizeof(TUint32)-1) )); } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the TRomEntry corresponding to the file or directory located at sl@0: the specified index position within the sorted tables. sl@0: sl@0: @param aIndex The index of the entry within the sorted tables. sl@0: Note that for the purpose of this function, the two tables sl@0: are treated as one single table. sl@0: sl@0: @return The required TRomEntry sl@0: */ sl@0: inline const TRomEntry* TRomDir::SortedEntry(TInt aIndex) const sl@0: { sl@0: const TRomDirSortInfo* s = SortInfo(); sl@0: return (const TRomEntry*)(((TLinAddr)&iEntry) + s->iEntryOffset[aIndex] * sizeof(TUint32)); sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the number of subdirectories in the directory. sl@0: sl@0: @return The number of subdirectories. sl@0: */ sl@0: inline TInt TRomDir::SubDirCount() const sl@0: { return SortInfo()->iSubDirCount; } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the number of files in the directory. sl@0: sl@0: @return The number of files. sl@0: */ sl@0: inline TInt TRomDir::FileCount() const sl@0: { return SortInfo()->iFileCount; } sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: Gets the total number of files and subdirectories in the directory. sl@0: sl@0: @return The total number of files and subdirectories. sl@0: */ sl@0: inline TInt TRomDir::EntryCount() const sl@0: { sl@0: const TRomDirSortInfo* s = SortInfo(); sl@0: return s->iSubDirCount + s->iFileCount; sl@0: } sl@0: sl@0: sl@0: sl@0: sl@0: // sl@0: // Header of ROM image files under the new scheme. (dlls & exes) sl@0: // sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagPrimary =0x80000000u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagVariant =0x40000000u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagExtension =0x20000000u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagDevice =0x10000000u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagsKernelMask =0xf0000000u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagSecondary =0x08000000u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagData =0x04000000u; // image has data and is not extension or variant sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagDataInit =0x02000000u; // image or non-EXE dependencies would require data initialisation sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagDataPresent =0x01000000u; // image or any dependencies have data sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagExeInTree =0x00800000u; // image depends on EXE sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagDll =0x00000001u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageFlagFixedAddressExe =0x00000004u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageABIMask =0x00000018u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageABI_GCC98r2 =0x00000000u; // for ARM sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageABI_EABI =0x00000008u; // for ARM sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageEptMask =0x000000e0u; // entry point type sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TInt KRomImageEptShift =5; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageEpt_Eka1 =0x00000000u; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: const TUint32 KRomImageEpt_Eka2 =0x00000020u; sl@0: sl@0: /** sl@0: Flag to indicate the image should not be code paged. sl@0: @internalTechnology sl@0: @released sl@0: */ sl@0: const TUint KRomImageFlagCodeUnpaged =0x00000100u; sl@0: sl@0: sl@0: /** sl@0: Flag to indicate the image should be code paged. sl@0: @internalTechnology sl@0: @released sl@0: */ sl@0: const TUint KRomImageFlagCodePaged =0x00000200u; sl@0: sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @released sl@0: Flag to indicate when named symbol export data present in image sl@0: */ sl@0: const TUint KRomImageNmdExpData =0x00000400u; sl@0: sl@0: /** sl@0: @internalTechnology sl@0: @released sl@0: Flag to indicate debuggability of this image. sl@0: */ sl@0: const TUint KRomImageDebuggable =0x00000800u; sl@0: sl@0: /** sl@0: Flag to indicate the image will default to not be data paged, sl@0: this can be overridden when creating chunks, threads and user heaps. sl@0: @internalTechnology sl@0: @released sl@0: */ sl@0: const TUint KRomImageFlagDataUnpaged = 0x00001000u; sl@0: sl@0: /** sl@0: Flag to indicate the image will default to be data paged, sl@0: this can be overridden when creating chunks, threads and user heaps. sl@0: @internalTechnology sl@0: @released sl@0: */ sl@0: const TUint KRomImageFlagDataPaged = 0x00002000u; sl@0: sl@0: /** sl@0: Mask for the data paging flag bits. sl@0: @internalTechnology sl@0: @released sl@0: */ sl@0: const TUint KRomImageDataPagingMask = KRomImageFlagDataUnpaged | KRomImageFlagDataPaged; sl@0: sl@0: /** sl@0: @released sl@0: Flag to indicate SMP safety of this image. sl@0: */ sl@0: const TUint KRomImageSMPSafe =0x00004000u; sl@0: sl@0: class TDllRefTable; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: The format of the header for a ROM file image. sl@0: sl@0: The structure of a file image is based on the native image file format, sl@0: but this can be compressed in the ROM image, as the relocation information sl@0: and the .idata section are discarded once the file is fixed up. sl@0: sl@0: The Import Address Table (IAT) is also removed and each reference to sl@0: an IAT entry is converted into a reference to the associated Export Directory sl@0: entry in the corresponding DLL. sl@0: sl@0: ROM file images have the following sections: sl@0: sl@0: @code sl@0: The header (as described by this structure) sl@0: .text - code sl@0: .rdata - constant (read-only) data sl@0: .edata - the export directory sl@0: .data - initialised data that is copied to RAM when the executable runs. sl@0: The DLL reference table (a TDllRefTable structure), which is a list of DLLs sl@0: used by the executable. sl@0: @endcode sl@0: sl@0: @see TRomImageHeader::iDllRefTable sl@0: @see TDllRefTable sl@0: */ sl@0: class TRomImageHeader sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: The UID1 for the file. sl@0: sl@0: @see TUidType sl@0: */ sl@0: TUint32 iUid1; sl@0: sl@0: sl@0: /** sl@0: The UID2 for the file. sl@0: sl@0: @see TUidType sl@0: */ sl@0: TUint32 iUid2; sl@0: sl@0: sl@0: /** sl@0: The UID3 for the file. sl@0: sl@0: @see TUidType sl@0: */ sl@0: TUint32 iUid3; sl@0: sl@0: sl@0: /** sl@0: The checksum of the UIDs sl@0: */ sl@0: TUint32 iUidChecksum; sl@0: sl@0: sl@0: /** sl@0: The entrypoint of this executable, i.e. the offset within this file. sl@0: */ sl@0: TUint32 iEntryPoint; sl@0: sl@0: sl@0: /** sl@0: This executables code address. sl@0: */ sl@0: TUint32 iCodeAddress; sl@0: sl@0: sl@0: /** sl@0: This executables data address. sl@0: */ sl@0: TUint32 iDataAddress; sl@0: sl@0: sl@0: /** sl@0: The size of the code. sl@0: sl@0: This includes the size of the constant data. sl@0: */ sl@0: TInt iCodeSize; sl@0: sl@0: sl@0: /** sl@0: The size of the executable code. sl@0: sl@0: This is the value of (iCodeSize - the size of the constant data). sl@0: */ sl@0: TInt iTextSize; sl@0: sl@0: sl@0: /** sl@0: The data size. sl@0: */ sl@0: TInt iDataSize; sl@0: sl@0: sl@0: /** sl@0: The size of the .bss (the zero-filled data) sl@0: */ sl@0: TInt iBssSize; sl@0: sl@0: sl@0: /** sl@0: The minimum size of the heap. sl@0: */ sl@0: TInt iHeapSizeMin; sl@0: sl@0: sl@0: /** sl@0: The maximum size of the heap. sl@0: */ sl@0: TInt iHeapSizeMax; sl@0: sl@0: sl@0: /** sl@0: The size of the stack. sl@0: */ sl@0: TInt iStackSize; sl@0: sl@0: sl@0: /** sl@0: The address of the DLL reference table. sl@0: sl@0: @see TDllRefTable sl@0: */ sl@0: TDllRefTable* iDllRefTable; sl@0: sl@0: sl@0: /** sl@0: The number of functions exported by this executable. sl@0: */ sl@0: TInt iExportDirCount; sl@0: sl@0: sl@0: /** sl@0: The address of the export directory, which is a simple list of functions sl@0: that can be indexed by ordinal. sl@0: */ sl@0: TUint32 iExportDir; sl@0: sl@0: sl@0: /** sl@0: Security information, details of which are internal to Symbian. sl@0: */ sl@0: SSecurityInfo iS; sl@0: sl@0: sl@0: /** sl@0: The version number of the tools used to generate this file image. sl@0: */ sl@0: TVersion iToolsVersion; sl@0: sl@0: sl@0: /** sl@0: Flags field. sl@0: */ sl@0: TUint32 iFlags; sl@0: sl@0: sl@0: /** sl@0: The priority of the process. sl@0: */ sl@0: TProcessPriority iPriority; sl@0: sl@0: sl@0: /** sl@0: The virtual base address of the data and .bss, where the process expects sl@0: its data chunk to be when it runs. sl@0: */ sl@0: TUint32 iDataBssLinearBase; sl@0: sl@0: sl@0: /** sl@0: The address of the TRomEntry for the next extension file. sl@0: sl@0: This field is only used if there is more than one extension. sl@0: The first extension is found using the TRomHeader. sl@0: sl@0: @see TRomEntry sl@0: @see TRomHeader sl@0: */ sl@0: TLinAddr iNextExtension; sl@0: sl@0: sl@0: /** sl@0: A number denoting the hardware Variant. sl@0: sl@0: It is used to determine whether this executable can run sl@0: on a given system. sl@0: */ sl@0: TUint32 iHardwareVariant; sl@0: sl@0: sl@0: /** sl@0: The total data size, including space reserved for DLLs sl@0: */ sl@0: TInt iTotalDataSize; // data+bss + space reserved for DLLs sl@0: sl@0: sl@0: /** sl@0: The module version. sl@0: */ sl@0: TUint32 iModuleVersion; sl@0: sl@0: /** sl@0: The address of the Exception Descriptor if present. sl@0: 0 if no Exception descriptor sl@0: */ sl@0: TLinAddr iExceptionDescriptor; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: // sl@0: // Header for extension ROMs sl@0: // Equivalent to TRomHeader sl@0: // sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: The format of a ROM extension header. sl@0: */ sl@0: class TExtensionRomHeader sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: The extension ROM image version number. sl@0: */ sl@0: TVersion iVersion; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the base of the extension ROM. sl@0: */ sl@0: TLinAddr iRomBase; sl@0: sl@0: sl@0: /** sl@0: The size of the extension ROM image. sl@0: */ sl@0: TUint32 iRomSize; sl@0: sl@0: sl@0: /** sl@0: The virtual address of the TRomRootDirList structure for sl@0: the combined kernel+extension ROM image. sl@0: sl@0: @see TRomRootDirList sl@0: */ sl@0: TLinAddr iRomRootDirectoryList; sl@0: sl@0: sl@0: /** sl@0: The date and time that the extension ROM image was built, in microseconds. sl@0: */ sl@0: TInt64 iTime; sl@0: sl@0: sl@0: /** sl@0: The extension ROM image checksum sl@0: */ sl@0: TUint iCheckSum; sl@0: sl@0: sl@0: // sl@0: /** sl@0: Copy of the kernel ROM image version number. sl@0: */ sl@0: TVersion iKernelVersion; sl@0: sl@0: sl@0: /** sl@0: Copy of the kernel ROM image build date & time. sl@0: */ sl@0: TInt64 iKernelTime; sl@0: sl@0: sl@0: /** sl@0: Copy of the kernel ROM image checksum. sl@0: */ sl@0: TUint iKernelCheckSum; sl@0: // sl@0: sl@0: sl@0: /** sl@0: The type of compression used for the image. sl@0: sl@0: This is a UID, or 0 if there is no compression. sl@0: */ sl@0: TUint32 iCompressionType; // compression type used sl@0: sl@0: sl@0: /** sl@0: The size of the image after compression. sl@0: */ sl@0: TUint32 iCompressedSize; // Size after compression sl@0: sl@0: sl@0: /** sl@0: The size of the image before compression. sl@0: */ sl@0: TUint32 iUncompressedSize; // Size before compression sl@0: sl@0: sl@0: /** sl@0: The virtual address of the TRomExceptionSearchTable structure. sl@0: sl@0: @see TRomExceptionSearchTable sl@0: */ sl@0: TLinAddr iRomExceptionSearchTable; sl@0: sl@0: sl@0: /** sl@0: Reserved for future use. sl@0: */ sl@0: TUint32 iPad[32-15]; // sizeof(TExtensionRomHeader)=128 sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @released sl@0: sl@0: A list of DLLs that an executable needs in order to run. sl@0: sl@0: Each DLL referenced in this list has a pointer to a TRomImageHeader structure sl@0: that describes that DLL. This allows the DLL loader to search sl@0: a dependency chain, and ensure that all required DLLs are loaded. sl@0: sl@0: @see TRomImageHeader sl@0: */ sl@0: class TDllRefTable sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Flags field. sl@0: */ sl@0: TUint16 iFlags; sl@0: sl@0: sl@0: /** sl@0: The number of referenced DLLs in this list. sl@0: */ sl@0: TUint16 iNumberOfEntries; sl@0: sl@0: sl@0: /** sl@0: A set of pointers to the TRomImageHeader structures for each referenced DLL. sl@0: */ sl@0: TRomImageHeader* iEntry[1]; sl@0: }; sl@0: sl@0: #endif sl@0: