epoc32/include/e32ldr.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
     1.1 --- a/epoc32/include/e32ldr.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/e32ldr.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,9 +1,9 @@
     1.4  // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5  // All rights reserved.
     1.6  // This component and the accompanying materials are made available
     1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// under the terms of the License "Eclipse Public License v1.0"
     1.9  // which accompanies this distribution, and is available
    1.10 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12  //
    1.13  // Initial Contributors:
    1.14  // Nokia Corporation - initial contribution.
    1.15 @@ -13,10 +13,11 @@
    1.16  // Description:
    1.17  // e32\include\e32ldr.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 -
    1.25 -
    1.26  /**
    1.27   @file
    1.28   @internalTechnology
    1.29 @@ -26,118 +27,27 @@
    1.30  #define __E32LDR_H__
    1.31  #include <e32cmn.h>
    1.32  
    1.33 -const TInt KMaxLibraryEntryPoints=0x100;
    1.34  
    1.35 -//
    1.36 -// Loader version number.
    1.37 -//
    1.38 -const TInt KLoaderMajorVersionNumber=1;
    1.39 -const TInt KLoaderMinorVersionNumber=0;
    1.40 +/**
    1.41 +	@internalTechnology
    1.42  
    1.43 -//
    1.44 -// IPC messages to the loader
    1.45 -//
    1.46 -enum TLoaderMsg
    1.47 -	{
    1.48 -	ELoadProcess=1,
    1.49 -	ELoadLibrary=2,
    1.50 -	ELoadLogicalDevice=3,
    1.51 -	ELoadPhysicalDevice=4,
    1.52 -	ELoadLocale=5,
    1.53 -	ELoadFileSystem=6,
    1.54 -	EGetInfo=7,
    1.55 -	ELoaderDebugFunction=8,
    1.56 -	ELoadFSExtension=9,
    1.57 -	EGetInfoFromHeader=10,
    1.58 -	ELoadFSPlugin=11,
    1.59 -	ELoaderCancelLazyDllUnload=12,
    1.60 -	ELdrDelete=13,
    1.61 -	ECheckLibraryHash=14, 
    1.62 -    
    1.63 -    EMaxLoaderMsg
    1.64 -	};
    1.65 -//
    1.66 -// Loader message arguments:
    1.67 -//		0 = TLdrInfo
    1.68 -//		1 = Filename
    1.69 -//		2 = Command line (process) or path (library)
    1.70 -//
    1.71 -class TLdrInfo
    1.72 -	{
    1.73 -public:
    1.74 -	IMPORT_C TLdrInfo();		// for BC
    1.75 -public:
    1.76 -	TUidType iRequestedUids;
    1.77 -	TOwnerType iOwnerType;
    1.78 -	TInt iHandle;
    1.79 -	TUint32 iSecureId;
    1.80 -	TUint32 iRequestedVersion;
    1.81 -	TInt iMinStackSize;			// CR0885 
    1.82 -	};
    1.83 -	
    1.84 -
    1.85 -#ifndef __KERNEL_MODE__
    1.86 -#include <e32std.h>
    1.87 -//
    1.88 -// Loader client class
    1.89 -//
    1.90 -class RLoader : public RSessionBase
    1.91 -	{
    1.92 -public:
    1.93 -	IMPORT_C TInt Connect();
    1.94 -	TVersion Version() const;
    1.95 -	TInt LoadProcess(TInt& aHandle, const TDesC& aFileName, const TDesC& aCommand, const TUidType& aUidType, TOwnerType aType);
    1.96 -	IMPORT_C TInt LoadLibrary(TInt& aHandle, const TDesC& aFileName, const TDesC& aPath, const TUidType& aType, TUint32 aModuleVersion);
    1.97 -	IMPORT_C TInt GetInfo(const TDesC& aFileName, TDes8& aInfoBuf);
    1.98 -	TInt LoadDeviceDriver(const TDesC& aFileName, TInt aDeviceType);
    1.99 -	IMPORT_C TInt DebugFunction(TInt aFunction, TInt a1, TInt a2, TInt a3);
   1.100 -	TInt LoadLocale(const TDesC& aLocaleDllName, TLibraryFunction* aExportList);
   1.101 -	TInt GetInfoFromHeader(const TDesC8& aHeader, TDes8& aInfoBuf);
   1.102 -	IMPORT_C TInt CancelLazyDllUnload();
   1.103 -	IMPORT_C TInt Delete(const TDesC& aFileName);
   1.104 -    IMPORT_C TInt CheckLibraryHash(const TDesC& aFileName, TBool aValidateHash=EFalse);
   1.105 -	TInt LoadProcess(TInt& aHandle, const TDesC& aFileName, const TDesC& aCommand, const TUidType& aUidType, TInt aMinStackSize, TOwnerType aType);
   1.106 -public:
   1.107 -#ifdef __ARMCC__
   1.108 -	// workaround for possible EDG bug (!!)
   1.109 -	inline TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const
   1.110 -	  { return RSessionBase::SendReceive(aFunction, aArgs); }
   1.111 -#else
   1.112 -	using RSessionBase::SendReceive;
   1.113 -#endif
   1.114 -	};
   1.115 -#endif
   1.116 -
   1.117 -//
   1.118 -// Information required to create a new code segment
   1.119 -//
   1.120 -enum TCodeSegAttributes
   1.121 -	{
   1.122 -	ECodeSegAttKernel	=0x00000001,
   1.123 -	ECodeSegAttGlobal	=0x00000002,
   1.124 -	ECodeSegAttFixed	=0x00000004,
   1.125 -	ECodeSegAttABIMask	=0x00000018,	  // same values as in image header
   1.126 -	ECodeSegAttPaged	=0x00000200,	  // the code seg is demand paged
   1.127 -	ECodeSegAttHDll		=(TInt)0x80000000,// Emulator host file type: 1=DLL, 0=EXE
   1.128 -	ECodeSegAttExpVer	=0x40000000,	  // Filename is explicitly versioned
   1.129 -	ECodeSegAttNmdExpData=0x20000000	  // Named symbol export data in code seg
   1.130 -	};
   1.131 -
   1.132 -class TBlockMapEntryBase
   1.133 -/**
   1.134  	Where sections of a file are located on the media.
   1.135  	The kernel uses this to load in parts of a demand paged file.
   1.136   */
   1.137 +class TBlockMapEntryBase
   1.138  	{
   1.139  public:
   1.140  	TUint iNumberOfBlocks;  // Number of contiguous blocks in map.
   1.141  	TUint iStartBlock;		// Number for first block in the map.
   1.142  	};
   1.143  
   1.144 -struct SBlockMapInfoBase
   1.145 +
   1.146  /**
   1.147 +	@internalTechnology
   1.148 +
   1.149  	Describes context for TBlockMapEntryBase objects.
   1.150   */
   1.151 +struct SBlockMapInfoBase
   1.152  	{
   1.153  	TUint iBlockGranularity;	// Size of a block in bytes.
   1.154  	TUint iBlockStartOffset;	// Offset to start of the file or requested file position within a block.
   1.155 @@ -145,259 +55,10 @@
   1.156  	TInt iLocalDriveNumber;		// Local drive number of where the file lies on.
   1.157  	};
   1.158  
   1.159 -// forward declarations from file server
   1.160 -class RFile;
   1.161 -class RFs;
   1.162  
   1.163 -/**
   1.164 -A Handle used to identify a file on storage media.
   1.165 -@internalTechnology
   1.166 -*/
   1.167 -class RFileClamp
   1.168 -	{
   1.169 -public:
   1.170 -	inline RFileClamp()
   1.171 -		{
   1.172 -		iCookie[0] = 0;
   1.173 -		iCookie[1] = 0;
   1.174 -		}
   1.175 -	IMPORT_C TInt Clamp(RFile& aFile);
   1.176 -	IMPORT_C TInt Close(RFs& aFs);
   1.177 -
   1.178 -public:
   1.179 -	TInt64 iCookie[2];
   1.180 -	};
   1.181 -
   1.182 -
   1.183 -class TCodeSegCreateInfo
   1.184 -	{
   1.185 -public:
   1.186 -	TBuf8<KMaxFileName> iFileName;		// not including {MMMMmmmm} version info
   1.187 -	TUidType iUids;				// uid1 indicates EXE or DLL
   1.188 -	TUint32 iAttr;
   1.189 -	TInt iCodeSize;
   1.190 -	TInt iTextSize;
   1.191 -	TInt iDataSize;
   1.192 -	TInt iBssSize;
   1.193 -	TInt iTotalDataSize;
   1.194 -	TUint32 iEntryPtVeneer;		// address of first instruction to be called
   1.195 -	TUint32 iFileEntryPoint;	// address of entry point within this code segment
   1.196 -	TInt iDepCount;
   1.197 -	TUint32 iExportDir;
   1.198 -	TInt iExportDirCount;
   1.199 -	TUint32 iCodeLoadAddress;	// 0 for RAM loaded code, else pointer to TRomImageHeader
   1.200 -	TUint32 iCodeRunAddress;
   1.201 -	TUint32 iDataLoadAddress;
   1.202 -	TUint32 iDataRunAddress;
   1.203 -	TUint32 iExceptionDescriptor;
   1.204 -	TInt iRootNameOffset;
   1.205 -	TInt iRootNameLength;
   1.206 -	TInt iExtOffset;
   1.207 -	TUint32 iModuleVersion;
   1.208 -	SSecurityInfo iS;
   1.209 -	TAny* iHandle;				// pointer to kernel-side DCodeSeg object
   1.210 -	TInt iClientProcessHandle;	// handle to client process for user DLL loads
   1.211 -	/** Code relocation information stored on loader heap. */
   1.212 -	TUint32* iCodeRelocTable;
   1.213 -	/** Size of code relocation table in bytes. */
   1.214 -	TInt iCodeRelocTableSize;
   1.215 -	/** Import fixup information stored on loader heap. */
   1.216 -	TUint32* iImportFixupTable;
   1.217 -	/** Size of import fixup table in bytes. */
   1.218 -	TInt iImportFixupTableSize;
   1.219 -	/** Offset to apply to each code address in the image when it is fixed up. */
   1.220 -	TUint32 iCodeDelta;
   1.221 -	/** Offset to apply to each data address in the image when it is fixed up. */
   1.222 -	TUint32 iDataDelta;
   1.223 -	/**
   1.224 -		Whether the code is paged.  If this is set, then
   1.225 -		TCodeSegCreateInfo::iCodeRelocTable[Size] and
   1.226 -		TCodeSegCreateInfo::iImportFixupTable[Size] contain fixup information
   1.227 -		which the kernel uses to fix up each page.
   1.228 -		(They may be null if the binary has no imports or no code section.)
   1.229 -	 */
   1.230 -	TBool iUseCodePaging;
   1.231 -	/** The UID of the compression scheme in use. */
   1.232 -	TUint32 iCompressionType;
   1.233 -	/**
   1.234 -		Start of compressed pages within the file.  The kernel uses
   1.235 -		this to load compressed pages from byte-pair files when demand
   1.236 -		paging.
   1.237 -	 */
   1.238 -	TInt32* iCodePageOffsets;
   1.239 -	/** Where (possibly compressed) object code starts in iFile. */
   1.240 -	TInt iCodeStartInFile;
   1.241 -	/** Length of (possibly compressed) object code in iFile. */
   1.242 -	TInt iCodeLengthInFile;
   1.243 -	/** Information about block map entries in iCodeBlockMapEntries. */
   1.244 -	SBlockMapInfoBase iCodeBlockMapCommon;
   1.245 -	/** Where object code is located on the media. */
   1.246 -	TBlockMapEntryBase* iCodeBlockMapEntries;
   1.247 -	/** Size of block map entry array in bytes. */
   1.248 -	TInt iCodeBlockMapEntriesSize;
   1.249 -	/**
   1.250 -		File clamp cookie, used to delete the file when the
   1.251 -		codeseg is destroyed.
   1.252 -	 */
   1.253 -	RFileClamp iFileClamp;
   1.254 -public:
   1.255 -	IMPORT_C TPtrC8 RootName() const;
   1.256 -	};
   1.257 -
   1.258 -//
   1.259 -// Information required to create a new process
   1.260 -//
   1.261 -class TProcessCreateInfo : public TCodeSegCreateInfo
   1.262 -	{
   1.263 -public:
   1.264 -	TInt iHeapSizeMin;
   1.265 -	TInt iHeapSizeMax;
   1.266 -	TInt iStackSize;
   1.267 -	TInt iClientHandle;			// handle to loader's client
   1.268 -	TInt iProcessHandle;		// handle to new DProcess
   1.269 -	TInt iFinalHandle;			// handle from loader client to new process
   1.270 -	TOwnerType iOwnerType;
   1.271 -	TProcessPriority iPriority;
   1.272 -	TUint iSecurityZone;
   1.273 -	enum TDebugAttributes	// must be the same as RLibrary::TInfoV2::TDebugAttributes
   1.274 -		{
   1.275 -		EDebugAllowed = 1<<0, ///< Flags set if executable may be debugged.
   1.276 -		ETraceAllowed = 1<<1 ///< Flags set if executable may be traced.
   1.277 -		};
   1.278 -	TUint iDebugAttributes;
   1.279 -	TRequestStatus* iDestructStat;
   1.280 -
   1.281 -	};
   1.282 -
   1.283 -const TUint KSecurityZoneUnique = 0u;
   1.284 -const TUint KSecurityZoneLegacyCode = ~0u;
   1.285 -
   1.286 -//
   1.287 -// Information required to attach a code segment to a process
   1.288 -// in the form of a library.
   1.289 -//
   1.290 -class TLibraryCreateInfo
   1.291 -	{
   1.292 -public:
   1.293 -	TAny* iCodeSegHandle;		// pointer to kernel-side DCodeSeg object
   1.294 -	TInt iClientHandle;			// handle to loader's client
   1.295 -	TInt iLibraryHandle;		// handle to new DLibrary
   1.296 -	TOwnerType iOwnerType;
   1.297 -	};
   1.298 -
   1.299 -//
   1.300 -// Information required to find an existing code segment
   1.301 -//
   1.302 -class TFindCodeSeg
   1.303 -	{
   1.304 -public:
   1.305 -	TUidType iUids;				// required UIDs
   1.306 -	const TAny* iRomImgHdr;		// ROM image header if ROM code required, NULL otherwise
   1.307 -	TUint32 iAttrMask;			// mask for attributes
   1.308 -	TUint32 iAttrVal;			// required value for masked attributes
   1.309 -	TInt iProcess;				// handle to process in which code is required to operate
   1.310 -								// not used if kernel only specified
   1.311 -	SSecurityInfo iS;			// required capabilities/SID
   1.312 -	TUint32 iModuleVersion;		// required version
   1.313 -	TBuf8<KMaxLibraryName> iName;	// name to look for - zero length means any
   1.314 -	};
   1.315 -
   1.316 -//
   1.317 -// Information required to by the reaper from the codeseg.
   1.318 -//
   1.319 -struct TCodeSegLoaderCookie
   1.320 -	{
   1.321 -	RFileClamp iFileClamp;
   1.322 -	TInt64 iStartAddress;
   1.323 -	TInt iDriveNumber;
   1.324 -	};
   1.325 -
   1.326 -//
   1.327 -// Loader magic executive functions
   1.328 -//
   1.329 -class E32Loader
   1.330 -	{
   1.331 -public:
   1.332 -	// used by loader only
   1.333 -	IMPORT_C static TInt CodeSegCreate(TCodeSegCreateInfo& aInfo);
   1.334 -	IMPORT_C static TInt CodeSegLoaded(TCodeSegCreateInfo& aInfo);
   1.335 -	IMPORT_C static TInt LibraryCreate(TLibraryCreateInfo& aInfo);
   1.336 -	IMPORT_C static TInt CodeSegOpen(TAny* aHandle, TInt aClientProcessHandle);
   1.337 -	IMPORT_C static void CodeSegClose(TAny* aHandle);
   1.338 -	IMPORT_C static void CodeSegNext(TAny*& aHandle, const TFindCodeSeg& aFind);
   1.339 -	IMPORT_C static void CodeSegInfo(TAny* aHandle, TCodeSegCreateInfo& aInfo);
   1.340 -	IMPORT_C static TInt CodeSegAddDependency(TAny* aImporter, TAny* aExporter);
   1.341 -	IMPORT_C static void CodeSegDeferDeletes();
   1.342 -	IMPORT_C static void CodeSegEndDeferDeletes();
   1.343 -	IMPORT_C static TInt ProcessCreate(TProcessCreateInfo& aInfo, const TDesC8* aCommandLine);
   1.344 -	IMPORT_C static TInt ProcessLoaded(TProcessCreateInfo& aInfo);
   1.345 -	IMPORT_C static TInt CheckClientState(TInt aClientHandle);
   1.346 -	IMPORT_C static TInt DeviceLoad(TAny* aHandle, TInt aType);
   1.347 -	IMPORT_C static TAny* ThreadProcessCodeSeg(TInt aHandle);
   1.348 -	IMPORT_C static void ReadExportDir(TAny* aHandle, TUint32* aDest);
   1.349 -	IMPORT_C static TInt LocaleExports(TAny* aHandle, TLibraryFunction* aExportsList);
   1.350 -
   1.351 -#ifdef __MARM__
   1.352 -	IMPORT_C static void GetV7StubAddresses(TLinAddr& aExe, TLinAddr& aDll);
   1.353 -	static TInt V7ExeEntryStub();
   1.354 -	static TInt V7DllEntryStub(TInt aReason);
   1.355 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
   1.356 +#include <e32ldr_private.h>
   1.357  #endif
   1.358  
   1.359 -	IMPORT_C static TUint32 PagingPolicy();
   1.360 -	
   1.361 -	IMPORT_C static TInt NotifyIfCodeSegDestroyed(TRequestStatus& aStatus);
   1.362 -	IMPORT_C static TInt GetDestroyedCodeSegInfo(TCodeSegLoaderCookie& aCookie);
   1.363 +#endif // __E32LDR_H__
   1.364  
   1.365 -public:
   1.366 -	// used by client side
   1.367 -	static TInt WaitDllLock();
   1.368 -	static TInt ReleaseDllLock();
   1.369 -	static TInt LibraryAttach(TInt aHandle, TInt& aNumEps, TLinAddr* aEpList);
   1.370 -	static TInt LibraryAttached(TInt aHandle);
   1.371 -	static TInt StaticCallList(TInt& aNumEps, TLinAddr* aEpList);
   1.372 -	static TInt LibraryDetach(TInt& aNumEps, TLinAddr* aEpList);
   1.373 -	static TInt LibraryDetached();
   1.374 -	};
   1.375 -
   1.376 -typedef TInt (*TSupervisorFunction)(TAny*);
   1.377 -
   1.378 -// Relocation types
   1.379 -/**
   1.380 -@internalTechnology
   1.381 -@released
   1.382 -*/
   1.383 -const TUint16 KReservedRelocType        = (TUint16)0x0000;
   1.384 -/**
   1.385 -@internalTechnology
   1.386 -@released
   1.387 -*/
   1.388 -const TUint16 KTextRelocType            = (TUint16)0x1000;
   1.389 -/**
   1.390 -@internalTechnology
   1.391 -@released
   1.392 -*/
   1.393 -const TUint16 KDataRelocType            = (TUint16)0x2000;
   1.394 -/**
   1.395 -@internalTechnology
   1.396 -@released
   1.397 -*/
   1.398 -const TUint16 KInferredRelocType        = (TUint16)0x3000;
   1.399 -
   1.400 -// Compression types
   1.401 -
   1.402 -/**
   1.403 -@internalTechnology
   1.404 -@released
   1.405 -*/
   1.406 -const TUint KFormatNotCompressed=0;
   1.407 -/**
   1.408 -@internalTechnology
   1.409 -@released
   1.410 -*/
   1.411 -const TUint KUidCompressionDeflate=0x101F7AFC;
   1.412 -
   1.413 -
   1.414 -const TUint KUidCompressionBytePair=0x102822AA;
   1.415 -
   1.416 -
   1.417 -#endif