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