summaryrefslogtreecommitdiff
path: root/laden
diff options
context:
space:
mode:
authorneal <neal>2007-07-30 11:37:56 +0000
committerneal <neal>2007-07-30 11:37:56 +0000
commit11347b8ad0317dd4ba81b24339433e08b3a2b88f (patch)
treec81ebec3fa30e41f2789e92fd9f4e3a1fd9fa72b /laden
parentfc2faf17beb29b5c4527aa7bcf59771073f1e25f (diff)
2007-07-30 Neal H. Walfield <neal@gnu.org>
* kip-fixup.c (kip_fixup): Use a symbolic name rather than a magic number. [_L4_X2]: Set KIP->MEMORY_INFO.NR to MEMORY_MAP_SIZE. * laden.c (load_components): Don't add L4 memory maps corresponding to the the kernel's, sigma0's, sigma1's or the root task's image. * loader.c (mem_check): Add debugging output. (loader_regions_reserve): Round USED_REGIONS[I].START and USED_REGIONS[I].END appropriately.
Diffstat (limited to 'laden')
-rw-r--r--laden/ChangeLog16
-rw-r--r--laden/kip-fixup.c6
-rw-r--r--laden/laden.c12
-rw-r--r--laden/loader.c26
4 files changed, 45 insertions, 15 deletions
diff --git a/laden/ChangeLog b/laden/ChangeLog
index 2db90d5..11bc15b 100644
--- a/laden/ChangeLog
+++ b/laden/ChangeLog
@@ -1,3 +1,19 @@
+2007-07-30 Neal H. Walfield <neal@gnu.org>
+
+ * kip-fixup.c (kip_fixup): Use a symbolic name rather than a magic
+ number.
+
+ [_L4_X2]: Set KIP->MEMORY_INFO.NR to MEMORY_MAP_SIZE.
+
+ * laden.c (load_components): Don't add L4 memory maps
+ corresponding to the the kernel's, sigma0's, sigma1's or the root
+ task's image.
+
+ * loader.c (mem_check): Add debugging output.
+
+ (loader_regions_reserve): Round USED_REGIONS[I].START and
+ USED_REGIONS[I].END appropriately.
+
2007-07-27 Neal H. Walfield <neal@gnu.org>
* laden.h (add_memory_map): Improve comment.
diff --git a/laden/kip-fixup.c b/laden/kip-fixup.c
index 9bf3250..743ee8d 100644
--- a/laden/kip-fixup.c
+++ b/laden/kip-fixup.c
@@ -51,7 +51,7 @@ kip_fixup (void)
{
#ifdef _L4_V2
case L4_API_VERSION_2:
- case 0x87:
+ case L4_API_VERSION_2PP:
/* Booting a v2 kernel. */
debug ("Booting a v2 kernel.\n");
break;
@@ -94,6 +94,10 @@ kip_fixup (void)
(char *) memory_map,
sizeof (l4_memory_desc_t) * memory_map_size);
+#ifdef _L4_X2
+ kip->memory_info.nr = memory_map_size;
+#endif
+
for (nr = 0; nr < memory_map_size; nr++)
debug ("Memory Map %i: Type %i/%i, Low 0x%llx, High 0x%llx\n",
nr + 1, memory_map[nr].type, memory_map[nr].subtype,
diff --git a/laden/laden.c b/laden/laden.c
index 934873c..44030cb 100644
--- a/laden/laden.c
+++ b/laden/laden.c
@@ -78,13 +78,11 @@ load_components (void)
/* Since we did not panic, there are no conflicts and we can now
unpack the images. */
loader_elf_load ("kernel", kernel.low, kernel.high,
- &kernel.low, &kernel.high, &kernel.ip,
- L4_MEMDESC_RESERVED);
+ &kernel.low, &kernel.high, &kernel.ip, -1);
loader_remove_region ("kernel-mod");
loader_elf_load ("sigma0", sigma0.low, sigma0.high,
- &sigma0.low, &sigma0.high, &sigma0.ip,
- L4_MEMDESC_RESERVED);
+ &sigma0.low, &sigma0.high, &sigma0.ip, -1);
loader_remove_region ("sigma0-mod");
#ifdef _L4_V2
/* Use the page following the extracted image as the stack. */
@@ -95,14 +93,12 @@ load_components (void)
if (sigma1.low)
{
loader_elf_load ("sigma1", sigma1.low, sigma1.high,
- &sigma1.low, &sigma1.high, &sigma1.ip,
- L4_MEMDESC_RESERVED);
+ &sigma1.low, &sigma1.high, &sigma1.ip, -1);
loader_remove_region ("sigma1-mod");
}
loader_elf_load ("rootserver", rootserver.low, rootserver.high,
- &rootserver.low, &rootserver.high, &rootserver.ip,
- L4_MEMDESC_BOOTLOADER);
+ &rootserver.low, &rootserver.high, &rootserver.ip, -1);
loader_remove_region ("rootserver-mod");
#ifdef _L4_V2
/* Use the page following the extracted image as the stack. */
diff --git a/laden/loader.c b/laden/loader.c
index 51b7e08..757def7 100644
--- a/laden/loader.c
+++ b/laden/loader.c
@@ -79,7 +79,14 @@ mem_check (const char *name, l4_word_t start, l4_word_t end)
&& start <= l4_memory_desc_high (memdesc)
&& end >= l4_memory_desc_low (memdesc)
&& end <= l4_memory_desc_high (memdesc))
- fits = 1;
+ {
+ debug ("Memory 0x%x-0x%x fits in conventional memory map %d "
+ "(0x%x-0x%x)\n",
+ start, end, nr,
+ l4_memory_desc_low (memdesc),
+ l4_memory_desc_high (memdesc));
+ fits = 1;
+ }
}
else
{
@@ -92,6 +99,11 @@ mem_check (const char *name, l4_word_t start, l4_word_t end)
|| (start < l4_memory_desc_low (memdesc)
&& end > l4_memory_desc_high (memdesc)))
{
+ debug ("Memory 0x%x-0x%x conflicts with non-conventional "
+ "memory map %d (0x%x-0x%x)\n",
+ start, end, nr,
+ l4_memory_desc_low (memdesc),
+ l4_memory_desc_high (memdesc));
fits = 0;
conflicts = 1 + nr;
}
@@ -311,13 +323,15 @@ loader_regions_reserve (void)
for (i = 0; i < nr_regions; i++)
if (used_regions[i].used && used_regions[i].desc_type != -1)
{
+ /* Round down. */
+ l4_word_t start = used_regions[i].start & ~0x3ff;
+ /* Round up. */
+ l4_word_t end = ((used_regions[i].end + 0x3ff - 1) & ~0x3ff) - 1;
+
debug ("Reserving memory 0x%x-0x%x (%s)\n",
- used_regions[i].start, used_regions[i].end,
- used_regions[i].name);
+ start, end, used_regions[i].name);
- add_memory_map (used_regions[i].start,
- ((used_regions[i].end + 0x3ff) & ~0x3ff) - 1,
- used_regions[i].desc_type, 0);
+ add_memory_map (start, end, used_regions[i].desc_type, 0);
}
}