36,6 → 36,7 |
|
#include <elf_dyn.h> |
#include <rtld.h> |
#include <pcb.h> |
|
void __main(void); |
void __io_init(void); |
73,22 → 74,29 |
elf_rel_t *rel_table; |
elf_rel_t *jmp_rel_table; |
size_t jmp_rel_entries; |
pcb_t *pcb; |
|
pcb = (pcb_t *)PCB_ADDRESS; |
|
/* The program loader (iloader) kindly provided us with these */ |
dynamic = pcb->rtld_dynamic; |
bias = pcb->rtld_bias; |
/* |
asm volatile ( |
/* Calculate the bias into %0 */ |
/* Generates "fake" R_386_RELATIVE run-time relocation */ |
// Calculate the bias into %0 |
// Generates "fake" R_386_RELATIVE run-time relocation |
" call .L0;" |
".L0: pop %0;" |
" subl $.L0, %0;" |
|
/* Calculate run-time address of _DYNAMIC into %1 */ |
/* Generates "fake" R_386_RELATIVE run-time relocation */ |
" movl $_DYNAMIC, %1;" /* Again, at link time 0-based VMA gets in */ |
" addl %0, %1;" /* Add bias to compute run-time address */ |
// Calculate run-time address of _DYNAMIC into %1 |
// Generates "fake" R_386_RELATIVE run-time relocation |
" movl $_DYNAMIC, %1;" // Again, at link time 0-based VMA gets in |
" addl %0, %1;" // Add bias to compute run-time address |
|
: "=r" (bias), "=r" (dynamic) |
); |
|
*/ |
kputint(bias); |
kputint((unsigned)dynamic); |
|