]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - packages/services/objloader/v2_0/include/relocate_ppc.h
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / services / objloader / v2_0 / include / relocate_ppc.h
1 #ifndef __RELOCATE_PPC_H__
2 #define __RELOCATE_PPC_H__
3
4 /* =================================================================
5  *
6  *      relocate_ppc.h
7  *
8  *      Architecture dependent relocation routines for the PowerPC
9  *
10  * ================================================================= 
11  * ####ECOSGPLCOPYRIGHTBEGIN####
12  * -------------------------------------------
13  * This file is part of eCos, the Embedded Configurable Operating
14  * System.
15  * Copyright (C) 2005 eCosCentric Ltd.
16  * 
17  * eCos is free software; you can redistribute it and/or modify it
18  * under the terms of the GNU General Public License as published by
19  * the Free Software Foundation; either version 2 or (at your option)
20  * any later version.
21  * 
22  * eCos is distributed in the hope that it will be useful, but
23  * WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25  * General Public License for more details.
26  * 
27  * You should have received a copy of the GNU General Public License
28  * along with eCos; if not, write to the Free Software Foundation,
29  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
30  * 
31  * As a special exception, if other files instantiate templates or
32  * use macros or inline functions from this file, or you compile this
33  * file and link it with other works to produce a work based on this
34  * file, this file does not by itself cause the resulting work to be
35  * covered by the GNU General Public License. However the source code
36  * for this file must still be made available in accordance with
37  * section (3) of the GNU General Public License.
38  * 
39  * This exception does not invalidate any other reasons why a work
40  * based on this file might be covered by the GNU General Public
41  * License.
42  *
43  * -------------------------------------------
44  * ####ECOSGPLCOPYRIGHTEND####
45  * =================================================================
46  * #####DESCRIPTIONBEGIN####
47  * 
48  *  Author(s):    Anthony Tonizzo (atonizzo@gmail.com)
49  *  Date:         2005-05-13
50  *  Purpose:      
51  *  Description:  
52  *               
53  * ####DESCRIPTIONEND####
54  * 
55  * =================================================================
56  */
57
58 #define Elf_Rel                0
59 #define Elf_Rela               1
60 #define ELF_ARCH_MACHINE_TYPE  20    // PowerPC.
61 #define ELF_ARCH_ENDIANNESS    ELFDATA2MSB
62 #define ELF_ARCH_RELTYPE       Elf_Rela
63
64 #define R_PPC_NONE              0
65 #define R_PPC_ADDR32            1  // 32bit absolute address 
66 #define R_PPC_ADDR24            2  // 26bit address, 2 bits ignored.  
67 #define R_PPC_ADDR16            3  // 16bit absolute address 
68 #define R_PPC_ADDR16_LO         4  // lower 16bit of absolute address 
69 #define R_PPC_ADDR16_HI         5  // high 16bit of absolute address 
70 #define R_PPC_ADDR16_HA         6  // adjusted high 16bit 
71 #define R_PPC_ADDR14            7  // 16bit address, 2 bits ignored 
72 #define R_PPC_ADDR14_BRTAKEN    8
73 #define R_PPC_ADDR14_BRNTAKEN   9
74 #define R_PPC_REL24            10  // PC relative 26 bit 
75 #define R_PPC_REL14            11   // PC relative 16 bit 
76 #define R_PPC_REL14_BRTAKEN    12
77 #define R_PPC_REL14_BRNTAKEN   13
78 #define R_PPC_GOT16            14
79 #define R_PPC_GOT16_LO         15
80 #define R_PPC_GOT16_HI         16
81 #define R_PPC_GOT16_HA         17
82 #define R_PPC_PLTREL24         18
83 #define R_PPC_COPY             19
84 #define R_PPC_GLOB_DAT         20
85 #define R_PPC_JMP_SLOT         21
86 #define R_PPC_RELATIVE         22
87 #define R_PPC_LOCAL24PC        23
88 #define R_PPC_UADDR32          24
89 #define R_PPC_UADDR16          25
90 #define R_PPC_REL32            26
91 #define R_PPC_PLT32            27
92 #define R_PPC_PLTREL32         28
93 #define R_PPC_PLT16_LO         29
94 #define R_PPC_PLT16_HI         30
95 #define R_PPC_PLT16_HA         31
96 #define R_PPC_SDAREL16         32
97 #define R_PPC_SECTOFF          33
98 #define R_PPC_SECTOFF_LO       34
99 #define R_PPC_SECTOFF_HI       35
100 #define R_PPC_SECTOFF_HA       36
101
102 // Keep this the last entry.  
103 #define R_PPC_NUM              37
104
105 // The remaining relocs are from the Embedded ELF ABI, and are not
106 //  in the SVR4 ELF ABI.  
107 #define R_PPC_EMB_NADDR32     101
108 #define R_PPC_EMB_NADDR16     102
109 #define R_PPC_EMB_NADDR16_LO  103
110 #define R_PPC_EMB_NADDR16_HI  104
111 #define R_PPC_EMB_NADDR16_HA  105
112 #define R_PPC_EMB_SDAI16      106
113 #define R_PPC_EMB_SDA2I16     107
114 #define R_PPC_EMB_SDA2REL     108
115 #define R_PPC_EMB_SDA21       109  // 16 bit offset in SDA 
116 #define R_PPC_EMB_MRKREF      110
117 #define R_PPC_EMB_RELSEC16    111
118 #define R_PPC_EMB_RELST_LO    112
119 #define R_PPC_EMB_RELST_HI    113
120 #define R_PPC_EMB_RELST_HA    114
121 #define R_PPC_EMB_BIT_FLD     115
122 #define R_PPC_EMB_RELSDA      116  // 16 bit relative offset in SDA 
123
124 // From the Elf PPC spec.
125 #define _lo_(x)    (x & 0xFFFF) 
126 #define _hi_(x)    ((x >> 16) & 0xFFFF)
127 #define _ha_(x)    (((x >> 16)+((x & 0x8000) ? 1 : 0)) & 0xFFFF)
128
129 void      cyg_ldr_flush_cache( void );
130 cyg_int32 cyg_ldr_relocate( cyg_int32, cyg_uint32, cyg_int32 );
131
132 #endif //__RELOCATE_PPC_H__