svn commit: r326486 - in head/stand: ofw/libofw powerpc/boot1.chrp

Bruce Evans brde at optusnet.com.au
Sun Dec 3 09:35:45 UTC 2017


On Sun, 3 Dec 2017, Warner Losh wrote:

> Log:
>  Include machine/md_var to pick up __syncicache prototype.

This is nonsense.  machine/md_var.h is kernel-only, but on powerpc
it declares __syncicache() which also exists in userland.  This include
is like including the kernel-only header sys/systm.h to declare printf()
in userland.

It is also an error to include machine/md_var.h in MI files in the
kernel.  Approx. 72 of the 305 includes of it in -current have this
bug.  The worst one is probably the one in altq_subr.c.  altq_subr.c
abuses the MD variable cpu_feature to test for CPUID_TSC.  That is just
the start of it layering violations and other bugs.

> Modified: head/stand/ofw/libofw/elf_freebsd.c
> ==============================================================================
> --- head/stand/ofw/libofw/elf_freebsd.c	Sun Dec  3 04:54:49 2017	(r326485)
> +++ head/stand/ofw/libofw/elf_freebsd.c	Sun Dec  3 04:54:54 2017	(r326486)
> @@ -32,6 +32,9 @@ __FBSDID("$FreeBSD$");
>
> #include <machine/metadata.h>
> #include <machine/elf.h>
> +#if defined(__powerpc__)
> +#include <machine/md_var.h>
> +#endif

Style bug (verbose spelling of 'ifdef').

Bruce


More information about the svn-src-head mailing list