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

Warner Losh imp at bsdimp.com
Sun Dec 3 21:17:08 UTC 2017


On Sun, Dec 3, 2017 at 2:35 AM, Bruce Evans <brde at 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


More information about the svn-src-head mailing list