diff options
author | marcus <marcus> | 2005-01-27 04:11:04 +0000 |
---|---|---|
committer | marcus <marcus> | 2005-01-27 04:11:04 +0000 |
commit | 262b31a3acf72a5c58ad6506422588238ee646dc (patch) | |
tree | c121ac046fadfd9648c2411887fd932e5fb5b785 /wortel | |
parent | 9baf8d8949a6c6059c0cce6d3928b53a3e16f72d (diff) |
2005-01-27 Marcus Brinkmann <marcus@gnu.org>
* wortel.c (start_elf): Initialize PHYS_STARTUP->flags. New
variables PHDR and PHDR_LEN. Calculate the virtual address of the
program header if it is loaded and use them for PHYS_STARTUP->phdr
and PHYS_STARTUP->phdr_len.
* wortel-intern.h (struct wortel_module): Remove members
HEADER_LOC and HEADER_SIZE.
Diffstat (limited to 'wortel')
-rw-r--r-- | wortel/ChangeLog | 7 | ||||
-rw-r--r-- | wortel/wortel-intern.h | 5 | ||||
-rw-r--r-- | wortel/wortel.c | 23 |
3 files changed, 28 insertions, 7 deletions
diff --git a/wortel/ChangeLog b/wortel/ChangeLog index 55e3003..22f08fb 100644 --- a/wortel/ChangeLog +++ b/wortel/ChangeLog @@ -1,5 +1,12 @@ 2005-01-27 Marcus Brinkmann <marcus@gnu.org> + * wortel.c (start_elf): Initialize PHYS_STARTUP->flags. New + variables PHDR and PHDR_LEN. Calculate the virtual address of the + program header if it is loaded and use them for PHYS_STARTUP->phdr + and PHYS_STARTUP->phdr_len. + * wortel-intern.h (struct wortel_module): Remove members + HEADER_LOC and HEADER_SIZE. + * startup.c (map): Loop over map requests until we mapped the whole range in case not all map items fit into a single reply message. diff --git a/wortel/wortel-intern.h b/wortel/wortel-intern.h index 2374a4b..0969622 100644 --- a/wortel/wortel-intern.h +++ b/wortel/wortel-intern.h @@ -100,11 +100,6 @@ struct wortel_module task is started. */ l4_word_t ip; - /* The program header location and size. Initialized just before - the task is started. */ - l4_word_t header_loc; - l4_word_t header_size; - /* The task control capability for this module. Initialized after the task server starts up. */ hurd_cap_handle_t task_ctrl; diff --git a/wortel/wortel.c b/wortel/wortel.c index ef0aeff..03730da 100644 --- a/wortel/wortel.c +++ b/wortel/wortel.c @@ -473,6 +473,11 @@ start_elf (unsigned int mod) struct hurd_startup_data *phys_startup; l4_word_t task_entry_point; + /* The virtual address of the program header. */ + l4_word_t phdr = 0; + /* The size of the program header. */ + l4_word_t phdr_len; + /* First clear everything. This ensures that the .bss section is initialized to zero. */ memset ((void *) start, 0, size); @@ -705,6 +710,19 @@ start_elf (unsigned int mod) phys_mapv->vaddr = (void *) l4_page_trunc (ph->p_vaddr); mapc++; } + + + /* Check if this is the segment that contains the phdr + image. */ + if (!phdr + && (ph->p_offset & -ph->p_align) == 0 /* Sanity check. */ + && ph->p_offset <= elf->e_phoff + && elf->e_phoff + elf->e_phnum * elf->e_phentsize + - ph->p_offset <= ph->p_filesz) + { + phdr = ph->p_vaddr + elf->e_phoff - ph->p_offset; + phdr_len = elf->e_phnum * elf->e_phentsize; + } } } while (i > 0); @@ -714,6 +732,7 @@ start_elf (unsigned int mod) /* Fill the startup structure. */ phys_startup->version_major = HURD_STARTUP_VERSION_MAJOR; phys_startup->version_minor = HURD_STARTUP_VERSION_MINOR; + phys_startup->flags = 0; /* See below. */ phys_startup->utcb_area = l4_fpage_log2 (((l4_word_t) HURD_STARTUP_ADDR) + HURD_STARTUP_SIZE @@ -732,8 +751,8 @@ start_elf (unsigned int mod) phys_startup->mapc = mapc; phys_startup->mapv = (struct hurd_startup_map *) STARTUP_TO_VIRT (mapv); /* The program header is already a virtual address for the task. */ - phys_startup->phdr = (void *) mods[mod].header_loc; - phys_startup->phdr_len = mods[mod].header_size; + phys_startup->phdr = (void *) phdr; + phys_startup->phdr_len = phdr_len; phys_startup->entry_point = (void *) task_entry_point; phys_startup->startup.server = mods[MOD_PHYSMEM].server_thread; phys_startup->startup.cap_handle = mods[mod].startup_cont; |