diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c --- a/stand/i386/libi386/bootinfo64.c +++ b/stand/i386/libi386/bootinfo64.c @@ -182,7 +182,7 @@ * - Module metadata are formatted and placed in kernel space. */ int -bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep, +bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, int add_smap) { struct preloaded_file *xp, *kfp; @@ -191,6 +191,7 @@ uint64_t kernend; uint64_t envp; uint64_t module; + uint64_t addr; vm_offset_t size; char *rootdevname; int howto; @@ -217,12 +218,11 @@ /* Try reading the /etc/fstab file to select the root device */ getrootmount(i386_fmtdev((void *)rootdev)); - if (addr == 0) { - /* find the last module in the chain */ - for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { - if (addr < (xp->f_addr + xp->f_size)) - addr = xp->f_addr + xp->f_size; - } + addr = 0; + /* find the last module in the chain */ + for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { + if (addr < (xp->f_addr + xp->f_size)) + addr = xp->f_addr + xp->f_size; } /* pad to a page boundary */ addr = roundup(addr, PAGE_SIZE); diff --git a/stand/i386/libi386/elf64_freebsd.c b/stand/i386/libi386/elf64_freebsd.c --- a/stand/i386/libi386/elf64_freebsd.c +++ b/stand/i386/libi386/elf64_freebsd.c @@ -80,7 +80,7 @@ return(EFTYPE); ehdr = (Elf_Ehdr *)&(md->md_data); - err = bi_load64(fp->f_args, 0, &modulep, &kernend, 1); + err = bi_load64(fp->f_args, &modulep, &kernend, 1); if (err != 0) return(err); diff --git a/stand/i386/libi386/libi386.h b/stand/i386/libi386/libi386.h --- a/stand/i386/libi386/libi386.h +++ b/stand/i386/libi386/libi386.h @@ -151,7 +151,7 @@ vm_offset_t bi_copyenv(vm_offset_t addr); int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t *modulep, vm_offset_t *kernend); -int bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep, +int bi_load64(char *args, vm_offset_t *modulep, vm_offset_t *kernend, int add_smap); void pxe_enable(void *pxeinfo); diff --git a/stand/i386/libi386/multiboot.c b/stand/i386/libi386/multiboot.c --- a/stand/i386/libi386/multiboot.c +++ b/stand/i386/libi386/multiboot.c @@ -274,7 +274,7 @@ bzero(mb_mod, sizeof(struct multiboot_mod_list) * NUM_MODULES); - error = bi_load64(fp->f_args, 0, &modulep, &kernend, 0); + error = bi_load64(fp->f_args, &modulep, &kernend, 0); if (error != 0) { printf("bi_load64 failed: %d\n", error); goto error;