summaryrefslogtreecommitdiff
path: root/laden
diff options
context:
space:
mode:
authorneal <neal>2007-07-27 09:02:07 +0000
committerneal <neal>2007-07-27 09:02:07 +0000
commit7e4cc0dd4525b0269a3538efcd332e4c69616dfc (patch)
tree46611dbd0b9f6c3a862e6fd961d0e82ffbe58d83 /laden
parenta084d87a3692c39b8106b995705ca56a65cc0ea2 (diff)
2007-07-27 Neal H. Walfield <neal@gnu.org>
* laden.h (add_memory_map): Improve comment. * loader.h (loader_add_region): Likewise. (loader_remove_region): Likewise. * laden.c (memory_map): Move from here... * loader.c (memory_map): ... to here. * laden.c (memory_map_size): Move from here... * loader.c (memory_map_size): ... to here. * laden.c (loader_get_num_memory_desc): Move from here... * loader.c (loader_get_num_memory_desc): ... to here. * laden.c (loader_get_memory_desc): Move from here... * loader.c (loader_get_memory_desc): ... to here. * kip-fixup.c (kip_fixup): Don't call loader_regions_reserve here... * laden.c (main): ... but here. * loader.c (mem_check): Don't decrement end.
Diffstat (limited to 'laden')
-rw-r--r--laden/ChangeLog21
-rw-r--r--laden/kip-fixup.c3
-rw-r--r--laden/laden.c25
-rw-r--r--laden/laden.h2
-rw-r--r--laden/loader.c23
-rw-r--r--laden/loader.h17
6 files changed, 56 insertions, 35 deletions
diff --git a/laden/ChangeLog b/laden/ChangeLog
index 8285186..2db90d5 100644
--- a/laden/ChangeLog
+++ b/laden/ChangeLog
@@ -1,3 +1,24 @@
+2007-07-27 Neal H. Walfield <neal@gnu.org>
+
+ * laden.h (add_memory_map): Improve comment.
+ * loader.h (loader_add_region): Likewise.
+ (loader_remove_region): Likewise.
+
+ * laden.c (memory_map): Move from here...
+ * loader.c (memory_map): ... to here.
+ * laden.c (memory_map_size): Move from here...
+ * loader.c (memory_map_size): ... to here.
+ * laden.c (loader_get_num_memory_desc): Move from here...
+ * loader.c (loader_get_num_memory_desc): ... to here.
+ * laden.c (loader_get_memory_desc): Move from here...
+ * loader.c (loader_get_memory_desc): ... to here.
+
+ * kip-fixup.c (kip_fixup): Don't call loader_regions_reserve
+ here...
+ * laden.c (main): ... but here.
+
+ * loader.c (mem_check): Don't decrement end.
+
2007-07-26 Neal H. Walfield <neal@gnu.org>
* loader.h (loader_add_region): Take an additional parameter, the
diff --git a/laden/kip-fixup.c b/laden/kip-fixup.c
index cb230ec..9bf3250 100644
--- a/laden/kip-fixup.c
+++ b/laden/kip-fixup.c
@@ -86,9 +86,6 @@ kip_fixup (void)
/* Load the memory map into the KIP. */
- /* Convert the reservations into memory maps. */
- loader_regions_reserve ();
-
/* Copy the memory map descriptors into the KIP. */
if (memory_map_size > kip->memory_info.nr)
panic ("Memory map table in KIP is too small.");
diff --git a/laden/laden.c b/laden/laden.c
index 7caf888..934873c 100644
--- a/laden/laden.c
+++ b/laden/laden.c
@@ -37,27 +37,6 @@ l4_rootserver_t rootserver;
l4_word_t boot_info;
-l4_memory_desc_t memory_map[MEMORY_MAP_MAX];
-
-l4_word_t memory_map_size;
-
-
-/* Return the number of memory descriptors. */
-l4_word_t
-loader_get_num_memory_desc (void)
-{
- return memory_map_size;
-}
-
-
-/* Return the NRth memory descriptor. The first memory descriptor is
- indexed by 0. */
-l4_memory_desc_t *
-loader_get_memory_desc (l4_word_t nr)
-{
- return &memory_map[nr];
-}
-
static void
rootserver_relocate (const char *name,
l4_word_t start, l4_word_t end, l4_word_t new_start,
@@ -109,6 +88,7 @@ load_components (void)
loader_remove_region ("sigma0-mod");
#ifdef _L4_V2
/* Use the page following the extracted image as the stack. */
+ /* XXX: Should reserve this? */
sigma0.sp = ((sigma0.high + 0xfff) & ~0xfff) + 0x1000;
#endif
@@ -126,6 +106,7 @@ load_components (void)
loader_remove_region ("rootserver-mod");
#ifdef _L4_V2
/* Use the page following the extracted image as the stack. */
+ /* XXX: Should reserve this? */
rootserver.sp = ((rootserver.high + 0xfff) & ~0xfff) + 0x1000;
#endif
}
@@ -229,6 +210,8 @@ main (int argc, char *argv[])
load_components ();
+ loader_regions_reserve ();
+
kip_fixup ();
debug ("Entering kernel at address 0x%x...\n", kernel.ip);
diff --git a/laden/laden.h b/laden/laden.h
index dd0b832..bf8bb18 100644
--- a/laden/laden.h
+++ b/laden/laden.h
@@ -69,7 +69,7 @@ extern l4_word_t memory_map_size;
({ \
if (memory_map_size == MEMORY_MAP_MAX) \
panic ("No more memory descriptor slots available.\n"); \
- /* Make sure START and END are 1k aligned. */ \
+ /* Make sure START and END are aligned. */ \
assert (((start) & ((1 << 10) - 1)) == 0); \
assert (((end) & ((1 << 10) - 1)) == (1 << 10) - 1); \
memory_map[memory_map_size].low = (start) >> 10; \
diff --git a/laden/loader.c b/laden/loader.c
index ee8c655..51b7e08 100644
--- a/laden/loader.c
+++ b/laden/loader.c
@@ -32,6 +32,27 @@
#include "elf.h"
+l4_memory_desc_t memory_map[MEMORY_MAP_MAX];
+
+l4_word_t memory_map_size;
+
+
+/* Return the number of memory descriptors. */
+l4_word_t
+loader_get_num_memory_desc (void)
+{
+ return memory_map_size;
+}
+
+
+/* Return the NRth memory descriptor. The first memory descriptor is
+ indexed by 0. */
+l4_memory_desc_t *
+loader_get_memory_desc (l4_word_t nr)
+{
+ return &memory_map[nr];
+}
+
/* Verify that the memory region START to END (exclusive) is valid. */
static void
mem_check (const char *name, l4_word_t start, l4_word_t end)
@@ -44,8 +65,6 @@ mem_check (const char *name, l4_word_t start, l4_word_t end)
if (!loader_get_num_memory_desc ())
return;
- end--;
-
/* FIXME: This implementation does not account for conventional
memory overriding non-conventional memory in the descriptor
list. */
diff --git a/laden/loader.h b/laden/loader.h
index b600d72..724345b 100644
--- a/laden/loader.h
+++ b/laden/loader.h
@@ -44,18 +44,19 @@ typedef void (*relocate_region) (const char *name,
l4_word_t new_start,
void *cookie);
-/* Add the region with the name NAME from START to END to the table of
- regions to check against. Before doing that, check for overlaps
- with existing regions. If at some time an overlap is detected and
- RR is not NULL, the region may be relocated. In this case RR is
- invoked providing for the possibility to update any pointers. If
- DESC_TYPE is not -1, then this region will be added as a memory
- descriptor by loader_regions_reserve. */
+/* Add the region with the name NAME from covering memory starting at
+ byte START and continuing and including byte END to the table of
+ protected region. Check for overlaps with existing regions. If at
+ some time an overlap is detected and RR is not NULL, the region may
+ be relocated. In this case RR is invoked (and passed COOKIE). RR
+ can then update any pointers referring to the memory. If DESC_TYPE
+ is not -1, then this region will be added as a memory descriptor by
+ loader_regions_reserve of type DESC_TYPE. */
void loader_add_region (const char *name, l4_word_t start, l4_word_t end,
relocate_region rr, void *cookie,
int desc_type);
-/* Remove the region(s) with the name NAME from the region descriptor
+/* Remove any regions with the name NAME from the region descriptor
table. */
void loader_remove_region (const char *name);