Subversion Repositories HelenOS-historic

Rev

Rev 841 | Rev 872 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 841 Rev 869
Line 34... Line 34...
34
{
34
{
35
    printf("Error: %s\n", msg);
35
    printf("Error: %s\n", msg);
36
    exit(2);
36
    exit(2);
37
}
37
}
38
 
38
 
39
#define ELF_VMA (0x88/sizeof(unsigned long long))
39
#define ELF_VMA (0x50/sizeof(unsigned long long))
40
#define ELF_LMA (0x90/sizeof(unsigned long long))
40
#define ELF_LMA (0x58/sizeof(unsigned long long))
-
 
41
#define ELF_ENTRY (0x18/sizeof(unsigned long long))
41
 
42
 
42
#define LENGTH  0x98
43
#define LENGTH  0x98
43
 
44
 
44
int main(int argc, char *argv[])
45
int main(int argc, char *argv[])
45
{
46
{
46
    int fd;
47
    int fd;
47
    unsigned long long vma, lma;
48
    unsigned long long vma, lma,entry;
48
    unsigned long long *elf;
49
    unsigned long long *elf;
49
 
50
 
50
    if (argc != 2)
51
    if (argc != 2)
51
        syntax(argv[0]);
52
        syntax(argv[0]);
52
   
53
   
Line 56... Line 57...
56
 
57
 
57
    elf = mmap(NULL, LENGTH, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
58
    elf = mmap(NULL, LENGTH, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
58
    if ((void *) elf  == (void *) -1)
59
    if ((void *) elf  == (void *) -1)
59
        error("map failed");
60
        error("map failed");
60
       
61
       
61
    vma = elf[ELF_VMA];
62
    /*vma = elf[ELF_VMA];*/
62
    lma = elf[ELF_LMA];
63
    lma = elf[ELF_LMA];
63
    elf[ELF_VMA] = lma;
64
    elf[ELF_VMA] = lma;
-
 
65
    entry = elf[ELF_ENTRY];
-
 
66
    entry &= ((~0LL)>>3);
-
 
67
    elf[ELF_ENTRY] = entry;
-
 
68
    elf[ELF_ENTRY] = 0x100000;
64
    elf[ELF_LMA] = vma;
69
    /*elf[ELF_LMA] = vma;*/
65
   
70
   
66
    if (munmap(elf, LENGTH) == -1)
71
    if (munmap(elf, LENGTH) == -1)
67
        error("munmap failed");
72
        error("munmap failed");
68
   
73
   
69
    if (close(fd) == -1)
74
    if (close(fd) == -1)