Commit Graph

7 Commits

Author SHA1 Message Date
Mateusz Guzik
ba96f37758 Use __builtin for various mem* and b* (e.g. bzero) routines.
Some of the routines were using artificially limited builtin already,
drop the explicit limit.

The use of builtins allows quite often allows the compiler to elide the call
or most zeroing to begin with. For instance, if the target object is 32 bytes
in size and gets zeroed + has 16 bytes initialized, the compiler can just
add code to zero out the rest.

Note not all the primites have asm variants and some of the existing ones
are not optimized. Maintaines are strongly encourage to take a look
(regardless of this change).
2018-06-02 18:03:35 +00:00
Mateusz Guzik
97e8984893 libkern: tidy up memset
1. Remove special-casing of 0 as it just results in an extra function call.
This is clearly pessimal.
2. Drop the inline stuff. For the most part it is much better served with
__builtin_memset (coming later).
3. Move the declaration to systm.h to match other funcs.

Archs are encouraged to implement the variant for their own platform so that
this implementation can be dropped.
2018-06-02 17:57:09 +00:00
Warner Losh
c6f7141fc0 Protect bzero call against macro expansion
Shortly, we'll be moving to defining bzero and memset in terms of
__builting_memset. To do that, we can't have macro calls to bzero in
the fallback impelmentation of memset. Normal calls to bzero are fine.
All 4 architectures that use this have their own copies of bzero, so
there's no mutual recursion issue between memset and bcopy.
2018-05-24 23:20:10 +00:00
Pedro F. Giffuni
8a36da99de sys/kern: adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-27 15:20:12 +00:00
David E. O'Brien
1989184838 Match the implementation of the inline function from libkern.h. 2008-07-14 21:36:02 +00:00
Alexander Kabaev
c8c0ba192e Add local ptototype for memset function. 2007-04-06 00:06:26 +00:00
Alexander Kabaev
616db5f04c Add trivial MI memset function implementation. GCC mandates the
existence of this function as a linkable symbol in standalone
configurations and existing inline memcpy from libkern.h fails
this requirement.
2007-04-05 22:02:39 +00:00