Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Dec 2017 14:17:07 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r326486 - in head/stand: ofw/libofw powerpc/boot1.chrp
Message-ID:  <CANCZdfoq_HO-CUm9mC=ZPKxOn2ENd4N2-G330VXC9efft6fDJw@mail.gmail.com>
In-Reply-To: <20171203185027.T872@besplex.bde.org>
References:  <201712030454.vB34ssem056112@repo.freebsd.org> <20171203185027.T872@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 3, 2017 at 2:35 AM, Bruce Evans <brde@optusnet.com.au> wrote:

> 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.
>

Yea.... This is the sort of thing that should be defined in cpufunc.h or
similar. I didn't feel like moving it, so I made one more bad place in the
tree instead... So I agree with this feedback.


> 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.


There's a number of swamps in the tree, alas. This is one of them...  I'm
draining the boot loader and associated programs swamp, which is a big
enough job as it is...

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').


Agreed. It matches the style used elsewhere, but that's a poor excuse.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfoq_HO-CUm9mC=ZPKxOn2ENd4N2-G330VXC9efft6fDJw>