|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // 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 |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32\include\e32rom.h |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __E32ROM_H__ |
|
19 #define __E32ROM_H__ |
|
20 #include <e32cmn.h> |
|
21 // |
|
22 |
|
23 #ifndef __SECURITY_INFO_DEFINED__ |
|
24 #define __SECURITY_INFO_DEFINED__ |
|
25 /** |
|
26 @internalTechnology |
|
27 */ |
|
28 //This struct must be identical in size and offset to the one in e32cmn.h |
|
29 //Functions need not be duplicated. But must be same structurally. |
|
30 struct SCapabilitySet |
|
31 { |
|
32 enum {ENCapW=2}; |
|
33 TUint32 iCaps[ENCapW]; |
|
34 inline const TUint32& operator[] (TInt aIndex) const { return iCaps[aIndex]; } |
|
35 inline TUint32& operator[] (TInt aIndex) { return iCaps[aIndex]; } |
|
36 }; |
|
37 |
|
38 /** |
|
39 @internalTechnology |
|
40 */ |
|
41 //This struct must be identical in size and offset to the one in e32cmn.h |
|
42 //Functions need not be duplicated. But must be same structurally. |
|
43 struct SSecurityInfo |
|
44 { |
|
45 TUint32 iSecureId; |
|
46 TUint32 iVendorId; |
|
47 SCapabilitySet iCaps; |
|
48 }; |
|
49 #endif |
|
50 |
|
51 /** |
|
52 @internalTechnology |
|
53 @prototype |
|
54 */ |
|
55 struct SDemandPagingConfig |
|
56 { |
|
57 TUint16 iMinPages; |
|
58 TUint16 iMaxPages; |
|
59 TUint16 iYoungOldRatio; |
|
60 TUint16 iSpare[3]; |
|
61 }; |
|
62 |
|
63 /** |
|
64 @internalTechnology |
|
65 @prototype |
|
66 */ |
|
67 struct SRomPageInfo |
|
68 { |
|
69 enum TAttributes |
|
70 { |
|
71 EPageable = 1<<0 |
|
72 }; |
|
73 enum TCompression |
|
74 { |
|
75 ENoCompression, |
|
76 EBytePair, |
|
77 }; |
|
78 TUint32 iDataStart; |
|
79 TUint16 iDataSize; |
|
80 TUint8 iCompressionType; |
|
81 TUint8 iPagingAttributes; |
|
82 }; |
|
83 |
|
84 /** |
|
85 @publishedPartner |
|
86 @released |
|
87 |
|
88 Defines the size of the header for a ROM image. |
|
89 |
|
90 @see TRomHeader |
|
91 */ |
|
92 const TUint KRomHeaderSize=0x200; |
|
93 // |
|
94 |
|
95 |
|
96 /** |
|
97 @publishedPartner |
|
98 @released |
|
99 |
|
100 The format of the header for a ROM image. |
|
101 |
|
102 This is retained as part of the ROM image. |
|
103 It is generated by the rombuild tool, and is used by the Bootstrap and |
|
104 the kernel. |
|
105 */ |
|
106 class TRomHeader |
|
107 { |
|
108 public: |
|
109 enum { KDefaultDebugPort = -1 }; |
|
110 enum { KNumTraceMask = 8 }; // this is also defined in e23const.h |
|
111 |
|
112 __ASSERT_COMPILE(KNumTraceMask==KNumTraceMaskWords); |
|
113 |
|
114 public: |
|
115 /** |
|
116 Reserved for a small amount of Bootstrap code, if required. |
|
117 The first 4 bytes of the binary image typically contains |
|
118 a branch instruction which jumps to code at offset 0x100. |
|
119 */ |
|
120 TUint8 iJump[124]; |
|
121 |
|
122 |
|
123 /** |
|
124 The restart vector. |
|
125 */ |
|
126 TLinAddr iRestartVector; |
|
127 |
|
128 |
|
129 /** |
|
130 The date and time that the ROM image was built, in microseconds. |
|
131 */ |
|
132 TInt64 iTime; |
|
133 |
|
134 |
|
135 /** |
|
136 The high order 32 bits of the ROM image build date & time. |
|
137 */ |
|
138 TUint32 iTimeHi; |
|
139 |
|
140 |
|
141 /** |
|
142 The virtual address of the base of the ROM. |
|
143 */ |
|
144 TLinAddr iRomBase; |
|
145 |
|
146 |
|
147 /** |
|
148 The size of the ROM image, in bytes. |
|
149 |
|
150 This includes the second section for sectioned ROMs. |
|
151 */ |
|
152 TUint32 iRomSize; |
|
153 |
|
154 |
|
155 /** |
|
156 The virtual address of the TRomRootDirectoryList structure. |
|
157 |
|
158 @see TRomRootDirectoryList |
|
159 */ |
|
160 TLinAddr iRomRootDirectoryList; |
|
161 |
|
162 |
|
163 /** |
|
164 The virtual address of kernel data, when in RAM. |
|
165 */ |
|
166 TLinAddr iKernDataAddress; |
|
167 |
|
168 |
|
169 /** |
|
170 The virtual address of the top of the kernel region, when in RAM. |
|
171 */ |
|
172 TLinAddr iKernelLimit; |
|
173 |
|
174 |
|
175 /** |
|
176 The virtual address of the primarys ROM file image header. |
|
177 |
|
178 @see TRomImageHeader |
|
179 */ |
|
180 TLinAddr iPrimaryFile; |
|
181 |
|
182 |
|
183 /** |
|
184 The virtual address of the secondarys ROM file image header. |
|
185 |
|
186 @see TRomImageHeader |
|
187 */ |
|
188 TLinAddr iSecondaryFile; |
|
189 |
|
190 |
|
191 /** |
|
192 A computed constant that causes the 32-bit checksum of the image to equal |
|
193 the value specified by the "romchecksum" keyword. |
|
194 */ |
|
195 TUint iCheckSum; |
|
196 |
|
197 |
|
198 /** |
|
199 A unique number identifying the hardware for which this ROM image |
|
200 has been built. |
|
201 |
|
202 Note that this is only used for testing purposes. |
|
203 */ |
|
204 TUint32 iHardware; |
|
205 |
|
206 |
|
207 /** |
|
208 A bitmask identifying which of the languages are supported by the ROM image, |
|
209 as specified by the "languages" keyword. |
|
210 |
|
211 Note that this is only used for testing purposes. |
|
212 */ |
|
213 TInt64 iLanguage; |
|
214 |
|
215 |
|
216 /** |
|
217 Contains the flags that define the security options in force. |
|
218 |
|
219 @see TKernelConfigFlags |
|
220 */ |
|
221 TUint32 iKernelConfigFlags; |
|
222 |
|
223 /** |
|
224 The virtual address of the TRomExceptionSearchTable structure. |
|
225 |
|
226 @see TRomExceptionSearchTable |
|
227 */ |
|
228 TLinAddr iRomExceptionSearchTable; |
|
229 |
|
230 /** |
|
231 Current size of ROM header (Previously iUnused3) |
|
232 If value is 0x69966996 then header size = 0x100 |
|
233 */ |
|
234 TUint32 iRomHeaderSize; |
|
235 |
|
236 |
|
237 /** |
|
238 The virtual address of the ROM section header, if the ROM is sectioned. |
|
239 |
|
240 @see TRomSectionHeader |
|
241 */ |
|
242 TLinAddr iRomSectionHeader; |
|
243 |
|
244 |
|
245 /** |
|
246 The total supervisor data size, i.e. the amount of memory mapped for |
|
247 the kernel data chunk. |
|
248 */ |
|
249 TInt iTotalSvDataSize; |
|
250 |
|
251 |
|
252 /** |
|
253 The virtual address of the TRomEntry for the Variant file. |
|
254 |
|
255 @see TRomEntry |
|
256 */ |
|
257 TLinAddr iVariantFile; |
|
258 |
|
259 |
|
260 /** |
|
261 The virtual address of TRomEntry for the first extension file, if it exists. |
|
262 |
|
263 If there is more than one extension, then the next extension field in |
|
264 the extensions TRomImageHeader points to the TRomEntry for |
|
265 that next extension. |
|
266 |
|
267 @see TRomImageHeader::iNextExtension |
|
268 @see TRomImageHeader |
|
269 @see TRomEntry |
|
270 */ |
|
271 TLinAddr iExtensionFile; |
|
272 |
|
273 |
|
274 /** |
|
275 The virtual adress of the first area to be relocated into RAM, as defined |
|
276 using the "area" keyword. |
|
277 */ |
|
278 TLinAddr iRelocInfo; |
|
279 |
|
280 |
|
281 /** |
|
282 The old position of the kernel trace mask, see iTraceMask below |
|
283 */ |
|
284 TUint32 iOldTraceMask; // The old location of the kernel tracemask |
|
285 |
|
286 |
|
287 /** |
|
288 The virtual address of the user data area. |
|
289 */ |
|
290 TLinAddr iUserDataAddress; // non-MMU stuff |
|
291 |
|
292 |
|
293 /** |
|
294 The total size of the user data. |
|
295 */ |
|
296 TInt iTotalUserDataSize; // non-MMU stuff |
|
297 |
|
298 |
|
299 /** |
|
300 A value that is interpreted by the Bootstrap and kernel as the debug port |
|
301 to be used. |
|
302 */ |
|
303 TUint32 iDebugPort; // semantic is ASSP-specific |
|
304 |
|
305 |
|
306 /** |
|
307 The ROM version number. |
|
308 */ |
|
309 TVersion iVersion; |
|
310 |
|
311 |
|
312 /** |
|
313 The type of compression used for the image. |
|
314 |
|
315 This is a UID, or 0 if there is no compression. |
|
316 */ |
|
317 TUint32 iCompressionType; // compression type used |
|
318 |
|
319 |
|
320 /** |
|
321 The size of the image after compression. |
|
322 */ |
|
323 TUint32 iCompressedSize; // Size after compression |
|
324 |
|
325 |
|
326 /** |
|
327 The size of the image before compression. |
|
328 */ |
|
329 TUint32 iUncompressedSize; // Size before compression |
|
330 |
|
331 |
|
332 /** |
|
333 */ |
|
334 TUint32 iDisabledCapabilities[2]; // 2==SSecurityInfo::ENCapW |
|
335 |
|
336 |
|
337 /** |
|
338 The initial value for the kernel trace masks. |
|
339 */ |
|
340 TUint32 iTraceMask[KNumTraceMask]; // The kernel debug trace masks |
|
341 |
|
342 /** |
|
343 Initial values for fast-trace filter. |
|
344 */ |
|
345 TUint32 iInitialBTraceFilter[8]; |
|
346 |
|
347 /** |
|
348 Initial value for size of fast-trace buffer. |
|
349 */ |
|
350 TInt iInitialBTraceBuffer; |
|
351 |
|
352 /** |
|
353 Initial value for size of fast-trace mode. |
|
354 */ |
|
355 TInt iInitialBTraceMode; |
|
356 |
|
357 /** |
|
358 Offset, in bytes from ROM start, for the start of the pageable ROM area. |
|
359 */ |
|
360 TInt iPageableRomStart; |
|
361 |
|
362 /** |
|
363 Size, in bytes, of the pageable ROM area. |
|
364 */ |
|
365 TInt iPageableRomSize; |
|
366 |
|
367 /** |
|
368 Offset, in bytes from ROM start, for the page index. (Array of SRomPageInfo objects.) |
|
369 @internalTechnology |
|
370 @prototype |
|
371 */ |
|
372 TInt iRomPageIndex; |
|
373 |
|
374 /** |
|
375 @internalTechnology |
|
376 @prototype |
|
377 */ |
|
378 SDemandPagingConfig iDemandPagingConfig; |
|
379 |
|
380 /** |
|
381 @internalComponent |
|
382 */ |
|
383 TUint32 iSpare[40]; // spare : force size to be correct |
|
384 |
|
385 }; |
|
386 |
|
387 __ASSERT_COMPILE(sizeof(TRomHeader)==KRomHeaderSize); |
|
388 __ASSERT_COMPILE(SCapabilitySet::ENCapW==2); // TRomHeader::iDisabledCapabilities has hard coded 2 because h2inc.pl does not parse scoped identifiers |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 /** |
|
394 @publishedPartner |
|
395 @released |
|
396 |
|
397 Contains information about a root directory. |
|
398 |
|
399 A variable number of these are contained in a TRomRootDirectoryList structure. |
|
400 |
|
401 @see TRomRootDirectoryList |
|
402 */ |
|
403 class TRootDirInfo |
|
404 { |
|
405 public: |
|
406 /** |
|
407 The hardware variant for this root directory entry. |
|
408 */ |
|
409 TUint iHardwareVariant; |
|
410 |
|
411 |
|
412 /** |
|
413 The virtual address of the root directory. |
|
414 |
|
415 @see TRomDir |
|
416 */ |
|
417 TLinAddr iAddressLin; |
|
418 }; |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 /** |
|
424 @publishedPartner |
|
425 @released |
|
426 |
|
427 A structure that allows you to find the root directories for each hardware |
|
428 Variant supported by the ROM. |
|
429 |
|
430 Usually, there is only one Variant and one root directory. However, a ROM can |
|
431 have multiple root directories and directory trees, one for each hardware Variant |
|
432 supported by the ROM. This ensures that the file server only sees the files |
|
433 that are relevant to the hardware on which it is running. In this case, there |
|
434 are multiple entries in the table describing each root directory. |
|
435 */ |
|
436 class TRomRootDirectoryList |
|
437 { |
|
438 public: |
|
439 /** |
|
440 The number of root directory entries. |
|
441 */ |
|
442 TInt iNumRootDirs; |
|
443 |
|
444 |
|
445 /** |
|
446 The root directory entries. |
|
447 |
|
448 The number of entries is defined by iNumRootDirs. |
|
449 */ |
|
450 TRootDirInfo iRootDir[1]; |
|
451 }; |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 /** |
|
457 @publishedPartner |
|
458 @released |
|
459 |
|
460 The format of a ROM section header. |
|
461 */ |
|
462 class TRomSectionHeader |
|
463 { |
|
464 public: |
|
465 |
|
466 /** |
|
467 The ROM version number. |
|
468 */ |
|
469 TVersion iVersion; |
|
470 |
|
471 |
|
472 /** |
|
473 A computed constant that causes the 32-bit checksum of the upper |
|
474 section to equal zero. |
|
475 |
|
476 Upper sections checksum to zero so that the overall ROM checksum in |
|
477 the TRomHeader is unaffected by changes to this section. |
|
478 |
|
479 @see TRomHeader |
|
480 */ |
|
481 TUint iCheckSum; |
|
482 |
|
483 |
|
484 /** |
|
485 The date and time that the ROM image was built, in microseconds. |
|
486 */ |
|
487 TInt64 iTime; |
|
488 |
|
489 |
|
490 /** |
|
491 A bitmask identifying which of the languages are supported by the ROM image, |
|
492 as specified by the "languages" keyword. |
|
493 */ |
|
494 TInt64 iLanguage; |
|
495 }; |
|
496 // |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 /** |
|
502 @publishedPartner |
|
503 @released |
|
504 |
|
505 A structure that describes a file or a directory. |
|
506 */ |
|
507 class TRomEntry |
|
508 { |
|
509 public: |
|
510 |
|
511 |
|
512 /** |
|
513 The size of the file. |
|
514 */ |
|
515 TInt iSize; |
|
516 |
|
517 |
|
518 /** |
|
519 The virtual address of the file, or of a TRomDir structure if this entry |
|
520 describes another directory. |
|
521 |
|
522 @see TRomDir |
|
523 */ |
|
524 TUint32 iAddressLin; |
|
525 |
|
526 |
|
527 /** |
|
528 Attributes. |
|
529 */ |
|
530 TUint8 iAtt; |
|
531 |
|
532 |
|
533 /** |
|
534 The length of the file or directory name. |
|
535 */ |
|
536 TUint8 iNameLength; |
|
537 |
|
538 |
|
539 /** |
|
540 A variable length field containing the file or directory name. |
|
541 */ |
|
542 TUint8 iName[2]; |
|
543 }; |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 /** |
|
549 @publishedPartner |
|
550 @released |
|
551 |
|
552 The size of the fixed part of a TRomEntry structure. |
|
553 */ |
|
554 const TInt KRomEntrySize=(sizeof(TRomEntry)-2); |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 // |
|
560 class TRomDirSortInfo; |
|
561 |
|
562 /** |
|
563 @publishedPartner |
|
564 @released |
|
565 |
|
566 A structure that describes the first part of a ROM directory. |
|
567 |
|
568 This part of a ROM directory is a sequence of variable length entries, |
|
569 each describing a file or a subdirectory, in the order that the members |
|
570 were specified in the original obey file; the variable length entries are |
|
571 the TRomEntry structures that follow the iSize member. |
|
572 |
|
573 This part of the ROM directory is followed by a structure defined |
|
574 by TRomDirSortInfo, which contains a pair of sorted tables suitable for |
|
575 a binary search. |
|
576 |
|
577 @see TRomDirSortInfo |
|
578 */ |
|
579 class TRomDir |
|
580 { |
|
581 public: |
|
582 inline const TRomDirSortInfo* SortInfo() const; |
|
583 inline const TRomEntry* SortedEntry(TInt aIndex) const; |
|
584 inline TInt SubDirCount() const; |
|
585 inline TInt FileCount() const; |
|
586 inline TInt EntryCount() const; |
|
587 TInt BinarySearch(const TDesC& aName, TInt aLengthLimit, TInt aMode, TBool aDir) const; |
|
588 const TRomDir* FindLeafDir(const TDesC& aPath) const; |
|
589 public: |
|
590 |
|
591 /** |
|
592 The number of bytes occupied by the set of TRomEntry structures |
|
593 that follow this field. |
|
594 |
|
595 @see TRomDir::iEntry |
|
596 */ |
|
597 TInt iSize; |
|
598 |
|
599 |
|
600 /** |
|
601 A variable number of entries, each of which describes a file or a directory. |
|
602 |
|
603 Each entry is 4-byte aligned, and may have padding to ensure that the entry |
|
604 is 4-bye aligned. |
|
605 */ |
|
606 TRomEntry iEntry; |
|
607 }; |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 /** |
|
613 @publishedPartner |
|
614 @released |
|
615 |
|
616 A structure that describes the second part of a ROM directory. |
|
617 |
|
618 It contains a pair of sorted tables suitable for |
|
619 a binary search. The sorted tables contain unsigned 16-bit scaled offsets, |
|
620 which point to the start of the corresponding TRomEntry in the TRomDir. |
|
621 |
|
622 @see TRomDir |
|
623 */ |
|
624 class TRomDirSortInfo |
|
625 { |
|
626 public: |
|
627 |
|
628 /** |
|
629 The number of subdirectories in this directory. |
|
630 */ |
|
631 TUint16 iSubDirCount; // number of subdirectories in this directory |
|
632 |
|
633 |
|
634 /** |
|
635 The number of files in this directory. |
|
636 */ |
|
637 TUint16 iFileCount; // number of non-directory files in this directory |
|
638 |
|
639 |
|
640 /** |
|
641 The two sorted tables: |
|
642 |
|
643 1. First one is a table of 16-bit scaled offsets to the directory entries. |
|
644 |
|
645 2. Second one is a table of 16-bit scaled ofsets to the file entries. |
|
646 This table starts at offset 2*iSubDirCount from the start of the first table. |
|
647 |
|
648 If the offset is X, then the corresponding TRomEntry is at address: |
|
649 @code |
|
650 4*X +(char*)address of the first TRomEntry |
|
651 @endcode |
|
652 For example, the first entry is at offset zero. |
|
653 |
|
654 The entries are sorted in the order of the UTF-8 representation of |
|
655 the names in a case insensitive way (compare the C function stricmp()). |
|
656 In effect, this folds upper and lowercase ASCII characters but leaves all |
|
657 other Unicode characters unchanged. |
|
658 */ |
|
659 TUint16 iEntryOffset[1]; // offsets of each entry from TRomDir::iEntry; extend |
|
660 // order of offsets is directories first, then files, lexicographic order within each group |
|
661 }; |
|
662 |
|
663 |
|
664 /** |
|
665 Gets a pointer to the start of the second part of the ROM directory, |
|
666 as described by the TRomDirSortInfo structure. |
|
667 |
|
668 @return The pointer to the start of the second part of the ROM directory. |
|
669 */ |
|
670 inline const TRomDirSortInfo* TRomDir::SortInfo() const |
|
671 { return (const TRomDirSortInfo*)( ((TLinAddr)&iEntry) + ( (iSize+sizeof(TUint32)-1) &~ (sizeof(TUint32)-1) )); } |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 /** |
|
677 Gets the TRomEntry corresponding to the file or directory located at |
|
678 the specified index position within the sorted tables. |
|
679 |
|
680 @param aIndex The index of the entry within the sorted tables. |
|
681 Note that for the purpose of this function, the two tables |
|
682 are treated as one single table. |
|
683 |
|
684 @return The required TRomEntry |
|
685 */ |
|
686 inline const TRomEntry* TRomDir::SortedEntry(TInt aIndex) const |
|
687 { |
|
688 const TRomDirSortInfo* s = SortInfo(); |
|
689 return (const TRomEntry*)(((TLinAddr)&iEntry) + s->iEntryOffset[aIndex] * sizeof(TUint32)); |
|
690 } |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 /** |
|
696 Gets the number of subdirectories in the directory. |
|
697 |
|
698 @return The number of subdirectories. |
|
699 */ |
|
700 inline TInt TRomDir::SubDirCount() const |
|
701 { return SortInfo()->iSubDirCount; } |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 /** |
|
707 Gets the number of files in the directory. |
|
708 |
|
709 @return The number of files. |
|
710 */ |
|
711 inline TInt TRomDir::FileCount() const |
|
712 { return SortInfo()->iFileCount; } |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 /** |
|
718 Gets the total number of files and subdirectories in the directory. |
|
719 |
|
720 @return The total number of files and subdirectories. |
|
721 */ |
|
722 inline TInt TRomDir::EntryCount() const |
|
723 { |
|
724 const TRomDirSortInfo* s = SortInfo(); |
|
725 return s->iSubDirCount + s->iFileCount; |
|
726 } |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 // |
|
732 // Header of ROM image files under the new scheme. (dlls & exes) |
|
733 // |
|
734 /** |
|
735 @publishedPartner |
|
736 @released |
|
737 */ |
|
738 const TUint32 KRomImageFlagPrimary =0x80000000u; |
|
739 |
|
740 /** |
|
741 @publishedPartner |
|
742 @released |
|
743 */ |
|
744 const TUint32 KRomImageFlagVariant =0x40000000u; |
|
745 |
|
746 /** |
|
747 @publishedPartner |
|
748 @released |
|
749 */ |
|
750 const TUint32 KRomImageFlagExtension =0x20000000u; |
|
751 |
|
752 /** |
|
753 @publishedPartner |
|
754 @released |
|
755 */ |
|
756 const TUint32 KRomImageFlagDevice =0x10000000u; |
|
757 |
|
758 /** |
|
759 @publishedPartner |
|
760 @released |
|
761 */ |
|
762 const TUint32 KRomImageFlagsKernelMask =0xf0000000u; |
|
763 |
|
764 /** |
|
765 @publishedPartner |
|
766 @released |
|
767 */ |
|
768 const TUint32 KRomImageFlagSecondary =0x08000000u; |
|
769 |
|
770 /** |
|
771 @publishedPartner |
|
772 @released |
|
773 */ |
|
774 const TUint32 KRomImageFlagData =0x04000000u; // image has data and is not extension or variant |
|
775 |
|
776 /** |
|
777 @publishedPartner |
|
778 @released |
|
779 */ |
|
780 const TUint32 KRomImageFlagDataInit =0x02000000u; // image or non-EXE dependencies would require data initialisation |
|
781 |
|
782 /** |
|
783 @publishedPartner |
|
784 @released |
|
785 */ |
|
786 const TUint32 KRomImageFlagDataPresent =0x01000000u; // image or any dependencies have data |
|
787 |
|
788 /** |
|
789 @publishedPartner |
|
790 @released |
|
791 */ |
|
792 const TUint32 KRomImageFlagExeInTree =0x00800000u; // image depends on EXE |
|
793 |
|
794 /** |
|
795 @publishedPartner |
|
796 @released |
|
797 */ |
|
798 const TUint32 KRomImageFlagDll =0x00000001u; |
|
799 |
|
800 /** |
|
801 @publishedPartner |
|
802 @released |
|
803 */ |
|
804 const TUint32 KRomImageFlagFixedAddressExe =0x00000004u; |
|
805 |
|
806 /** |
|
807 @publishedPartner |
|
808 @released |
|
809 */ |
|
810 const TUint32 KRomImageABIMask =0x00000018u; |
|
811 |
|
812 /** |
|
813 @publishedPartner |
|
814 @released |
|
815 */ |
|
816 const TUint32 KRomImageABI_GCC98r2 =0x00000000u; // for ARM |
|
817 |
|
818 /** |
|
819 @publishedPartner |
|
820 @released |
|
821 */ |
|
822 const TUint32 KRomImageABI_EABI =0x00000008u; // for ARM |
|
823 |
|
824 /** |
|
825 @publishedPartner |
|
826 @released |
|
827 */ |
|
828 const TUint32 KRomImageEptMask =0x000000e0u; // entry point type |
|
829 |
|
830 /** |
|
831 @publishedPartner |
|
832 @released |
|
833 */ |
|
834 const TInt KRomImageEptShift =5; |
|
835 |
|
836 /** |
|
837 @publishedPartner |
|
838 @released |
|
839 */ |
|
840 const TUint32 KRomImageEpt_Eka1 =0x00000000u; |
|
841 |
|
842 /** |
|
843 @publishedPartner |
|
844 @released |
|
845 */ |
|
846 const TUint32 KRomImageEpt_Eka2 =0x00000020u; |
|
847 |
|
848 /** |
|
849 @internalTechnology |
|
850 @released |
|
851 */ |
|
852 const TUint KRomImageFlagUnpaged =0x00000100u; |
|
853 |
|
854 |
|
855 /** |
|
856 @internalTechnology |
|
857 @released |
|
858 */ |
|
859 const TUint KRomImageFlagPaged =0x00000200u; |
|
860 |
|
861 |
|
862 /** |
|
863 @internalTechnology |
|
864 @released |
|
865 Flag to indicate when named symbol export data present in image |
|
866 */ |
|
867 const TUint KRomImageNmdExpData =0x00000400u; |
|
868 |
|
869 /** |
|
870 @internalTechnology |
|
871 @released |
|
872 Flag to indicate debuggability of this image. |
|
873 */ |
|
874 const TUint KRomImageDebuggable =0x00000800u; |
|
875 |
|
876 class TDllRefTable; |
|
877 |
|
878 /** |
|
879 @publishedPartner |
|
880 @released |
|
881 |
|
882 The format of the header for a ROM file image. |
|
883 |
|
884 The structure of a file image is based on the native image file format, |
|
885 but this can be compressed in the ROM image, as the relocation information |
|
886 and the .idata section are discarded once the file is fixed up. |
|
887 |
|
888 The Import Address Table (IAT) is also removed and each reference to |
|
889 an IAT entry is converted into a reference to the associated Export Directory |
|
890 entry in the corresponding DLL. |
|
891 |
|
892 ROM file images have the following sections: |
|
893 |
|
894 @code |
|
895 The header (as described by this structure) |
|
896 .text - code |
|
897 .rdata - constant (read-only) data |
|
898 .edata - the export directory |
|
899 .data - initialised data that is copied to RAM when the executable runs. |
|
900 The DLL reference table (a TDllRefTable structure), which is a list of DLLs |
|
901 used by the executable. |
|
902 @endcode |
|
903 |
|
904 @see TRomImageHeader::iDllRefTable |
|
905 @see TDllRefTable |
|
906 */ |
|
907 class TRomImageHeader |
|
908 { |
|
909 public: |
|
910 |
|
911 /** |
|
912 The UID1 for the file. |
|
913 |
|
914 @see TUidType |
|
915 */ |
|
916 TUint32 iUid1; |
|
917 |
|
918 |
|
919 /** |
|
920 The UID2 for the file. |
|
921 |
|
922 @see TUidType |
|
923 */ |
|
924 TUint32 iUid2; |
|
925 |
|
926 |
|
927 /** |
|
928 The UID3 for the file. |
|
929 |
|
930 @see TUidType |
|
931 */ |
|
932 TUint32 iUid3; |
|
933 |
|
934 |
|
935 /** |
|
936 The checksum of the UIDs |
|
937 */ |
|
938 TUint32 iUidChecksum; |
|
939 |
|
940 |
|
941 /** |
|
942 The entrypoint of this executable, i.e. the offset within this file. |
|
943 */ |
|
944 TUint32 iEntryPoint; |
|
945 |
|
946 |
|
947 /** |
|
948 This executables code address. |
|
949 */ |
|
950 TUint32 iCodeAddress; |
|
951 |
|
952 |
|
953 /** |
|
954 This executables data address. |
|
955 */ |
|
956 TUint32 iDataAddress; |
|
957 |
|
958 |
|
959 /** |
|
960 The size of the code. |
|
961 |
|
962 This includes the size of the constant data. |
|
963 */ |
|
964 TInt iCodeSize; |
|
965 |
|
966 |
|
967 /** |
|
968 The size of the executable code. |
|
969 |
|
970 This is the value of (iCodeSize - the size of the constant data). |
|
971 */ |
|
972 TInt iTextSize; |
|
973 |
|
974 |
|
975 /** |
|
976 The data size. |
|
977 */ |
|
978 TInt iDataSize; |
|
979 |
|
980 |
|
981 /** |
|
982 The size of the .bss (the zero-filled data) |
|
983 */ |
|
984 TInt iBssSize; |
|
985 |
|
986 |
|
987 /** |
|
988 The minimum size of the heap. |
|
989 */ |
|
990 TInt iHeapSizeMin; |
|
991 |
|
992 |
|
993 /** |
|
994 The maximum size of the heap. |
|
995 */ |
|
996 TInt iHeapSizeMax; |
|
997 |
|
998 |
|
999 /** |
|
1000 The size of the stack. |
|
1001 */ |
|
1002 TInt iStackSize; |
|
1003 |
|
1004 |
|
1005 /** |
|
1006 The address of the DLL reference table. |
|
1007 |
|
1008 @see TDllRefTable |
|
1009 */ |
|
1010 TDllRefTable* iDllRefTable; |
|
1011 |
|
1012 |
|
1013 /** |
|
1014 The number of functions exported by this executable. |
|
1015 */ |
|
1016 TInt iExportDirCount; |
|
1017 |
|
1018 |
|
1019 /** |
|
1020 The address of the export directory, which is a simple list of functions |
|
1021 that can be indexed by ordinal. |
|
1022 */ |
|
1023 TUint32 iExportDir; |
|
1024 |
|
1025 |
|
1026 /** |
|
1027 Security information, details of which are internal to Symbian. |
|
1028 */ |
|
1029 SSecurityInfo iS; |
|
1030 |
|
1031 |
|
1032 /** |
|
1033 The version number of the tools used to generate this file image. |
|
1034 */ |
|
1035 TVersion iToolsVersion; |
|
1036 |
|
1037 |
|
1038 /** |
|
1039 Flags field. |
|
1040 */ |
|
1041 TUint32 iFlags; |
|
1042 |
|
1043 |
|
1044 /** |
|
1045 The priority of the process. |
|
1046 */ |
|
1047 TProcessPriority iPriority; |
|
1048 |
|
1049 |
|
1050 /** |
|
1051 The virtual base address of the data and .bss, where the process expects |
|
1052 its data chunk to be when it runs. |
|
1053 */ |
|
1054 TUint32 iDataBssLinearBase; |
|
1055 |
|
1056 |
|
1057 /** |
|
1058 The address of the TRomEntry for the next extension file. |
|
1059 |
|
1060 This field is only used if there is more than one extension. |
|
1061 The first extension is found using the TRomHeader. |
|
1062 |
|
1063 @see TRomEntry |
|
1064 @see TRomHeader |
|
1065 */ |
|
1066 TLinAddr iNextExtension; |
|
1067 |
|
1068 |
|
1069 /** |
|
1070 A number denoting the hardware Variant. |
|
1071 |
|
1072 It is used to determine whether this executable can run |
|
1073 on a given system. |
|
1074 */ |
|
1075 TUint32 iHardwareVariant; |
|
1076 |
|
1077 |
|
1078 /** |
|
1079 The total data size, including space reserved for DLLs |
|
1080 */ |
|
1081 TInt iTotalDataSize; // data+bss + space reserved for DLLs |
|
1082 |
|
1083 |
|
1084 /** |
|
1085 The module version. |
|
1086 */ |
|
1087 TUint32 iModuleVersion; |
|
1088 |
|
1089 /** |
|
1090 The address of the Exception Descriptor if present. |
|
1091 0 if no Exception descriptor |
|
1092 */ |
|
1093 TLinAddr iExceptionDescriptor; |
|
1094 }; |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 // |
|
1100 // Header for extension ROMs |
|
1101 // Equivalent to TRomHeader |
|
1102 // |
|
1103 |
|
1104 /** |
|
1105 @publishedPartner |
|
1106 @released |
|
1107 |
|
1108 The format of a ROM extension header. |
|
1109 */ |
|
1110 class TExtensionRomHeader |
|
1111 { |
|
1112 public: |
|
1113 |
|
1114 /** |
|
1115 The extension ROM image version number. |
|
1116 */ |
|
1117 TVersion iVersion; |
|
1118 |
|
1119 |
|
1120 /** |
|
1121 The virtual address of the base of the extension ROM. |
|
1122 */ |
|
1123 TLinAddr iRomBase; |
|
1124 |
|
1125 |
|
1126 /** |
|
1127 The size of the extension ROM image. |
|
1128 */ |
|
1129 TUint32 iRomSize; |
|
1130 |
|
1131 |
|
1132 /** |
|
1133 The virtual address of the TRomRootDirList structure for |
|
1134 the combined kernel+extension ROM image. |
|
1135 |
|
1136 @see TRomRootDirList |
|
1137 */ |
|
1138 TLinAddr iRomRootDirectoryList; |
|
1139 |
|
1140 |
|
1141 /** |
|
1142 The date and time that the extension ROM image was built, in microseconds. |
|
1143 */ |
|
1144 TInt64 iTime; |
|
1145 |
|
1146 |
|
1147 /** |
|
1148 The extension ROM image checksum |
|
1149 */ |
|
1150 TUint iCheckSum; |
|
1151 |
|
1152 |
|
1153 // |
|
1154 /** |
|
1155 Copy of the kernel ROM image version number. |
|
1156 */ |
|
1157 TVersion iKernelVersion; |
|
1158 |
|
1159 |
|
1160 /** |
|
1161 Copy of the kernel ROM image build date & time. |
|
1162 */ |
|
1163 TInt64 iKernelTime; |
|
1164 |
|
1165 |
|
1166 /** |
|
1167 Copy of the kernel ROM image checksum. |
|
1168 */ |
|
1169 TUint iKernelCheckSum; |
|
1170 // |
|
1171 |
|
1172 |
|
1173 /** |
|
1174 The type of compression used for the image. |
|
1175 |
|
1176 This is a UID, or 0 if there is no compression. |
|
1177 */ |
|
1178 TUint32 iCompressionType; // compression type used |
|
1179 |
|
1180 |
|
1181 /** |
|
1182 The size of the image after compression. |
|
1183 */ |
|
1184 TUint32 iCompressedSize; // Size after compression |
|
1185 |
|
1186 |
|
1187 /** |
|
1188 The size of the image before compression. |
|
1189 */ |
|
1190 TUint32 iUncompressedSize; // Size before compression |
|
1191 |
|
1192 |
|
1193 /** |
|
1194 The virtual address of the TRomExceptionSearchTable structure. |
|
1195 |
|
1196 @see TRomExceptionSearchTable |
|
1197 */ |
|
1198 TLinAddr iRomExceptionSearchTable; |
|
1199 |
|
1200 |
|
1201 /** |
|
1202 Reserved for future use. |
|
1203 */ |
|
1204 TUint32 iPad[32-15]; // sizeof(TExtensionRomHeader)=128 |
|
1205 }; |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 /** |
|
1212 @publishedPartner |
|
1213 @released |
|
1214 |
|
1215 A list of DLLs that an executable needs in order to run. |
|
1216 |
|
1217 Each DLL referenced in this list has a pointer to a TRomImageHeader structure |
|
1218 that describes that DLL. This allows the DLL loader to search |
|
1219 a dependency chain, and ensure that all required DLLs are loaded. |
|
1220 |
|
1221 @see TRomImageHeader |
|
1222 */ |
|
1223 class TDllRefTable |
|
1224 { |
|
1225 public: |
|
1226 |
|
1227 /** |
|
1228 Flags field. |
|
1229 */ |
|
1230 TUint16 iFlags; |
|
1231 |
|
1232 |
|
1233 /** |
|
1234 The number of referenced DLLs in this list. |
|
1235 */ |
|
1236 TUint16 iNumberOfEntries; |
|
1237 |
|
1238 |
|
1239 /** |
|
1240 A set of pointers to the TRomImageHeader structures for each referenced DLL. |
|
1241 */ |
|
1242 TRomImageHeader* iEntry[1]; |
|
1243 }; |
|
1244 |
|
1245 #endif |