Rev 2995 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2995 | Rev 2996 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (c) 2008 Jiri Svoboda |
2 | * Copyright (c) 2008 Jiri Svoboda |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | /** @addtogroup rtld rtld |
29 | /** @addtogroup rtld rtld |
30 | * @brief |
30 | * @brief |
31 | * @{ |
31 | * @{ |
32 | */ |
32 | */ |
33 | /** |
33 | /** |
34 | * @file |
34 | * @file |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #include <elf_dyn.h> |
37 | #include <elf_dyn.h> |
38 | #include <rtld.h> |
38 | #include <rtld.h> |
39 | #include <pcb.h> |
39 | #include <pcb.h> |
40 | 40 | ||
41 | // for testing printf |
41 | // for testing printf |
42 | #include <stdio.h> |
42 | #include <stdio.h> |
43 | 43 | ||
44 | void __main(void); |
44 | void __main(void); |
45 | void __io_init(void); |
45 | void __io_init(void); |
46 | void __exit(void); |
46 | void __exit(void); |
47 | 47 | ||
48 | static void kputint(unsigned i) |
48 | static void kputint(unsigned i) |
49 | { |
49 | { |
50 | asm volatile ( |
50 | asm volatile ( |
51 | "mr %%r3, %0\n" |
51 | "mr %%r3, %0\n" |
52 | "li %%r9, 30\n" |
52 | "li %%r9, 30\n" |
53 | "sc\n" |
53 | "sc\n" |
54 | : |
54 | : |
55 | : "r" (i) |
55 | : "r" (i) |
56 | : "%r3","%r9" |
56 | : "%r3","%r9" |
57 | ) ; |
57 | ) ; |
58 | } |
58 | } |
59 | 59 | ||
60 | #define __L(ptr) ((uint32_t)(ptr) & 0x0000ffff) |
60 | #define __L(ptr) ((uint32_t)(ptr) & 0x0000ffff) |
61 | #define __HA(ptr) ((uint32_t)(ptr) >> 16) |
61 | #define __HA(ptr) ((uint32_t)(ptr) >> 16) |
62 | 62 | ||
63 | // ldis r11, .PLTtable@ha |
63 | // ldis r11, .PLTtable@ha |
64 | static inline uint32_t _ldis(unsigned rD, uint16_t imm16) |
64 | static inline uint32_t _ldis(unsigned rD, uint16_t imm16) |
65 | { |
65 | { |
66 | /* Special case of addis: ldis rD,SIMM == addis rD,0,SIMM */ |
66 | /* Special case of addis: ldis rD,SIMM == addis rD,0,SIMM */ |
67 | return 0x3C000000 | (rD << 21) | imm16; |
67 | return 0x3C000000 | (rD << 21) | imm16; |
68 | } |
68 | } |
69 | 69 | ||
70 | static inline uint32_t _lwz(unsigned rD, uint16_t disp16, unsigned rA) |
70 | static inline uint32_t _lwz(unsigned rD, uint16_t disp16, unsigned rA) |
71 | { |
71 | { |
72 | return 0x80000000 | (rD << 21) | (rA << 16) | disp16; |
72 | return 0x80000000 | (rD << 21) | (rA << 16) | disp16; |
73 | } |
73 | } |
74 | 74 | ||
75 | static inline uint32_t _mtctr(unsigned rS) |
75 | static inline uint32_t _mtctr(unsigned rS) |
76 | { |
76 | { |
77 | /* mtctr rD == mtspr 9, rD */ |
77 | /* mtctr rD == mtspr 9, rD */ |
78 | return 0x7c0003a6 | (rS << 21) | (9/*CTR*/ << 16); |
78 | return 0x7c0003a6 | (rS << 21) | (9/*CTR*/ << 16); |
79 | } |
79 | } |
80 | 80 | ||
81 | static inline uint32_t _bctr() |
81 | static inline uint32_t _bctr() |
82 | { |
82 | { |
83 | /* bcctr 0x1f, 0 */ |
83 | /* bcctr 0x1f, 0 */ |
84 | return 0x4c000420 | (0x1f/*always*/ << 21); |
84 | return 0x4c000420 | (0x1f/*always*/ << 21); |
85 | } |
85 | } |
86 | 86 | ||
87 | /* branch */ |
87 | /* branch */ |
88 | static inline uint32_t _b(uint32_t *addr, uint32_t *location) |
88 | static inline uint32_t _b(uint32_t *addr, uint32_t *location) |
89 | { |
89 | { |
90 | uint32_t raddr = ((uint32_t)addr - (uint32_t)location) & 0x03fffffc; |
90 | uint32_t raddr = ((uint32_t)addr - (uint32_t)location) & 0x03fffffc; |
91 | return 0x48000000 | raddr; |
91 | return 0x48000000 | raddr; |
92 | } |
92 | } |
93 | 93 | ||
94 | void test_func(void) |
94 | void test_func(void) |
95 | { |
95 | { |
96 | kputint(-1); |
96 | kputint(-1); |
97 | kputint(42); |
97 | kputint(42); |
98 | kputint(-1); |
98 | kputint(-1); |
99 | } |
99 | } |
100 | 100 | ||
101 | void __bootstrap(void); |
101 | void __bootstrap(void); |
102 | 102 | ||
103 | void __bootstrap(void) |
103 | void __bootstrap(void) |
104 | { |
104 | { |
105 | unsigned bias; |
105 | unsigned bias; |
106 | uint32_t *plt; |
106 | uint32_t *plt; |
107 | elf_dyn_t *dynamic; |
107 | elf_dyn_t *dynamic; |
108 | void *dptr; |
108 | void *dptr; |
109 | unsigned dval; |
109 | unsigned dval; |
110 | int i; |
110 | int i; |
111 | 111 | ||
112 | size_t rel_entries; |
112 | size_t rel_entries; |
113 | size_t r_offset; |
113 | size_t r_offset; |
114 | elf_word r_info; |
114 | elf_word r_info; |
115 | unsigned rel_type; |
115 | unsigned rel_type; |
116 | elf_word sym_idx; |
116 | elf_word sym_idx; |
117 | uintptr_t sym_addr; |
117 | uintptr_t sym_addr; |
118 | 118 | ||
119 | elf_symbol_t *sym_table; |
119 | elf_symbol_t *sym_table; |
120 | elf_rela_t *rel_table; |
120 | elf_rela_t *rel_table; |
121 | elf_rela_t *jmp_rel_table; |
121 | elf_rela_t *jmp_rel_table; |
122 | size_t jmp_rel_entries; |
122 | size_t jmp_rel_entries; |
123 | pcb_t *pcb; |
123 | pcb_t *pcb; |
124 | uint32_t a, res; |
124 | uint32_t a, res; |
125 | uint32_t *r_ptr; |
125 | uint32_t *r_ptr; |
126 | uint32_t *_plt_ent; |
126 | uint32_t *_plt_ent; |
127 | 127 | ||
128 | kputint(42); |
128 | kputint(42); |
129 | pcb = __pcb_get(); |
129 | pcb = __pcb_get(); |
130 | 130 | ||
131 | /* The program loader (iloader) kindly provided us with these */ |
131 | /* The program loader (iloader) kindly provided us with these */ |
132 | dynamic = pcb->rtld_dynamic; |
132 | dynamic = pcb->rtld_dynamic; |
133 | bias = pcb->rtld_bias; |
133 | bias = pcb->rtld_bias; |
134 | 134 | ||
135 | kputint(bias); |
135 | kputint(bias); |
136 | kputint((unsigned)dynamic); |
136 | kputint((unsigned)dynamic); |
137 | 137 | ||
138 | /* parse DYNAMIC */ |
138 | /* parse DYNAMIC */ |
139 | plt = 0; |
139 | plt = 0; |
140 | sym_table = 0; |
140 | sym_table = 0; |
141 | rel_table = 0; |
141 | rel_table = 0; |
142 | rel_entries = 0; |
142 | rel_entries = 0; |
143 | jmp_rel_table = 0; |
143 | jmp_rel_table = 0; |
144 | jmp_rel_entries = 0; |
144 | jmp_rel_entries = 0; |
145 | 145 | ||
146 | i = 0; |
146 | i = 0; |
147 | while (dynamic[i].d_tag != 0) { |
147 | while (dynamic[i].d_tag != 0) { |
148 | // kputint((uintptr_t)&dynamic[i]); |
148 | // kputint((uintptr_t)&dynamic[i]); |
149 | // kputint((uintptr_t)&(dynamic[i].d_tag)); |
149 | // kputint((uintptr_t)&(dynamic[i].d_tag)); |
150 | // kputint(dynamic[i].d_tag); |
150 | // kputint(dynamic[i].d_tag); |
151 | 151 | ||
152 | dptr = (void *)(dynamic[i].d_un.d_val + bias); |
152 | dptr = (void *)(dynamic[i].d_un.d_val + bias); |
153 | dval = dynamic[i].d_un.d_val; |
153 | dval = dynamic[i].d_un.d_val; |
154 | 154 | ||
155 | // kputint(0x10); |
155 | // kputint(0x10); |
156 | register unsigned tag = dynamic[i].d_tag; |
156 | register unsigned tag = dynamic[i].d_tag; |
157 | 157 | ||
158 | /* |
158 | /* |
159 | * Note that switches only work because we are using |
159 | * Note that switches only work because we are using |
160 | * -fno-jump-tables. |
160 | * -fno-jump-tables. |
161 | */ |
161 | */ |
162 | switch (tag) { |
162 | switch (tag) { |
163 | case DT_PLTRELSZ: jmp_rel_entries = dval/8; break; |
163 | case DT_PLTRELSZ: jmp_rel_entries = dval/sizeof(elf_rela_t); break; |
164 | case DT_JMPREL: jmp_rel_table = dptr; break; |
164 | case DT_JMPREL: jmp_rel_table = dptr; break; |
165 | case DT_PLTGOT: |
165 | case DT_PLTGOT: |
166 | /* PLT address */ |
166 | /* PLT address */ |
167 | plt = dptr; break; |
167 | plt = dptr; break; |
168 | case DT_SYMTAB: sym_table = dptr; break; |
168 | case DT_SYMTAB: sym_table = dptr; break; |
169 | case DT_RELA: rel_table = dptr; break; |
169 | case DT_RELA: rel_table = dptr; break; |
170 | case DT_RELASZ: rel_entries = dval / 8; break; |
170 | case DT_RELASZ: rel_entries = dval / sizeof(elf_rela_t); break; |
171 | default: break; |
171 | default: break; |
172 | } |
172 | } |
173 | 173 | ||
174 | // kputint(0x20); |
174 | // kputint(0x20); |
175 | 175 | ||
176 | ++i; |
176 | ++i; |
177 | } |
177 | } |
178 | 178 | ||
179 | kputint(1); |
179 | kputint(1); |
180 | kputint((unsigned)sym_table); |
180 | kputint((unsigned)sym_table); |
181 | kputint((unsigned)rel_table); |
181 | kputint((unsigned)rel_table); |
182 | kputint((unsigned)rel_entries); |
182 | kputint((unsigned)rel_entries); |
183 | 183 | ||
184 | /* Now relocate all our dynsyms */ |
184 | /* Now relocate all our dynsyms */ |
185 | kputint(-1); |
185 | kputint(-1); |
186 | 186 | ||
187 | // PLT entries start here. However, each occupies 2 words |
187 | // PLT entries start here. However, each occupies 2 words |
188 | _plt_ent = plt + 18; |
188 | _plt_ent = plt + 18; |
189 | 189 | ||
190 | // By definition of the ppc ABI, there's 1:1 correspondence |
190 | // By definition of the ppc ABI, there's 1:1 correspondence |
191 | // between JMPREL entries and PLT entries |
191 | // between JMPREL entries and PLT entries |
192 | unsigned plt_n = jmp_rel_entries; |
192 | unsigned plt_n = jmp_rel_entries; |
193 | 193 | ||
194 | uint32_t *_plt_table; |
194 | uint32_t *_plt_table; |
195 | uint32_t *_plt_call; |
195 | uint32_t *_plt_call; |
196 | uint32_t *_plt_resolve; |
196 | uint32_t *_plt_resolve; |
197 | 197 | ||
198 | _plt_resolve = plt; |
198 | _plt_resolve = plt; |
199 | _plt_call = plt + 6; |
199 | _plt_call = plt + 6; |
200 | _plt_table = plt + 18 + plt_n; |
200 | _plt_table = plt + 18 + plt_n; |
201 | 201 | ||
202 | for (i=0; i<rel_entries; i++) { |
202 | for (i=0; i<rel_entries; i++) { |
203 | // kputint(i); |
203 | // kputint(i); |
204 | r_offset = rel_table[i].r_offset; |
204 | r_offset = rel_table[i].r_offset; |
205 | r_info = rel_table[i].r_info; |
205 | r_info = rel_table[i].r_info; |
206 | r_ptr = (uint32_t *)(r_offset + bias); |
206 | r_ptr = (uint32_t *)(r_offset + bias); |
207 | a = rel_table[i].r_addend; |
207 | a = rel_table[i].r_addend; |
208 | // kputint(-2); |
208 | // kputint(-2); |
209 | // kputint(a); |
209 | // kputint(a); |
210 | // kputint(ELF32_R_TYPE(r_info)); |
210 | // kputint(ELF32_R_TYPE(r_info)); |
211 | // kputint(ELF32_R_SYM(r_info)); |
211 | // kputint(ELF32_R_SYM(r_info)); |
212 | 212 | ||
213 | rel_type = ELF32_R_TYPE(r_info); |
213 | rel_type = ELF32_R_TYPE(r_info); |
214 | 214 | ||
215 | // kputint(rel_type); |
215 | // kputint(rel_type); |
216 | // kputint(r_offset); |
216 | // kputint(r_offset); |
217 | 217 | ||
218 | switch (rel_type) { |
218 | switch (rel_type) { |
219 | case R_PPC_JMP_SLOT: |
219 | case R_PPC_JMP_SLOT: |
220 | kputint(0xa); |
220 | kputint(0xa); |
221 | sym_idx = ELF32_R_SYM(r_info); |
221 | sym_idx = ELF32_R_SYM(r_info); |
222 | 222 | ||
223 | sym_addr = sym_table[sym_idx].st_value + bias; |
223 | sym_addr = sym_table[sym_idx].st_value + bias; |
224 | kputint(sym_idx); |
224 | kputint(sym_idx); |
225 | kputint(sym_addr); |
225 | kputint(sym_addr); |
226 | 226 | ||
227 | // r_ptr should point to a plt entry... |
227 | // r_ptr should point to a plt entry... |
228 | uint32_t pidx = (r_ptr - _plt_ent) / 2; |
228 | uint32_t pidx = (r_ptr - _plt_ent) / 2; |
229 | if (pidx >= plt_n) { |
229 | if (pidx >= plt_n) { |
230 | kputint(0xee00ee0ee00); |
230 | kputint(0xee00ee0ee00); |
231 | //while(1); |
231 | //while(1); |
232 | } |
232 | } |
233 | _plt_table[pidx] = sym_addr; |
233 | _plt_table[pidx] = sym_addr; |
234 | // kputint(pidx); |
234 | // kputint(pidx); |
235 | // plt[18] = _b(sym_addr, plt + 18); |
235 | // plt[18] = _b(sym_addr, plt + 18); |
236 | // kputint(&plt[18]); |
236 | // kputint(&plt[18]); |
237 | // kputint(plt[18]); |
237 | // kputint(plt[18]); |
238 | // while(1); |
238 | // while(1); |
239 | // while(1); |
239 | // while(1); |
240 | //*r_ptr = sym_addr; |
240 | //*r_ptr = sym_addr; |
241 | break; |
241 | break; |
242 | 242 | ||
243 | case R_PPC_ADDR32: |
243 | case R_PPC_ADDR32: |
244 | kputint(0xb); |
244 | kputint(0xb); |
245 | sym_idx = ELF32_R_SYM(r_info); |
245 | sym_idx = ELF32_R_SYM(r_info); |
246 | 246 | ||
247 | sym_addr = sym_table[sym_idx].st_value + bias; |
247 | sym_addr = sym_table[sym_idx].st_value + bias; |
248 | kputint(sym_idx); |
248 | kputint(sym_idx); |
249 | kputint(sym_addr); |
249 | kputint(sym_addr); |
250 | 250 | ||
251 | *r_ptr = a + sym_addr; |
251 | *r_ptr = a + sym_addr; |
252 | break; |
252 | break; |
253 | 253 | ||
254 | case R_PPC_RELATIVE: |
254 | case R_PPC_RELATIVE: |
255 | // kputint(0xc); |
255 | // kputint(0xc); |
256 | *r_ptr = a + bias; |
256 | *r_ptr = a + bias; |
257 | break; |
257 | break; |
258 | 258 | ||
259 | case R_PPC_REL24: |
259 | case R_PPC_REL24: |
260 | kputint(0xd); |
260 | kputint(0xd); |
261 | sym_idx = ELF32_R_SYM(r_info); |
261 | sym_idx = ELF32_R_SYM(r_info); |
262 | sym_addr = sym_table[sym_idx].st_value + bias; |
262 | sym_addr = sym_table[sym_idx].st_value + bias; |
263 | kputint(sym_addr); |
263 | kputint(sym_addr); |
264 | res = (sym_addr - (uint32_t)r_ptr + a) >> 2; |
264 | res = (sym_addr - (uint32_t)r_ptr + a) >> 2; |
265 | kputint(res); |
265 | kputint(res); |
266 | if (res & 0xff000000) { |
266 | if (res & 0xff000000) { |
267 | /* out of range?? */ |
267 | /* out of range?? */ |
268 | kputint(0xeeeeeeee); |
268 | kputint(0xeeeeeeee); |
269 | //while(1); |
269 | //while(1); |
270 | } |
270 | } |
271 | *r_ptr = (*r_ptr & ~0x00ffffff) | (res & 0x00ffffff); |
271 | *r_ptr = (*r_ptr & ~0x00ffffff) | (res & 0x00ffffff); |
272 | kputint(0x1d); |
272 | kputint(0x1d); |
273 | break; |
273 | break; |
274 | } |
274 | } |
275 | } |
275 | } |
276 | 276 | ||
277 | kputint(-3); |
277 | kputint(-3); |
278 | if (plt != 0) { |
278 | if (plt != 0) { |
279 | 279 | ||
280 | /* .PLTcall: */ |
280 | /* .PLTcall: */ |
281 | plt[6] = _ldis(11, __HA(_plt_table)); // ldis r11, .PLTtable@ha |
281 | plt[6] = _ldis(11, __HA(_plt_table)); // ldis r11, .PLTtable@ha |
282 | plt[7] = _lwz(11, __L(_plt_table), 11); // lwz r11, .PLTtable@l(r11) |
282 | plt[7] = _lwz(11, __L(_plt_table), 11); // lwz r11, .PLTtable@l(r11) |
283 | plt[8] = _mtctr(11); // mtctr r11 |
283 | plt[8] = _mtctr(11); // mtctr r11 |
284 | plt[9] = _bctr(); |
284 | plt[9] = _bctr(); |
285 | 285 | ||
286 | /* .PLTi, i = 0..N-1 */ |
286 | /* .PLTi, i = 0..N-1 */ |
287 | kputint(-4); |
287 | kputint(-4); |
288 | for (i = 0; i < plt_n; ++i) { |
288 | for (i = 0; i < plt_n; ++i) { |
289 | //_plt_table[i] == function address; |
289 | //_plt_table[i] == function address; |
290 | plt[18+i] = _b(_plt_call, &plt[18+i]); // b .PLTcall |
290 | plt[18+i] = _b(_plt_call, &plt[18+i]); // b .PLTcall |
291 | } |
291 | } |
292 | 292 | ||
293 | kputint(-5); |
293 | kputint(-5); |
- | 294 | kputint(_plt_table[0]); |
|
- | 295 | } |
|
294 | 296 | ||
295 | /* This will come in handy */ |
297 | /* This will come in handy */ |
296 | // runtime_env.rtld_dynamic = dynamic; |
298 | runtime_env.rtld_dynamic = dynamic; |
297 | // runtime_env.rtld.bias = bias; |
299 | runtime_env.rtld.bias = bias; |
298 | 300 | ||
299 | kputint(_plt_table[0]); |
- | |
300 | } |
- | |
301 | // volatile int ff=1; |
301 | // volatile int ff=1; |
302 | // while(ff); |
302 | // while(ff); |
303 | test_func(); |
303 | test_func(); |
304 | kputint(0x42); |
304 | kputint(0x42); |
305 | // while(1); |
305 | // while(1); |
306 | /* Init libc and run rtld main */ |
306 | /* Init libc and run rtld main */ |
307 | kputint(0x22); |
307 | kputint(0x22); |
308 | __main(); |
308 | __main(); |
309 | 309 | ||
310 | kputint(33); |
310 | kputint(33); |
311 | __io_init(); |
311 | __io_init(); |
312 | kputint(-1); |
312 | kputint(-1); |
313 | kputint(0x52); |
313 | kputint(0x52); |
314 | printf("Hello, world! (from ppc rtld)\n"); |
314 | // printf("Hello, world! (from ppc rtld)\n"); |
315 | kputint(0x62); |
315 | kputint(0x62); |
316 | while(1); |
316 | // while(1); |
317 | // kputint(34); |
317 | kputint(34); |
318 | // _rtld_main(); |
318 | _rtld_main(); |
319 | // kputint(35); |
319 | kputint(35); |
320 | // __exit(); |
320 | __exit(); |
321 | 321 | ||
322 | // kputint(36); |
322 | kputint(36); |
323 | } |
323 | } |
324 | 324 | ||
325 | /** @} |
325 | /** @} |
326 | */ |
326 | */ |
327 | 327 |