Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 May 1996 11:18:17 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        current@FreeBSD.ORG, scrappy@ki.net
Subject:   Re: memset/memcopy vs bzero/bcopy
Message-ID:  <199605281818.LAA11469@phaeton.artisoft.com>
In-Reply-To: <199605280931.TAA10416@godzilla.zeta.org.au> from "Bruce Evans" at May 28, 96 07:31:28 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >	which one is preferred?  and does it matter?
> 
> New application code should use memset.
> 
> kernel code must use bzero.  memset isn't available in the kernel.
> 
> New application code should use memcpy for non-overlapping copies and
> memmove for possibly-overlapping.  memcopy doesn't exist.
> 
> kernel code should use bcopy except for small, aligned copies, especially
> for ones of a known size.  memcpy is only used in the kernel to give gcc
> a chance to inline it.  The inline code is slower for misaligned copies
> and may be slower for large copies.

Spaking of which: out of curiousity...


If we have a processor where we can turn on unaligned access exceptions,
and we turn them on, how much of the kernel code starts failing?  I would
like to see this flag on by default for P5 or better systems...  the
better to encourage writing code that can run on RISC systems.

At the very least, the kernel needs to be completely clean, and there
should be a user settable sysctl() to turn it on or off; I'd still
vote for a default of "on".

Before anyone has a fit, note that page 0 is unmapped because it was
the right thing to do, even though it caused us similar magnitude
problems.

I'd like the machine to tell me if I've buggered up an access to make
it take two bus cycles instead of one bus cycle, etc..  It can only
lead to faster code.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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