98,6 → 98,8 |
kputint(-1); |
} |
|
int test_var = 0x818283; |
|
void __bootstrap(void); |
|
void __bootstrap(void) |
217,27 → 219,28 |
|
switch (rel_type) { |
case R_PPC_JMP_SLOT: |
kputint(0xa); |
// kputint(0xa); |
sym_idx = ELF32_R_SYM(r_info); |
|
sym_addr = sym_table[sym_idx].st_value + bias; |
kputint(sym_idx); |
kputint(sym_addr); |
// kputint(sym_idx); |
// kputint(sym_addr); |
|
// r_ptr should point to a plt entry... |
uint32_t pidx = (r_ptr - _plt_ent) / 2; |
if (pidx >= plt_n) { |
kputint(0xee00ee0ee00); |
//while(1); |
while(1); |
} |
_plt_table[pidx] = sym_addr; |
// _plt_table[pidx] = sym_addr; |
// kputint(pidx); |
// plt[18] = _b(sym_addr, plt + 18); |
plt[18+2*pidx] = _b(sym_addr, &plt[18+2*pidx]); |
// kputint(&plt[18]); |
// kputint(plt[18]); |
// while(1); |
// while(1); |
//*r_ptr = sym_addr; |
|
break; |
|
case R_PPC_ADDR32: |
252,7 → 255,7 |
break; |
|
case R_PPC_RELATIVE: |
// kputint(0xc); |
kputint(0xc); |
*r_ptr = a + bias; |
break; |
|
284,16 → 287,17 |
plt[9] = _bctr(); |
|
/* .PLTi, i = 0..N-1 */ |
kputint(-4); |
/* kputint(-4); |
for (i = 0; i < plt_n; ++i) { |
//_plt_table[i] == function address; |
plt[18+i] = _b(_plt_call, &plt[18+i]); // b .PLTcall |
} |
|
*/ |
kputint(-5); |
kputint(_plt_table[0]); |
} |
|
kputint(-6); |
/* This will come in handy */ |
runtime_env.rtld_dynamic = dynamic; |
runtime_env.rtld.bias = bias; |
300,9 → 304,12 |
|
// volatile int ff=1; |
// while(ff); |
kputint(-7); |
test_func(); |
kputint(0x42); |
kputint(test_var); |
// while(1); |
// while(1); |
/* Init libc and run rtld main */ |
kputint(0x22); |
__main(); |