1 /*---------------------------------------------------------------------------*
2   Project:  Dolphin application format library
3   File:     dolformat.h
4 
5   Copyright 1998, 1999 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: dolformat.h,v $
14   Revision 1.2  2006/02/04 11:56:44  hashida
15   (none)
16 
17   Revision 1.1.1.1  2005/12/29 06:53:27  hiratsu
18   Initial import.
19 
20   Revision 1.1.1.1  2005/05/12 02:41:06  yasuh-to
21   transitioned from the Dolphin source tree
22 
23 
24     2     4/06/00 10:00p Shiki
25     Added padding to DolImage.
26 
27     4     8/06/99 11:02a Tian
28     Corrected comments
29 
30     3     7/07/99 6:52p Tian
31     Cleanup
32 
33     2     7/07/99 10:49a Tian
34     Fixed build error
35 
36     1     7/07/99 9:52a Tian
37     Initial check-in.  DOL format structure.  Based on code by Jojo Wesener.
38   $NoKeywords: $
39  *---------------------------------------------------------------------------*/
40 
41 #include <revolution/types.h>
42 
43 #ifndef __DOLFORMAT_H__
44 #define __DOLFORMAT_H__
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif // __cplusplus
49 
50 // We impose limits on the number of segments allowed
51 #define  DOL_MAX_TEXT           7
52 #define  DOL_MAX_DATA           11
53 
54 // Other constraints
55 // 1. All section addresses must be 32 byte aligned (for DVD alignment)
56 // 2. All section lengths must be 4 byte aligned (DVD constraint).
57 //    Constraint #1 let's us round up lengths safely with no fear of
58 //    overlap.
59 // 3. DolImage itself should be a multiple of 32 byte.
60 
61 typedef struct DolImage
62 {
63     u8*     textData[DOL_MAX_TEXT]; // actual text segments
64     u8*     dataData[DOL_MAX_DATA]; // actual data segments
65 
66     u32     text[DOL_MAX_TEXT];     // virtual address destination
67     u32     data[DOL_MAX_DATA];     // virtual address destination
68 
69     u32     textLen[DOL_MAX_TEXT];  // length of each text segment
70     u32     dataLen[DOL_MAX_DATA];  // length of each data segment
71 
72     u32     bss;                    // All bss sections lumped together
73     u32     bssLen;
74 
75     u32     entry;                  // entry point
76 
77 #if ((3*(DOL_MAX_TEXT+DOL_MAX_DATA)+3)*4)%32
78     u8       padding[32-((3*(DOL_MAX_TEXT+DOL_MAX_DATA)+3)*4)%32];
79 #endif
80 } DolImage;
81 
82 #ifdef EPPC
83 #include <revolution/dolformat/DOLLoader.h>
84 #endif // EPPC
85 
86 #ifdef __cplusplus
87 }
88 #endif // __cplusplus
89 #endif // __DOLFORMAT_H__
90