/branches/dynload/uspace/app/iloader/main.c |
---|
66,7 → 66,7 |
printf("Create PCB\n"); |
if (elf_create_pcb(&prog_info) < 0) return 1; |
// getchar(); |
getchar(); |
printf("Load dynamic linker\n"); |
file_name = "/rtld.so"; |
/branches/dynload/uspace/app/dltest/dltest.c |
---|
34,8 → 34,6 |
* @file |
*/ |
#include <libtest.h> |
void __io_init(void); |
void __main(void); |
void __exit(void); |
63,8 → 61,6 |
int main(int argc, char *argv[]) |
{ |
test(); |
/* Unreachable, yet. Just to create a relocation entry */ |
test_func(); |
return 0; |
} |
/branches/dynload/uspace/app/dltest/Makefile |
---|
36,7 → 36,7 |
SOFTINT_PREFIX = ../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
CFLAGS += -I../../lib/libtest -O0 |
CFLAGS += -I../../srv/kbd/include |
LFLAGS := -Bdynamic -I/rtld.so |
# LIBS = $(LIBC_PREFIX)/libc.a |
/branches/dynload/uspace/lib/rtld/rtld.c |
---|
42,13 → 42,24 |
#include <dynamic.h> |
#include <pcb.h> |
#include <elf_load.h> |
#include <arch.h> |
static void kputint(unsigned i) |
{ |
unsigned dummy; |
asm volatile ( |
"movl $30, %%eax;" |
"int $0x30" |
: "=d" (dummy) /* output - %edx clobbered */ |
: "d" (i) /* input */ |
: "%eax","%ecx" /* all scratch registers clobbered */ |
); |
} |
void _rtld_main(void) |
{ |
pcb_t *pcb; |
static dyn_info_t dyn_info; |
elf_info_t lib_info; |
static module_t prog; |
int rc; |
printf("Hello, world! (from rtld)\n"); |
56,9 → 67,9 |
printf("Parse .dynamic section\n"); |
pcb = (pcb_t *)PCB_ADDRESS; |
dynamic_parse(pcb->dynamic, 0, &prog.dyn); |
dynamic_parse(pcb->dynamic, 0, &dyn_info); |
printf("Program requested library '%s'\n", prog.dyn.needed); |
printf("Program requested library '%s'\n", dyn_info.needed); |
rc = elf_load_file("/libtest.so.0", 0x20000, &lib_info); |
if (rc < 0) { |
66,10 → 77,6 |
return; |
} |
/* Parse program's relocation tables */ |
rel_table_process(&prog, prog.dyn.rel, prog.dyn.rel_sz); |
rel_table_process(&prog, prog.dyn.jmp_rel, prog.dyn.plt_rel_sz); |
printf("Run program..\n"); |
pcb->entry(); |
} |
/branches/dynload/uspace/lib/rtld/arch/ia32/src/reloc.c |
---|
File deleted |
/branches/dynload/uspace/lib/rtld/arch/ia32/Makefile.inc |
---|
31,6 → 31,5 |
ARCH_SOURCES := \ |
arch/$(ARCH)/src/entry.s \ |
arch/$(ARCH)/src/bootstrap.c \ |
arch/$(ARCH)/src/runtime.c \ |
arch/$(ARCH)/src/reloc.c |
arch/$(ARCH)/src/runtime.c |
/branches/dynload/uspace/lib/rtld/include/arch.h |
---|
File deleted |
/branches/dynload/uspace/lib/rtld/include/rtld.h |
---|
35,15 → 35,6 |
#ifndef RTLD_H_ |
#define RTLD_H_ |
#include <sys/types.h> |
#include <dynamic.h> |
typedef struct { |
dyn_info_t dyn; |
size_t bias; |
} module_t; |
void _rtld_main(void); |
#endif |