svn commit: r305814 - head/sys/boot/common

Bruce Evans brde at optusnet.com.au
Wed Sep 14 20:51:49 UTC 2016


On Wed, 14 Sep 2016, Emmanuel Vadot wrote:

> Bruce Evans <brde at optusnet.com.au> wrote:
>
>> On Wed, 14 Sep 2016, Emmanuel Vadot wrote:
>>
>>> Log:
>>>  ufsread: Do not cast struct direct from void *
>>>  This cause alignment problem on ARM (and possibly other archs), instead copy it.
>>> ...
>>
>> This looks like a good pessimization for space.  boot2 on i386 has to
>> fit in 8192 bytes and has a negative number to spare (features are
>> already left out).
>
> Do you have any suggestion on making the code better ?
> This was the last patch for having EFI working on ARMv6 and this is
> something that I want to be enabled by default at some point.

At least copy to a local variable.  Ifdefs for the space-constrained &&
non-strict-alignment arches work of course, but shouldn't be needed.

You will have to investigate the -ffreestanding and builtin situation.
-ffreestanding is set in 24 sub-Makefiles instead of correctly in 1
Makefile.inc.  I think it applies to all of boot/i386.  boot code
almost never recovers from this using __builtin_*.  Beware that some
builtins just call an extern function which might not exist in boot
code.  Even memcpy barely exists in small boot2's.  Some compilers
have buggy -ffreestanding and call memcpy() for struct copying, so it
is preferred to bcopy() in boot code.

Bruce


More information about the svn-src-all mailing list