From nobody Fri Jan 24 22:13:19 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YfsXF01dmz5lTvF for ; Fri, 24 Jan 2025 22:13:33 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YfsXD4sw7z3nlT for ; Fri, 24 Jan 2025 22:13:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2f42992f608so3888753a91.0 for ; Fri, 24 Jan 2025 14:13:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1737756811; x=1738361611; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FaQ7nvOortELnV7zUsIVwAVvFb2XoGkSHmo6rtHc3m8=; b=C0zZQmHe1JNt1V/ZUEIMAwPiYu0pPHtV+LNKKanqrMHO0tBqJtZdvTFfEpeNRHThYv PFeCzzk+fZxjPR+S5CkP6JFiW3T36SreadL6T7IVRrKqUHBKTDsqdEwQXyqwV8eh0ba/ jOT/LScfrzBAPlUFPUdez0NuCFXBv8VZ0O+c7bpx8WfI4IGj4A6j0mZMtakKX6izawX9 7ycJcxq0Dn3kw0v0UH8Tqou8hnv+SSW7t6CzcypiKW9pkijXC6/p/g4EVpWnBAI32GHx 8lRtJRleZWwOEVXgKrPMdvlh74JJJqvQs1SeiUXcMaunWUk/kmbIWdNm1okS4sbQdzrC tAZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737756811; x=1738361611; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FaQ7nvOortELnV7zUsIVwAVvFb2XoGkSHmo6rtHc3m8=; b=Jbexvhbq6JrEAu/6ELBsHs0jZHmIB+quUV2PKTlvtUcpND09dURX8PzKhUfhlsyvjQ 7UfW0ZcasMYSblM2nH+BVUhh1wQJihiGvgz49hYXup0QphIyKBPKPxgGenzR9Fdghyw+ 9kkyuJqsP4inBWCqsVtH5LxHdoFxOUNp/0kYpdOz1j5VdPYZoYRinqno4fJAZsM3n1G0 u42crBdZDkJne+SJ6AhLKcGn1IGk1KwTXUfH6XlA6JUy/tJkM2MftNyPY7zSmdR6s3da bciQQWHylQCYFsA76so5WaX7GYB7F/zBsylsjNrP+sn28kmeCqR6qkabKAqsjjp792VQ 0sfA== X-Forwarded-Encrypted: i=1; AJvYcCW30I1Xf3+32SHB9opgsHtdYgUmwvtGE1Cg0jnjwJc6rzEf9t3Qb/UrNEUNU1WKfROApGbbh76iLI5P74DWT5sRwVYd@freebsd.org X-Gm-Message-State: AOJu0Yx+EcqZ/dKwzy7CCpeKrVTwr8GUpaeMSyk4B2VRadEYSXhXSFPi Znytx4K2Lz6LNywP0pMYwghHC+JXmE7K2iA0Vlk7qhikO27PZqkxel7uA7lOp2Q6Q0ZK9mukCs2 VXV09F5e+4IQyy+oHyDncn3QhO/Tx9uy7MgAF6w== X-Gm-Gg: ASbGncsMbqy8GkLhugT2Vri0k1q3KF3lx5PSsjV++IVtTx4Qn10q03CYvVvuuA30GTF n9dLoPjZkyj7Fp4xEUkTm2tJdzDLNgAVbCA/ktue4rmzU5JgT04+fbh7SnQ7+2Q== X-Google-Smtp-Source: AGHT+IGPoSlKDoBm0DSemyqowfy4kPuiQxncqJPfmVAKcksMfo7e5bglCQMmX/eNX5du8DDLAhHZhghUZWzlEfWB8OE= X-Received: by 2002:a17:90b:3a0c:b0:2ee:e113:815d with SMTP id 98e67ed59e1d1-2f782c70168mr45162351a91.8.1737756811091; Fri, 24 Jan 2025 14:13:31 -0800 (PST) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 References: <202501242137.50OLbHWK094915@gitrepo.freebsd.org> <4ED8708B-32AF-4D7D-B1DC-6D790FB586C4@freebsd.org> In-Reply-To: <4ED8708B-32AF-4D7D-B1DC-6D790FB586C4@freebsd.org> From: Warner Losh Date: Fri, 24 Jan 2025 15:13:19 -0700 X-Gm-Features: AWEUYZkC_TGpQcC_xcc0yRzctn5NuIv2H5AyBbK-xuxT0os4ka6pqw-p7cN7xxI Message-ID: Subject: Re: git: 86077f4fd110 - main - stand: use globals for the kernel and module types To: Jessica Clarke Cc: Warner Losh , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: multipart/alternative; boundary="0000000000006e7b3d062c7b090f" X-Rspamd-Queue-Id: 4YfsXD4sw7z3nlT X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] --0000000000006e7b3d062c7b090f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 24, 2025 at 2:55=E2=80=AFPM Jessica Clarke = wrote: > On 24 Jan 2025, at 21:37, Warner Losh wrote: > > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D86077f4fd11070518a6d04eee7fdb93= cbbfb1b52 > > > > commit 86077f4fd11070518a6d04eee7fdb93cbbfb1b52 > > Author: Ahmad Khalifa > > AuthorDate: 2024-08-24 15:16:09 +0000 > > Commit: Warner Losh > > CommitDate: 2025-01-24 21:29:39 +0000 > > > > stand: use globals for the kernel and module types > > As with the kernel, please just use the macros directly. > Both are fine as is, which is why I didn't push the issue in the code review. Either a macro or global is fine, and doesn't materially change anything doing it one way or the other. But if someone wants to convert them to macros, that's cool too. It's likely marginally better, but both are light-years ahead of a dozen strings, some inexplicably different. Warner > Jess > > > Reviewed by: imp, kib > > Pull Request: https://github.com/freebsd/freebsd-src/pull/1394 > > --- > > stand/common/gfx_fb.c | 6 ++++-- > > stand/common/load_elf.c | 12 +++++------- > > stand/common/load_elf_obj.c | 8 +++----- > > stand/common/metadata.c | 2 +- > > stand/common/modinfo.c | 5 +++++ > > stand/common/modinfo.h | 5 +++++ > > stand/efi/loader/arch/amd64/multiboot2.c | 9 +++++---- > > stand/efi/loader/bootinfo.c | 2 +- > > stand/i386/libi386/bootinfo32.c | 2 +- > > stand/i386/libi386/bootinfo64.c | 2 +- > > stand/i386/libi386/multiboot.c | 9 +++++---- > > stand/powerpc/ofw/elf_freebsd.c | 2 +- > > stand/powerpc/ofw/ppc64_elf_freebsd.c | 2 +- > > stand/uboot/arch/powerpc/ppc64_elf_freebsd.c | 2 +- > > stand/uboot/elf_freebsd.c | 2 +- > > stand/userboot/userboot/bootinfo32.c | 2 +- > > stand/userboot/userboot/bootinfo64.c | 2 +- > > 17 files changed, 42 insertions(+), 32 deletions(-) > > > > diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c > > index 9bda0e7139a9..63036f3c07f6 100644 > > --- a/stand/common/gfx_fb.c > > +++ b/stand/common/gfx_fb.c > > @@ -102,6 +102,8 @@ > > #include > > #endif > > > > +#include "modinfo.h" > > + > > /* VGA text mode does use bold font. */ > > #if !defined(VGA_8X16_FONT) > > #define VGA_8X16_FONT "/boot/fonts/8x16b.fnt" > > @@ -2982,7 +2984,7 @@ build_font_module(vm_offset_t addr) > > > > fi.fi_checksum =3D -checksum; > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) > > panic("can't find kernel file"); > > > > @@ -3024,7 +3026,7 @@ build_splash_module(vm_offset_t addr) > > return (addr); > > } > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) > > panic("can't find kernel file"); > > > > diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c > > index d3775b9f0017..e19aefa121e7 100644 > > --- a/stand/common/load_elf.c > > +++ b/stand/common/load_elf.c > > @@ -37,6 +37,7 @@ > > #include > > > > #include "bootstrap.h" > > +#include "modinfo.h" > > > > #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) > > > > @@ -89,9 +90,6 @@ static int __elfN(parse_modmetadata)(struct > preloaded_file *mp, elf_file_t ef, > > static symaddr_fn __elfN(symaddr); > > static char *fake_modname(const char *name); > > > > -const char *__elfN(kerneltype) =3D "elf kernel"; > > -const char *__elfN(moduletype) =3D "elf module"; > > - > > uint64_t __elfN(relocation_offset) =3D 0; > > > > #ifdef __powerpc__ > > @@ -384,7 +382,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, > > /* > > * Check to see what sort of module we are. > > */ > > - kfp =3D file_findfile(NULL, __elfN(kerneltype)); > > + kfp =3D file_findfile(NULL, md_kerntype); > > #ifdef __powerpc__ > > /* > > * Kernels can be ET_DYN, so just assume the first loaded object is the > > @@ -435,7 +433,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, > > err =3D EPERM; > > goto oerr; > > } > > - if (strcmp(__elfN(kerneltype), kfp->f_type)) { > > + if (strcmp(md_kerntype, kfp->f_type)) { > > printf("elf" __XSTRING(__ELF_WORD_SIZE) > > "_loadfile: can't load module with kernel type '%s'\n", > > kfp->f_type); > > @@ -470,9 +468,9 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, > > fp->f_name =3D strdup(filename); > > if (multiboot =3D=3D 0) > > fp->f_type =3D strdup(ef.kernel ? > > - __elfN(kerneltype) : __elfN(moduletype)); > > + md_kerntype : md_modtype); > > else > > - fp->f_type =3D strdup("elf multiboot kernel"); > > + fp->f_type =3D strdup(md_kerntype_mb); > > > > if (module_verbose >=3D MODULE_VERBOSE_FULL) { > > if (ef.kernel) > > diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c > > index 9ff1d238b8c8..1e07828dd8ac 100644 > > --- a/stand/common/load_elf_obj.c > > +++ b/stand/common/load_elf_obj.c > > @@ -37,6 +37,7 @@ > > #include > > > > #include "bootstrap.h" > > +#include "modinfo.h" > > > > #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) > > > > @@ -77,9 +78,6 @@ static int __elfN(obj_parse_modmetadata)(struct > preloaded_file *mp, > > elf_file_t ef); > > static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size > symidx); > > > > -const char *__elfN(obj_kerneltype) =3D "elf kernel"; > > -const char *__elfN(obj_moduletype) =3D "elf obj module"; > > - > > /* > > * Attempt to load the file (file) as an ELF module. It will be stored > at > > * (dest), and a pointer to a module structure describing the loaded > object > > @@ -154,7 +152,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, > > } > > #endif > > > > - kfp =3D file_findfile(NULL, __elfN(obj_kerneltype)); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) { > > printf("elf" __XSTRING(__ELF_WORD_SIZE) > > "_obj_loadfile: can't load module before kernel\n"); > > @@ -178,7 +176,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest, > > goto out; > > } > > fp->f_name =3D strdup(filename); > > - fp->f_type =3D strdup(__elfN(obj_moduletype)); > > + fp->f_type =3D strdup(md_modtype_obj); > > > > if (module_verbose > MODULE_VERBOSE_SILENT) > > printf("%s ", filename); > > diff --git a/stand/common/metadata.c b/stand/common/metadata.c > > index 8962763061dc..22df6f175791 100644 > > --- a/stand/common/metadata.c > > +++ b/stand/common/metadata.c > > @@ -146,7 +146,7 @@ md_load_dual(char *args, vm_offset_t *modulep, > vm_offset_t *dtb, int kern64) > > #endif > > > > kernend =3D 0; > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); > > diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c > > index 381bd9dfd719..d00548c91c57 100644 > > --- a/stand/common/modinfo.c > > +++ b/stand/common/modinfo.c > > @@ -109,6 +109,11 @@ > > > > #define MOD_ALIGN(l) roundup(l, align) > > > > +const char md_modtype[] =3D MODTYPE; > > +const char md_kerntype[] =3D KERNTYPE; > > +const char md_modtype_obj[] =3D MODTYPE_OBJ; > > +const char md_kerntype_mb[] =3D KERNTYPE_MB; > > + > > vm_offset_t > > md_copymodules(vm_offset_t addr, bool kern64) > > { > > diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h > > index 967367beeeb0..d26129089fb6 100644 > > --- a/stand/common/modinfo.h > > +++ b/stand/common/modinfo.h > > @@ -6,6 +6,11 @@ > > #ifndef COMMON_MODINFO_H > > #define COMMON_MODINFO_H > > > > +extern const char md_modtype[]; > > +extern const char md_kerntype[]; > > +extern const char md_modtype_obj[]; > > +extern const char md_kerntype_mb[]; > > + > > int md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb); > > int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb); > > > > diff --git a/stand/efi/loader/arch/amd64/multiboot2.c > b/stand/efi/loader/arch/amd64/multiboot2.c > > index d09b01fce1fc..eb7362293406 100644 > > --- a/stand/efi/loader/arch/amd64/multiboot2.c > > +++ b/stand/efi/loader/arch/amd64/multiboot2.c > > @@ -51,6 +51,7 @@ > > #include "bootstrap.h" > > #include "multiboot2.h" > > #include "loader_efi.h" > > +#include "modinfo.h" > > > > extern int elf32_loadfile_raw(char *filename, uint64_t dest, > > struct preloaded_file **result, int multiboot); > > @@ -436,7 +437,7 @@ exec(struct preloaded_file *fp) > > * module 0 module 1 > > */ > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) { > > printf("No FreeBSD kernel provided, aborting\n"); > > error =3D EINVAL; > > @@ -498,7 +499,7 @@ obj_loadfile(char *filename, uint64_t dest, struct > preloaded_file **result) > > int error; > > > > /* See if there's a multiboot kernel loaded */ > > - mfp =3D file_findfile(NULL, "elf multiboot kernel"); > > + mfp =3D file_findfile(NULL, md_kerntype_mb); > > if (mfp =3D=3D NULL) > > return (EFTYPE); > > > > @@ -506,14 +507,14 @@ obj_loadfile(char *filename, uint64_t dest, struc= t > preloaded_file **result) > > * We have a multiboot kernel loaded, see if there's a FreeBSD > > * kernel loaded also. > > */ > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) { > > /* > > * No kernel loaded, this must be it. The kernel has to > > * be loaded as a raw file, it will be processed by > > * Xen and correctly loaded as an ELF file. > > */ > > - rfp =3D file_loadraw(filename, "elf kernel", 0); > > + rfp =3D file_loadraw(filename, md_kerntype, 0); > > if (rfp =3D=3D NULL) { > > printf( > > "Unable to load %s as a multiboot payload kernel\n", > > diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c > > index b7d4070c2ffb..3e74a9228b5e 100644 > > --- a/stand/efi/loader/bootinfo.c > > +++ b/stand/efi/loader/bootinfo.c > > @@ -420,7 +420,7 @@ bi_load(char *args, vm_offset_t *modulep, > vm_offset_t *kernendp, bool exit_bs) > > addr +=3D roundup(dtb_size, PAGE_SIZE); > > #endif > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/i386/libi386/bootinfo32.c > b/stand/i386/libi386/bootinfo32.c > > index df715e547795..37b227b913bd 100644 > > --- a/stand/i386/libi386/bootinfo32.c > > +++ b/stand/i386/libi386/bootinfo32.c > > @@ -129,7 +129,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* pad to a page boundary */ > > addr =3D roundup(addr, PAGE_SIZE); > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/i386/libi386/bootinfo64.c > b/stand/i386/libi386/bootinfo64.c > > index 4731b10325fe..f7181dcd599f 100644 > > --- a/stand/i386/libi386/bootinfo64.c > > +++ b/stand/i386/libi386/bootinfo64.c > > @@ -143,7 +143,7 @@ bi_load64(char *args, vm_offset_t *modulep, > > /* place the metadata before anything */ > > module =3D *modulep =3D addr; > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/i386/libi386/multiboot.c > b/stand/i386/libi386/multiboot.c > > index b69895de9706..e2bd44fe83f5 100644 > > --- a/stand/i386/libi386/multiboot.c > > +++ b/stand/i386/libi386/multiboot.c > > @@ -48,6 +48,7 @@ > > #include "bootstrap.h" > > #include "multiboot.h" > > #include "libi386.h" > > +#include "modinfo.h" > > #include > > > > #define MULTIBOOT_SUPPORTED_FLAGS \ > > @@ -256,7 +257,7 @@ multiboot_exec(struct preloaded_file *fp) > > * module 0 module 1 > > */ > > > > - fp =3D file_findfile(NULL, "elf kernel"); > > + fp =3D file_findfile(NULL, md_kerntype); > > if (fp =3D=3D NULL) { > > printf("No FreeBSD kernel provided, aborting\n"); > > error =3D EINVAL; > > @@ -324,7 +325,7 @@ multiboot_obj_loadfile(char *filename, uint64_t des= t, > > int error, mod_num; > > > > /* See if there's a multiboot kernel loaded */ > > - mfp =3D file_findfile(NULL, "elf multiboot kernel"); > > + mfp =3D file_findfile(NULL, md_kerntype_mb); > > if (mfp =3D=3D NULL) > > return (EFTYPE); > > > > @@ -332,14 +333,14 @@ multiboot_obj_loadfile(char *filename, uint64_t > dest, > > * We have a multiboot kernel loaded, see if there's a FreeBSD > > * kernel loaded also. > > */ > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) { > > /* > > * No kernel loaded, this must be it. The kernel has to > > * be loaded as a raw file, it will be processed by > > * Xen and correctly loaded as an ELF file. > > */ > > - rfp =3D file_loadraw(filename, "elf kernel", 0); > > + rfp =3D file_loadraw(filename, md_kerntype, 0); > > if (rfp =3D=3D NULL) { > > printf( > > "Unable to load %s as a multiboot payload kernel\n", > > diff --git a/stand/powerpc/ofw/elf_freebsd.c > b/stand/powerpc/ofw/elf_freebsd.c > > index 21ab834f76fa..4d34fa18c5dd 100644 > > --- a/stand/powerpc/ofw/elf_freebsd.c > > +++ b/stand/powerpc/ofw/elf_freebsd.c > > @@ -58,7 +58,7 @@ __elfN(ofw_loadfile)(char *filename, uint64_t dest, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > #endif > > return (0); > > diff --git a/stand/powerpc/ofw/ppc64_elf_freebsd.c > b/stand/powerpc/ofw/ppc64_elf_freebsd.c > > index e0518abe2283..bc68d129f353 100644 > > --- a/stand/powerpc/ofw/ppc64_elf_freebsd.c > > +++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c > > @@ -57,7 +57,7 @@ ppc64_ofw_elf_loadfile(char *filename, uint64_t dest, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > return (0); > > } > > diff --git a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > > index 291fe6b944fb..e500b862de2e 100644 > > --- a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > > +++ b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c > > @@ -53,7 +53,7 @@ ppc64_uboot_elf_loadfile(char *filename, uint64_t des= t, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > return (0); > > } > > diff --git a/stand/uboot/elf_freebsd.c b/stand/uboot/elf_freebsd.c > > index 6c764d143881..3b1bdc542538 100644 > > --- a/stand/uboot/elf_freebsd.c > > +++ b/stand/uboot/elf_freebsd.c > > @@ -53,7 +53,7 @@ __elfN(uboot_load)(char *filename, uint64_t dest, > > * No need to sync the icache for modules: this will > > * be done by the kernel after relocation. > > */ > > - if (!strcmp((*result)->f_type, "elf kernel")) > > + if (!strcmp((*result)->f_type, md_kerntype)) > > __syncicache((void *) (*result)->f_addr, (*result)->f_size); > > #endif > > return (0); > > diff --git a/stand/userboot/userboot/bootinfo32.c > b/stand/userboot/userboot/bootinfo32.c > > index 91f1f81f1181..750574912172 100644 > > --- a/stand/userboot/userboot/bootinfo32.c > > +++ b/stand/userboot/userboot/bootinfo32.c > > @@ -108,7 +108,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* pad to a page boundary */ > > addr =3D roundup(addr, PAGE_SIZE); > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > diff --git a/stand/userboot/userboot/bootinfo64.c > b/stand/userboot/userboot/bootinfo64.c > > index fb9fd0fb82f1..d20202bf4fbb 100644 > > --- a/stand/userboot/userboot/bootinfo64.c > > +++ b/stand/userboot/userboot/bootinfo64.c > > @@ -140,7 +140,7 @@ bi_load64(char *args, vm_offset_t *modulep, > vm_offset_t *kernendp) > > /* pad to a page boundary */ > > addr =3D roundup(addr, PAGE_SIZE); > > > > - kfp =3D file_findfile(NULL, "elf kernel"); > > + kfp =3D file_findfile(NULL, md_kerntype); > > if (kfp =3D=3D NULL) > > panic("can't find kernel file"); > > kernend =3D 0; /* fill it in later */ > > --0000000000006e7b3d062c7b090f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Fri, Jan 24,= 2025 at 2:55=E2=80=AFPM Jessica Clarke <jrtc27@freebsd.org> wrote:
On 24 Jan 2025, at 21:37, Warner Losh <imp@Free= BSD.org> wrote:
>
> The branch main has been updated by imp:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3D86077f4fd11070518a6d04eee7fdb93cbbfb1b52<= /a>
>
> commit 86077f4fd11070518a6d04eee7fdb93cbbfb1b52
> Author:=C2=A0 =C2=A0 =C2=A0Ahmad Khalifa <
ahmadkhalifa570@gmail.com>
> AuthorDate: 2024-08-24 15:16:09 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2025-01-24 21:29:39 +0000
>
>=C2=A0 =C2=A0 stand: use globals for the kernel and module types

