diff options
author | green <green@FreeBSD.org> | 2004-08-09 18:46:13 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2004-08-09 18:46:13 +0000 |
commit | fbabec2d12724a752845a3f5af2ce62ffb358ff0 (patch) | |
tree | ea3b437877c2b42d157f80737879687b223e544b | |
parent | 61fada7840e0031c1ea485ad598d1368b9052ee9 (diff) | |
download | FreeBSD-src-fbabec2d12724a752845a3f5af2ce62ffb358ff0.zip FreeBSD-src-fbabec2d12724a752845a3f5af2ce62ffb358ff0.tar.gz |
Normalize the VM wiring done with SPARSE_MAPPING: check for errors, and
unmap when done. For whatever reason, SPARSE_MAPPING is not even a
config option, so this is dead code.
-rw-r--r-- | sys/kern/link_elf.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 5679cbf..62843c7 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -710,6 +710,15 @@ link_elf_load_file(linker_class_t cls, const char* filename, (vm_offset_t *) &ef->address, mapsize, 1, VM_PROT_ALL, VM_PROT_ALL, 0); +#ifdef SPARSE_MAPPING + /* + * Wire down the pages + */ + if (error == 0) + error = vm_map_wire(kernel_map, (vm_offset_t) ef->address, + (vm_offset_t) ef->address + mapsize, + VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); +#endif if (error) { vm_object_deallocate(ef->object); ef->object = 0; @@ -738,16 +747,6 @@ link_elf_load_file(linker_class_t cls, const char* filename, } bzero(segbase + segs[i]->p_filesz, segs[i]->p_memsz - segs[i]->p_filesz); - -#ifdef SPARSE_MAPPING - /* - * Wire down the pages - */ - vm_map_wire(kernel_map, - (vm_offset_t) segbase, - (vm_offset_t) segbase + segs[i]->p_memsz, - VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); -#endif } #ifdef GPROF @@ -881,6 +880,14 @@ link_elf_unload_file(linker_file_t file) #ifdef SPARSE_MAPPING if (ef->object) { + /* + * Unwire the pages + */ + vm_map_unwire(kernel_map, + (vm_offset_t) ef->address, + (vm_offset_t) ef->address + + (ef->object->size << PAGE_SHIFT), + VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); vm_map_remove(kernel_map, (vm_offset_t) ef->address, (vm_offset_t) ef->address + (ef->object->size << PAGE_SHIFT)); |