Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jul 2017 09:15:52 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ryan Libby <rlibby@gmail.com>
Cc:        Bruce Evans <brde@optusnet.com.au>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, imp@freebsd.org
Subject:   Re: svn commit: r321284 - in head/sys: amd64/include sys
Message-ID:  <20170721061552.GK1935@kib.kiev.ua>
In-Reply-To: <CAHgpiFxZxdW30P3VDqe%2BcTihEf92c3AaJy7e9cJ1uGUdWGFu6Q@mail.gmail.com>
References:  <201707200647.v6K6l7Hq076554@repo.freebsd.org> <20170720172157.W1152@besplex.bde.org> <CAHgpiFxW7JzurYeYuN5WaN0Z%2BjcpPLSjtHL34iCgmdJUz7bSyg@mail.gmail.com> <20170720103323.GG1935@kib.kiev.ua> <CAHgpiFxZxdW30P3VDqe%2BcTihEf92c3AaJy7e9cJ1uGUdWGFu6Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 20, 2017 at 04:02:02PM -0700, Ryan Libby wrote:
> On Thu, Jul 20, 2017 at 3:33 AM, Konstantin Belousov
> <kostikbel@gmail.com> wrote:
> > On Thu, Jul 20, 2017 at 02:08:30AM -0700, Ryan Libby wrote:
> >> On Thu, Jul 20, 2017 at 1:01 AM, Bruce Evans <brde@optusnet.com.au> wrote:
> [...]
> >> > This bug is not very common.  There seem to be no instances of it in
> >> > <sys> (only sys/cdefs.h uses __attribute__(()), and it seems to use
> >> > underscores for all the attributes).  Grepping sys/include/*.h for
> >> > attribute shows the following bugs:
> >> >
> >> > X amd64/include/efi.h:#define   EFIABI_ATTR     __attribute__((ms_abi))
> >> > X i386/include/efi.h:#define    EFIABI_ATTR /* __attribute__((ms_abi)) */ /* clang fails with this */
> >> > X ofed/include/rdma/ib_user_mad.h:typedef unsigned long __attribute__((aligned(4))) packed_ulong;
> >> > X ofed/include/rdma/ib_smi.h:} __attribute__ ((packed));
> >> > X ofed/include/rdma/ib_mad.h:} __attribute__ ((packed));
> >> > X ofed/include/rdma/ib_mad.h:} __attribute__ ((packed));
> >> >
> >> > The commented-out ms_abi was only a style bug.  Now it is a larger style
> >> > bug -- it is different and worse than amd64.
> >>
> >> I'm not sure what to do about i386 there (again beyond fixing up the
> >> spelling in the comment).  Maybe the unsupported architectures should
> >> just not be declaring EFIABI_ATTR at all?  (Thoughts, kib?)
> >
> > I think i386 should be treated exactly same as amd64, i.e. EFIABI_ATTR
> > should be not defined if gcc < 4.4. Or I do not understand the scope
> > of the question.
> 
> After googling around [1] and a quick check of the spec [2], it now
> seems to me that the i386 comment might just be erroneous.  I think the
> right solution for sys/i386/include/efi.h may just be to delete the
> comment and leave that EFIAPI_ATTR macro definition as empty (always, no
> compiler version check) in order to use the native calling convention.
> 
> [1] http://wiki.osdev.org/UEFI#Calling_Conventions
> [2] http://www.uefi.org/sites/default/files/resources/UEFI_Spec_2_7.pdf

At very least, the UEFI Spec requires 16-byte alignment of the stack.
This is not guaranteed by our i386 ABI.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170721061552.GK1935>