As with the kernel, please just use the macros directly.

Both are fine as is, which is why I didn't push the i= ssue in the code review.
Either a macro or global is fine, and do= esn't materially change=C2=A0anything
doing it one way or the= other. But if someone wants to convert them to
macros, that'= s cool too. It's likely marginally better, but both are light-years
ahead of a dozen strings, some inexplicably=C2=A0different.

Warner
=C2=A0
Jess

>=C2=A0 =C2=A0 Reviewed by: imp, kib
>=C2=A0 =C2=A0 Pull Request: https://github.com/f= reebsd/freebsd-src/pull/1394
> ---
> stand/common/gfx_fb.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 6 ++++--
> stand/common/load_elf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 12 +++++-------
> stand/common/load_elf_obj.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 |=C2=A0 8 +++-----
> stand/common/metadata.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
> stand/common/modinfo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 5 +++++
> stand/common/modinfo.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 5 +++++
> stand/efi/loader/arch/amd64/multiboot2.c=C2=A0 =C2=A0 =C2=A0|=C2=A0 9 = +++++----
> stand/efi/loader/bootinfo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
> stand/i386/libi386/bootinfo32.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 2 +-
> stand/i386/libi386/bootinfo64.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 2 +-
> stand/i386/libi386/multiboot.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0|=C2=A0 9 +++++----
> stand/powerpc/ofw/elf_freebsd.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 2 +-
> stand/powerpc/ofw/ppc64_elf_freebsd.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 2 +-
> stand/uboot/arch/powerpc/ppc64_elf_freebsd.c |=C2=A0 2 +-
> stand/uboot/elf_freebsd.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 2 +-
> stand/userboot/userboot/bootinfo32.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 2 +-
> stand/userboot/userboot/bootinfo64.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 2 +-
> 17 files changed, 42 insertions(+), 32 deletions(-)
>
> diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c
> index 9bda0e7139a9..63036f3c07f6 100644
> --- a/stand/common/gfx_fb.c
> +++ b/stand/common/gfx_fb.c
> @@ -102,6 +102,8 @@
> #include <vbe.h>
> #endif
>
> +#include "modinfo.h"
> +
> /* VGA text mode does use bold font. */
> #if !defined(VGA_8X16_FONT)
> #define VGA_8X16_FONT "/boot/fonts/8x16b.fnt"
> @@ -2982,7 +2984,7 @@ build_font_module(vm_offset_t addr)
>
> fi.fi_checksum =3D -checksum;
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL)
> panic("can't find kernel file");
>
> @@ -3024,7 +3026,7 @@ build_splash_module(vm_offset_t addr)
> return (addr);
> }
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL)
> panic("can't find kernel file");
>
> diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c
> index d3775b9f0017..e19aefa121e7 100644
> --- a/stand/common/load_elf.c
> +++ b/stand/common/load_elf.c
> @@ -37,6 +37,7 @@
> #include <sys/link_elf.h>
>
> #include "bootstrap.h"
> +#include "modinfo.h"
>
> #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
>
> @@ -89,9 +90,6 @@ static int __elfN(parse_modmetadata)(struct preloade= d_file *mp, elf_file_t ef,
> static symaddr_fn __elfN(symaddr);
> static char *fake_modname(const char *name);
>
> -const char *__elfN(kerneltype) =3D "elf kernel";
> -const char *__elfN(moduletype) =3D "elf module";
> -
> uint64_t __elfN(relocation_offset) =3D 0;
>
> #ifdef __powerpc__
> @@ -384,7 +382,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest= ,
> /*
> * Check to see what sort of module we are.
> */
> - kfp =3D file_findfile(NULL, __elfN(kerneltype));
> + kfp =3D file_findfile(NULL, md_kerntype);
> #ifdef __powerpc__
> /*
> * Kernels can be ET_DYN, so just assume the first loaded object is the=
> @@ -435,7 +433,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest= ,
> err =3D EPERM;
> goto oerr;
> }
> - if (strcmp(__elfN(kerneltype), kfp->f_type)) {
> + if (strcmp(md_kerntype, kfp->f_type)) {
> printf("elf" __XSTRING(__ELF_WORD_SIZE)
> "_loadfile: can't load module with kernel type '%s'\n= ",
>=C2=A0 =C2=A0 kfp->f_type);
> @@ -470,9 +468,9 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest= ,
> fp->f_name =3D strdup(filename);
> if (multiboot =3D=3D 0)
> fp->f_type =3D strdup(ef.kernel ?
> -=C2=A0 =C2=A0 __elfN(kerneltype) : __elfN(moduletype));
> +=C2=A0 =C2=A0 md_kerntype : md_modtype);
> else
> - fp->f_type =3D strdup("elf multiboot kernel");
> + fp->f_type =3D strdup(md_kerntype_mb);
>
> if (module_verbose >=3D MODULE_VERBOSE_FULL) {
> if (ef.kernel)
> diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c=
> index 9ff1d238b8c8..1e07828dd8ac 100644
> --- a/stand/common/load_elf_obj.c
> +++ b/stand/common/load_elf_obj.c
> @@ -37,6 +37,7 @@
> #include <sys/link_elf.h>
>
> #include "bootstrap.h"
> +#include "modinfo.h"
>
> #define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
>
> @@ -77,9 +78,6 @@ static int __elfN(obj_parse_modmetadata)(struct prel= oaded_file *mp,
>=C2=A0 =C2=A0 =C2=A0elf_file_t ef);
> static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symi= dx);
>
> -const char *__elfN(obj_kerneltype) =3D "elf kernel";
> -const char *__elfN(obj_moduletype) =3D "elf obj module"; > -
> /*
>=C2=A0 * Attempt to load the file (file) as an ELF module.=C2=A0 It wil= l be stored at
>=C2=A0 * (dest), and a pointer to a module structure describing the loa= ded object
> @@ -154,7 +152,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest= ,
> }
> #endif
>
> - kfp =3D file_findfile(NULL, __elfN(obj_kerneltype));
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL) {
> printf("elf" __XSTRING(__ELF_WORD_SIZE)
>=C2=A0 =C2=A0 "_obj_loadfile: can't load module before kernel\= n");
> @@ -178,7 +176,7 @@ __elfN(obj_loadfile)(char *filename, uint64_t dest= ,
> goto out;
> }
> fp->f_name =3D strdup(filename);
> - fp->f_type =3D strdup(__elfN(obj_moduletype));
> + fp->f_type =3D strdup(md_modtype_obj);
>
> if (module_verbose > MODULE_VERBOSE_SILENT)
> printf("%s ", filename);
> diff --git a/stand/common/metadata.c b/stand/common/metadata.c
> index 8962763061dc..22df6f175791 100644
> --- a/stand/common/metadata.c
> +++ b/stand/common/metadata.c
> @@ -146,7 +146,7 @@ md_load_dual(char *args, vm_offset_t *modulep, vm_= offset_t *dtb, int kern64)
> #endif
>
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0;
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto= , &howto);
> diff --git a/stand/common/modinfo.c b/stand/common/modinfo.c
> index 381bd9dfd719..d00548c91c57 100644
> --- a/stand/common/modinfo.c
> +++ b/stand/common/modinfo.c
> @@ -109,6 +109,11 @@
>
> #define MOD_ALIGN(l) roundup(l, align)
>
> +const char md_modtype[] =3D MODTYPE;
> +const char md_kerntype[] =3D KERNTYPE;
> +const char md_modtype_obj[] =3D MODTYPE_OBJ;
> +const char md_kerntype_mb[] =3D KERNTYPE_MB;
> +
> vm_offset_t
> md_copymodules(vm_offset_t addr, bool kern64)
> {
> diff --git a/stand/common/modinfo.h b/stand/common/modinfo.h
> index 967367beeeb0..d26129089fb6 100644
> --- a/stand/common/modinfo.h
> +++ b/stand/common/modinfo.h
> @@ -6,6 +6,11 @@
> #ifndef COMMON_MODINFO_H
> #define COMMON_MODINFO_H
>
> +extern const char md_modtype[];
> +extern const char md_kerntype[];
> +extern const char md_modtype_obj[];
> +extern const char md_kerntype_mb[];
> +
> int md_load(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
> int md_load64(char *args, vm_offset_t *modulep, vm_offset_t *dtb);
>
> diff --git a/stand/efi/loader/arch/amd64/multiboot2.c b/stand/efi/load= er/arch/amd64/multiboot2.c
> index d09b01fce1fc..eb7362293406 100644
> --- a/stand/efi/loader/arch/amd64/multiboot2.c
> +++ b/stand/efi/loader/arch/amd64/multiboot2.c
> @@ -51,6 +51,7 @@
> #include "bootstrap.h"
> #include "multiboot2.h"
> #include "loader_efi.h"
> +#include "modinfo.h"
>
> extern int elf32_loadfile_raw(char *filename, uint64_t dest,
>=C2=A0 =C2=A0 =C2=A0struct preloaded_file **result, int multiboot);
> @@ -436,7 +437,7 @@ exec(struct preloaded_file *fp)
> *=C2=A0 module 0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0module 1
> */
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL) {
> printf("No FreeBSD kernel provided, aborting\n");
> error =3D EINVAL;
> @@ -498,7 +499,7 @@ obj_loadfile(char *filename, uint64_t dest, struct= preloaded_file **result)
> int error;
>
> /* See if there's a multiboot kernel loaded */
> - mfp =3D file_findfile(NULL, "elf multiboot kernel");
> + mfp =3D file_findfile(NULL, md_kerntype_mb);
> if (mfp =3D=3D NULL)
> return (EFTYPE);
>
> @@ -506,14 +507,14 @@ obj_loadfile(char *filename, uint64_t dest, stru= ct preloaded_file **result)
> * We have a multiboot kernel loaded, see if there's a FreeBSD
> * kernel loaded also.
> */
> - kfp =3D file_findfile(NULL, "elf kernel");
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL) {
> /*
> * No kernel loaded, this must be it. The kernel has to
> * be loaded as a raw file, it will be processed by
> * Xen and correctly loaded as an ELF file.
> */
> - rfp =3D file_loadraw(filename, "elf kernel", 0);
> + rfp =3D file_loadraw(filename, md_kerntype, 0);
> if (rfp =3D=3D NULL) {
> printf(
> "Unable to load %s as a multiboot payload kernel\n",
> diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c=
> index b7d4070c2ffb..3e74a9228b5e 100644
> --- a/stand/efi/loader/bootinfo.c
> +++ b/stand/efi/loader/bootinfo.c
> @@ -420,7 +420,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offse= t_t *kernendp, bool exit_bs)
> addr +=3D roundup(dtb_size, PAGE_SIZE);
> #endif
>
> - kfp =3D file_findfile(NULL, "elf kernel");
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL)
> panic("can't find kernel file");
> kernend =3D 0; /* fill it in later */
> diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/boot= info32.c
> index df715e547795..37b227b913bd 100644
> --- a/stand/i386/libi386/bootinfo32.c
> +++ b/stand/i386/libi386/bootinfo32.c
> @@ -129,7 +129,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, = vm_offset_t *bip, vm_offset_t
>=C2=A0 =C2=A0 =C2=A0/* pad to a page boundary */
>=C2=A0 =C2=A0 =C2=A0addr =3D roundup(addr, PAGE_SIZE);
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */
> diff --git a/stand/i386/libi386/bootinfo64.c b/stand/i386/libi386/boot= info64.c
> index 4731b10325fe..f7181dcd599f 100644
> --- a/stand/i386/libi386/bootinfo64.c
> +++ b/stand/i386/libi386/bootinfo64.c
> @@ -143,7 +143,7 @@ bi_load64(char *args, vm_offset_t *modulep,
>=C2=A0 =C2=A0 =C2=A0/* place the metadata before anything */
>=C2=A0 =C2=A0 =C2=A0module =3D *modulep =3D addr;
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */
> diff --git a/stand/i386/libi386/multiboot.c b/stand/i386/libi386/multi= boot.c
> index b69895de9706..e2bd44fe83f5 100644
> --- a/stand/i386/libi386/multiboot.c
> +++ b/stand/i386/libi386/multiboot.c
> @@ -48,6 +48,7 @@
> #include "bootstrap.h"
> #include "multiboot.h"
> #include "libi386.h"
> +#include "modinfo.h"
> #include <btxv86.h>
>
> #define MULTIBOOT_SUPPORTED_FLAGS \
> @@ -256,7 +257,7 @@ multiboot_exec(struct preloaded_file *fp)
> *=C2=A0 module 0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0module 1
> */
>
> - fp =3D file_findfile(NULL, "elf kernel");
> + fp =3D file_findfile(NULL, md_kerntype);
> if (fp =3D=3D NULL) {
> printf("No FreeBSD kernel provided, aborting\n");
> error =3D EINVAL;
> @@ -324,7 +325,7 @@ multiboot_obj_loadfile(char *filename, uint64_t de= st,
> int error, mod_num;
>
> /* See if there's a multiboot kernel loaded */
> - mfp =3D file_findfile(NULL, "elf multiboot kernel");
> + mfp =3D file_findfile(NULL, md_kerntype_mb);
> if (mfp =3D=3D NULL)
> return (EFTYPE);
>
> @@ -332,14 +333,14 @@ multiboot_obj_loadfile(char *filename, uint64_t = dest,
> * We have a multiboot kernel loaded, see if there's a FreeBSD
> * kernel loaded also.
> */
> - kfp =3D file_findfile(NULL, "elf kernel");
> + kfp =3D file_findfile(NULL, md_kerntype);
> if (kfp =3D=3D NULL) {
> /*
> * No kernel loaded, this must be it. The kernel has to
> * be loaded as a raw file, it will be processed by
> * Xen and correctly loaded as an ELF file.
> */
> - rfp =3D file_loadraw(filename, "elf kernel", 0);
> + rfp =3D file_loadraw(filename, md_kerntype, 0);
> if (rfp =3D=3D NULL) {
> printf(
> "Unable to load %s as a multiboot payload kernel\n",
> diff --git a/stand/powerpc/ofw/elf_freebsd.c b/stand/powerpc/ofw/elf_f= reebsd.c
> index 21ab834f76fa..4d34fa18c5dd 100644
> --- a/stand/powerpc/ofw/elf_freebsd.c
> +++ b/stand/powerpc/ofw/elf_freebsd.c
> @@ -58,7 +58,7 @@ __elfN(ofw_loadfile)(char *filename, uint64_t dest,<= br> > * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> #endif
> return (0);
> diff --git a/stand/powerpc/ofw/ppc64_elf_freebsd.c b/stand/powerpc/ofw= /ppc64_elf_freebsd.c
> index e0518abe2283..bc68d129f353 100644
> --- a/stand/powerpc/ofw/ppc64_elf_freebsd.c
> +++ b/stand/powerpc/ofw/ppc64_elf_freebsd.c
> @@ -57,7 +57,7 @@ ppc64_ofw_elf_loadfile(char *filename, uint64_t dest= ,
> * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> return (0);
> }
> diff --git a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c b/stand/uboo= t/arch/powerpc/ppc64_elf_freebsd.c
> index 291fe6b944fb..e500b862de2e 100644
> --- a/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c
> +++ b/stand/uboot/arch/powerpc/ppc64_elf_freebsd.c
> @@ -53,7 +53,7 @@ ppc64_uboot_elf_loadfile(char *filename, uint64_t de= st,
> * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> return (0);
> }
> diff --git a/stand/uboot/elf_freebsd.c b/stand/uboot/elf_freebsd.c
> index 6c764d143881..3b1bdc542538 100644
> --- a/stand/uboot/elf_freebsd.c
> +++ b/stand/uboot/elf_freebsd.c
> @@ -53,7 +53,7 @@ __elfN(uboot_load)(char *filename, uint64_t dest, > * No need to sync the icache for modules: this will
> * be done by the kernel after relocation.
> */
> - if (!strcmp((*result)->f_type, "elf kernel"))
> + if (!strcmp((*result)->f_type, md_kerntype))
> __syncicache((void *) (*result)->f_addr, (*result)->f_size);
> #endif
> return (0);
> diff --git a/stand/userboot/userboot/bootinfo32.c b/stand/userboot/use= rboot/bootinfo32.c
> index 91f1f81f1181..750574912172 100644
> --- a/stand/userboot/userboot/bootinfo32.c
> +++ b/stand/userboot/userboot/bootinfo32.c
> @@ -108,7 +108,7 @@ bi_load32(char *args, int *howtop, int *bootdevp, = vm_offset_t *bip, vm_offset_t
>=C2=A0 =C2=A0 =C2=A0/* pad to a page boundary */
>=C2=A0 =C2=A0 =C2=A0addr =3D roundup(addr, PAGE_SIZE);
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */
> diff --git a/stand/userboot/userboot/bootinfo64.c b/stand/userboot/use= rboot/bootinfo64.c
> index fb9fd0fb82f1..d20202bf4fbb 100644
> --- a/stand/userboot/userboot/bootinfo64.c
> +++ b/stand/userboot/userboot/bootinfo64.c
> @@ -140,7 +140,7 @@ bi_load64(char *args, vm_offset_t *modulep, vm_off= set_t *kernendp)
>=C2=A0 =C2=A0 =C2=A0/* pad to a page boundary */
>=C2=A0 =C2=A0 =C2=A0addr =3D roundup(addr, PAGE_SIZE);
>
> -=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, "elf kernel"); > +=C2=A0 =C2=A0 kfp =3D file_findfile(NULL, md_kerntype);
>=C2=A0 =C2=A0 =C2=A0if (kfp =3D=3D NULL)
> panic("can't find kernel file");
>=C2=A0 =C2=A0 =C2=A0kernend =3D 0; /* fill it in later */

--0000000000006e7b3d062c7b090f--