Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Dec 2001 07:56:30 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "David E. O'Brien" <obrien@FreeBSD.org>
Cc:        <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/conf kern.pre.mk
Message-ID:  <20011207072556.E16470-100000@gamplex.bde.org>
In-Reply-To: <200112061753.fB6HrWa49164@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 6 Dec 2001, David E. O'Brien wrote:

> obrien      2001/12/06 09:53:32 PST
>
>   Modified files:
>     sys/conf             kern.pre.mk
>   Log:
>   Compile all kernels with "-ffreestanding":
>
>           Assert that compilation takes place in a freestanding environment. This
>           implies `-fno-builtin'. A freestanding environment is one in which the
>           standard library may not exist, and program startup may not necessarily be
>           at main. The most obvious example is an OS kernel. This is equivalent to
>           `-fno-hosted'.

Builtins are required for some optimizations.  Some relevant history:

! davidg      95/05/01 22:20:30
!
!   Modified:    sys/i386/i386  support.s
!   Log:
!   Added a memcpy() routine.
!
!
! davidg      95/05/01 22:35:08
!
!   Modified:    sys/sys   systm.h
!   Log:
!   Added prototype for memcpy(). Changed size argument of "b" functions to
!   size_t.
!
!
! davidg      95/05/09 06:35:49
!
!   Modified:    sys/net   bpf.c if_ethersubr.c if_fddisubr.c
!                sys/netinet  if_ether.c ip_input.c ip_output.c tcp_output.c
!                         udp_usrreq.c
!   Log:
!   Replaced some bcopy()'s with memcpy()'s so that gcc while inline/optimize.
!
!
! bde         96/06/08 01:19:10
!
!   Modified:    sys/i386/isa  random_machdep.c
!   Log:
!   Replaced some memcpy()'s by bcopy()'s.
!
!   gcc only inlines memcpy()'s whose count is constant and didn't inline
!   these.  I want memcpy() in the kernel go away so that it's obvious that
!   it doesn't need to be optimized.  Now it is only used for one struct
!   copy in si.c.
!
!   Revision  Changes    Path
!   1.7       +3 -3      src/sys/i386/isa/random_machdep.c
!
!   Modified:    sys/net   bpf.c
!                sys/netinet  if_ether.c ip_input.c ip_output.c tcp_output.c
!                         udp_usrreq.c
!   Log:
!   Changed some memcpy()'s back to bcopy()'s.
!
!   gcc only inlines memcpy()'s whose count is constant and didn't inline
!   these.  I want memcpy() in the kernel go away so that it's obvious that
!   it doesn't need to be optimized.  Now it is only used for one struct
!   copy in si.c.
!
!   Revision  Changes    Path
!   1.26      +2 -2      src/sys/net/bpf.c
!   1.30      +2 -2      src/sys/netinet/if_ether.c
!   1.43      +2 -2      src/sys/netinet/ip_input.c
!   1.40      +5 -5      src/sys/netinet/ip_output.c
!   1.21      +2 -2      src/sys/netinet/tcp_output.c
!   1.28      +2 -2      src/sys/netinet/udp_usrreq.c
!
!
! peter       96/06/17 11:52:57
!
!   Modified:    sys/i386/isa  si.c
!   Log:
!   This time, get rid of the struct copies that were really causing gcc to
!   call memcpy..  It seems that gcc would not inline the implicit call
!   when copying from a volatile...
!
!   Revision  Changes    Path
!   1.45      +4 -4      src/sys/i386/isa/si.c
!
!
! bde         96/07/12 00:18:14
!
!   Modified:    sys/i386/i386  pmap.c
!   Log:
!   Removed "optimization" using gcc's builtin memcpy instead of bcopy.
!   There is little difference now since the amount copied is large,
!   and bcopy will become much faster on some machines.
!
!   Revision  Changes    Path
!   1.109     +2 -5      src/sys/i386/i386/pmap.c

I never completed removing memcpy() like I said I wanted in my 96/06/08
commit (see above).  The is many times larger now.  The slightly pessimal
extern memcpy is now referred to in about 70 .o's in LINT.

Kernel Makefiles should set -fbuiltin together with -ffreestanding
until these optimizations are reorganized.  memcpy() should be an
inline function (actually named bcopy()) that calls __bultin_memcpy()
when appropriate.

I think -ffreestanding and -fbuiltin should be set in bsd.kern.mk so
that they get used for modules.

BTW, kern.{post,pre}.mk complicate debugging of kernel Makefiles.  I'd
like config(8) to merge in all include files at config time.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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