[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hurd-l4 laden/ia32-cmain.c laden/loader.c worte...
From: |
Marcus Brinkmann |
Subject: |
hurd-l4 laden/ia32-cmain.c laden/loader.c worte... |
Date: |
Mon, 15 Sep 2003 15:24:01 -0400 |
CVSROOT: /cvsroot/hurd
Module name: hurd-l4
Branch:
Changes by: Marcus Brinkmann <address@hidden> 03/09/15 15:24:01
Modified files:
laden : ia32-cmain.c loader.c
wortel : ia32-cmain.c loader.c wortel.c
Log message:
Change the semantics of END of a region (to be in line with grub
modules and
L4 memdescs high address) to exclude the byte with address END.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/laden/ia32-cmain.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/laden/loader.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/ia32-cmain.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/loader.c.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/wortel.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
Patches:
Index: hurd-l4/laden/ia32-cmain.c
diff -u hurd-l4/laden/ia32-cmain.c:1.8 hurd-l4/laden/ia32-cmain.c:1.9
--- hurd-l4/laden/ia32-cmain.c:1.8 Mon Sep 8 17:06:18 2003
+++ hurd-l4/laden/ia32-cmain.c Mon Sep 15 15:24:01 2003
@@ -331,7 +331,7 @@
loader_add_region (program_name, (l4_word_t) &_start, (l4_word_t) &_end);
start = (l4_word_t) mbi;
- end = start + sizeof (*mbi) - 1;
+ end = start + sizeof (*mbi);
loader_add_region ("grub-mbi", start, end);
if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count)
@@ -344,7 +344,7 @@
loader_add_region ("grub-mods", start, end);
start = (l4_word_t) mod[0].string;
- end = start;
+ end = start + 1;
for (nr = 0; nr < mbi->mods_count; nr++)
{
char *str = (char *) mod[nr].string;
@@ -355,8 +355,8 @@
start = (l4_word_t) str;
while (*str)
str++;
- if (((l4_word_t) str) > end)
- end = (l4_word_t) str;
+ if (((l4_word_t) str) + 1 > end)
+ end = (l4_word_t) str + 1;
}
}
loader_add_region ("grub-mods-cmdlines", start, end);
Index: hurd-l4/laden/loader.c
diff -u hurd-l4/laden/loader.c:1.7 hurd-l4/laden/loader.c:1.8
--- hurd-l4/laden/loader.c:1.7 Mon Sep 15 14:14:07 2003
+++ hurd-l4/laden/loader.c Mon Sep 15 15:24:01 2003
@@ -26,7 +26,7 @@
-/* Verify that the memory region START to END (inclusive) is valid. */
+/* Verify that the memory region START to END (exclusive) is valid. */
static void
mem_check (const char *name, unsigned long start, unsigned long end)
{
@@ -49,7 +49,7 @@
{
/* Check if the region fits into conventional memory. */
if (start >= (memdesc->low << 10) && start < (memdesc->high << 10)
- && end >= (memdesc->low << 10) && end < (memdesc->high << 10))
+ && end > (memdesc->low << 10) && end <= (memdesc->high << 10))
fits = 1;
}
else
@@ -57,7 +57,7 @@
/* Check if the region overlaps with non-conventional
memory. */
if ((start >= (memdesc->low << 10) && start < (memdesc->high << 10))
- || (end >= (memdesc->low << 10) && end < (memdesc->high << 10))
+ || (end > (memdesc->low << 10) && end <= (memdesc->high << 10))
|| (start < (memdesc->low << 10) && end > (memdesc->high << 10)))
{
conflicts = 1;
@@ -102,8 +102,8 @@
for (i = 0; i < nr_regions; i++)
{
if ((start >= used_regions[i].start && start < used_regions[i].end)
- || (end >= used_regions[i].start && end < used_regions[i].end)
- || (start < used_regions[i].start && end >= used_regions[i].start))
+ || (end >= used_regions[i].start && end <= used_regions[i].end)
+ || (start < used_regions[i].start && end > used_regions[i].start))
panic ("%s (0x%x - 0x%x) conflicts with %s (0x%x - 0x%x)",
name, start, end, used_regions[i].name, used_regions[i].start,
used_regions[i].end);
@@ -153,10 +153,10 @@
}
-/* Load the ELF image from START to END into memory under the name
- NAME (also used as the name for the region of the resulting ELF
- program). Return the lowest and highest address used by the
- program in NEW_START_P and NEW_END_P, and the entry point in
+/* Load the ELF image from START to END (exclusive) into memory under
+ the name NAME (also used as the name for the region of the
+ resulting ELF program). Return the lowest and highest address used
+ by the program in NEW_START_P and NEW_END_P, and the entry point in
ENTRY. */
void
loader_elf_load (const char *name, l4_word_t start, l4_word_t end,
Index: hurd-l4/wortel/ia32-cmain.c
diff -u hurd-l4/wortel/ia32-cmain.c:1.5 hurd-l4/wortel/ia32-cmain.c:1.6
--- hurd-l4/wortel/ia32-cmain.c:1.5 Mon Sep 15 14:45:16 2003
+++ hurd-l4/wortel/ia32-cmain.c Mon Sep 15 15:24:01 2003
@@ -113,7 +113,8 @@
/* The following must be defined and are used to calculate the extents
- of the laden binary itself. */
+ of the laden binary itself. _END is one more than the address of
+ the last byte. */
extern char _start;
extern char _end;
@@ -123,6 +124,7 @@
void
find_components (void)
{
+ l4_word_t min_page_size = getpagesize ();
multiboot_info_t *mbi = (multiboot_info_t *) l4_boot_info ();
l4_word_t start;
l4_word_t end;
@@ -143,9 +145,11 @@
{
mods[i].name = mod_names[i];
mods[i].start = mod[i].mod_start;
- mods[i].end = mod[i].mod_end;
+ if (mods[i].start & (min_page_size - 1))
+ panic ("Module %s does not start on a page boundary.\n");
+ mods[i].end = (mod[i].mod_end + min_page_size - 1)
+ & ~(min_page_size - 1);
mods[i].args = (char *) mod[i].string;
- mod++;
}
}
@@ -154,7 +158,7 @@
loader_add_region (program_name, (l4_word_t) &_start, (l4_word_t) &_end);
start = (l4_word_t) mbi;
- end = start + sizeof (*mbi) - 1;
+ end = start + sizeof (*mbi);
loader_add_region ("grub-mbi", start, end);
if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count)
@@ -167,7 +171,7 @@
loader_add_region ("grub-mods", start, end);
start = (l4_word_t) mod[0].string;
- end = start;
+ end = start + 1;
for (nr = 0; nr < mbi->mods_count; nr++)
{
char *str = (char *) mod[nr].string;
@@ -178,10 +182,10 @@
start = (l4_word_t) str;
while (*str)
str++;
- if (((l4_word_t) str) > end)
- end = (l4_word_t) str;
+ if (((l4_word_t) str) + 1> end)
+ end = (l4_word_t) str + 1;
}
}
- loader_add_region ("grub-mods-cmdlines", start, end);
+ loader_add_region ("grub-mods-cmdlines", start, end + 1);
}
}
Index: hurd-l4/wortel/loader.c
diff -u hurd-l4/wortel/loader.c:1.2 hurd-l4/wortel/loader.c:1.3
--- hurd-l4/wortel/loader.c:1.2 Mon Sep 15 14:09:45 2003
+++ hurd-l4/wortel/loader.c Mon Sep 15 15:24:01 2003
@@ -26,7 +26,7 @@
-/* Verify that the memory region START to END (inclusive) is valid. */
+/* Verify that the memory region START to END (exclusive) is valid. */
static void
mem_check (const char *name, unsigned long start, unsigned long end)
{
@@ -49,7 +49,7 @@
{
/* Check if the region fits into conventional memory. */
if (start >= (memdesc->low << 10) && start < (memdesc->high << 10)
- && end >= (memdesc->low << 10) && end < (memdesc->high << 10))
+ && end > (memdesc->low << 10) && end <= (memdesc->high << 10))
fits = 1;
}
else
@@ -57,7 +57,7 @@
/* Check if the region overlaps with non-conventional
memory. */
if ((start >= (memdesc->low << 10) && start < (memdesc->high << 10))
- || (end >= (memdesc->low << 10) && end < (memdesc->high << 10))
+ || (end > (memdesc->low << 10) && end <= (memdesc->high << 10))
|| (start < (memdesc->low << 10) && end > (memdesc->high << 10)))
{
conflicts = 1;
@@ -102,8 +102,8 @@
for (i = 0; i < nr_regions; i++)
{
if ((start >= used_regions[i].start && start < used_regions[i].end)
- || (end >= used_regions[i].start && end < used_regions[i].end)
- || (start < used_regions[i].start && end >= used_regions[i].start))
+ || (end >= used_regions[i].start && end <= used_regions[i].end)
+ || (start < used_regions[i].start && end > used_regions[i].start))
panic ("%s (0x%x - 0x%x) conflicts with %s (0x%x - 0x%x)",
name, start, end, used_regions[i].name, used_regions[i].start,
used_regions[i].end);
@@ -153,10 +153,10 @@
}
-/* Load the ELF image from START to END into memory under the name
- NAME (also used as the name for the region of the resulting ELF
- program). Return the lowest and highest address used by the
- program in NEW_START_P and NEW_END_P, and the entry point in
+/* Load the ELF image from START to END (exclusive) into memory under
+ the name NAME (also used as the name for the region of the
+ resulting ELF program). Return the lowest and highest address used
+ by the program in NEW_START_P and NEW_END_P, and the entry point in
ENTRY. */
void
loader_elf_load (const char *name, l4_word_t start, l4_word_t end,
Index: hurd-l4/wortel/wortel.c
diff -u hurd-l4/wortel/wortel.c:1.7 hurd-l4/wortel/wortel.c:1.8
--- hurd-l4/wortel/wortel.c:1.7 Mon Sep 15 14:45:16 2003
+++ hurd-l4/wortel/wortel.c Mon Sep 15 15:24:01 2003
@@ -174,16 +174,16 @@
{
l4_fpage_t fpages[MAX_FPAGES];
unsigned int nr_fpages;
- l4_word_t start = mods[MOD_PHYSMEM].start;
- l4_word_t size = (mods[MOD_PHYSMEM].end - start + min_page_size)
- & ~(min_page_size - 1);
+ l4_word_t size = (mods[MOD_PHYSMEM].end - mods[MOD_PHYSMEM].start
+ + min_page_size - 1) & ~(min_page_size - 1);
/* We want to grant all the memory for the physmem binary image
with the first page fault, but we might have to send several
fpages. So we first create a list of all fpages we need, then
we serve one after another, providing the one containing the
fault address last. */
- nr_fpages = make_fpages (start, size, fpages);
+ nr_fpages = make_fpages (mods[MOD_PHYSMEM].start, size,
+ fpages);
/* Now serve page requests. */
while (nr_fpages)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- hurd-l4 laden/ia32-cmain.c laden/loader.c worte...,
Marcus Brinkmann <=