1 /*---------------------------------------------------------------------------*
2   Project:  RSO
3   File:     RSOLink.h
4 
5   Copyright 2006 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   @version $Id: RSOLink.h,v 1.11 12/19/2006 04:07:35 srd_nisiwaki Exp $
14 
15  *---------------------------------------------------------------------------*/
16 
17 //RSOLink.c header
18 
19 #ifndef __RSO_LINK_H__
20 #define __RSO_LINK_H__
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /*---------------------------------------------------------------------------*
27    RSOObject
28  *---------------------------------------------------------------------------*/
29 RSOImportTable*         RSOGetImport                    ( const RSOSymbolHeader* imp );
30 const RSOExportTable*   RSOGetExport                    ( const RSOSymbolHeader* exp );
31 BOOL                    RSOLocateObject                 ( void* newModule, void* bss );
32 BOOL                    RSOLocateObjectFixed            (void* newModule,void* bss);
33 BOOL                    RSOStaticLocateObject           ( void* newModule );
34 BOOL                    RSOUnLocateObject               ( void* oldModule );
35 int                     RSOLink                         ( RSOObjectHeader* rsoImp, const RSOObjectHeader* rsoExp );
36 void                    RSOUnLink                      ( RSOObjectHeader* rsoImp, const RSOObjectHeader* rsoExp );
37 RSOHash                 RSOGetHash                      ( const char * symbolname );
38 /*---------------------------------------------------------------------------*
39    RSOImport
40  *---------------------------------------------------------------------------*/
41 BOOL                RSOIsImportSymbolResolved       ( const RSOObjectHeader* rso, int index );
42 BOOL                RSOIsImportSymbolResolvedAll    ( const RSOObjectHeader* rso );
43 int                 RSOGetNumImportSymbols          ( const RSOSymbolHeader* imp );
44 const char*         RSOGetImportSymbolName          ( const RSOSymbolHeader* imp, int index );
45 
46 int                 RSOGetNumImportSymbolsUnresolved( const RSOObjectHeader* rso );
47 
48 /*---------------------------------------------------------------------------*
49    RSOExport
50  *---------------------------------------------------------------------------*/
51 int                 RSOGetNumExportSymbols          ( const RSOSymbolHeader* exp );
52 const void*         RSOFindExportSymbolAddr         ( const RSOObjectHeader* rso, const char* name );
53 RSOExportTable*     RSOFindExportSymbol             ( const RSOObjectHeader* rso, const char* name );
54 const char*         RSOGetExportSymbolName          ( const RSOSymbolHeader* exp, int index );
55 const void*         RSOGetExportSymbolAddr          ( const RSOObjectHeader* rso, int index );
56 
57 /*---------------------------------------------------------------------------*
58    RSOLinkList
59  *---------------------------------------------------------------------------*/
60 BOOL                RSOListInit                    (void* i_staticRso);
61 BOOL                RSOLinkList                    (void* i_newRso, void* i_bss);
62 BOOL                RSOLinkListFixed               (void* i_newRso, void* i_bss,int i_fixed);
63 BOOL                RSOUnLinkList                  (void* i_oldRso);
64 
65 u32                 RSOGetFixedSize                 (void *i_rso,int i_fixed_level);
66 /*---------------------------------------------------------------------------*
67    RSOLinkFar
68  *---------------------------------------------------------------------------*/
69 int RSOGetFarCodeSize(const RSOObjectHeader* rsoImp, const RSOObjectHeader* rsoExp);
70 int RSOLinkFar(RSOObjectHeader* rsoImp, const RSOObjectHeader* rsoExp,void *buff);
71 /*---------------------------------------------------------------------------*
72    RSOLinkJump
73  *---------------------------------------------------------------------------*/
74 int RSOGetJumpCodeSize(const RSOObjectHeader *i_rsoRso);
75 void RSOMakeJumpCode(const RSOObjectHeader *i_rsoExp,void *i_buff);
76 int RSOLinkJump(RSOObjectHeader* i_rsoImp,const RSOObjectHeader* i_rsoExp,void *i_buff);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif // __RSO_LINK_H__
83