26 |
|
|
27 |
|
|
28 |
|
|
29 |
/* Verify that the memory region START to END (inclusive) is valid. */ |
/* Verify that the memory region START to END (exclusive) is valid. */ |
30 |
static void |
static void |
31 |
mem_check (const char *name, unsigned long start, unsigned long end) |
mem_check (const char *name, unsigned long start, unsigned long end) |
32 |
{ |
{ |
49 |
{ |
{ |
50 |
/* Check if the region fits into conventional memory. */ |
/* Check if the region fits into conventional memory. */ |
51 |
if (start >= (memdesc->low << 10) && start < (memdesc->high << 10) |
if (start >= (memdesc->low << 10) && start < (memdesc->high << 10) |
52 |
&& end >= (memdesc->low << 10) && end < (memdesc->high << 10)) |
&& end > (memdesc->low << 10) && end <= (memdesc->high << 10)) |
53 |
fits = 1; |
fits = 1; |
54 |
} |
} |
55 |
else |
else |
57 |
/* Check if the region overlaps with non-conventional |
/* Check if the region overlaps with non-conventional |
58 |
memory. */ |
memory. */ |
59 |
if ((start >= (memdesc->low << 10) && start < (memdesc->high << 10)) |
if ((start >= (memdesc->low << 10) && start < (memdesc->high << 10)) |
60 |
|| (end >= (memdesc->low << 10) && end < (memdesc->high << 10)) |
|| (end > (memdesc->low << 10) && end <= (memdesc->high << 10)) |
61 |
|| (start < (memdesc->low << 10) && end > (memdesc->high << 10))) |
|| (start < (memdesc->low << 10) && end > (memdesc->high << 10))) |
62 |
{ |
{ |
63 |
conflicts = 1; |
conflicts = 1; |
102 |
for (i = 0; i < nr_regions; i++) |
for (i = 0; i < nr_regions; i++) |
103 |
{ |
{ |
104 |
if ((start >= used_regions[i].start && start < used_regions[i].end) |
if ((start >= used_regions[i].start && start < used_regions[i].end) |
105 |
|| (end >= used_regions[i].start && end < used_regions[i].end) |
|| (end >= used_regions[i].start && end <= used_regions[i].end) |
106 |
|| (start < used_regions[i].start && end >= used_regions[i].start)) |
|| (start < used_regions[i].start && end > used_regions[i].start)) |
107 |
panic ("%s (0x%x - 0x%x) conflicts with %s (0x%x - 0x%x)", |
panic ("%s (0x%x - 0x%x) conflicts with %s (0x%x - 0x%x)", |
108 |
name, start, end, used_regions[i].name, used_regions[i].start, |
name, start, end, used_regions[i].name, used_regions[i].start, |
109 |
used_regions[i].end); |
used_regions[i].end); |
153 |
} |
} |
154 |
|
|
155 |
|
|
156 |
/* Load the ELF image from START to END into memory under the name |
/* Load the ELF image from START to END (exclusive) into memory under |
157 |
NAME (also used as the name for the region of the resulting ELF |
the name NAME (also used as the name for the region of the |
158 |
program). Return the lowest and highest address used by the |
resulting ELF program). Return the lowest and highest address used |
159 |
program in NEW_START_P and NEW_END_P, and the entry point in |
by the program in NEW_START_P and NEW_END_P, and the entry point in |
160 |
ENTRY. */ |
ENTRY. */ |
161 |
void |
void |
162 |
loader_elf_load (const char *name, l4_word_t start, l4_word_t end, |
loader_elf_load (const char *name, l4_word_t start, l4_word_t end, |