Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 2021 14:41:38 GMT
From:      Roger Pau Monné <royger@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 45ecda8ebf80 - main - stand/amd64: remove unused addr parameter from bi_load64
Message-ID:  <202102011441.111Efc7G056173@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/src/commit/?id=45ecda8ebf80bb341aa3b4955810518ae6fab158

commit 45ecda8ebf80bb341aa3b4955810518ae6fab158
Author:     Roger Pau Monné <royger@FreeBSD.org>
AuthorDate: 2021-01-29 11:29:37 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2021-02-01 14:41:26 +0000

    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
---
 stand/i386/libi386/bootinfo64.c    | 14 +++++++-------
 stand/i386/libi386/elf64_freebsd.c |  2 +-
 stand/i386/libi386/libi386.h       |  2 +-
 stand/i386/libi386/multiboot.c     |  2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/bootinfo64.c
index 9f038f2a4f2b..1ffa4188d926 100644
--- a/stand/i386/libi386/bootinfo64.c
+++ b/stand/i386/libi386/bootinfo64.c
@@ -182,7 +182,7 @@ bi_checkcpu(void)
  * - 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 @@ bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep,
     uint64_t			kernend;
     uint64_t			envp;
     uint64_t			module;
+    uint64_t			addr;
     vm_offset_t			size;
     char			*rootdevname;
     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 */
     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
index 6bf884045eea..1108a9e4d713 100644
--- a/stand/i386/libi386/elf64_freebsd.c
+++ b/stand/i386/libi386/elf64_freebsd.c
@@ -80,7 +80,7 @@ elf64_exec(struct preloaded_file *fp)
 	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
index dbd6565f8d1c..a52a1190e7ec 100644
--- a/stand/i386/libi386/libi386.h
+++ b/stand/i386/libi386/libi386.h
@@ -151,7 +151,7 @@ void	bi_setboothowto(int howto);
 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
index 71fd63bb4c88..2d0a4a9b2274 100644
--- a/stand/i386/libi386/multiboot.c
+++ b/stand/i386/libi386/multiboot.c
@@ -274,7 +274,7 @@ multiboot_exec(struct preloaded_file *fp)
 
 	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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102011441.111Efc7G056173>