stand/amd64: remove unused addr parameter from bi_load64

All callers of bi_load64 pass 0 as the addr parameter, so just remove
it and always calculate the last load address from the module chain.

No functional change.

Sponsored by:		Citrix Systems R&D
Reviewed by:		tsoome, imp
Differential revision:	https://reviews.freebsd.org/D28412
This commit is contained in:
Roger Pau Monné 2021-01-29 12:29:37 +01:00
parent 243125c81a
commit 45ecda8ebf
4 changed files with 10 additions and 10 deletions

View File

@ -182,7 +182,7 @@ bi_checkcpu(void)
* - Module metadata are formatted and placed in kernel space. * - Module metadata are formatted and placed in kernel space.
*/ */
int 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) vm_offset_t *kernendp, int add_smap)
{ {
struct preloaded_file *xp, *kfp; struct preloaded_file *xp, *kfp;
@ -191,6 +191,7 @@ bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep,
uint64_t kernend; uint64_t kernend;
uint64_t envp; uint64_t envp;
uint64_t module; uint64_t module;
uint64_t addr;
vm_offset_t size; vm_offset_t size;
char *rootdevname; char *rootdevname;
int howto; int howto;
@ -217,12 +218,11 @@ bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep,
/* Try reading the /etc/fstab file to select the root device */ /* Try reading the /etc/fstab file to select the root device */
getrootmount(i386_fmtdev((void *)rootdev)); getrootmount(i386_fmtdev((void *)rootdev));
if (addr == 0) { addr = 0;
/* find the last module in the chain */ /* find the last module in the chain */
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
if (addr < (xp->f_addr + xp->f_size)) if (addr < (xp->f_addr + xp->f_size))
addr = xp->f_addr + xp->f_size; addr = xp->f_addr + xp->f_size;
}
} }
/* pad to a page boundary */ /* pad to a page boundary */
addr = roundup(addr, PAGE_SIZE); addr = roundup(addr, PAGE_SIZE);

View File

@ -80,7 +80,7 @@ elf64_exec(struct preloaded_file *fp)
return(EFTYPE); return(EFTYPE);
ehdr = (Elf_Ehdr *)&(md->md_data); 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) if (err != 0)
return(err); return(err);

View File

@ -151,7 +151,7 @@ void bi_setboothowto(int howto);
vm_offset_t bi_copyenv(vm_offset_t addr); vm_offset_t bi_copyenv(vm_offset_t addr);
int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, int bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip,
vm_offset_t *modulep, vm_offset_t *kernend); 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); vm_offset_t *kernend, int add_smap);
void pxe_enable(void *pxeinfo); void pxe_enable(void *pxeinfo);

View File

@ -274,7 +274,7 @@ multiboot_exec(struct preloaded_file *fp)
bzero(mb_mod, sizeof(struct multiboot_mod_list) * NUM_MODULES); 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) { if (error != 0) {
printf("bi_load64 failed: %d\n", error); printf("bi_load64 failed: %d\n", error);
goto error; goto error;