Subversion Repositories HelenOS

Rev

Rev 2981 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2981 Rev 2989
Line 34... Line 34...
34
 * @file
34
 * @file
35
 */
35
 */
36
 
36
 
37
#include <elf_dyn.h>
37
#include <elf_dyn.h>
38
#include <rtld.h>
38
#include <rtld.h>
-
 
39
#include <pcb.h>
39
 
40
 
40
void __main(void);
41
void __main(void);
41
void __io_init(void);
42
void __io_init(void);
42
void __exit(void);
43
void __exit(void);
43
 
44
 
Line 71... Line 72...
71
   
72
   
72
    elf_symbol_t *sym_table;
73
    elf_symbol_t *sym_table;
73
    elf_rel_t *rel_table;
74
    elf_rel_t *rel_table;
74
    elf_rel_t *jmp_rel_table;
75
    elf_rel_t *jmp_rel_table;
75
    size_t jmp_rel_entries;
76
    size_t jmp_rel_entries;
-
 
77
    pcb_t *pcb;
76
 
78
   
-
 
79
    pcb = (pcb_t *)PCB_ADDRESS;
-
 
80
 
-
 
81
    /* The program loader (iloader) kindly provided us with these */
-
 
82
    dynamic = pcb->rtld_dynamic;
-
 
83
    bias = pcb->rtld_bias;
-
 
84
/*
77
asm volatile (
85
asm volatile (
78
    /* Calculate the bias into %0 */
86
    // Calculate the bias into %0
79
    /* Generates "fake" R_386_RELATIVE run-time relocation */
87
    // Generates "fake" R_386_RELATIVE run-time relocation
80
"   call .L0;"
88
"   call .L0;"
81
".L0:   pop %0;"
89
".L0:   pop %0;"
82
"   subl $.L0, %0;"
90
"   subl $.L0, %0;"
83
 
91
 
84
    /* Calculate run-time address of _DYNAMIC into %1 */
92
    // Calculate run-time address of _DYNAMIC into %1
85
    /* Generates "fake" R_386_RELATIVE run-time relocation */
93
    // Generates "fake" R_386_RELATIVE run-time relocation
86
"   movl $_DYNAMIC, %1;"    /* Again, at link time 0-based VMA gets in */
94
"   movl $_DYNAMIC, %1;"    // Again, at link time 0-based VMA gets in
87
"   addl %0, %1;"       /* Add bias to compute run-time address */
95
"   addl %0, %1;"       // Add bias to compute run-time address
88
 
96
 
89
: "=r" (bias), "=r" (dynamic)
97
: "=r" (bias), "=r" (dynamic)
90
);
98
);
91
 
99
*/
92
    kputint(bias);
100
    kputint(bias);
93
    kputint((unsigned)dynamic);
101
    kputint((unsigned)dynamic);
94
 
102
 
95
    /* parse DYNAMIC */
103
    /* parse DYNAMIC */
96
    got = 0;
104
    got = 0;