diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 51ad523a605d..9040901855b3 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -991,7 +991,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, ef = (elf_file_t) lf; #ifdef SPARSE_MAPPING - ef->object = vm_object_allocate(OBJT_DEFAULT, mapsize >> PAGE_SHIFT); + ef->object = vm_object_allocate(OBJT_PHYS, atop(mapsize)); if (ef->object == NULL) { error = ENOMEM; goto out; diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 55c2f7de387d..578f9e9572c1 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -774,8 +774,7 @@ link_elf_load_file(linker_class_t cls, const char *filename, * This stuff needs to be in a single chunk so that profiling etc * can get the bounds and gdb can associate offsets with modules */ - ef->object = vm_object_allocate(OBJT_DEFAULT, - round_page(mapsize) >> PAGE_SHIFT); + ef->object = vm_object_allocate(OBJT_PHYS, atop(round_page(mapsize))); if (ef->object == NULL) { error = ENOMEM; goto out;