exec() cleanup, generalization, improvement

. make exec() callers (i.e. vfs and rs) determine the
	  memory layout by explicitly reserving regions using
	  mmap() calls on behalf of the exec()ing process,
	  i.e. handling all of the exec logic, thereby eliminating
	  all special exec() knowledge from VM.
	. the new procedure is: clear the exec()ing process
	  first, then call third-party mmap()s to reserve memory, then
	  copy the executable file section contents in, all using callbacks
	  tailored to the caller's way of starting an executable
	. i.e. no more explicit EXEC_NEWMEM-style calls in PM or VM
	  as with rigid 2-section arguments
	. this naturally allows generalizing exec() by simply loading
	  all ELF sections
	. drop/merge of lots of duplicate exec() code into libexec
	. not copying the code sections to vfs and into the executable
	  again is a measurable performance improvement (about 3.3% faster
	  for 'make' in src/servers/)
This commit is contained in:
Ben Gras
2012-05-30 19:34:07 +02:00
parent 41b869d4d6
commit 040362e379
29 changed files with 409 additions and 946 deletions

View File

@@ -368,7 +368,7 @@ static void mb_extract_image(multiboot_info_t mbi)
off_t text_offset, data_offset;
/* Save memory map for kernel tasks */
r = read_header_elf((const char *)MULTIBOOT_KERNEL_ADDR,
r = read_header_elf((char *) MULTIBOOT_KERNEL_ADDR,
4096, /* everything is there */
&text_vaddr, &text_paddr,
&text_filebytes, &text_membytes,
@@ -401,7 +401,7 @@ static void mb_extract_image(multiboot_info_t mbi)
/* Load boot image services into memory and save memory map */
for (i = 0; module < &mb_module_info[mods_count]; ++module, ++i) {
r = read_header_elf((const char *)module->mod_start,
r = read_header_elf((char *) module->mod_start,
module->mod_end - module->mod_start + 1,
&text_vaddr, &text_paddr,
&text_filebytes, &text_membytes,