34,12 → 34,12 |
* @file |
*/ |
|
#include <loader/pcb.h> |
#include <elf_dyn.h> |
#include <rtld.h> |
#include <pcb.h> |
|
void __main(void); |
void __io_init(void); |
void __main(pcb_t *pcb); |
//void __io_init(void); |
void __exit(void); |
|
static void kputint(unsigned i) |
46,15 → 46,15 |
{ |
unsigned dummy; |
asm volatile ( |
"movl $31, %%eax;" |
"movl $32, %%eax;" |
"int $0x30" |
: "=d" (dummy) /* output - %edx clobbered */ |
: "d" (i) /* input */ |
: "%eax","%ecx" /* all scratch registers clobbered */ |
); |
); |
} |
|
void __bootstrap(void) |
void __bootstrap(pcb_t *pcb) |
{ |
unsigned bias; |
unsigned *got; |
74,11 → 74,8 |
elf_rel_t *rel_table; |
elf_rel_t *jmp_rel_table; |
size_t jmp_rel_entries; |
pcb_t *pcb; |
|
pcb = __pcb_get(); |
|
/* The program loader (iloader) kindly provided us with these */ |
/* The program loader kindly provided us with these */ |
dynamic = pcb->rtld_dynamic; |
bias = pcb->rtld_bias; |
/* |
97,6 → 94,7 |
: "=r" (bias), "=r" (dynamic) |
); |
*/ |
kputint(pcb); |
kputint(bias); |
kputint((unsigned)dynamic); |
|
128,13 → 126,13 |
++i; |
} |
|
kputint(1); |
kputint((unsigned)sym_table); |
kputint((unsigned)rel_table); |
kputint((unsigned)rel_entries); |
// kputint(1); |
// kputint((unsigned)sym_table); |
// kputint((unsigned)rel_table); |
// kputint((unsigned)rel_entries); |
|
/* Now relocate all our dynsyms */ |
kputint(-1); |
// kputint(-1); |
|
for (i=0; i<rel_entries; i++) { |
kputint(i); |
221,16 → 219,22 |
} |
|
kputint(-1); |
kputint(0x42); |
|
/* This will come in handy */ |
__pcb = pcb; |
runtime_env.rtld_dynamic = dynamic; |
runtime_env.rtld.bias = bias; |
|
kputint(0x43); |
|
/* Init libc and run rtld main */ |
__main(); |
__main(pcb); |
|
kputint(33); |
__io_init(); |
kputint(0x44); |
|
// kputint(33); |
// __io_init(); |
kputint(34); |
_rtld_main(); |
kputint(35); |