Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3399 → Rev 3400

/branches/dynload/uspace/lib/rtld/arch/ia32/Makefile.inc
27,10 → 27,10
#
 
CFLAGS += -D__32_BITS__
LFLAGS += -e __bootstrap
LFLAGS += -e __entry
 
ARCH_SOURCES := \
arch/$(ARCH)/src/entry.s \
arch/$(ARCH)/src/bootstrap.c \
arch/$(ARCH)/src/runtime.c \
arch/$(ARCH)/src/reloc.c
 
/branches/dynload/uspace/lib/rtld/arch/ia32/src/entry.s
28,15 → 28,15
 
.section .text
 
.globl __bootstrap
.globl __entry
.hidden __bootstrap
 
.type __entry, @function
 
## Rtld entry point
#
# %ebx contains the PCB pointer
#
__entry:
mov %ss, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
 
# Pass the PCB pointer to __bootstrap as the first argument
pushl %ebx
call __bootstrap
/branches/dynload/uspace/lib/rtld/arch/ia32/src/runtime.c
40,14 → 40,14
 
static void kputint(unsigned i)
{
unsigned dummy;
asm volatile (
"movl $31, %%eax;"
"int $0x30"
: "=d" (dummy) /* output - %edx clobbered */
: "d" (i) /* input */
: "%eax","%ecx" /* all scratch registers clobbered */
);
// unsigned dummy;
// asm volatile (
// "movl $31, %%eax;"
// "int $0x30"
// : "=d" (dummy) /* output - %edx clobbered */
// : "d" (i) /* input */
// : "%eax","%ecx" /* all scratch registers clobbered */
// );
}
 
typedef struct {
/branches/dynload/uspace/lib/rtld/arch/ia32/src/bootstrap.c
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);