Home | History | Annotate | only in /src/sys/lib
History log of /src/sys/lib
RevisionDateAuthorComments
 1.8 15-Sep-1995  pk libsa compilation is no longer controlled from here, obviating the purpose
of this makefile.
 1.7 10-Jul-1995  gwr Removed libc_sa, libnetboot
 1.6 30-Jun-1995  christos Don't make libkern.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 27-Jul-1994  brezak Build libsa too
 1.3 04-Dec-1993  cgd branches: 1.3.2; 1.3.4;
deal with missing lib dirs
 1.2 13-Oct-1993  cgd add mini standalone libc, to be filled in as necessary. strip extra gunk
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.3.4.1 14-Aug-1994  mycroft update from trunk (to build libsa, too)
 1.3.2.2 04-Dec-1993  cgd deal with missing lib dirs
 1.3.2.1 04-Dec-1993  cgd file Makefile was added on branch magnum on 1993-12-04 03:13:32 +0000
 1.6 03-Feb-2017  roy Fix build with clang.
 1.5 24-Jan-2017  nonaka Initial commit of native amd64 EFI boot loader.
 1.4 22-Mar-2016  mrg branches: 1.4.2; 1.4.4;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.3 07-Sep-2015  uebayasi Order library object build.
 1.2 07-Sep-2015  uebayasi Sprinkle more done messages.
 1.1 28-Apr-2014  jakllsch branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Makefile glue to build libgnuefi; similar to libsa or libkern.
 1.1.12.3 05-Feb-2017  skrll Sync with HEAD
 1.1.12.2 22-Apr-2016  skrll Sync with HEAD
 1.1.12.1 22-Sep-2015  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 28-Apr-2014  tls file Makefile was added on branch tls-maxphys on 2014-08-20 00:04:29 +0000
 1.1.6.2 10-Aug-2014  tls Rebase.
 1.1.6.1 28-Apr-2014  tls file Makefile was added on branch tls-earlyentropy on 2014-08-10 06:56:02 +0000
 1.1.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.4.1 28-Apr-2014  yamt file Makefile was added on branch yamt-pagecache on 2014-05-22 11:41:04 +0000
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 28-Apr-2014  rmind file Makefile was added on branch rmind-smpnet on 2014-05-18 17:46:08 +0000
 1.4.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.5 27-May-2018  christos - Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Revert :Q to work as before.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@
XXX: pullup 8
 1.4 24-Jan-2017  nonaka branches: 1.4.6; 1.4.12;
Initial commit of native amd64 EFI boot loader.
 1.3 22-Mar-2016  mrg branches: 1.3.2; 1.3.4;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.2 06-Sep-2015  uebayasi In kernel lib build, print message when things not only start bug also end.
 1.1 28-Apr-2014  jakllsch branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Makefile glue to build libgnuefi; similar to libsa or libkern.
 1.1.12.3 05-Feb-2017  skrll Sync with HEAD
 1.1.12.2 22-Apr-2016  skrll Sync with HEAD
 1.1.12.1 22-Sep-2015  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 28-Apr-2014  tls file Makefile.inc was added on branch tls-maxphys on 2014-08-20 00:04:29 +0000
 1.1.6.2 10-Aug-2014  tls Rebase.
 1.1.6.1 28-Apr-2014  tls file Makefile.inc was added on branch tls-earlyentropy on 2014-08-10 06:56:02 +0000
 1.1.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.4.1 28-Apr-2014  yamt file Makefile.inc was added on branch yamt-pagecache on 2014-05-22 11:41:04 +0000
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 28-Apr-2014  rmind file Makefile.inc was added on branch rmind-smpnet on 2014-05-18 17:46:08 +0000
 1.3.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.3.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.4.12.1 25-Jun-2018  pgoyette Sync with HEAD
 1.4.6.1 09-Jun-2018  martin Pull up following revision(s) (requested by christos in ticket #870):

sys/lib/libgnuefi/Makefile.inc: revision 1.5
external/mit/xorg/xorg-pkg-ver.mk: revision 1.9
sys/arch/i386/stand/lib/Makefile.inc: revision 1.17
sys/compat/common/Makefile.inc: revision 1.25
usr.bin/make/unit-tests/varquote.exp: revision 1.1, 1.2
sys/lib/libsa/Makefile.inc: revision 1.24
usr.bin/make/var.c: revision 1.220
sys/arch/ia64/stand/efi/libefi/Makefile.inc: revision 1.5
sys/arch/hppa/spmath/Makefile.inc: revision 1.10
usr.bin/make/unit-tests/varquote.mk: revision 1.1, 1.2
usr.bin/make/unit-tests/Makefile: revision 1.53
sys/lib/libkern/Makefile.inc: revision 1.45
sys/arch/acorn32/stand/lib/Makefile.inc: revision 1.4
sys/arch/m68k/fpsp/Makefile.inc: revision 1.21
usr.bin/make/make.1: revision 1.273
sys/lib/libz/Makefile.inc: revision 1.17

- Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@

XXX: pullup 8
 1.1 24-Jan-2017  nonaka branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18;
Initial commit of native amd64 EFI boot loader.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 24-Jan-2017  jdolecek file Makefile.inc was added on branch tls-maxphys on 2017-12-03 11:38:46 +0000
 1.1.8.2 24-Jan-2017  nonaka 1468398
 1.1.8.1 24-Jan-2017  nonaka file Makefile.inc was added on branch bouyer-socketcan on 2017-01-24 11:09:16 +0000
 1.1.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.1.4.1 24-Jan-2017  pgoyette file Makefile.inc was added on branch pgoyette-localcount on 2017-03-20 06:57:48 +0000
 1.1.2.2 05-Feb-2017  skrll Sync with HEAD
 1.1.2.1 24-Jan-2017  skrll file Makefile.inc was added on branch nick-nhusb on 2017-02-05 13:40:56 +0000
 1.1 24-Jan-2017  nonaka branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18;
Initial commit of native amd64 EFI boot loader.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 24-Jan-2017  jdolecek file Makefile.inc was added on branch tls-maxphys on 2017-12-03 11:38:46 +0000
 1.1.8.2 24-Jan-2017  nonaka 1468398
 1.1.8.1 24-Jan-2017  nonaka file Makefile.inc was added on branch bouyer-socketcan on 2017-01-24 11:09:16 +0000
 1.1.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.1.4.1 24-Jan-2017  pgoyette file Makefile.inc was added on branch pgoyette-localcount on 2017-03-20 06:57:48 +0000
 1.1.2.2 05-Feb-2017  skrll Sync with HEAD
 1.1.2.1 24-Jan-2017  skrll file Makefile.inc was added on branch nick-nhusb on 2017-02-05 13:40:56 +0000
 1.101 05-Jun-2018  christos Use the standard build rules.
 1.100 22-Mar-2016  mrg branches: 1.100.16;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.99 07-Sep-2015  uebayasi Order library object build.
 1.98 07-Sep-2015  uebayasi Sprinkle more done messages.
 1.97 09-Feb-2014  njoly branches: 1.97.6;
Revert previous revision. It bkeaks profiling kernel builds.
LIBISPRIVATE unconditionnally set MKPROFILE to no, preventing
profiling kernel library.
 1.96 21-Aug-2013  matt Simplify by using LIBISPRIVATE?= yes
 1.95 18-Jan-2009  he branches: 1.95.24; 1.95.28;
Change the use of formally undocumented features, which have now been
made to fail. Specifically, change
.ifdef(SYMBOL) -> .ifdef SYMBOL or .if defined(SYMBOL),
and corresponding for .ifndef.

Also correct one error in lib/libm/Makefile (.ifdef (${MKCOMPLEX} != "no")?!?).
 1.94 04-Jan-2009  pooka Split variables out of Makefile into Makefile.libkern so that we
can easily just .include it for the proper SRCS etc. definitions
in case we're interested in the files but not in building an actual
libkern.{a,o}. for librump
 1.93 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.92 20-Nov-2008  matt Add new ptree (Patricia / RADIX tree) implementation to NetBSD.
 1.91 16-Nov-2008  ad Our qsort() is inappropriate for kernel use because it makes recursive
calls. Replace it with a kheapsort() function in kernel. Pointed out
by tron@.
 1.90 16-Nov-2008  ad Make qsort() available in libkern.
 1.89 30-Jun-2008  matt branches: 1.89.2; 1.89.4; 1.89.6; 1.89.10;
Move rb.c from sys/lib/libkern to common so it can be in both libc and libkern.
 1.88 15-Jun-2008  christos Include cpuset.
 1.87 31-Jan-2008  matt branches: 1.87.6; 1.87.8; 1.87.10; 1.87.12; 1.87.14;
Add Mersenne Twister prototypes and state struct to libkern.h
Cleanup a comment. s/RLEN/MTPRNG_RLEN/g s/POS1/MTPRNG_POS1/g
Remove unneeded test code.
 1.86 22-Nov-2007  plunky remove insque/remque from libkern, they are no longer used
 1.85 20-Nov-2007  yamt build rb.c.
 1.84 13-Nov-2006  dyoung branches: 1.84.22; 1.84.24; 1.84.28; 1.84.30;
Add strsep(3) to libkern.

To avoid code duplication, move strsep.c to the kernel/userland
common files.

Soon I will commit source-address selection (options IPSELSRC).
It will use strsep(3).
 1.83 27-Oct-2006  christos Merge kernel and userland rmd160 and sha2 implementation.
XXX: We still install rmd160.h and sha2.h in /usr/include/crypto, unlike
the other hash functions which get installed in /usr/include for compatibility.
 1.82 08-Oct-2006  thorpej - Move strtoll.c and strtoull.c from libc/stdlib to common/libc/stdlib.
- Add strtoll.c and strtoull.c to libkern.
 1.81 28-Aug-2006  tsutsui branches: 1.81.2; 1.81.4;
Add src/common/include to include header search path so that
standalone programs can be built without installed ${DESTDIR} tree.
Okayed by christos, and should close PR 33431.
 1.80 27-Apr-2006  thorpej Support for building proplib in the kernel.
 1.79 22-Apr-2006  thorpej Move strtoumax.c from libc/stdlib to common/libc/stdlib and include it
in libkern. Required for new code coming soon.
 1.78 11-Mar-2006  kleink branches: 1.78.2;
Provide BCD<->binary conversion in libkern and turn <dev/clock_subr.h>'s
FROMBCD()/TOBCD() macros into wrappers around it, resulting in both
smaller code footprint and elimination of possible issues due to
multiple evaluation of macro arguments.

Suggested by Simon Burge and Anders Gavare on tech-kern.
 1.77 20-Dec-2005  christos branches: 1.77.4; 1.77.6; 1.77.8; 1.77.10;
Use common sources with userland.
 1.76 11-Dec-2005  christos merge ktrace-lwp.
 1.75 02-Oct-2005  chs put mcount.c in the normal object list, so that "make depend" works.
use a gcc attribute to prevent it from being instrumented.
 1.74 25-Aug-2005  uebayasi Redo previous; don't add mcount.po to POBJS when MKPROFILE=no.
 1.73 25-Aug-2005  uebayasi Create mcount.po only when MKPROFILE != no.
 1.72 26-Feb-2005  perry branches: 1.72.4;
nuke trailing whitespace
 1.71 07-Jul-2003  dsl branches: 1.71.8; 1.71.10;
Add xlat_mbr_fstype - converts mbr type to disklabel type
 1.70 15-May-2003  itojun branches: 1.70.2;
add strl{cpy,cat} to libkern. code from lib/libc/string (originally from openbsd).
 1.69 23-Nov-2002  fvdl If LIBKERN_ARCH is defined, use that as the architecture-specific
subdirectory. Needed for the x86_64 32bit compile case.
 1.68 02-Nov-2002  perry set LLIBS= so we don't try to check the lint lib against llib-lc.ln
 1.67 04-Oct-2002  junyoung Unconditionally add strstr.c. Bill Studenmund.
 1.66 04-Oct-2002  junyoung Add strstr() to libkern. For now, it's only used in i386 (for processor
identification).
 1.65 18-Jun-2002  wrstuden Updated version of cscope/mkid support. Check libkern and compat lib
for source files. Also include header files in mkid run.
 1.64 28-May-2002  itojun have arc4random(9).
 1.63 12-Dec-2001  tv branches: 1.63.8; 1.63.10;
MKfoo=no -> NOfoo
 1.62 14-Nov-2001  tv Undefine DESTDIR; we don't want the special DESTDIR <bsd.lib.mk>
handling for kernel libraries.

XXX this build method should be replaced by something more sane
 1.61 12-Aug-2001  jdolecek Move _insque()/_remque() to libkern. Once remaining uses would
be converted to <sys/queue.h> macros, _insque()/_remque() would be eliminated
altogether.
 1.60 18-Feb-2001  enami branches: 1.60.2; 1.60.4;
Don't set ARCHSUBDIR to empty string.
 1.59 16-Feb-2001  bjh21 Use MACHINE_CPU to find the architecture subdir, or MACHINE_ARCH if that
exists. Same algorithm as libc uses.
 1.58 15-Feb-2001  simonb Use arm arch directory for arm32 as well as arm26.
 1.57 04-Jan-2001  itojun prepare for sh3e[bl] split
 1.56 29-Dec-2000  bjh21 Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.55 08-Dec-2000  deberg add md4c.c
 1.54 02-Mar-2000  itojun make CMSG_ALIGN always synchronize with kernel's idea of ALIGNBYTES.
ancillary data alignment will be ALIGNBYTES, not sizeof(long) - 1, from now.

CMSG_xx will NOT resolve into constant. if you use CMSG_xx to allocate
arrays, you'll lose.

bump shlib minor for libc.

NOTE: if you are on top of arch with ALIGNBYTES != sizeof(long) - 1,
you need to recompile IPv6-related binaries. there is no way to guarantee
backward compat in this aspect. sorry for this. this should be the last
backward compat breakage for IPv6-related ancillary data manipulation.
(we still have PR 9516 for unix-domain sockets...)
 1.53 07-May-1999  drochner branches: 1.53.2;
move intoa() from libsa:net.c to libkern, turn inet_ntoa() into a macro,
nuke ip_convertaddr()
 1.52 07-May-1999  drochner Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.51 11-Apr-1999  gwr Add inet_addr.c (for nfs_bootparam.c)
 1.50 04-Mar-1999  drochner branches: 1.50.4;
make the mipse[lb]->mips translation really work
(the S/// doesn't work as I'm now telling the 3rd time),
put the translation onto a separate line to make it more understandable
 1.49 03-Mar-1999  jonathan Makefile ${MACHINE_ARCH} changes for mips{eb,el}, as suggested by
Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
 1.48 24-Feb-1999  chs no need to add ${OBJS} to POBJS here, bsd.lib.mk does it automatically.
 1.47 13-Feb-1999  lukem convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.46 04-Aug-1998  perry branches: 1.46.2;
replace several special targets with stub .c files, as in libc/string
 1.45 03-Aug-1998  perry fix silly comment typo
 1.44 31-Jul-1998  perry make libkern build memmove() properly
 1.43 19-Jul-1998  drochner branches: 1.43.2;
Make the combination "profiled kernel" and "${KERN_AS} == "library""
work too. (mcount.po was forgotten)
 1.42 21-Jun-1998  christos Add a small string pattern matching function to facilitate pcmcia cis string
matches.
 1.41 27-May-1998  explorer add sha1.c, and build it.
 1.40 22-Feb-1998  mycroft Build memcpy() out of bcopy() by default.
 1.39 23-Jan-1998  cgd update to match (now-fixed) libc rules for strchr and strrchr.
Brokenness pointed out by Matthias Drochner.
 1.38 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.37 04-Nov-1997  gwr Use LORDER, TSORT
 1.36 31-May-1997  cjs branches: 1.36.8;
Back out BUILDDIR and NOINSTALL changes.
 1.35 30-May-1997  cjs Use new NOINSTALL option for libraries that are used only during the build
of a program, and not installed into the final system.
 1.34 07-May-1997  mycroft Use libinstall::, not install:, to prevent instaling LIB.
 1.33 30-Apr-1997  thorpej Build md5c.c
 1.32 16-Feb-1997  cgd allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.31 10-Aug-1996  mycroft branches: 1.31.6;
Add anchors so that only exactly `-I. is modified.
 1.30 10-Aug-1996  mycroft Convert the -I. to -I${.OBJDIR}, so that the `machine symlink is available.
 1.29 08-Aug-1996  mycroft We dont need to pass down COMPATDIR and KERNDIR.
 1.28 08-Aug-1996  mycroft Run the child make in the source directory, so that nothing here needs to be
changed when the compile directory is outside the source tree.
 1.27 10-May-1996  scottr Make sure we clean up libkern.o and libkern.po, too. Closes PRs 1951
and 2387.
 1.26 18-Apr-1996  cgd don't get rid of the -D_KERNEL in KERNCPPFLAGS
 1.25 02-Feb-1996  mycroft Simplify, and add support for passing CPPFLAGS.
 1.24 20-Oct-1995  cgd set, don't add to, CFLAGS from KERNCFLAGS. Do assignment of CC and
CFLAGS earlier, so that the arch-specific Makefile can add to them.
 1.23 07-Oct-1995  mycroft Build libkern as one .o file, so that all symbols defined therein are
always available to loadable modules.
 1.22 26-Sep-1995  jonathan Remove old .PATH directives that referenced libc source.
Libkern has its own copies of all the requisite source files.
 1.21 26-Jun-1995  christos Add the ability to override KERNREL and KERNDST.
 1.20 24-Jun-1995  christos Build libkern in the kernel compilation directory, like libcompat.
 1.19 13-Feb-1995  cgd slight cleanup/reorg. don't use quad code on the alpha.
 1.18 31-Dec-1994  mycroft Change a dependency to work when not using `all' target.
 1.17 07-Dec-1994  deraadt silence link creation
 1.16 26-Oct-1994  cgd new RCS ID format.
 1.15 16-Sep-1994  deraadt compile -O3
 1.14 30-Jun-1994  deraadt clean obj better
 1.13 30-Jun-1994  deraadt to find the DEFS.h files here, not in libc..
 1.12 30-Jun-1994  deraadt mv ${arch}/ to arch/${arch}, so that libkern builds without obj/
 1.11 21-May-1994  cgd be careful about mcount.po
 1.10 16-May-1994  cgd need a backslash!
 1.9 16-May-1994  deraadt attempts to reduce our reliance on /usr/include
 1.8 14-May-1994  cgd add libkern mcount
 1.7 23-Mar-1994  deraadt kernel/disklib.c goes away, not very portable
 1.6 09-Mar-1994  ws Make FFS optional
 1.5 04-Dec-1993  cgd quad support
 1.4 04-Dec-1993  cgd branches: 1.4.2;
change to use MACHINE_ARCH and update from libc
 1.3 23-Oct-1993  cgd use obj.${MACHINE} dirs to compile into
 1.2 13-Oct-1993  cgd slight cleanup, and ... (gasp) add comments
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.4.2.2 04-Dec-1993  cgd use quad support; we need it
 1.4.2.1 04-Dec-1993  cgd file Makefile was added on branch magnum on 1993-12-04 05:07:45 +0000
 1.31.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.36.8.1 12-Nov-1997  thorpej Sync w/ trunk.
 1.43.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.46.2.3 09-Apr-1999  chs undo previous changes to the LD lines.
I fixed my cross build environment.
 1.46.2.2 25-Feb-1999  chs sync with HEAD - profiling fixes.
 1.46.2.1 09-Nov-1998  chs initial snapshot. lots left to do.
 1.50.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.53.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.53.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.53.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.53.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.60.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.60.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.60.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.60.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.60.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.60.2.7 11-Nov-2002  nathanw Catch up to -current
 1.60.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.60.2.5 01-Aug-2002  nathanw Catch up to -current.
 1.60.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.60.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.60.2.2 14-Nov-2001  thorpej Merge from -current, required to cross-build kernels properly.
 1.60.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.63.10.1 19-Jun-2002  lukem Pull up revision 1.65 (requested by wrstuden in ticket #318):
Updated version of cscope/mkid support. Check libkern and compat lib
for source files. Also include header files in mkid run.
 1.63.8.2 15-Jul-2002  gehenna catch up with -current.
 1.63.8.1 30-May-2002  gehenna Catch up with -current.
 1.70.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.70.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.70.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.70.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.70.2.1 03-Aug-2004  skrll Sync with HEAD
 1.71.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.71.8.1 29-Apr-2005  kent sync with -current
 1.72.4.4 04-Feb-2008  yamt sync with head.
 1.72.4.3 07-Dec-2007  yamt sync with head
 1.72.4.2 30-Dec-2006  yamt sync with head.
 1.72.4.1 21-Jun-2006  yamt sync with head.
 1.77.10.2 11-May-2006  elad sync with head
 1.77.10.1 19-Apr-2006  elad sync with head.
 1.77.8.3 03-Sep-2006  yamt sync with head.
 1.77.8.2 24-May-2006  yamt sync with head.
 1.77.8.1 13-Mar-2006  yamt sync with head.
 1.77.6.2 01-Jun-2006  kardel Sync with head.
 1.77.6.1 22-Apr-2006  simonb Sync with head.
 1.77.4.1 09-Sep-2006  rpaulo sync with head
 1.78.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.81.4.2 10-Dec-2006  yamt sync with head.
 1.81.4.1 22-Oct-2006  yamt sync with head
 1.81.2.1 18-Nov-2006  ad Sync with head.
 1.84.30.2 18-Feb-2008  mjf Sync with HEAD.
 1.84.30.1 08-Dec-2007  mjf Sync with HEAD.
 1.84.28.1 21-Nov-2007  bouyer Sync with HEAD
 1.84.24.2 23-Mar-2008  matt sync with HEAD
 1.84.24.1 09-Jan-2008  matt sync with HEAD
 1.84.22.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.84.22.1 21-Nov-2007  joerg Sync with HEAD.
 1.87.14.2 03-Jul-2008  simonb Sync with head.
 1.87.14.1 18-Jun-2008  simonb Sync with head.
 1.87.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.87.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.87.10.1 04-May-2009  yamt sync with head.
 1.87.8.1 17-Jun-2008  yamt sync with head.
 1.87.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.87.6.2 02-Jul-2008  mjf Sync with HEAD.
 1.87.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.89.10.3 27-Dec-2011  matt Add popcount32 and popcount64 for flash/nand
 1.89.10.2 21-Apr-2010  matt sync to netbsd-5
 1.89.10.1 21-Aug-2009  matt Pass LDFLAGS to LD
 1.89.6.1 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
sys/lib/libkern/Makefile: patch
sys/lib/libkern/crc32.c: revision 1.1
sys/lib/libkern/crc32.h: revision 1.1
sys/lib/libkern/libkern.h: revision 1.89
sys/lib/libkern/arch/i386/Makefile.inc: revision 1.28
sys/net/zlib.h: revision 1.14 via patch
sys/opencrypto/crypto.c: revision 1.33
sys/opencrypto/cryptodev.c: revision 1.46
sys/opencrypto/cryptodev.h: revision 1.16
sys/opencrypto/cryptosoft.c: revision 1.24
sys/opencrypto/cryptosoft.h: revision 1.6
sys/opencrypto/deflate.h: revision 1.6
sys/opencrypto/cryptosoft_xform.c: revision 1.12
sys/opencrypto/deflate.c: revision 1.13
sys/opencrypto/files.opencrypto: revision 1.20
sys/opencrypto/ocryptodev.c: revision 1.1
sys/opencrypto/ocryptodev.h: revision 1.1
sys/opencrypto/xform.c: revision 1.18
sys/opencrypto/xform.h: revision 1.10
Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.89.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.89.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.95.28.2 18-May-2014  rmind sync with head
 1.95.28.1 28-Aug-2013  rmind sync with head
 1.95.24.1 03-Dec-2017  jdolecek update from HEAD
 1.97.6.2 22-Apr-2016  skrll Sync with HEAD
 1.97.6.1 22-Sep-2015  skrll Sync with HEAD
 1.100.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.15 20-Oct-2025  nat New port: mac68ksf - Macintosh 68k softfloat.

This commit is all the Makefile glue for the new port which is the mac68k
port with MKSOFTFLOAT set to "yes".

As posted here:
https://mail-index.netbsd.org/port-mac68k/2025/10/14/msg001037.html
 1.14 13-Nov-2023  mrg avoid dependency on NETBSDSRCDIR being set.

due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.

XXX: pullup-10, ..?
 1.13 16-Jun-2021  rin PR port-arm/55897

Fix ABI mismatch for armhf runtime routines for floating-point arithmetics;
For hard-float arm variants, provide

(1) generic runtime routines with correct calling convention, and
(2) EABI runtime routines at the same time.

I've confirmed that no binary changes for kernels.

LGTM by skrll
 1.12 24-Apr-2020  rin branches: 1.12.6;
For m68k, do not compile in {,u}divmodsi4 also, that are not used by
codes generated by gcc (confirmed not only for kernel, but also all
executables and libraries for userland).

Fix build failure for MODULAR kernel, noticed by mlelstv.
 1.11 23-Apr-2020  rin For m68k, do not compile in {,u}divsi3 and {,u}modsi3 since codes
generated by gcc do not depend on them.

We should not have unused functions in libkern for MODULAR.
 1.10 29-Sep-2019  mrg branches: 1.10.6;
convert HAVE_GCC == 7 to HAVE_GCC >= 7.
 1.9 05-Apr-2019  thorpej branches: 1.9.4;
clzdi2 and ctzdi2 are needed on alpha. (counting instructions are in the
optional CIX extension, and thus not used by the default compiler configuation).
 1.8 07-Feb-2019  mrg don't use -fnon-call-exceptions on arm. not needed and triggers eh_frame generation.
 1.7 07-Feb-2019  mrg apply the previous to all GCC-7 platforms. it affects vax as well.
 1.6 07-Feb-2019  mrg for sh3 and GCC 7 pass -fnon-call-exceptions for udivmoddi4.c.
avoids it emitting a call to abort() for an explicit divide by zero.
 1.5 10-Aug-2014  matt branches: 1.5.4; 1.5.30;
Changes to existing files to enable building AARCH64 userland.
evbarm64-el
This is clang only. While gcc4.8 supports aarch64, no netbsd support has
been written for aarch64 with gcc4.8.
 1.4 26-Feb-2014  joerg branches: 1.4.4; 1.4.6;
Update compiler-rt glue for the new source layout.
 1.3 29-Jan-2014  joerg For ARM EABI, includ divide-by-0 trap handlers.
 1.2 17-Jan-2014  joerg This is not libc, so don't check the libc arch macro.
 1.1 03-Dec-2013  joerg libkern build glue for compiler-rt.
 1.4.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.6.1 26-Feb-2014  yamt file Makefile.compiler-rt was added on branch yamt-pagecache on 2014-05-22 11:41:04 +0000
 1.4.4.2 18-May-2014  rmind sync with head
 1.4.4.1 26-Feb-2014  rmind file Makefile.compiler-rt was added on branch rmind-smpnet on 2014-05-18 17:46:08 +0000
 1.5.30.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.30.1 10-Jun-2019  christos Sync with HEAD
 1.5.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.4.1 10-Aug-2014  tls file Makefile.compiler-rt was added on branch tls-maxphys on 2014-08-20 00:04:29 +0000
 1.9.4.1 08-Aug-2021  martin Pull up following revision(s) (requested by skrll in ticket #1328):

sys/external/bsd/compiler_rt/dist/lib/builtins/negsf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/muldf3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfhf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/negsf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/muldf3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfhf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c: revision 1.4
sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c: revision 1.5
sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c: revision 1.2
sys/external/bsd/compiler_rt/abi.mk: revision 1.1
sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsisf.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsisf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.4
sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfsf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/subdf3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.5
sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c: revision 1.3
sys/lib/libkern/Makefile.compiler-rt: revision 1.13
sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfsf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/subdf3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.6
sys/external/bsd/compiler_rt/dist/lib/builtins/lshrdi3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatsisf.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/lshrdi3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatsisf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsidf.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsidf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfsi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfsi.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_frsub.c: revision 1.2
lib/libm/compiler_rt/Makefile.inc: revision 1.11
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfsi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatsidf.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfsi.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatsidf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_div0.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/mulsf3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/mulsf3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfdi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfdi.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/negdf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfdi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/negdf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfdi.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatundisf.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatundisf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfsi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_drsub.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfsi.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/muldi3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfsi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/muldi3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfsi.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatdisf.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatdisf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c: revision 1.3
lib/libc/compiler_rt/Makefile.inc: revision 1.40
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfdi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfdi.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/udivsi3.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/truncsfhf2.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/floatundidf.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfdi.c: revision 1.2
sys/external/bsd/compiler_rt/dist/lib/builtins/udivsi3.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/truncsfhf2.c: revision 1.3
sys/external/bsd/compiler_rt/dist/lib/builtins/floatundidf.c: revision 1.4
sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfdi.c: revision 1.3

PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 266891:
https://github.com/llvm/llvm-project/commit/28e1b977d4694c6b3a5c4d8107570a969be71e77#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007
----
[PATCH] builtins: remove use of __attribute__((pcs("aapcs"))) on
Windows
Windows does not honour the __attribute__((pcs)) on ARM. Although this will
result in ABI mismatches, compiler-rt should largely be unneeded for resolving
dependencies as we generate MS ABI compliant library calls now for the most
part.
llvm-svn: 266891
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 298974 for lib/builtins/int_lib.h.
https://github.com/llvm/llvm-project/commit/d8ca74176e25bd4080ee81982819e2ef7a36553f#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007
----
[Builtin] Unxfail tests for armhf
Summary:
Originally, a few tests fail for armhf target due to:
1) COMPILER_RT_ARMHF_TARGET was not set when building the lib
2) COMPILER_RT_ABI should not be defined as `__attribute__((pcs("aapcs")))` for armhf when building for both lib and tests
This addresshttps://bugs.llvm.org//show_bug.cgi?id=32261
mulsc3_test.c is a newly exposed issue, which will be addressed separately.
Reviewers: rengolin, compnerd
Reviewed By: compnerd
Subscribers: aemerson, llvm-commits, mgorny
Differential Revision:https://reviews.llvm.org/D31448
llvm-svn: 298974
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 303138:
https://github.com/llvm/llvm-project/commit/44c45717b9e9f3dc194508d2eeeb8599a9d76949#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007
----
[PATCH] builtins: use reserved spelling (NFC)
llvm-svn: 303138
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 303188:
https://github.com/llvm/llvm-project/commit/36ac5ddff7377586390a71cb3261f0a40d274308#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007
----
[PATCH] builtins: expand out the AEABI function stubs
These actually may change calling conventions. We cannot simply provide
function aliases as the aliased function may have a different calling
convention. Provide a forwarding function instead to permit the
compiler to synthesize the calling convention adjustment thunk.
Remove the `ARM_EABI_FNALIAS` macro as that is not safe to use.
Resolves PR33030!
llvm-svn: 303188
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 303207:
https://github.com/llvm/llvm-project/commit/4a45838d10085defac0f3b3003a5263e34536f3b#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007
----
[PATCH] builtins: fix guard __AEABI__ -> __ARM_EABI__
llvm-svn: 303207
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 314851:
https://github.com/llvm/llvm-project/commit/0d586d06a756b126a7eb43a21ecc12bd243d7cd8#diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007
----
[PATCH] [compiler-rt] Add back ARM EABI aliases where legal.
r303188 removed all the uses of aliases for EABI functions from
compiler-rt, because some of them had mismatched calling conventions.
Obviously, we can't use aliases for functions which don't have the same
calling convention, but that's only an issue for floating-point
functions with the hardfloat ABI. In other cases, the stubs increase
size and reduce performance for no benefit.
This patch adds back the aliases, with appropriate checks to make sure
they're only used in cases where the calling convention matches.
llvm-svn: 314851
PR port-arm/55897
Fix ABI mismatch for armhf runtime routines for floating-point arithmetics;
For hard-float arm variants, provide
(1) generic runtime routines with correct calling convention, and
(2) EABI runtime routines at the same time.
I've confirmed that no binary changes for kernels.
LGTM by skrll
 1.10.6.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.12.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.50 20-Sep-2025  mrg mark cleankernlib and cleandirkernlib as .MAKE.

fixes a couple of:
nbmake[1]: warning: Invalid internal option "-J" in <..>
problems that appear with "build.sh -U .. kernel=" but not with -u.

solution from rillig@ in private email.
 1.49 30-Aug-2023  christos explicitly pass COPTS
 1.48 19-Jun-2022  rillig libkern: fix wrong escaping in makefile

In the unlikely event that KERNDIR contains a '$' character, that '$'
should not be doubled to '$$'. It only needs the usual shell quoting.
 1.47 30-May-2022  rin Introduce LIBKERN_MD_FLAGS to pass some MD flags for libkern.

This is necessary since libkern is built by coprocess, and
threfore subsets of make(1) variables are passed.
 1.46 22-Sep-2018  rin - Determine KERN_AS automatically depending on whether OPT_MODULAR is
set or not, in the same way as libcompat.

- Specify OPT_MODULAR in the port Makefile instead of KERN_AS.

Now, KERN_AS=library is used for kernels without module(7) for all ports.

OK christos
 1.45 27-May-2018  christos branches: 1.45.2;
- Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Revert :Q to work as before.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@
XXX: pullup 8
 1.44 29-Oct-2015  mrg branches: 1.44.10; 1.44.16;
remove "@echo done" from 4 rules that don't need it and the random "done"
in my build logs don't help understanding.
 1.43 06-Sep-2015  uebayasi In kernel lib build, print message when things not only start bug also end.
 1.42 12-Dec-2012  matt branches: 1.42.14;
Don't pass down CPUFLAGS since its value is already in CFLAGS.
 1.41 10-Aug-2012  joerg branches: 1.41.2;
Deal with optional HAVE_GCC.
 1.40 20-Dec-2005  christos branches: 1.40.94; 1.40.110; 1.40.118;
Use common sources with userland.
 1.39 11-Dec-2005  christos merge ktrace-lwp.
 1.38 26-Feb-2005  perry branches: 1.38.4;
nuke trailing whitespace
 1.37 07-Nov-2003  dsl branches: 1.37.8; 1.37.10;
Make 'dependall' generate dependencies in these libraries.
 1.36 02-Nov-2002  perry branches: 1.36.6;
Add lint infrastructure
 1.35 21-Nov-2001  jmc Don't make clean and cleandir depend on the lib subdir. Just check for it's
existance before running the submake. This makes it possible to run a
make build (which runs cleandir before make obj) in a r/o source tree
 1.34 05-Dec-2000  sommerfeld branches: 1.34.2; 1.34.4;
Have recursive make invocations depend on the .MAKE pseudo-target so
make knows to handle them specially.
 1.33 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.32 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.31 07-May-1999  drochner branches: 1.31.2;
Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.30 15-Oct-1998  drochner branches: 1.30.8;
change handling of libkern:
-sys/lib/libkern builds as library per default (as it was documented all
the time)
-ports able to LKM set "KERN_AS=obj" explicitely in their Makefiles
 1.29 05-Sep-1998  lukem distclean is a synonym for cleandir
 1.28 07-Feb-1998  cgd make sure that LORDER, TSORT, AR, NM, RANLIB, and SIZE are correctly
and consistently set when doing kernel library builds.
 1.27 04-Nov-1997  gwr Pass down the values of: AR NM RANLIB
(Fixes PR#4426 from SAITOH Masanobu)
Also pass down LORDER TSORT.
 1.26 07-Mar-1997  thorpej branches: 1.26.8;
Allow depend target to be parallized, from Andrew Wheadon
<andrew@wipux2.wifo.uni-mannheim.de>, PR #3257.
 1.25 16-Feb-1997  cgd allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.24 23-Jan-1997  cgd branches: 1.24.4;
clean up substantially. Transform clean, depend, cleandir targets from ::
to :, so they can be used e.g. with <bsd.prog.mk>. Standardize variable
names used to configure kernel libraries.

Variables used by these Makefile.inc's are:

S must be set to the top of the 'sys' tree.
${LIB}DST may be set to the location of the directory where library
objects are to be built. Defaults to ${.OBJDIR}/lib/${lib}.
${LIB}_AS may be set to 'obj' to build a object from the library's
object files. (Otherwise, a library will be built.)
Defaults to 'library'.
${LIB}MISCMAKEFLAGS
Miscellaneous flags to be passed to the library's Makefile when
building. See library's Makefile for more details about
supported flags and their default values.

(where LIB is KERN, SA, or Z, and lib is kern, sa, or z, depending on which
library's Makefile.inc is being discussed.)
 1.23 26-Dec-1996  christos PR/2981: use ${VAR:Q} instead of '${VAR}' to avoid quoting problems
 1.22 30-Sep-1996  ws Allow compilation of libkern as library for standalone programs
 1.21 23-Sep-1996  ghudson Handle relative paths to the source directory if they begin with a '.'.
 1.20 09-Sep-1996  mycroft Pass $STRIP to the sub-make.
 1.19 10-Aug-1996  mycroft Add anchors so that only exactly `-I. is modified.
 1.18 10-Aug-1996  mycroft Convert the -I. to -I${.OBJDIR}, so that the `machine symlink is available.
 1.17 08-Aug-1996  mycroft We dont need to pass down COMPATDIR and KERNDIR.
 1.16 08-Aug-1996  mycroft Run the child make in the source directory, so that nothing here needs to be
changed when the compile directory is outside the source tree.
 1.15 20-May-1996  mrg use ' not " when passing variables to a sub-make. pr#1199/pr#1296
 1.14 11-May-1996  mycroft Make `make depend' work for libraries.
 1.13 02-Feb-1996  mycroft Simplify, and add support for passing CPPFLAGS.
 1.12 07-Oct-1995  mycroft Build libkern as one .o file, so that all symbols defined therein are
always available to loadable modules.
 1.11 26-Jun-1995  christos Add the ability to override KERNREL and KERNDST.
 1.10 24-Jun-1995  christos Build libkern in the kernel compilation directory, like libcompat.
 1.9 31-Dec-1994  mycroft Only build the version of the library that's needed.
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 09-Jan-1994  ws Use $(MAKE) instead of make
 1.6 28-Dec-1993  davidb Changed to use make's new .OBJDIR
 1.5 22-Dec-1993  cgd use ${MAKE} rather than "make", as suggested by Roland McGrath
 1.4 23-Oct-1993  cgd branches: 1.4.2;
use obj.${MACHINE} dirs to compile into
 1.3 13-Oct-1993  cgd punt on doing minimal work in favor of less output in 'happy' case.
 1.2 13-Oct-1993  cgd add a bunch of .NOTMAINs
 1.1 13-Oct-1993  cgd slight cleanup, and ... (gasp) add comments
 1.4.2.2 28-Dec-1993  davidb Changes from main branch:
Use make's new .OBJDIR
Changed make to $(MAKE)
 1.4.2.1 23-Oct-1993  davidb file Makefile.inc was added on branch magnum on 1993-12-28 12:24:33 +0000
 1.24.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.26.8.1 12-Nov-1997  thorpej Sync w/ trunk.
 1.30.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.31.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.31.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.34.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.34.2.2 11-Nov-2002  nathanw Catch up to -current
 1.34.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.36.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.36.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.36.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.36.6.1 03-Aug-2004  skrll Sync with HEAD
 1.37.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.37.8.1 29-Apr-2005  kent sync with -current
 1.38.4.1 21-Jun-2006  yamt sync with head.
 1.40.118.1 06-Dec-2012  matt Don't pass CPUFLAGS down since its value is in CFLAGS
 1.40.110.2 16-Jan-2013  yamt sync with (a bit old) head
 1.40.110.1 30-Oct-2012  yamt sync with head
 1.40.94.1 21-Aug-2009  matt Pass LDFLAGS
 1.41.2.1 25-Feb-2013  tls resync with head
 1.42.14.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.42.14.1 22-Sep-2015  skrll Sync with HEAD
 1.44.16.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.44.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.44.10.1 09-Jun-2018  martin Pull up following revision(s) (requested by christos in ticket #870):

sys/lib/libgnuefi/Makefile.inc: revision 1.5
external/mit/xorg/xorg-pkg-ver.mk: revision 1.9
sys/arch/i386/stand/lib/Makefile.inc: revision 1.17
sys/compat/common/Makefile.inc: revision 1.25
usr.bin/make/unit-tests/varquote.exp: revision 1.1, 1.2
sys/lib/libsa/Makefile.inc: revision 1.24
usr.bin/make/var.c: revision 1.220
sys/arch/ia64/stand/efi/libefi/Makefile.inc: revision 1.5
sys/arch/hppa/spmath/Makefile.inc: revision 1.10
usr.bin/make/unit-tests/varquote.mk: revision 1.1, 1.2
usr.bin/make/unit-tests/Makefile: revision 1.53
sys/lib/libkern/Makefile.inc: revision 1.45
sys/arch/acorn32/stand/lib/Makefile.inc: revision 1.4
sys/arch/m68k/fpsp/Makefile.inc: revision 1.21
usr.bin/make/make.1: revision 1.273
sys/lib/libz/Makefile.inc: revision 1.17

- Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@

XXX: pullup 8
 1.45.2.1 10-Jun-2019  christos Sync with HEAD
 1.56 22-Oct-2025  roy rbtree: Rename rb.c to rbtree.c to match it's header rbtree.h

While here rename RBTEST to RBLOCAL to give a better meaning as we
want to include the local rbtest.h rather than the system one.

Also allow to compile outside of NetBSD source tree by guarding some
things we would otherwise expect to be defined.
 1.55 20-Jan-2024  kre Compensate for src/common/lib/libc/atomic/atomic_init_cas.c losing
the extern declaration of __libc_atomic_init() and instead using a
new one added to src/lib/libc/include/extern.h

That file is outside src/common and src/sys so is unavailable to
kernel builds, so instead make a new include file in src/common
which the kernel can read which contains the needed extern decl
for __libc_atomic_init()

This seems to fix the evbarm builds (maybe others) - but it is
all MUCH TOO UGLY to keep. Someone please make a better fix,
even if that just means reverting rev 1.5 of
src/common/lib/libc/atomic/atomic_init_cas.c
and all of the changes here (the addition to libc/include/extern.h
should be harmless to keep).
 1.54 01-Jan-2024  rhialto avoid dependency on NETBSDSRCDIR being set.

(similar to an earlier commit)
due to various things, non-build.sh builds don't have it set already
and it ends up defaulting to /usr/src, so if that doesn't exist or
is the wrong version, building libkern fails.
 1.53 27-Oct-2021  ryo revert previous: http://mail-index.netbsd.org/source-changes/2021/10/25/msg133295.html

going to add __always_inline to the functions called from _mcount()
discussed on http://mail-index.netbsd.org/source-changes-d/2021/10/25/msg013480.html
 1.52 25-Oct-2021  ryo In some arch, _mcount() would be called recursively when built with COPTS=-O0.

Normally, functions called from mcount.c are expected to be expanded inline,
so _mcount() will never be called recursively. But when build with COPTS=-O0,
`static inline' functions aren't inlined, and _mcount() will be called
recursively.

Even if _mcount() has `__attribute__((__no_ instrument_function__))',
it has no effect on the calling external (no-inlined) function.

To avoid this, PROF.<fn> is added can be set the profiling flag of any file.
"PROF.mcount.c" is set to blank by default, mcount.c itself is compiled
without -pg.
 1.51 17-May-2021  mrg move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.50 25-Jan-2021  thorpej branches: 1.50.4; 1.50.6;
Build strlist.c.

(Sigh, missed in original commit.)
 1.49 30-Jun-2020  maxv branches: 1.49.2;
Make copystr() a MI C function, part of libkern and shared on all
architectures.

Notes:

- On alpha and ia64 the function is kept but gets renamed locally to avoid
symbol collision. This is because on these two arches, I am not sure
whether the ASM callers do not rely on fixed registers, so I prefer to
keep the ASM body for now.
- On Vax, only the symbol is removed, because the body is used from other
functions.
- On RISC-V, this change fixes a bug: copystr() was just a wrapper around
strlcpy(), but strlcpy() makes the operation less safe (strlen on the
source beyond its size).
- The kASan, kCSan and kMSan wrappers are removed, because now that
copystr() is in C, the compiler transformations are applied to it,
without the need for manual wrappers.

Could test on amd64 only, but should be fine.
 1.48 30-Apr-2020  riastradh Rewrite entropy subsystem.

Primary goals:

1. Use cryptography primitives designed and vetted by cryptographers.
2. Be honest about entropy estimation.
3. Propagate full entropy as soon as possible.
4. Simplify the APIs.
5. Reduce overhead of rnd_add_data and cprng_strong.
6. Reduce side channels of HWRNG data and human input sources.
7. Improve visibility of operation with sysctl and event counters.

Caveat: rngtest is no longer used generically for RND_TYPE_RNG
rndsources. Hardware RNG devices should have hardware-specific
health tests. For example, checking for two repeated 256-bit outputs
works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are
necessarily designed to produce exactly uniform output.

ENTROPY POOL

- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1
kludge as the cryptographic primitive.

- `Entropy depletion' is available for testing purposes with a sysctl
knob kern.entropy.depletion; otherwise it is disabled, and once the
system reaches full entropy it is assumed to stay there as far as
modern cryptography is concerned.

- No `entropy estimation' based on sample values. Such `entropy
estimation' is a contradiction in terms, dishonest to users, and a
potential source of side channels. It is the responsibility of the
driver author to study the entropy of the process that generates
the samples.

- Per-CPU gathering pools avoid contention on a global queue.

- Entropy is occasionally consolidated into global pool -- as soon as
it's ready, if we've never reached full entropy, and with a rate
limit afterward. Operators can force consolidation now by running
sysctl -w kern.entropy.consolidate=1.

- rndsink(9) API has been replaced by an epoch counter which changes
whenever entropy is consolidated into the global pool.
. Usage: Cache entropy_epoch() when you seed. If entropy_epoch()
has changed when you're about to use whatever you seeded, reseed.
. Epoch is never zero, so initialize cache to 0 if you want to reseed
on first use.
. Epoch is -1 iff we have never reached full entropy -- in other
words, the old rnd_initial_entropy is (entropy_epoch() != -1) --
but it is better if you check for changes rather than for -1, so
that if the system estimated its own entropy incorrectly, entropy
consolidation has the opportunity to prevent future compromise.

- Sysctls and event counters provide operator visibility into what's
happening:
. kern.entropy.needed - bits of entropy short of full entropy
. kern.entropy.pending - bits known to be pending in per-CPU pools,
can be consolidated with sysctl -w kern.entropy.consolidate=1
. kern.entropy.epoch - number of times consolidation has happened,
never 0, and -1 iff we have never reached full entropy

CPRNG_STRONG

- A cprng_strong instance is now a collection of per-CPU NIST
Hash_DRBGs. There are only two in the system: user_cprng for
/dev/urandom and sysctl kern.?random, and kern_cprng for kernel
users which may need to operate in interrupt context up to IPL_VM.

(Calling cprng_strong in interrupt context does not strike me as a
particularly good idea, so I added an event counter to see whether
anything actually does.)

- Event counters provide operator visibility into when reseeding
happens.

INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)

- Unwired for now; will be rewired in a subsequent commit.
 1.47 14-Dec-2019  riastradh Nix trailing whitespace.
 1.46 14-Dec-2019  riastradh Remove never-used Mersenne twister from libkern.
 1.45 14-Dec-2019  riastradh Omit vestigial unused commented-out experiment.
 1.44 14-Dec-2019  ad Include radixtree in the kernel.
 1.43 03-Sep-2018  riastradh Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.42 08-Jul-2018  christos provide memmem
 1.41 08-Dec-2017  christos branches: 1.41.2; 1.41.4;
coalesce the two copies of hexdump into libkern
 1.40 30-Nov-2017  riastradh Import SHA-3 code into libc and libkern.

No new public symbols in libc, but publishing the symbols is a simple
matter if/when we decide to do so.

Proposed on tech-kern and tech-userlevel with no objections:

https://mail-index.NetBSD.org/tech-kern/2017/11/11/msg022581.html
https://mail-index.NetBSD.org/tech-userlevel/2017/11/11/msg010968.html
 1.39 02-May-2016  christos move scsipi_strvis -> libkern:strnvisx()
change the prototype to match userland
fix sizes of strings passed to it
 1.38 15-Apr-2015  mrg remove various HAVE_GCC=45 fragments.
 1.37 16-Jan-2015  christos strtoi and strtou for the kernel
 1.36 20-Nov-2014  christos branches: 1.36.2;
bcdtobin and bintobcd are now inlines in <dev/clock_subr.h>
 1.35 10-Aug-2014  tls branches: 1.35.2;
Merge tls-earlyentropy branch into HEAD.
 1.34 19-Jul-2014  lneto lua: updated from 5.1 to 5.3 work3

* lua(1):
- changed lua_Integer to intmax_t
- updated distrib/sets/lists and etc/mtree
- updated bsd.lua.mk
- fixed bozohttpd (lua-bozo.c)
- compatibilized bindings: gpio, sqlite
* lua(4):
- removed floating-point and libc dependencies using '#ifndef _KERNEL'
- fixed division by zero and exponentiation
- libkern: added isalnum(), iscntrl(), isgraph(), isprint() and ispunct()
- acpica: removed isprint() from acnetbsd.h
- libc: moved strcspn.c, strpbrk.c and strspn.c to common
- removed stub headers
- compatibilized bindings: luapmf, luasystm
* reorganized luaconf.h
* updated doc/CHANGES and doc/RESPONSIBLE
 1.33 04-Jul-2014  jmcneill ${.PARSEDIR} not .${PARSEDIR} for Makefile.compiler-rt include
 1.32 12-Mar-2014  pooka branches: 1.32.2;
Do not include compiler-rt in librump. librump is not a toolchain support
library, and toolchain support belongs in the host libc or libgcc or
equivalent entity that is actually supposed to complement the toolchain.

Fixes librump build on (a) Linux ARM (collisions with libgcc)
 1.31 29-Jan-2014  joerg Include compiler-rt in libc, libm and libkern.
 1.30 15-Jan-2014  joerg For HAVE_LIBGCC=no, use compiler-rt for quad support.
 1.29 27-Dec-2013  christos add strncat (for acpi)
 1.28 11-Dec-2013  joerg Allow kernel code to access constant databases by moving cdbr(3) and the
required mi_vector_hash(3) into src/common.
 1.27 02-Dec-2013  lneto changed lua_Number to int64_t
 1.26 23-Jul-2013  skrll Another codegen bug that fixes (in this case lots of) atf tests.
rump_server doesn't die so much now.
 1.25 29-Jun-2013  rmind branches: 1.25.2;
libkern: add murmurhash module.
 1.24 24-Jun-2013  riastradh branches: 1.24.2;
Replace consttime_bcmp/explicit_bzero by consttime_memequal/explicit_memset.

consttime_memequal is the same as the old consttime_bcmp.
explicit_memset is to memset as explicit_bzero was to bcmp.

Passes amd64 release and i386/ALL, but I'm sure I missed some spots,
so please let me know.
 1.23 17-Mar-2013  christos undo sparc64 kludge
 1.22 14-Mar-2013  nakayama Make sparc64 32-bit kernel buildable.
 1.21 11-Mar-2013  christos amend previous sparc64 fix: rump does not know about memcpyset.s
 1.20 10-Mar-2013  christos On sparc64 memcpy and memset are provided by memcpyset.s (should have been
memcpyset.S, but...). Don't include them in the build because it breaks the
modular build where the kernel library is built as an object.
 1.19 23-Jan-2013  matt Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).
 1.18 30-Aug-2012  drochner branches: 1.18.2;
Add "consttime_bcmp" and "explicit_bzero" functions for both kernel
abd userland, as proposed on tech-security, with explicit_bzero using
a volatile function pointer as suggested by Alan Barrett.
Both do what the name says. For userland, both are prefixed by "__"
to keep them out of the user namespace.
Change some memset/memcmp uses to the new functions where it makes
sense -- these are just some examples, more to come.
 1.17 05-Feb-2012  dholland branches: 1.17.2; 1.17.4; 1.17.6; 1.17.8;
Migrate one last leftover bit (used only by the kernel now) to
sys/ufs/ufs and remove the old quota headers and no-longer-used shared
code. Ok by releng.
 1.16 20-Jan-2012  joerg Don't use __cmsg_alignbytes in the kernel. Mark it as constant function
for userland as its value never changes. This allows the compiler to
optimise most invocations away.
 1.15 19-Nov-2011  tls branches: 1.15.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.14 26-Aug-2011  dyoung branches: 1.14.2;
Build and install ppath(3), property-list paths library.
 1.13 24-Mar-2011  bouyer Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.12 26-Feb-2011  jakllsch Add quad srcs if building x86_64 32-bit libkern.
 1.11 26-Feb-2011  matt Add quad srcs if using MIPS O32 ABI
 1.10 11-May-2010  pooka branches: 1.10.2; 1.10.4;
fix typo
 1.9 19-Jan-2010  pooka branches: 1.9.2; 1.9.4;
Get rid of last "easy" kernel symbols starting with __:
__assert -> kern_assert
__sigtimedwait1 -> sigtimedwait1
__wdstart -> wdstart1

The rest are MD and/or shared with userspace, so they will require
a little more involvement than what is available for this quick
"ride the 5.99.24 bump" action.
 1.8 14-Dec-2009  uebayasi Build fix for the mips64 merge:
- If memset2.c is in ${SRCS}, exclude conflicting memset.c.
- If MD byte_swap_8.* is in ${SRCS}, exclude conflicting bswap64.c.
 1.7 21-Nov-2009  uebayasi Redo the previous inverted logic. Sort alphabetically.
 1.6 21-Nov-2009  uebayasi Don't build quad support code on 64-bit platforms.
 1.5 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.4 12-Aug-2009  dsl Use stuff from libc/Makefile to auto-remove .c files if a .S has been added.
Use it to dispose of tne .c files that were already only conditionally
added.
 1.3 21-Jul-2009  joerg Move popcount et al to src/common and add popcount32/popcount64.
Requested by rmind@. MD should now override popcount32/popcount64 and
provide the aliases as fitting.
 1.2 25-Mar-2009  darran branches: 1.2.2;
Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.1 04-Jan-2009  pooka branches: 1.1.2; 1.1.4; 1.1.6;
Split variables out of Makefile into Makefile.libkern so that we
can easily just .include it for the proper SRCS etc. definitions
in case we're interested in the files but not in building an actual
libkern.{a,o}. for librump
 1.1.6.2 23-Jul-2009  jym Sync with HEAD.
 1.1.6.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 04-Jan-2009  skrll file Makefile.libkern was added on branch nick-hppapmap on 2009-01-19 13:19:56 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 04-Jan-2009  mjf file Makefile.libkern was added on branch mjf-devfs2 on 2009-01-17 13:29:21 +0000
 1.2.2.6 11-Aug-2010  yamt sync with head.
 1.2.2.5 11-Mar-2010  yamt sync with head
 1.2.2.4 19-Aug-2009  yamt sync with head.
 1.2.2.3 20-Jun-2009  yamt sync with head
 1.2.2.2 04-May-2009  yamt sync with head.
 1.2.2.1 25-Mar-2009  yamt file Makefile.libkern was added on branch yamt-nfs-mp on 2009-05-04 08:13:50 +0000
 1.9.4.3 21-Apr-2011  rmind sync with head
 1.9.4.2 05-Mar-2011  rmind sync with head
 1.9.4.1 30-May-2010  rmind sync with head
 1.9.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.10.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.10.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.2.3 30-Oct-2012  yamt sync with head
 1.14.2.2 17-Apr-2012  yamt sync with head
 1.14.2.1 02-Nov-2011  yamt page cache related changes

- maintain object pages in radix tree rather than rb tree.
- reduce unnecessary page scan in putpages. esp. when an object has a ton of
pages cached but only a few of them are dirty.
- reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
- fix nfs commit range tracking.
- fix nfs write clustering. XXX hack
 1.15.2.1 18-Feb-2012  mrg merge to -current.
 1.17.8.1 23-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1481):
sys/lib/libkern/Makefile.libkern: revision 1.19
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).
 1.17.6.1 23-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1481):
sys/lib/libkern/Makefile.libkern: revision 1.19
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).
 1.17.4.1 07-Feb-2013  matt Pullup rev 1.19:
date: 2013/01/23 22:34:37; author: matt; state: Exp; lines: +2 -2
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).
 1.17.2.1 23-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1481):
sys/lib/libkern/Makefile.libkern: revision 1.19
Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).
 1.18.2.4 03-Dec-2017  jdolecek update from HEAD
 1.18.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.2.2 23-Jun-2013  tls resync from head
 1.18.2.1 25-Feb-2013  tls resync with head
 1.24.2.2 18-May-2014  rmind sync with head
 1.24.2.1 28-Aug-2013  rmind sync with head
 1.25.2.1 23-Jul-2013  riastradh sync with HEAD
 1.32.2.4 10-Aug-2014  tls Rebase.
 1.32.2.3 09-Aug-2014  tls (Temporarily) disable LZF in libkern -- it introduces a dependency from
src/sys to src/external which I'll need to fix by moving the LZF sources.
 1.32.2.2 17-Jul-2014  tls Adjustments to the "earlyentropy" branch in response to the various
discussions beginning with my initial proposal
http://mail-index.netbsd.org/tech-kern/2014/04/08/msg016876.html and
particularly the long discussion of cprng_fast() performance (e.g.
https://mail-index.netbsd.org/tech-crypto/2014/04/21/msg000642.html).

In particular:

* Per-CPU, lockless cprng_fast replacement using Dennis Ferguson's
"ccrand" implementation of ChaCha8.

* libkern arc4random() is gone, gone, gone.

* Entropy estimator reverted to 32-bit recordkeeping and timestamps
per Dennis' comments and analysis.

* LZF entropy estimator removed: it required a great deal of state,
and rejected only truly pathological input.

I have not yet reverted the changes that provide LZF in the kernel
as generic functionality; I will likely revert those changes prior
to any merge of this branch to HEAD.
 1.32.2.1 07-Apr-2014  tls LZF in the kernel. As an entropy estimator for now but it's very small, and
we could use it for ipcomp, for hibernation, for paging, for core dumps, etc.
 1.35.2.1 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.36.2.3 29-May-2016  skrll Sync with HEAD
 1.36.2.2 06-Jun-2015  skrll Sync with HEAD
 1.36.2.1 06-Apr-2015  skrll Sync with HEAD
 1.41.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.41.4.1 10-Jun-2019  christos Sync with HEAD
 1.41.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.41.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.49.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.50.6.1 31-May-2021  cjep sync with head
 1.50.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.12 19-Jan-2010  pooka Get rid of last "easy" kernel symbols starting with __:
__assert -> kern_assert
__sigtimedwait1 -> sigtimedwait1
__wdstart -> wdstart1

The rest are MD and/or shared with userspace, so they will require
a little more involvement than what is available for this quick
"ride the 5.99.24 bump" action.
 1.11 24-Sep-2007  pooka branches: 1.11.22; 1.11.40;
Rename __assert() to __kernassert() so that it doesn't collide
with the libc version. They take different arguments.
 1.10 03-Aug-2007  ad branches: 1.10.2; 1.10.4; 1.10.6; 1.10.8;
Do the panicstr check only if _KERNEL.
 1.9 29-Jul-2007  ad Disable kernel assertions if panicstr != NULL.
 1.8 11-Dec-2005  christos branches: 1.8.30; 1.8.40;
merge ktrace-lwp.
 1.7 12-Mar-2005  dsl branches: 1.7.4;
KNF
 1.6 27-Sep-2002  provos branches: 1.6.6; 1.6.14; 1.6.16;
remove trailing \n in panic(). approved perry.
 1.5 29-Mar-2000  simonb branches: 1.5.6; 1.5.8;
Don't prototype __assert() if not STANDALONE - <sys/systm.h> has already
included <lib/libkern/libkern.h> to get the prototype by this stage.

XXX: should we just change <sys/systm.h> from
#ifdef _KERNEL
#include <sys/systm.h>
#endif
to
#if defined(_KERNEL) || defined(_STANDALONE)
#include <sys/systm.h>
#endif
anyways?
 1.4 13-Apr-1999  drochner branches: 1.4.2;
make libkern compile in userland - for testing purposes
 1.3 11-Feb-1999  pk branches: 1.3.4;
Can't include libkern.h twice which is what happens if _KERNEL is on.
For now, protect here with _STANDALONE.
XXX - must probably fix sys/systm.h
 1.2 11-Feb-1999  pk Pull libkern.h in.
 1.1 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.3.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.8.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.6.1 18-Oct-2002  nathanw Catch up to -current.
 1.6.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.14.1 29-Apr-2005  kent sync with -current
 1.6.6.1 01-Apr-2005  skrll Sync with HEAD.
 1.7.4.2 27-Oct-2007  yamt sync with head.
 1.7.4.1 03-Sep-2007  yamt sync with head.
 1.8.40.1 15-Aug-2007  skrll Sync with HEAD.
 1.8.30.2 09-Oct-2007  ad Sync with head.
 1.8.30.1 20-Aug-2007  ad Sync with HEAD.
 1.10.8.2 03-Aug-2007  ad Do the panicstr check only if _KERNEL.
 1.10.8.1 03-Aug-2007  ad file __assert.c was added on branch matt-mips64 on 2007-08-03 13:06:01 +0000
 1.10.6.1 06-Oct-2007  yamt sync with head.
 1.10.4.1 06-Nov-2007  matt sync with HEAD
 1.10.2.2 02-Oct-2007  joerg Sync with HEAD.
 1.10.2.1 03-Aug-2007  joerg file __assert.c was added on branch jmcneill-pm on 2007-10-02 18:29:08 +0000
 1.11.40.1 14-Feb-2014  matt Change KASSERTMSG/KDASSERTMSG to use varadic arguments like HEAD.
panic -> vpanic, add panic wrapper to vpanic.
 1.11.22.1 11-Mar-2010  yamt sync with head
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 15-Nov-2001  lukem branches: 1.3.32;
don't need <sys/types.h> when including <sys/param.h>
 1.2 19-Apr-2000  itojun branches: 1.2.6; 1.2.8; 1.2.10;
change copyright notice from 3-clause TNF -> 4-clause TNF.
not sure if which we prefer, but the point is to use exactly the same
copyright. From: matthew green <mrg@eterna.com.au>
 1.1 02-Mar-2000  itojun make CMSG_ALIGN always synchronize with kernel's idea of ALIGNBYTES.
ancillary data alignment will be ALIGNBYTES, not sizeof(long) - 1, from now.

CMSG_xx will NOT resolve into constant. if you use CMSG_xx to allocate
arrays, you'll lose.

bump shlib minor for libc.

NOTE: if you are on top of arch with ALIGNBYTES != sizeof(long) - 1,
you need to recompile IPv6-related binaries. there is no way to guarantee
backward compat in this aspect. sorry for this. this should be the last
backward compat breakage for IPv6-related ancillary data manipulation.
(we still have PR 9516 for unix-domain sockets...)
 1.2.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.6.1 19-Apr-2000  bouyer file __cmsg_alignbytes.c was added on branch thorpej_scsipi on 2000-11-20 18:09:19 +0000
 1.3.32.1 21-Jun-2006  yamt sync with head.
 1.6 15-Mar-2009  cegger ansify function definitions
 1.5 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.4 14-Mar-1996  christos branches: 1.4.166; 1.4.176; 1.4.182;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 15-Oct-1993  cgd branches: 1.1.2;
add __main()
 1.1.2.2 15-Oct-1993  cgd add __main()
 1.1.2.1 15-Oct-1993  cgd file __main.c was added on branch magnum on 1993-10-15 06:20:47 +0000
 1.4.182.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.176.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.166.1 04-May-2009  yamt sync with head.
 1.4 22-Nov-2007  plunky remove insque/remque from libkern, they are no longer used
 1.3 11-Dec-2005  christos branches: 1.3.44; 1.3.46; 1.3.52;
merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 12-Aug-2001  jdolecek branches: 1.1.2; 1.1.4; 1.1.24; 1.1.32; 1.1.34;
Move _insque()/_remque() to libkern. Once remaining uses would
be converted to <sys/queue.h> macros, _insque()/_remque() would be eliminated
altogether.
 1.1.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.32.1 29-Apr-2005  kent sync with -current
 1.1.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.1.4.1 12-Aug-2001  thorpej file _que.c was added on branch kqueue on 2001-08-25 06:16:50 +0000
 1.1.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.1.2.1 12-Aug-2001  nathanw file _que.c was added on branch nathanw_sa on 2001-08-24 00:11:49 +0000
 1.2.4.1 07-Dec-2007  yamt sync with head
 1.3.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.46.1 23-Mar-2008  matt sync with HEAD
 1.3.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 20-Oct-2002  scw branches: 1.7.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.6 27-Mar-1998  cgd branches: 1.6.26;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file adddi3.c was added on branch magnum on 1993-12-04 05:01:34 +0000
 1.6.26.1 11-Nov-2002  nathanw Catch up to -current
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file anddi3.c was added on branch magnum on 1993-12-04 05:01:36 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.36 10-Aug-2014  tls Merge tls-earlyentropy branch into HEAD.
 1.35 24-Jun-2013  riastradh branches: 1.35.6;
Replace consttime_bcmp/explicit_bzero by consttime_memequal/explicit_memset.

consttime_memequal is the same as the old consttime_bcmp.
explicit_memset is to memset as explicit_bzero was to bcmp.

Passes amd64 release and i386/ALL, but I'm sure I missed some spots,
so please let me know.
 1.34 23-Jun-2013  riastradh Account bytes drawn from initial call to libkern arc4random.

XXX This unlocked initialization looks rather bogus...
 1.33 23-Jun-2013  riastradh Rework rndsink(9) abstraction and adapt arc4random(9) and cprng(9).

rndsink(9):
- Simplify API.
- Simplify locking scheme.
- Add a man page.
- Avoid races in destruction.
- Avoid races in requesting entropy now and scheduling entropy later.

Periodic distribution of entropy to sinks reduces the need for the
last one, but this way we don't need to rely on periodic distribution
(e.g., in a future tickless NetBSD).

rndsinks_lock should probably eventually merge with the rndpool lock,
but we'll put that off for now.

cprng(9):
- Make struct cprng_strong opaque.
- Move rndpseudo.c parts that futz with cprng guts to subr_cprng.c.
- Fix kevent locking. (Is kevent locking documented anywhere?)
- Stub out rump cprng further until we can rumpify rndsink instead.
- Strip code to grovel through struct cprng_strong in fstat.
 1.32 10-Apr-2012  tls branches: 1.32.2;

Add a spin mutex to the rndsink structure; it is used to avoid lock
ordering and sleep-holding-locks problems when rekeying, and thus
to avoid a nasty race between cprng destruction and reseeding.
 1.31 14-Feb-2012  njoly branches: 1.31.2;
void function _arc4randbytes cannot return a value.
 1.30 02-Feb-2012  tls Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.29 29-Nov-2011  drochner branches: 1.29.2;
make "rs" static -- this name is too unspecific for the global namespace
 1.28 29-Nov-2011  tls Remove rnd_extract_data from the public kernel API (it is for use by the
stream generators only). Clean up some related minor issues.
 1.27 28-Nov-2011  tls Remove arc4random() and arc4randbytes() from the kernel API. Replace
arc4random() hacks in rump with stubs that call the host arc4random() to
get numbers that are hopefully actually random (arc4random() keyed with
stack junk is not). This should fix some of the currently failing anita
tests -- we should no longer generate duplicate "random" MAC addresses in
the test environment.
 1.26 27-Nov-2011  tsutsui Disable a DIAGNOSTIC test which causes kernel stack overflow on all arm ports.

Boot failure is reported from several arm users (nonaka@, ryo@, and others),
and too large auto variable in arc4_randrekey() is pointed out by enami@.
 1.25 26-Nov-2011  enami Use exact 32bit integral type to declare variable to store
32bit random value. This is necessary since it is overwritten
by four bytes.
 1.24 26-Nov-2011  enami Fix white space usage.
 1.23 20-Nov-2011  para make it compile without DIAGNOSTIC defined
 1.22 19-Nov-2011  tls First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.21 18-Jan-2010  joerg branches: 1.21.12;
Keep arc4_i and arc4_j synchronised after a rekeying. This prevents
accidentally ending up in a short ARC4 cycle.
 1.20 28-Apr-2008  martin branches: 1.20.10; 1.20.16; 1.20.18;
Remove clause 3 and 4 from TNF licenses
 1.19 19-Jul-2007  dsl branches: 1.19.26; 1.19.28; 1.19.30; 1.19.32;
include sys/cdefs.h
 1.18 05-Nov-2006  christos branches: 1.18.2; 1.18.8; 1.18.18; 1.18.22;
- call the initialization routine for arc4randbytes.
- knf (add continues)
 1.17 07-Jun-2006  kardel branches: 1.17.6; 1.17.8;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.16 24-Dec-2005  perry branches: 1.16.4; 1.16.6; 1.16.8; 1.16.14;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.15 11-Dec-2005  christos merge ktrace-lwp.
 1.14 26-Feb-2005  perry branches: 1.14.4;
nuke trailing whitespace
 1.13 17-Sep-2004  enami branches: 1.13.4; 1.13.6;
Redo part of rev. 1.10.
 1.12 08-Sep-2004  yamt arc4random: fix a bug introduced by rev.1.7.
actually generate four bytes random value, rather than
leaving a byte always zero.
 1.11 02-Oct-2003  itojun branches: 1.11.2;
fix build for bootloaders (no /usr/include/sys/kernel.h any more).
 1.10 20-Aug-2003  itojun KNF
 1.9 06-Oct-2002  dan branches: 1.9.6;
let this compile in the non KERNEL case without NRND.
 1.8 06-Oct-2002  tls ESP output was drawing down the entropy pool at a ferocious rate, a
particular problem on hosts with only wireless interfaces that are
definitely not safe to use as entropy sources.

Add arc4randbytes() which hands out bytes from the same source used
by arc4random(). This is intended to be a _temporary_ interface
until we can design and implement a better general PRNG interface
that is decoupled from the entropy-pool implementation.

Modify key_randomfill() (used only for initialization vectors on
SA creation and via key_sa_stir_iv(), which does not "stir",
despite its name) to use arc4randbytes() instead of pulling bits
directly from the entropy pool. It is my hope that this change
will pose minimal integration problems for the KAME folks as the
random-pool interface is *already* different between each BSD
variant; this just simplifies the NetBSD case and solves a
fairly serious problem.

Note that it is generally considered acceptable cryptographic
practice to use a fast stream cipher to generate IVs for encryption
with stronger block ciphers. For example, the use of "non-Approved"
PRNGs to generate IVs for "Approved" block ciphers is explicitly
sanctioned by FIPS 140-2.
 1.7 06-Oct-2002  tls This commit includes two major changes:

1) Speed up arc4random(). We make arc4randbyte() inline, which makes this
not much slower than, say, the other arc4 implementation in our kernel.

We also replace four calls to arc4randbyte() with a loop, saving about
20% on some processors where the "unrolled" arc4randbyte() calls would
needlessly stomp the cache.

2) Address various problems with the initialization/"stirring" code,
primarily in the area of handling of the source data from the kernel
entropy pool. We used to:

a) Ask the entropy pool for 32 bytes

b) If we got zero bytes, key with junk from the stack (ouch!)
which has some nasty implications, to say the least. For
example, we're most likely to get zero bytes at boot time,
when the stack contents are even more predictable than usual.

c) If we got less than 32 bytes but more than zero bytes, use
however many bytes we got as the arc4 key, copying it
repeatedly as per usual arc4 key setup.

Because of the way NetBSD's entropy pool works, this was
mostly harmless, because if you ask for RND_EXTRACT_ANY,
you always get as many bytes as you ask for. However,
this is probably a security hole in the original FreeBSD
code, where AFAICT you might end up using an 8-bit arc4
key -- not good, much worse than using the output of the
entropy pool hash function even when it thinks it only
has 8 bits of entropy to give you.

One thing this code could do on NetBSD that was not so
good was to replace a key with a lot of entropy with
one with less entropy. That's clearly counterproductive.

The new code, instead:

a) Asks for 32 good bytes. If it gets them, use them as the
arc4 key in the usual way.

b) Tracks how many entropy bytes the key it's replacing had.
If the new entropy request got less bytes, leave the old
key in place. Note that the first time through, the "old
key" had zero bytes, so we'll always replace it.

c) If we get less then 32 bytes but more than we had, request
EXTRACT_ANY bytes from the entropy pool, padding the key
out to 32 bytes which we then use as the arc4 key in the
usual way.

This is still really all rather backwards. Instead of this generator
deciding to rekey itself using a basically arbitrary metric, it should
register a callback so that the entropy pool code could rekey it when
a lot of bits were available. Details at 11.

Finally, rename the "stir" function (which did not stir) to "rekey",
which is what it actually does.
 1.6 04-Oct-2002  itojun include rnd.h only under kernel build.
caveat: arc4random() will not get stirred in bootstrap code.
 1.5 04-Oct-2002  itojun add missing "rnd.h" include - noted by simonb
 1.4 14-Jun-2002  itojun branches: 1.4.2; 1.4.4;
discard 256 bytes of output every time we stir (not just when initializing)
 1.3 29-May-2002  itojun branches: 1.3.2;
need libkern.h for bootloaders
 1.2 28-May-2002  itojun no need for libkern.h
 1.1 28-May-2002  itojun have arc4random(9).
 1.3.2.3 20-Jun-2002  gehenna catch up with -current.
 1.3.2.2 30-May-2002  gehenna Catch up with -current.
 1.3.2.1 29-May-2002  gehenna file arc4random.c was added on branch gehenna-devsw on 2002-05-30 14:48:12 +0000
 1.4.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.4.1 14-Jun-2002  jdolecek file arc4random.c was added on branch kqueue on 2002-06-23 17:49:45 +0000
 1.4.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.4.2.1 14-Jun-2002  nathanw file arc4random.c was added on branch nathanw_sa on 2002-06-20 03:47:32 +0000
 1.9.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.2.1 11-Sep-2004  he Pull up revision 1.12 (requested by dan in ticket #824):
Fix bug introduced earlier: actually generate four bytes of
random value, rather than always leaving a byte zero.
 1.13.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.14.4.3 03-Sep-2007  yamt sync with head.
 1.14.4.2 30-Dec-2006  yamt sync with head.
 1.14.4.1 21-Jun-2006  yamt sync with head.
 1.16.14.1 19-Jun-2006  chap Sync with head.
 1.16.8.1 26-Jun-2006  yamt sync with head.
 1.16.6.1 04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.8.1 10-Dec-2006  yamt sync with head.
 1.17.6.1 18-Nov-2006  ad Sync with head.
 1.18.22.1 21-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1374):
sys/lib/libkern/arc4random.c: revision 1.21
Keep arc4_i and arc4_j synchronised after a rekeying. This prevents
accidentally ending up in a short ARC4 cycle.
 1.18.18.1 15-Aug-2007  skrll Sync with HEAD.
 1.18.8.1 20-Aug-2007  ad Sync with HEAD.
 1.18.2.1 21-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1374):
sys/lib/libkern/arc4random.c: revision 1.21
Keep arc4_i and arc4_j synchronised after a rekeying. This prevents
accidentally ending up in a short ARC4 cycle.
 1.19.32.2 19-Jul-2007  dsl include sys/cdefs.h
 1.19.32.1 19-Jul-2007  dsl file arc4random.c was added on branch matt-mips64 on 2007-07-19 22:00:05 +0000
 1.19.30.2 11-Mar-2010  yamt sync with head
 1.19.30.1 16-May-2008  yamt sync with head.
 1.19.28.1 18-May-2008  yamt sync with head.
 1.19.26.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.18.1 21-Apr-2010  matt sync to netbsd-5
 1.20.16.1 20-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1253):
sys/lib/libkern/arc4random.c: revision 1.21
Keep arc4_i and arc4_j synchronised after a rekeying. This prevents
accidentally ending up in a short ARC4 cycle.
 1.20.10.1 20-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1253):
sys/lib/libkern/arc4random.c: revision 1.21
Keep arc4_i and arc4_j synchronised after a rekeying. This prevents
accidentally ending up in a short ARC4 cycle.
 1.21.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.21.12.1 17-Apr-2012  yamt sync with head
 1.29.2.2 29-Apr-2012  mrg sync to latest -current.
 1.29.2.1 18-Feb-2012  mrg merge to -current.
 1.31.2.1 19-Apr-2012  riz Pull up following revision(s) (requested by tls in ticket #185):
sys/kern/subr_cprng.c: revision 1.6
sys/kern/subr_cprng.c: revision 1.7
sys/lib/libkern/arc4random.c: revision 1.32
sys/kern/kern_rndq.c: revision 1.2
sys/dev/rndpseudo.c: revision 1.7
sys/sys/rnd.h: revision 1.30
Add a spin mutex to the rndsink structure; it is used to avoid lock
ordering and sleep-holding-locks problems when rekeying, and thus
to avoid a nasty race between cprng destruction and reseeding.
Fix LOCKDEBUG problems pointed out by drochner@
1) Lock ordering in cprng_strong_destroy had us take a spin mutex then
an adaptive mutex. Can't do that. Reordering this requires changing
cprng_strong_reseed to tryenter the cprng's own mutex and skip the
reseed on failure, or we could deadlock.
2) Can't free memory with a valid mutex in it.
reorder initialization to improve error handling in case the system
runs out of file descriptors, avoids LOCKDEBUG panic due to double
mutex initialization
 1.32.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.6.1 17-Jul-2014  tls Adjustments to the "earlyentropy" branch in response to the various
discussions beginning with my initial proposal
http://mail-index.netbsd.org/tech-kern/2014/04/08/msg016876.html and
particularly the long discussion of cprng_fast() performance (e.g.
https://mail-index.netbsd.org/tech-crypto/2014/04/21/msg000642.html).

In particular:

* Per-CPU, lockless cprng_fast replacement using Dennis Ferguson's
"ccrand" implementation of ChaCha8.

* libkern arc4random() is gone, gone, gone.

* Entropy estimator reverted to 32-bit recordkeeping and timestamps
per Dennis' comments and analysis.

* LZF entropy estimator removed: it required a great deal of state,
and rejected only truly pathological input.

I have not yet reverted the changes that provide LZF in the kernel
as generic functionality; I will likely revert those changes prior
to any merge of this branch to HEAD.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 20-Oct-2002  scw branches: 1.7.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.6 27-Mar-1998  cgd branches: 1.6.26;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file ashldi3.c was added on branch magnum on 1993-12-04 05:01:37 +0000
 1.6.26.1 11-Nov-2002  nathanw Catch up to -current
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 20-Oct-2002  scw branches: 1.8.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.7 10-Sep-1999  drochner branches: 1.7.14;
sync with libc
 1.6 27-Mar-1998  cgd sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file ashrdi3.c was added on branch magnum on 1993-12-04 05:01:38 +0000
 1.7.14.1 11-Nov-2002  nathanw Catch up to -current
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.2 20-Nov-2014  christos bcdtobin and bintobcd are now inlines in <dev/clock_subr.h>
 1.1 11-Mar-2006  kleink branches: 1.1.2; 1.1.6; 1.1.8; 1.1.14; 1.1.20; 1.1.120;
Provide BCD<->binary conversion in libkern and turn <dev/clock_subr.h>'s
FROMBCD()/TOBCD() macros into wrappers around it, resulting in both
smaller code footprint and elimination of possible issues due to
multiple evaluation of macro arguments.

Suggested by Simon Burge and Anders Gavare on tech-kern.
 1.1.120.1 03-Dec-2017  jdolecek update from HEAD
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 11-Mar-2006  rpaulo file bcd.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 11-Mar-2006  yamt file bcd.c was added on branch yamt-lazymbuf on 2006-06-21 15:10:13 +0000
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 11-Mar-2006  simonb file bcd.c was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.1.6.2 19-Apr-2006  elad sync with head.
 1.1.6.1 11-Mar-2006  elad file bcd.c was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.1.2.2 13-Mar-2006  yamt sync with head.
 1.1.2.1 11-Mar-2006  yamt file bcd.c was added on branch yamt-pdpolicy on 2006-03-13 09:07:39 +0000
 1.14 20-Dec-2005  christos Use common sources with userland.
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 07-Aug-2003  agc branches: 1.12.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 01-Apr-1999  simonb branches: 1.11.42;
Sync with src/lib/libc/string/bcmp.c
 1.10 27-Mar-1998  cgd sync with libc
 1.9 13-Oct-1997  lukem rcsid fascism
 1.8 24-Oct-1996  cgd branches: 1.8.10;
when casting const pointers, preserve const qualifiers. (-Wcast-qual)
 1.7 18-Apr-1996  cgd don't include user-land headers in libkern files when compiling for
the kernel.
 1.6 14-Mar-1996  christos - Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file bcmp.c was added on branch magnum on 1993-10-27 22:00:43 +0000
 1.8.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.42.1 03-Aug-2004  skrll Sync with HEAD
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 31-May-2005  christos branches: 1.6.2;
add missing const
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 07-Apr-2003  scw branches: 1.4.2;
When MEMCOPY is defined, don't bother checking if a backwards-copy is
required. That's what memmove() is for.

This should fix port-powerpc/16889. The backwards copyin can confuse
uiomove/genfs_getpages, resulting in corruption of files written over NFS.
 1.3 27-Mar-1998  cgd sync with libc
 1.2 22-Feb-1998  mycroft Sync with libc.
 1.1 22-Feb-1998  mycroft Need bcopy.c to generate memcpy().
 1.4.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 04-Dec-2003  keihan branches: 1.3.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.2 15-Jan-1999  bouyer branches: 1.2.42;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1 09-Oct-1997  bouyer branches: 1.1.2;
Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 09-Oct-1997  thorpej file bswap16.c was added on branch marc-pcmcia on 1997-10-14 10:26:37 +0000
 1.2.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.42.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 04-Dec-2003  keihan branches: 1.3.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.2 15-Jan-1999  bouyer branches: 1.2.42;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1 09-Oct-1997  bouyer branches: 1.1.2;
Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 09-Oct-1997  thorpej file bswap32.c was added on branch marc-pcmcia on 1997-10-14 10:26:38 +0000
 1.2.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.42.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 04-Dec-2003  keihan branches: 1.5.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.4 10-Aug-2003  martin Sync with userland version.
 1.3 05-Feb-1999  bouyer branches: 1.3.42;
Sync with libc version.
 1.2 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1 09-Oct-1997  bouyer branches: 1.1.2;
Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 09-Oct-1997  thorpej file bswap64.c was added on branch marc-pcmcia on 1997-10-14 10:26:40 +0000
 1.3.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.42.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 04-Aug-1998  perry branches: 1.9.62;
update bzero.c to stub from libc/string
 1.8 27-Mar-1998  cgd sync with libc
 1.7 13-Oct-1997  lukem rcsid fascism
 1.6 18-Apr-1996  cgd branches: 1.6.12;
don't include user-land headers in libkern files when compiling for
the kernel.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file bzero.c was added on branch magnum on 1993-10-27 22:00:45 +0000
 1.6.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.62.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file cmpdi2.c was added on branch magnum on 1993-12-04 05:01:39 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.1 30-Jun-2020  maxv Make copystr() a MI C function, part of libkern and shared on all
architectures.

Notes:

- On alpha and ia64 the function is kept but gets renamed locally to avoid
symbol collision. This is because on these two arches, I am not sure
whether the ASM callers do not rely on fixed registers, so I prefer to
keep the ASM body for now.
- On Vax, only the symbol is removed, because the body is used from other
functions.
- On RISC-V, this change fixes a bug: copystr() was just a wrapper around
strlcpy(), but strlcpy() makes the operation less safe (strlen on the
source beyond its size).
- The kASan, kCSan and kMSan wrappers are removed, because now that
copystr() is in C, the compiler transformations are applied to it,
without the need for manual wrappers.

Could test on amd64 only, but should be fine.
 1.3 16-Apr-2020  rin Revert previous for now:
http://mail-index.netbsd.org/source-changes/2020/04/16/msg116278.html

The reasoning turned out to be wrong; __KERNEL_RCSID() in header files
does *not* overwrite RCSID in main source files. The real problem is that
it inserts its RCSID into *every* object files. However, it can be still
useful even if heavily duplicated.
 1.2 16-Apr-2020  rin Stop using __KERNEL_RCSID() in header files; it confuses ident(1) by
overwriting RCSID in main source files.

XXX
The first argument of __KERNEL_RCSID() is neglected for ELF. If we wish
to have RCSID of header files in kernel binary, we need something like
__FBSDID() macro in FreeBSD.
 1.1 20-Aug-2016  jdolecek branches: 1.1.2; 1.1.4; 1.1.18; 1.1.32;
extract crc16 code from utoppy driver to a separate file in libkern, for use
by ext2fs; every usage gets their own copy of the table for now, as it's
fairly small, and too rare to be used to be useful pulling into every kernel
 1.1.32.1 20-Apr-2020  bouyer Sync with HEAD
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 20-Aug-2016  jdolecek file crc16.h was added on branch tls-maxphys on 2017-12-03 11:38:46 +0000
 1.1.4.2 05-Oct-2016  skrll Sync with HEAD
 1.1.4.1 20-Aug-2016  skrll file crc16.h was added on branch nick-nhusb on 2016-10-05 20:56:03 +0000
 1.1.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.1.2.1 20-Aug-2016  pgoyette file crc16.h was added on branch pgoyette-localcount on 2016-09-14 03:04:17 +0000
 1.4 26-Mar-2009  he branches: 1.4.2; 1.4.4; 1.4.6; 1.4.8; 1.4.14;
Make the function declaration the same for the big-endian case as
for the little-endian case, and consistent with the libkern.h
declaration. Fixes build problem for at least hp700 and evbbarm-eb.
 1.3 25-Mar-2009  tls Fix compilation error on 64-bit platforms.
 1.2 25-Mar-2009  tls Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.1 25-Mar-2009  darran Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.4.14.2 21-Apr-2010  matt sync to netbsd-5
 1.4.14.1 26-Mar-2009  matt file crc32.c was added on branch matt-nb5-mips64 on 2010-04-21 00:28:20 +0000
 1.4.8.3 16-May-2009  jym Fix a merge botch that hampered kernel's build for amd64.

Reported by cegger@ in private mail. Thanks.
 1.4.8.2 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.8.1 26-Mar-2009  jym file crc32.c was added on branch jym-xensuspend on 2009-05-13 17:22:15 +0000
 1.4.6.2 04-May-2009  yamt sync with head.
 1.4.6.1 26-Mar-2009  yamt file crc32.c was added on branch yamt-nfs-mp on 2009-05-04 08:13:50 +0000
 1.4.4.5 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
sys/lib/libkern/crc32.c: revision 1.4
Make the function declaration the same for the big-endian case as
for the little-endian case, and consistent with the libkern.h
declaration. Fixes build problem for at least hp700 and evbbarm-eb.
 1.4.4.4 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
sys/lib/libkern/crc32.c: revision 1.3
Fix compilation error on 64-bit platforms.
 1.4.4.3 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
common/dist/zlib/zlib.h: revision 1.3
sys/lib/libkern/crc32.c: revision 1.2
sys/lib/libkern/libkern.h: revision 1.90 via patch
sys/lib/libsa/cread.c: revision 1.23
sys/lib/libz/Makefile: revision 1.16
Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.4.4.2 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
sys/lib/libkern/Makefile: patch
sys/lib/libkern/crc32.c: revision 1.1
sys/lib/libkern/crc32.h: revision 1.1
sys/lib/libkern/libkern.h: revision 1.89
sys/lib/libkern/arch/i386/Makefile.inc: revision 1.28
sys/net/zlib.h: revision 1.14 via patch
sys/opencrypto/crypto.c: revision 1.33
sys/opencrypto/cryptodev.c: revision 1.46
sys/opencrypto/cryptodev.h: revision 1.16
sys/opencrypto/cryptosoft.c: revision 1.24
sys/opencrypto/cryptosoft.h: revision 1.6
sys/opencrypto/deflate.h: revision 1.6
sys/opencrypto/cryptosoft_xform.c: revision 1.12
sys/opencrypto/deflate.c: revision 1.13
sys/opencrypto/files.opencrypto: revision 1.20
sys/opencrypto/ocryptodev.c: revision 1.1
sys/opencrypto/ocryptodev.h: revision 1.1
sys/opencrypto/xform.c: revision 1.18
sys/opencrypto/xform.h: revision 1.10
Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.4.4.1 26-Mar-2009  snj file crc32.c was added on branch netbsd-5 on 2009-05-03 17:24:45 +0000
 1.4.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.4.2.1 26-Mar-2009  skrll file crc32.c was added on branch nick-hppapmap on 2009-04-28 07:37:13 +0000
 1.1 25-Mar-2009  darran branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14;
Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.1.14.2 21-Apr-2010  matt sync to netbsd-5
 1.1.14.1 25-Mar-2009  matt file crc32.h was added on branch matt-nb5-mips64 on 2010-04-21 00:28:20 +0000
 1.1.8.2 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.8.1 25-Mar-2009  jym file crc32.h was added on branch jym-xensuspend on 2009-05-13 17:22:15 +0000
 1.1.6.2 04-May-2009  yamt sync with head.
 1.1.6.1 25-Mar-2009  yamt file crc32.h was added on branch yamt-nfs-mp on 2009-05-04 08:13:50 +0000
 1.1.4.2 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
sys/lib/libkern/Makefile: patch
sys/lib/libkern/crc32.c: revision 1.1
sys/lib/libkern/crc32.h: revision 1.1
sys/lib/libkern/libkern.h: revision 1.89
sys/lib/libkern/arch/i386/Makefile.inc: revision 1.28
sys/net/zlib.h: revision 1.14 via patch
sys/opencrypto/crypto.c: revision 1.33
sys/opencrypto/cryptodev.c: revision 1.46
sys/opencrypto/cryptodev.h: revision 1.16
sys/opencrypto/cryptosoft.c: revision 1.24
sys/opencrypto/cryptosoft.h: revision 1.6
sys/opencrypto/deflate.h: revision 1.6
sys/opencrypto/cryptosoft_xform.c: revision 1.12
sys/opencrypto/deflate.c: revision 1.13
sys/opencrypto/files.opencrypto: revision 1.20
sys/opencrypto/ocryptodev.c: revision 1.1
sys/opencrypto/ocryptodev.h: revision 1.1
sys/opencrypto/xform.c: revision 1.18
sys/opencrypto/xform.h: revision 1.10
Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.1.4.1 25-Mar-2009  snj file crc32.h was added on branch netbsd-5 on 2009-05-03 17:24:45 +0000
 1.1.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.1.2.1 25-Mar-2009  skrll file crc32.h was added on branch nick-hppapmap on 2009-04-28 07:37:13 +0000
 1.1 17-May-2021  mrg branches: 1.1.2; 1.1.6;
move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.1.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1.6.1 17-May-2021  thorpej file disklabel_swap.c was added on branch thorpej-i2c-spi-conf on 2021-06-17 04:46:33 +0000
 1.1.2.2 31-May-2021  cjep sync with head
 1.1.2.1 17-May-2021  cjep file disklabel_swap.c was added on branch cjep_staticlib_x on 2021-05-31 22:15:20 +0000
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file divdi3.c was added on branch magnum on 1993-12-04 05:01:40 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.1 17-May-2021  mrg branches: 1.1.2; 1.1.6;
move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.1.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1.6.1 17-May-2021  thorpej file dkcksum.c was added on branch thorpej-i2c-spi-conf on 2021-06-17 04:46:33 +0000
 1.1.2.2 31-May-2021  cjep sync with head
 1.1.2.1 17-May-2021  cjep file dkcksum.c was added on branch cjep_staticlib_x on 2021-05-31 22:15:20 +0000
 1.1 30-Apr-2020  riastradh Rewrite entropy subsystem.

Primary goals:

1. Use cryptography primitives designed and vetted by cryptographers.
2. Be honest about entropy estimation.
3. Propagate full entropy as soon as possible.
4. Simplify the APIs.
5. Reduce overhead of rnd_add_data and cprng_strong.
6. Reduce side channels of HWRNG data and human input sources.
7. Improve visibility of operation with sysctl and event counters.

Caveat: rngtest is no longer used generically for RND_TYPE_RNG
rndsources. Hardware RNG devices should have hardware-specific
health tests. For example, checking for two repeated 256-bit outputs
works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are
necessarily designed to produce exactly uniform output.

ENTROPY POOL

- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1
kludge as the cryptographic primitive.

- `Entropy depletion' is available for testing purposes with a sysctl
knob kern.entropy.depletion; otherwise it is disabled, and once the
system reaches full entropy it is assumed to stay there as far as
modern cryptography is concerned.

- No `entropy estimation' based on sample values. Such `entropy
estimation' is a contradiction in terms, dishonest to users, and a
potential source of side channels. It is the responsibility of the
driver author to study the entropy of the process that generates
the samples.

- Per-CPU gathering pools avoid contention on a global queue.

- Entropy is occasionally consolidated into global pool -- as soon as
it's ready, if we've never reached full entropy, and with a rate
limit afterward. Operators can force consolidation now by running
sysctl -w kern.entropy.consolidate=1.

- rndsink(9) API has been replaced by an epoch counter which changes
whenever entropy is consolidated into the global pool.
. Usage: Cache entropy_epoch() when you seed. If entropy_epoch()
has changed when you're about to use whatever you seeded, reseed.
. Epoch is never zero, so initialize cache to 0 if you want to reseed
on first use.
. Epoch is -1 iff we have never reached full entropy -- in other
words, the old rnd_initial_entropy is (entropy_epoch() != -1) --
but it is better if you check for changes rather than for -1, so
that if the system estimated its own entropy incorrectly, entropy
consolidation has the opportunity to prevent future compromise.

- Sysctls and event counters provide operator visibility into what's
happening:
. kern.entropy.needed - bits of entropy short of full entropy
. kern.entropy.pending - bits known to be pending in per-CPU pools,
can be consolidated with sysctl -w kern.entropy.consolidate=1
. kern.entropy.epoch - number of times consolidation has happened,
never 0, and -1 iff we have never reached full entropy

CPRNG_STRONG

- A cprng_strong instance is now a collection of per-CPU NIST
Hash_DRBGs. There are only two in the system: user_cprng for
/dev/urandom and sysctl kern.?random, and kern_cprng for kernel
users which may need to operate in interrupt context up to IPL_VM.

(Calling cprng_strong in interrupt context does not strike me as a
particularly good idea, so I added an event counter to see whether
anything actually does.)

- Event counters provide operator visibility into when reseeding
happens.

INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)

- Unwired for now; will be rewired in a subsequent commit.
 1.1 30-Apr-2020  riastradh Rewrite entropy subsystem.

Primary goals:

1. Use cryptography primitives designed and vetted by cryptographers.
2. Be honest about entropy estimation.
3. Propagate full entropy as soon as possible.
4. Simplify the APIs.
5. Reduce overhead of rnd_add_data and cprng_strong.
6. Reduce side channels of HWRNG data and human input sources.
7. Improve visibility of operation with sysctl and event counters.

Caveat: rngtest is no longer used generically for RND_TYPE_RNG
rndsources. Hardware RNG devices should have hardware-specific
health tests. For example, checking for two repeated 256-bit outputs
works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are
necessarily designed to produce exactly uniform output.

ENTROPY POOL

- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1
kludge as the cryptographic primitive.

- `Entropy depletion' is available for testing purposes with a sysctl
knob kern.entropy.depletion; otherwise it is disabled, and once the
system reaches full entropy it is assumed to stay there as far as
modern cryptography is concerned.

- No `entropy estimation' based on sample values. Such `entropy
estimation' is a contradiction in terms, dishonest to users, and a
potential source of side channels. It is the responsibility of the
driver author to study the entropy of the process that generates
the samples.

- Per-CPU gathering pools avoid contention on a global queue.

- Entropy is occasionally consolidated into global pool -- as soon as
it's ready, if we've never reached full entropy, and with a rate
limit afterward. Operators can force consolidation now by running
sysctl -w kern.entropy.consolidate=1.

- rndsink(9) API has been replaced by an epoch counter which changes
whenever entropy is consolidated into the global pool.
. Usage: Cache entropy_epoch() when you seed. If entropy_epoch()
has changed when you're about to use whatever you seeded, reseed.
. Epoch is never zero, so initialize cache to 0 if you want to reseed
on first use.
. Epoch is -1 iff we have never reached full entropy -- in other
words, the old rnd_initial_entropy is (entropy_epoch() != -1) --
but it is better if you check for changes rather than for -1, so
that if the system estimated its own entropy incorrectly, entropy
consolidation has the opportunity to prevent future compromise.

- Sysctls and event counters provide operator visibility into what's
happening:
. kern.entropy.needed - bits of entropy short of full entropy
. kern.entropy.pending - bits known to be pending in per-CPU pools,
can be consolidated with sysctl -w kern.entropy.consolidate=1
. kern.entropy.epoch - number of times consolidation has happened,
never 0, and -1 iff we have never reached full entropy

CPRNG_STRONG

- A cprng_strong instance is now a collection of per-CPU NIST
Hash_DRBGs. There are only two in the system: user_cprng for
/dev/urandom and sysctl kern.?random, and kern_cprng for kernel
users which may need to operate in interrupt context up to IPL_VM.

(Calling cprng_strong in interrupt context does not strike me as a
particularly good idea, so I added an event counter to see whether
anything actually does.)

- Event counters provide operator visibility into when reseeding
happens.

INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)

- Unwired for now; will be rewired in a subsequent commit.
 1.12 20-Dec-2005  christos Use common sources with userland.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 07-Aug-2003  agc branches: 1.10.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 10-Oct-2002  jdolecek branches: 1.9.6;
#undef ffs before the ffs() function definition, so that the name
isn't rewrote to __builtin_ffs() on gcc 2.95+; this fixes compilation
on sun2
also change the comment for function
 1.8 27-Mar-1998  cgd branches: 1.8.26; 1.8.28; 1.8.42;
sync with libc
 1.7 13-Oct-1997  lukem rcsid fascism
 1.6 18-Apr-1996  cgd branches: 1.6.12;
don't include user-land headers in libkern files when compiling for
the kernel.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file ffs.c was added on branch magnum on 1993-10-27 22:00:46 +0000
 1.6.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.42.1 23-Nov-2002  tron Pull up revision 1.9 (requested by skrll in ticket #1009):
isn't rewrote to __builtin_ffs() on gcc 2.95+; this fixes compilation
on sun2
also change the comment for function
 1.8.28.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.8.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.4 09-Dec-2017  christos Even smaller and takes print function.
 1.3 08-Dec-2017  christos don't ifdef _KERNEL
 1.2 08-Dec-2017  christos use a different, more readable approach.
 1.1 08-Dec-2017  christos coalesce the two copies of hexdump into libkern
 1.14 20-Dec-2005  christos Use common sources with userland.
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 26-Feb-2005  perry branches: 1.12.4;
nuke trailing whitespace
 1.11 04-Dec-2003  keihan branches: 1.11.8; 1.11.10;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.10 22-Aug-2001  itojun branches: 1.10.20;
sync argument/return type of [hn]to[nh][ls] to XNET 5.2 (uint{16,32}_t).
as discussed on tech-net.
 1.9 27-Mar-1998  cgd branches: 1.9.26; 1.9.28;
sync with libc
 1.8 17-Oct-1996  cgd pull down from libc
 1.7 29-May-1996  cgd Copy from libkern:
Add some casts so that we're not bitten by type promotions on 64-bit
systems. Not a great concern since the only 64-bit system currently
supported by NetBSD (Alpha) uses assembly versions of these routines.
 1.6 07-Oct-1995  mycroft branches: 1.6.6;
Update from libc.
 1.5 06-Jan-1995  cgd copy back from libc
 1.4 06-Jan-1995  cgd from libc
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file htonl.c was added on branch magnum on 1993-10-27 22:00:46 +0000
 1.6.6.1 29-May-1996  cgd Pull changes copied from libc to the release branch: Add some casts so
that we're not bitten by type promotions on 64-bit systems.
 1.9.28.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.9.26.1 21-Sep-2001  nathanw Catch up to -current.
 1.10.20.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.20.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.12.4.1 21-Jun-2006  yamt sync with head.
 1.13 20-Dec-2005  christos Use common sources with userland.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 04-Dec-2003  keihan branches: 1.11.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.10 22-Aug-2001  itojun branches: 1.10.20;
sync argument/return type of [hn]to[nh][ls] to XNET 5.2 (uint{16,32}_t).
as discussed on tech-net.
 1.9 27-Mar-1998  cgd branches: 1.9.26; 1.9.28;
sync with libc
 1.8 17-Oct-1996  cgd pull down from libc
 1.7 29-May-1996  cgd Copy from libkern:
Add some casts so that we're not bitten by type promotions on 64-bit
systems. Not a great concern since the only 64-bit system currently
supported by NetBSD (Alpha) uses assembly versions of these routines.
 1.6 07-Oct-1995  mycroft branches: 1.6.6;
Update from libc.
 1.5 06-Jan-1995  cgd copy back from libc
 1.4 06-Jan-1995  cgd from libc
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file htons.c was added on branch magnum on 1993-10-27 22:00:47 +0000
 1.6.6.1 29-May-1996  cgd Pull changes copied from libc to the release branch: Add some casts so
that we're not bitten by type promotions on 64-bit systems.
 1.9.28.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.9.26.1 21-Sep-2001  nathanw Catch up to -current.
 1.10.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.20.1 03-Aug-2004  skrll Sync with HEAD
 1.11.16.1 21-Jun-2006  yamt sync with head.
 1.6 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file imax.c was added on branch magnum on 1993-10-13 05:40:37 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.6 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file imin.c was added on branch magnum on 1993-10-13 05:40:39 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.5 01-Nov-2003  jdolecek g/c index.c and rindex.c (not used anywhere)
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 27-Mar-1998  cgd branches: 1.3.48;
sync with libc
 1.2 22-Feb-1998  mycroft Don't even think about cdefs.h here...
 1.1 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.3.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 18-Apr-2001  thorpej branches: 1.6.38;
ctype-like functions are now in libkern.
 1.5 30-Mar-2000  augustss branches: 1.5.6;
Kill some more register declarations.
 1.4 13-Apr-1999  drochner branches: 1.4.2;
make libkern compile in userland - for testing purposes
 1.3 12-Apr-1999  drochner This was an n_long, not u_long, so u_int32_t is correct.
 1.2 12-Apr-1999  ross libkern just got an inet_addr(), but it won't compile, no prototype. Cleanup...
* Add prototype to libkern.h.
* Remove the almost-identical-copy from libsa/net.[ch].
* Change its type back to the (wrong, but harmless) historical one. (u_long)
* Kill the XXX local prototype in nfs_bootparam.c
 1.1 12-Dec-1997  gwr branches: 1.1.10;
Copied from src/lib/libc/net/inet_pton.c
and adapted for kernel and libsa use.
 1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.38.1 21-Jun-2006  yamt sync with head.
 1.3 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.2 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.1 07-May-1999  drochner branches: 1.1.2; 1.1.140; 1.1.150; 1.1.156;
move intoa() from libsa:net.c to libkern, turn inet_ntoa() into a macro,
nuke ip_convertaddr()
 1.1.156.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.150.1 28-Apr-2009  skrll Sync with HEAD.
 1.1.140.1 04-May-2009  yamt sync with head.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file iordi3.c was added on branch magnum on 1993-12-04 05:01:42 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.5 13-Dec-2021  chs revert rev 1.4 ("Add garbage instructions at end of kern_assert after vpanic.")

that change had no effect because vpanic() is marked __dead / noreturn
and thus the compiler would optimize away everything after a call to vpanic().
the original problem has now been fixed differently (but only for x86 so far).
 1.4 14-Mar-2017  riastradh Add garbage instructions at end of kern_assert after vpanic.

This avoids having the return address passed to vpanic confusingly
appear to be some other symbol.
 1.3 19-Nov-2013  christos branches: 1.3.6; 1.3.10; 1.3.14;
For the purposes of static analysis, this never returns.
 1.2 29-Sep-2011  christos branches: 1.2.2; 1.2.12; 1.2.16;
Don't include <sys/systm.h> because it brings in too much stuff that
conflicts with standalone code. Instead modify kern_assert() to be like
panic() and call that.
 1.1 19-Jan-2010  pooka branches: 1.1.4;
Get rid of last "easy" kernel symbols starting with __:
__assert -> kern_assert
__sigtimedwait1 -> sigtimedwait1
__wdstart -> wdstart1

The rest are MD and/or shared with userspace, so they will require
a little more involvement than what is available for this quick
"ride the 5.99.24 bump" action.
 1.1.4.2 11-Mar-2010  yamt sync with head
 1.1.4.1 19-Jan-2010  yamt file kern_assert.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:21 +0000
 1.2.16.1 18-May-2014  rmind sync with head
 1.2.12.2 03-Dec-2017  jdolecek update from HEAD
 1.2.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.3.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.3.6.1 28-Aug-2017  skrll Sync with HEAD
 1.148 02-Mar-2025  riastradh libc: New _r variants of heapsort, mergesort, qsort.

Also kheapsort_r for kernel/standalone use.

These variants allow the caller to pass a cookie through to the
comparison function, e.g. if you want to sort an array of indices
into a buffer.

qsort_r is new in POSIX.1-2024; the others are obvious analogues of
our nonstandard extensions for heapsort and mergesort.

PR lib/58931: qsort_r() missing
 1.147 01-Nov-2024  riastradh string.h: Fix various symbol visibility issues.

1. Order declarations according to POSIX 2024 to make this easier to
review side-by-side with the spec.
2. Fix visibility of memccpy: XSI-only, not POSIX in general; require
_XOPEN_SOURCE, not just _POSIX_C_SOURCE.
3. Omit redundant _XOPEN_SOURCE test around stpcpy/stpncpy.
4. Hide strdup in POSIX 2001. Not POSIX (without XSI) until 2008.
5. Hide strerror_r until POSIX 2001. Can't find evidence of it in
any earlier POSIX or X/Open. (Not 100% sure on this one, maybe
someone can double-check my research.)
6. Add restrict to strlcat/strlcpy.
7. Omit redundant _XOPEN_SOURCE test around strndup and strnlen.
8. Hide strtok_r until POSIX 2001. Can't find evidence of it in
any earlier POSIX or X/Open. (Not 100% sure on this one, maybe
someone can double-check my research.)

Carry the restrict qualifiers on strlcat/strlcpy to libkern too.

Main reference:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/string.h.html

PR standards/58804: string.h: wrong visibility for memccpy
 1.146 09-Oct-2024  christos deduplicate offsetof (stddef.h) and container_of (container_of.h)
 1.145 06-Sep-2023  mrg branches: 1.145.6;
fix the example for container_of().

needs to be a pointer into the containing structure, not the
value of a pointer inside the structure.
 1.144 31-Dec-2021  riastradh libkern: Make KASSERT verify expression is valid if !DIAGNOSTIC.

This way it is no longer necessary to mark variables __diagused if
they are used in KASSERT conditions.

Fix fallout from this by removing now-unnecessary and `#ifdef
DIAGNOSTIC'.

Don't do the same for KDASSERT if !DEBUG -- unlike KASSERT and
DIAGNOSTIC, variables needed by KDASSERT and DEBUG are likely to be
expensive to compute (and potentially difficult for a compiler to
prove flushable), so we don't want to require them under !DEBUG.
 1.143 17-May-2021  mrg move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.142 21-Jan-2021  thorpej branches: 1.142.4; 1.142.6;
Add a generic set of routines for interacting with OpenFirmware-style
string lists.
 1.141 16-Jan-2021  chs remove unused "_DIAGNOSTIC" option and opt_diagnostic.h.
note that this is unrelated to the widely used "DIAGNOSTIC" option.
 1.140 17-Apr-2020  maxv branches: 1.140.2;
Slightly reorder for clarity, and add header.
 1.139 07-Apr-2020  skrll branches: 1.139.2;
Fix KASAN build on aarch64
 1.138 03-Apr-2020  maxv Add KASAN instrumentation on strcat/strchr/strrchr.
 1.137 14-Dec-2019  riastradh Remove never-used Mersenne twister from libkern.
 1.136 05-Dec-2019  riastradh #ifdef notyet ---> never
 1.135 22-Nov-2019  maxv Ah, strcat/strchr/strrchr are ASM functions, so instrument them.
 1.134 14-Nov-2019  maxv Add support for Kernel Memory Sanitizer (kMSan). It detects uninitialized
memory used by the kernel at run time, and just like kASan and kCSan, it
is an excellent feature. It has already detected 38 uninitialized variables
in the kernel during my testing, which I have since discreetly fixed.

We use two shadows:
- "shad", to track uninitialized memory with a bit granularity (1:1).
Each bit set to 1 in the shad corresponds to one uninitialized bit of
real kernel memory.
- "orig", to track the origin of the memory with a 4-byte granularity
(1:1). Each uint32_t cell in the orig indicates the origin of the
associated uint32_t of real kernel memory.

The memory consumption of these shadows is consequent, so at least 4GB of
RAM is recommended to run kMSan.

The compiler inserts calls to specific __msan_* functions on each memory
access, to manage both the shad and the orig and detect uninitialized
memory accesses that change the execution flow (like an "if" on an
uninitialized variable).

We mark as uninit several types of memory buffers (stack, pools, kmem,
malloc, uvm_km), and check each buffer passed to copyout, copyoutstr,
bwrite, if_transmit_lock and DMA operations, to detect uninitialized memory
that leaves the system. This allows us to detect kernel info leaks in a way
that is more efficient and also more user-friendly than KLEAK.

Contrary to kASan, kMSan requires comprehensive coverage, ie we cannot
tolerate having one non-instrumented function, because this could cause
false positives. kMSan cannot instrument ASM functions, so I converted
most of them to __asm__ inlines, which kMSan is able to instrument. Those
that remain receive special treatment.

Contrary to kASan again, kMSan uses a TLS, so we must context-switch this
TLS during interrupts. We use different contexts depending on the interrupt
level.

The orig tracks precisely the origin of a buffer. We use a special encoding
for the orig values, and pack together in each uint32_t cell of the orig:
- a code designating the type of memory (Stack, Pool, etc), and
- a compressed pointer, which points either (1) to a string containing
the name of the variable associated with the cell, or (2) to an area
in the kernel .text section which we resolve to a symbol name + offset.

This encoding allows us not to consume extra memory for associating
information with each cell, and produces a precise output, that can tell
for example the name of an uninitialized variable on the stack, the
function in which it was pushed on the stack, and the function where we
accessed this uninitialized variable.

kMSan is available with LLVM, but not with GCC.

The code is organized in a way that is similar to kASan and kCSan, so it
means that other architectures than amd64 can be supported.
 1.133 05-Nov-2019  maxv Add Kernel Concurrency Sanitizer (kCSan) support. This sanitizer allows us
to detect race conditions at runtime. It is a variation of TSan that is
easy to implement and more suited to kernel internals, albeit theoretically
less precise than TSan's happens-before.

We do basically two things:

- On every KCSAN_NACCESSES (=2000) memory accesses, we create a cell
describing the access, and delay the calling CPU (10ms).

- On all memory accesses, we verify if the memory we're reading/writing
is referenced in a cell already.

The combination of the two means that, if for example cpu0 does a read that
is selected and cpu1 does a write at the same address, kCSan will fire,
because cpu1's write collides with cpu0's read cell.

The coverage of the instrumentation is the same as that of kASan. Also, the
code is organized in a way similar to kASan, so it is easy to add support
for more architectures than amd64. kCSan is compatible with KCOV.

Reviewed by Kamil.
 1.132 20-Sep-2019  maxv Add ifdefs to eliminate false positives on lgtm, same as coverity.
 1.131 07-Sep-2019  maxv Add KASAN instrumentation for memmove.
 1.130 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.129 27-Aug-2018  maxv Add kasan interceptors for strcpy/strcmp/strlen.
 1.128 20-Aug-2018  maxv Add support for kASan on amd64. Written by me, with some parts inspired
from Siddharth Muralee's initial work. This feature can detect several
kinds of memory bugs, and it's an excellent feature.

It can be enabled by uncommenting these three lines in GENERIC:

#makeoptions KASAN=1 # Kernel Address Sanitizer
#options KASAN
#no options SVS

The kernel is compiled without SVS, without DMAP and without PCPU area.
A shadow area is created at boot time, and it can cover the upper 128TB
of the address space. This area is populated gradually as we allocate
memory. With this design the memory consumption is kept at its lowest
level.

The compiler calls the __asan_* functions each time a memory access is
done. We verify whether this access is legal by looking at the shadow
area.

We declare our own special memcpy/memset/etc functions, because the
compiler's builtins don't add the __asan_* instrumentation.

Initially all the mappings are marked as valid. During dynamic
allocations, we add a redzone, which we mark as invalid. Any access on
it will trigger a kASan error message. Additionally, the compiler adds
a redzone on global variables, and we mark these redzones as invalid too.
The illegal-access detection works with a 1-byte granularity.

For now, we cover three areas:

- global variables
- kmem_alloc-ated areas
- malloc-ated areas

More will come, but that's a good start.
 1.127 08-Jul-2018  christos provide memmem
 1.126 09-Dec-2017  christos branches: 1.126.2; 1.126.4;
Even smaller and takes print function.
 1.125 08-Dec-2017  christos coalesce the two copies of hexdump into libkern
 1.124 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.123 11-May-2016  rtr provide const versions of container_of macros.

discussed with riastradh@ by email
 1.122 02-May-2016  christos move scsipi_strvis -> libkern:strnvisx()
change the prototype to match userland
fix sizes of strings passed to it
 1.121 30-Aug-2015  uebayasi Include opt_diagnostic.h.
 1.120 29-May-2015  matt If the platform support popcount as a __builtin, use that in preference
to the libc versions.
 1.119 09-May-2015  christos tricks with sizeof() make coverity complain.
 1.118 20-Apr-2015  riastradh Add container_of to libkern.

Given x = &c->f, container_of(x, T, f) yields c, where T is the type
of c.

Discussed on tech-kern a while ago:

https://mail-index.netbsd.org/tech-kern/2013/03/21/msg015131.html
 1.117 16-Jan-2015  christos strtoi and strtou for the kernel
 1.116 20-Nov-2014  christos branches: 1.116.2;
bcdtobin and bintobcd are now inlines in <dev/clock_subr.h>
 1.115 10-Aug-2014  tls branches: 1.115.2;
Merge tls-earlyentropy branch into HEAD.
 1.114 19-Jul-2014  lneto lua: updated from 5.1 to 5.3 work3

* lua(1):
- changed lua_Integer to intmax_t
- updated distrib/sets/lists and etc/mtree
- updated bsd.lua.mk
- fixed bozohttpd (lua-bozo.c)
- compatibilized bindings: gpio, sqlite
* lua(4):
- removed floating-point and libc dependencies using '#ifndef _KERNEL'
- fixed division by zero and exponentiation
- libkern: added isalnum(), iscntrl(), isgraph(), isprint() and ispunct()
- acpica: removed isprint() from acnetbsd.h
- libc: moved strcspn.c, strpbrk.c and strspn.c to common
- removed stub headers
- compatibilized bindings: luapmf, luasystm
* reorganized luaconf.h
* updated doc/CHANGES and doc/RESPONSIBLE
 1.113 27-Feb-2014  joerg branches: 1.113.2;
Provide labs, llabs and imaxabs for kernel use.
 1.112 27-Dec-2013  christos add strncat (for acpi)
 1.111 15-Dec-2013  pooka Allow overriding CTASSERT. This helps with building NetBSD sources with
compilers that don't support __COUNTER__ -- shifting the CTASSERTs
around to avoid __LINE__ conflicts is a hopeless struggle.
 1.110 11-Dec-2013  joerg Allow kernel code to access constant databases by moving cdbr(3) and the
required mi_vector_hash(3) into src/common.
 1.109 02-Dec-2013  lneto changed lua_Number to int64_t
 1.108 28-Aug-2013  riastradh Fix libkern's prototype for explicit_memset.
 1.107 24-Jun-2013  riastradh branches: 1.107.2;
Replace consttime_bcmp/explicit_bzero by consttime_memequal/explicit_memset.

consttime_memequal is the same as the old consttime_bcmp.
explicit_memset is to memset as explicit_bzero was to bcmp.

Passes amd64 release and i386/ALL, but I'm sure I missed some spots,
so please let me know.
 1.106 30-Aug-2012  drochner branches: 1.106.2;
Add "consttime_bcmp" and "explicit_bzero" functions for both kernel
abd userland, as proposed on tech-security, with explicit_bzero using
a volatile function pointer as suggested by Alan Barrett.
Both do what the name says. For userland, both are prefixed by "__"
to keep them out of the user namespace.
Change some memset/memcmp uses to the new functions where it makes
sense -- these are just some examples, more to come.
 1.105 22-Jan-2012  rmind Add CTASSERT_SIGNED() and CTASSERT_UNSIGNED().
 1.104 28-Nov-2011  tls branches: 1.104.2;
Remove arc4random() and arc4randbytes() from the kernel API. Replace
arc4random() hacks in rump with stubs that call the host arc4random() to
get numbers that are hopefully actually random (arc4random() keyed with
stack junk is not). This should fix some of the currently failing anita
tests -- we should no longer generate duplicate "random" MAC addresses in
the test environment.
 1.103 01-Oct-2011  chs branches: 1.103.2;
use gcc builtin for memset() on vax too.
 1.102 29-Sep-2011  christos Don't include <sys/systm.h> because it brings in too much stuff that
conflicts with standalone code. Instead modify kern_assert() to be like
panic() and call that.
 1.101 27-Sep-2011  jym Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
 1.100 25-Sep-2011  jym Do as Joerg said and kill the __STDC__ blocks. They only make sense for
things used by assembler, which won't be the case for these macros.
 1.99 01-Sep-2011  jym Make strnlen(3) accessible in kernel. ok christos@.
 1.98 05-Jul-2011  matt If GCC 4.0 or later, use __builtin_offsetof for offsetof.
This make GCC 4.5 with offsetof in mbuf.h and kern_cpu.c
 1.97 19-Feb-2011  matt Define CTASSERT in terms of __CTASSERT
 1.96 26-Jan-2011  matt Fix KDASSERTMSG defintions for !DEBUG
 1.95 24-Jan-2011  matt Add KDASSERTMSG (KDASSERT already exists).
 1.94 25-Apr-2010  rmind branches: 1.94.2; 1.94.4;
Fix KASSERTMSG() to be consistent with KASSERT() logic, not inverted.
Hi matt@!
 1.93 19-Jan-2010  pooka branches: 1.93.2; 1.93.4;
Get rid of last "easy" kernel symbols starting with __:
__assert -> kern_assert
__sigtimedwait1 -> sigtimedwait1
__wdstart -> wdstart1

The rest are MD and/or shared with userspace, so they will require
a little more involvement than what is available for this quick
"ride the 5.99.24 bump" action.
 1.92 21-Jul-2009  joerg Move popcount et al to src/common and add popcount32/popcount64.
Requested by rmind@. MD should now override popcount32/popcount64 and
provide the aliases as fitting.
 1.91 13-May-2009  pgoyette Implement snprintb_m(3) to provide multi-line bit/bit-field decode.
Discussed on tech-kern.
 1.90 25-Mar-2009  tls Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.89 25-Mar-2009  darran Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.88 23-Mar-2009  tsutsui Don't use gcc's __builtin_*() functions #if defined(_STANDALONE)
because they could be larger than __OPTIMIZE_SIZE__'ed libsa ones and
__builtin_memcpy() on vax rejects NULL (i.e. copying from/to address 0x0).

No particular comments on tech-toolchain.

Tested on alpha, arc, cobalt, hp300, i386, landisk, macppc, news68k, sgimips,
sparc, sparc64, sun3, and vax (on simh).
 1.87 18-Mar-2009  tsutsui - remove bcmp(9), bcopy(9), and bzero(9) from libkern since <sys/systm.h> has
macro which replace them with mem*() functions in #ifdef _KERNEL as noted
in man pages
- move declarations of bcopy(3) and bzero(3) into <lib/libsa/stand.h>
since they are still in libsa for some MD standalone sources
(I guess all bcmp(3) in standalone sources have been replaced with memcmp(3)
but they should be replaced with memcmp() anyway)
 1.86 14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.85 16-Dec-2008  christos branches: 1.85.2;
replace bitmask_snprintf(9) with snprintb(3)
 1.84 16-Nov-2008  ad Our qsort() is inappropriate for kernel use because it makes recursive
calls. Replace it with a kheapsort() function in kernel. Pointed out
by tron@.
 1.83 16-Nov-2008  ad Make qsort() available in libkern.
 1.82 08-Sep-2008  gmcgarry branches: 1.82.2; 1.82.4; 1.82.8;
Replace most gcc-specific __attribute__ uses with BSD-style sys/cdef.h
preprocessor macros.
 1.81 02-Jul-2008  matt branches: 1.81.2;
Add KASSERTMSG(e, msg) for umass.c. XXX directly calls panic.
 1.80 02-Jul-2008  matt Add CTASSERT (compile time assert) from FreeBSD.
Causes sources to fail to compile:
<file>:<line>: error: size of array '__ctassert<line>' is negative
 1.79 25-Mar-2008  christos branches: 1.79.4; 1.79.6; 1.79.8;
fix again
 1.78 25-Mar-2008  christos fix bcopy again
 1.77 25-Mar-2008  christos fix bcopy prototype
 1.76 25-Mar-2008  christos add a prototype for bcopy.
 1.75 17-Feb-2008  matt branches: 1.75.6;
Don't need to that particular in mtprng_random(). Use 2 values instead of 8.
 1.74 02-Feb-2008  matt Improve my version of mtprng_random. Reshuffle things. Add an compatible
version of init_by_array.
 1.73 31-Jan-2008  matt Add Mersenne Twister prototypes and state struct to libkern.h
Cleanup a comment. s/RLEN/MTPRNG_RLEN/g s/POS1/MTPRNG_POS1/g
Remove unneeded test code.
 1.72 25-Dec-2007  perry Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.71 24-Sep-2007  pooka branches: 1.71.4; 1.71.6; 1.71.10;
Rename __assert() to __kernassert() so that it doesn't collide
with the libc version. They take different arguments.
 1.70 29-Jul-2007  ad branches: 1.70.4; 1.70.6; 1.70.8; 1.70.10;
Disable kernel assertions if panicstr != NULL.
 1.69 09-Apr-2007  matt branches: 1.69.4;
Enable builtin_ffs for vax
 1.68 21-Feb-2007  thorpej branches: 1.68.4; 1.68.6;
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.67 08-Oct-2006  thorpej branches: 1.67.2; 1.67.4; 1.67.6;
- Move strtoll.c and strtoull.c from libc/stdlib to common/libc/stdlib.
- Add strtoll.c and strtoull.c to libkern.
 1.66 10-Sep-2006  matt branches: 1.66.2;
If __STDC__ and GNU C >= 3.0, define C99's bool, true, false
 1.65 31-Aug-2006  dyoung branches: 1.65.2;
Per discussion on tech-kern and tech-userlevel, move the bit-twiddling
macros, __BIT, __BITS, SHIFTIN, SHIFTOUT, and __arraycount() from
lib/libkern/libkern.h to sys/cdefs.h. Add a __-prefix to SHIFTIN
and SHIFTOUT, and add a manual page for the bit-twiddling macros,
bits(3).

Make the __BIT and __BITS macros "widthless," as best I can, by
changing their type to uintmax_t from uint32_t. XXX The manual
page lags this change by a bit.

Define __PRIxBIT and __PRIxBITS printf(3) format strings.
 1.64 25-Aug-2006  matt Add __NULL_STMT which is do { } while (/* CONSTCOND */ 0)
 1.63 08-Jul-2006  matt With VAX & GCC4, use builtin memset and memmove.
 1.62 22-Apr-2006  thorpej branches: 1.62.4;
Move strtoumax.c from libc/stdlib to common/libc/stdlib and include it
in libkern. Required for new code coming soon.
 1.61 15-Apr-2006  christos Imply DIAGNOSTIC if __COVERITY__.
 1.60 14-Apr-2006  christos If __COVERITY__ is defined, turn on KASSERT and _DIAGASSERT.
 1.59 27-Mar-2006  dyoung Per discussion on source-changes@, add __arraycount(array) for
counting the number of elements in a static array, using the idiom,
sizeof(array)/sizeof(array[0]).

XXX This may move in the future, but this is a safe place to put
XXX it for use in the kernel.
 1.58 11-Mar-2006  kleink branches: 1.58.2;
Provide BCD<->binary conversion in libkern and turn <dev/clock_subr.h>'s
FROMBCD()/TOBCD() macros into wrappers around it, resulting in both
smaller code footprint and elimination of possible issues due to
multiple evaluation of macro arguments.

Suggested by Simon Burge and Anders Gavare on tech-kern.
 1.57 08-Mar-2006  dyoung Change macro names to avoid collisions:

BIT -> __BIT
BITS -> __BITS
 1.56 08-Mar-2006  dyoung Move my bit-twiddling macros to libkern.h from my drivers, where
I had duplicated them. Improve the macros' names. Simplify their
implementation.

A brief description of each macro is below.

BIT(n): Return a bitmask with bit m set, where the least
significant bit is bit 0.

BITS(m, n): Return a bitmask with bits m through n, inclusive,
set. It does not matter whether m>n or m<=n.
The least significant bit is bit 0.

A "bitfield" is a span of consecutive bits defined by a
bitmask, where 1s select the bits in the bitfield. SHIFTIN,
SHIFTOUT, and SHIFTOUT_MASK help read and write bitfields
from device registers.

SHIFTIN(v, mask): Left-shift bits `v' into the bitfield
defined by `mask', and return them. No
side-effects.

SHIFTOUT(v, mask): Extract and return the bitfield selected
by `mask' from `v', right-shifting the
bits so that the rightmost selected bit
is at bit 0. No side-effects.

SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that
the rightmost non-zero bit is at bit
0. This is useful for finding the
greatest unsigned value that a bitfield
can hold. No side-effects. Note that
SHIFTOUT_MASK(m) = SHIFTOUT(m, m).

Examples:

/*
* Register definitions taken from the RFMD RF3000 manual.
*/
#define RF3000_GAINCTL 0x11 /* TX variable gain control */
#define RF3000_GAINCTL_TXVGC_MASK BITS(7, 2)
#define RF3000_GAINCTL_SCRAMBLER BIT(1)

/*
* Shift the transmit power into the transmit-power field of the
* gain-control register and write it to the baseband processor.
*/
atw_rf3000_write(sc, RF3000_GAINCTL,
SHIFTIN(txpower, RF3000_GAINCTL_TXVGC_MASK));


/*
* Register definitions taken from the ADMtek ADM8211 manual.
*
*/
#define ATW_RXSTAT_OWN BIT(31) /* 1: NIC may fill descriptor */
/* ... */
#define ATW_RXSTAT_DA1 BIT(17) /* DA bit 1, admin'd address */
#define ATW_RXSTAT_DA0 BIT(16) /* DA bit 0, group address */
#define ATW_RXSTAT_RXDR_MASK BITS(15,12) /* RX data rate */
#define ATW_RXSTAT_FL_MASK BITS(11,0) /* RX frame length, last
* descriptor only
*/

/* Extract the frame length from the Rx descriptor's
* status field.
*/
len = SHIFTOUT(rxstat, ATW_RXSTAT_FL_MASK);
 1.55 16-Feb-2006  perry branches: 1.55.2; 1.55.4;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.54 24-Dec-2005  perry branches: 1.54.2; 1.54.4; 1.54.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.53 21-Dec-2005  christos Add the state setting functions for the new random function, but use the
small one by default, so that we can switch in the future if we want to.
 1.52 20-Dec-2005  christos Provide _DIAGASSERT and NULL, so that we don't have to do it in *all* the
libkern files.
Also the new inet_addr, provides inet_aton; advertise it.
 1.51 11-Dec-2005  christos merge ktrace-lwp.
 1.50 13-Aug-2003  ragge branches: 1.50.16;
Do not use the builtins for the mem* functions on vax, the compiler gets
confused with the static inline functions vax uses.
 1.49 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.48 15-May-2003  itojun branches: 1.48.2;
add strl{cpy,cat} to libkern. code from lib/libc/string (originally from openbsd).
 1.47 24-Oct-2002  christos make offsetof lint friendlier.
 1.46 06-Oct-2002  tls ESP output was drawing down the entropy pool at a ferocious rate, a
particular problem on hosts with only wireless interfaces that are
definitely not safe to use as entropy sources.

Add arc4randbytes() which hands out bytes from the same source used
by arc4random(). This is intended to be a _temporary_ interface
until we can design and implement a better general PRNG interface
that is decoupled from the entropy-pool implementation.

Modify key_randomfill() (used only for initialization vectors on
SA creation and via key_sa_stir_iv(), which does not "stir",
despite its name) to use arc4randbytes() instead of pulling bits
directly from the entropy pool. It is my hope that this change
will pose minimal integration problems for the KAME folks as the
random-pool interface is *already* different between each BSD
variant; this just simplifies the NetBSD case and solves a
fairly serious problem.

Note that it is generally considered acceptable cryptographic
practice to use a fast stream cipher to generate IVs for encryption
with stronger block ciphers. For example, the use of "non-Approved"
PRNGs to generate IVs for "Approved" block ciphers is explicitly
sanctioned by FIPS 140-2.
 1.45 04-Oct-2002  junyoung Add strstr() to libkern. For now, it's only used in i386 (for processor
identification).
 1.44 04-Oct-2002  matt Ansify's (use prototypes).
 1.43 25-Aug-2002  thorpej Tweak the previous change so that a prototype is always provided.
 1.42 23-Aug-2002  ragge Do not try to use "__builtin_ffs" on vax, ffs is an instruction already.
Maybe possible to teach gcc to use it?
 1.41 21-Aug-2002  thorpej GCC 2.95 supports __builtin_ffs(); use it.
 1.40 28-May-2002  itojun have arc4random(9).
 1.39 28-Dec-2001  thorpej branches: 1.39.8; 1.39.10;
Always provide alloca() as __builtin_alloca().
 1.38 23-Dec-2001  thorpej The kernel is now built with -ffreestanding, so GCC built-ins are
disabled. Explicitly re-enable some that we want to use, namely:

* memcpy() -> __builtin_memcpy()
* memcmp() -> __builtin_memcmp()
* memset() -> __builtin_memset()

* strcpy() -> __builtin_strcpy()
* strcmp() -> __builtin_strcmp()
* strlen() -> __builtin_strlen()

We might also consider some others for GCC 3.x.
 1.37 07-Jul-2001  perry branches: 1.37.2;
restore bzero and bcmp prototypes for now -- this has to be hashed out.
 1.36 07-Jul-2001  simonb Put the prototypes for bcmp() and bzero() back (ifdef _STANDALONE) so that
libsa builds again.
 1.35 07-Jul-2001  perry Remove bcmp and bzero prototypes. And yes, I actually checked and
tested this time. (Slap self repeatedly.)
 1.34 30-Apr-2001  lukem remove some lint
 1.33 05-Apr-2001  thorpej Add ctype routines.
 1.32 01-Nov-2000  thorpej branches: 1.32.2;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.31 12-Oct-2000  msaitoh enclose offsetof macro definition with #ifndef offsetof ... #endif
 1.30 08-May-2000  thorpej branches: 1.30.4;
__predict_true() the expressions passed to the assert family, so
as to move the calls to __assert() out-of-line.

Suggested by Bill Sommerfeld.
 1.29 29-Mar-2000  simonb Multiple include protection.
 1.28 29-Nov-1999  simonb Move strtoul.c (via CVS repo copy) to libkern. Also sort prototypes
in libkern.h and sources in arm32/Makefile.inc alphabetically.
 1.27 10-Sep-1999  tron branches: 1.27.2; 1.27.8;
Add prototype for memcmp() as suggested by Anders Hjalmarsson in
PR kern/8360.
 1.26 07-May-1999  drochner move intoa() from libsa:net.c to libkern, turn inet_ntoa() into a macro,
nuke ip_convertaddr()
 1.25 12-Apr-1999  drochner This was an n_long, not u_long, so u_int32_t is correct.
 1.24 12-Apr-1999  ross libkern just got an inet_addr(), but it won't compile, no prototype. Cleanup...
* Add prototype to libkern.h.
* Remove the almost-identical-copy from libsa/net.[ch].
* Change its type back to the (wrong, but harmless) historical one. (u_long)
* Kill the XXX local prototype in nfs_bootparam.c
 1.23 31-Jul-1998  perry branches: 1.23.8;
make libkern build memmove() properly
 1.22 21-Jun-1998  christos branches: 1.22.2;
Add a small string pattern matching function to facilitate pcmcia cis string
matches.
 1.21 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.20 22-Feb-1998  mycroft Add memcpy() and memset(), and sort.
 1.19 28-Jan-1998  thorpej Add offsetof().
 1.18 23-Jan-1998  drochner remove prototypes for deprecated index() and rindex()
 1.17 22-Jan-1998  drochner add prototype for index()
 1.16 21-Jan-1998  cgd add strrchr
 1.15 24-Oct-1997  mjacob Add missing NULL define for KERNEL case and prototype into libkern.h.
 1.14 07-Jul-1997  cgd mark prototypes for static inline functions as possibly unused (with
__attribute__ ((unused))), to avoid generating warnings when compiling
without optimization but with most ports' default warning flags.
 1.13 13-Jun-1997  drochner Add prototype for bzero() (since it is implemented here).
 1.12 18-Jan-1997  cgd add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.11 24-Oct-1996  cgd second and third args to scanc() (string and table) are not and should not
be modified. Make them 'const'.
 1.10 22-Sep-1996  cgd add a missing #else, pointed out by Wolfgang Solfrank
 1.9 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.8 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.7 14-Mar-1996  christos - Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.6 13-Feb-1996  christos Add declaration of strncasecmp.
 1.5 23-Sep-1995  leo Add abs() function as an 'inline'. The atari-port needs it since the
-fno-builtin is used in the kernel Makefile.
 1.4 14-Aug-1995  cgd prototype inline functions, almost as suggested by Jonathan Stone in PR 1258.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 15-Jul-1994  cgd don't use inline, use __inline, like cdefs intends (so it can kill it if nongcc
 1.1 05-May-1994  cgd branches: 1.1.2;
lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.1.2.1 15-Jul-1994  cgd updates from trunk. basically, C language errors.
 1.22.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.23.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.27.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.27.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.27.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.30.4.1 05-Nov-2000  tv Pullup 1.31 [msaitoh]:
enclose offsetof macro definition with #ifndef offsetof ... #endif
 1.32.2.8 11-Nov-2002  nathanw Catch up to -current
 1.32.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.32.2.6 27-Aug-2002  nathanw Catch up to -current.
 1.32.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.32.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.32.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.32.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.32.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.37.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.37.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.37.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.10.2 03-Dec-2002  he Pull up revisions 1.42-1.43 (requested by thorpej in ticket #1024):
Don't use __builtin_ffs() on vax, ffs is an instruction
there already. Also, always provide an ffs() prototype.
Should fix build problem on vax.
 1.39.10.1 21-Nov-2002  he Pull up revision 1.41 (requested by thorpej in ticket #710):
GCC 2.95 supports __builtin_ffs(), so use it.
 1.39.8.2 29-Aug-2002  gehenna catch up with -current.
 1.39.8.1 30-May-2002  gehenna Catch up with -current.
 1.48.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.48.2.1 03-Aug-2004  skrll Sync with HEAD
 1.50.16.8 27-Feb-2008  yamt sync with head.
 1.50.16.7 04-Feb-2008  yamt sync with head.
 1.50.16.6 21-Jan-2008  yamt sync with head
 1.50.16.5 27-Oct-2007  yamt sync with head.
 1.50.16.4 03-Sep-2007  yamt sync with head.
 1.50.16.3 26-Feb-2007  yamt sync with head.
 1.50.16.2 30-Dec-2006  yamt sync with head.
 1.50.16.1 21-Jun-2006  yamt sync with head.
 1.54.6.2 01-Jun-2006  kardel Sync with head.
 1.54.6.1 22-Apr-2006  simonb Sync with head.
 1.54.4.1 09-Sep-2006  rpaulo sync with head
 1.54.2.1 18-Feb-2006  yamt sync with head.
 1.55.4.2 11-May-2006  elad sync with head
 1.55.4.1 19-Apr-2006  elad sync with head.
 1.55.2.6 14-Sep-2006  yamt sync with head.
 1.55.2.5 03-Sep-2006  yamt sync with head.
 1.55.2.4 11-Aug-2006  yamt sync with head
 1.55.2.3 24-May-2006  yamt sync with head.
 1.55.2.2 01-Apr-2006  yamt sync with head.
 1.55.2.1 13-Mar-2006  yamt sync with head.
 1.58.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.58.2.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.62.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.65.2.1 18-Nov-2006  ad Sync with head.
 1.66.2.1 22-Oct-2006  yamt sync with head
 1.67.6.1 07-Apr-2008  skrll Oops, missed this one.
 1.67.4.2 15-Apr-2007  yamt sync with head.
 1.67.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.67.2.1 19-Apr-2008  bouyer Pull up following revision(s) (requested by skrll in ticket #1129):
share/mk/bsd.own.mk: revision 1.489.4.3
gnu/dist/gcc4/gcc/config/vax/vax.h: revision 1.2.6.1
gnu/dist/gcc4/gcc/config/vax/builtins.md: revision 1.2.10.2
sys/arch/vax/conf/Makefile.vax: revision 1.77.22.1
gnu/dist/gcc4/gcc/config/vax/vax-protos.h: revision 1.1.1.1.6.1
gnu/dist/binutils/gas/config/tc-vax.h: revision 1.1.1.1.18.1
gnu/lib/libgcc4/libgcc/Makefile: revision 1.2.6.1
sys/arch/vax/include/macros.h: revision 1.37.14.1
gnu/lib/crtstuff4/Makefile: revision 1.1.6.1
gnu/dist/gcc4/gcc/config/vax/elf.h: revision 1.1.1.1.6.1
gnu/dist/gcc4/gcc/config/vax/vax.c: revision 1.1.1.1.6.1
sys/arch/vax/boot/Makefile.inc: revision 1.12.16.1
tools/gcc/Makefile: revision 1.22.4.1
lib/libcrypto/Makefile: revision 1.46.4.2
gnu/dist/gcc4/gcc/config/vax/netbsd-elf.h: revision 1.1.1.1.6.1
sys/lib/libkern/libkern.h: revision 1.67.6.1
gnu/dist/gcc4/gcc/config/vax/predicates.md: revision 1.3.10.2
gnu/dist/binutils/bfd/elf32-vax.c: revision 1.5.6.1
gnu/dist/gcc4/gcc/config/vax/vax.md: revision 1.1.1.1.4.1.2.1
gnu/dist/gcc4/gcc/config/vax/vax.opt: revision 1.1.1.1.6.1
gnu/dist/binutils/gas/config/tc-vax.c: revision 1.4.4.1.2.1
Pullup changes to get vax shlibs working from the wrstuden-fixsa branch.
 1.68.6.1 11-Jul-2007  mjf Sync with head.
 1.68.4.3 09-Oct-2007  ad Sync with head.
 1.68.4.2 20-Aug-2007  ad Sync with HEAD.
 1.68.4.1 10-Apr-2007  ad Sync with head.
 1.69.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.70.10.2 29-Jul-2007  ad Disable kernel assertions if panicstr != NULL.
 1.70.10.1 29-Jul-2007  ad file libkern.h was added on branch matt-mips64 on 2007-07-29 11:46:03 +0000
 1.70.8.1 06-Oct-2007  yamt sync with head.
 1.70.6.3 23-Mar-2008  matt sync with HEAD
 1.70.6.2 09-Jan-2008  matt sync with HEAD
 1.70.6.1 06-Nov-2007  matt sync with HEAD
 1.70.4.1 02-Oct-2007  joerg Sync with HEAD.
 1.71.10.1 02-Jan-2008  bouyer Sync with HEAD
 1.71.6.1 26-Dec-2007  ad Sync with head.
 1.71.4.1 18-Feb-2008  mjf Sync with HEAD.
 1.75.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.75.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.75.6.2 02-Jul-2008  mjf Sync with HEAD.
 1.75.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.79.8.1 03-Jul-2008  simonb Sync with head.
 1.79.6.2 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.79.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.79.4.5 11-Aug-2010  yamt sync with head.
 1.79.4.4 11-Mar-2010  yamt sync with head
 1.79.4.3 19-Aug-2009  yamt sync with head.
 1.79.4.2 16-May-2009  yamt sync with head
 1.79.4.1 04-May-2009  yamt sync with head.
 1.81.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.81.2.1 19-Oct-2008  haad Sync with HEAD.
 1.82.8.5 14-Feb-2014  matt Change KASSERTMSG/KDASSERTMSG to use varadic arguments like HEAD.
panic -> vpanic, add panic wrapper to vpanic.
 1.82.8.4 27-Dec-2011  matt Add popcount32 and popcount64 for flash/nand
 1.82.8.3 29-Apr-2011  matt Move CTASSERT to __CTASSERT in <sys/cdefs.h> (from current)
Add KDASSERTMSG (from current)
 1.82.8.2 03-Feb-2011  cliff fix KASSERTMSG
 1.82.8.1 21-Apr-2010  matt sync to netbsd-5
 1.82.4.2 03-May-2009  snj branches: 1.82.4.2.4;
Pull up following revision(s) (requested by tls in ticket #611):
common/dist/zlib/zlib.h: revision 1.3
sys/lib/libkern/crc32.c: revision 1.2
sys/lib/libkern/libkern.h: revision 1.90 via patch
sys/lib/libsa/cread.c: revision 1.23
sys/lib/libz/Makefile: revision 1.16
Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.82.4.1 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
sys/lib/libkern/Makefile: patch
sys/lib/libkern/crc32.c: revision 1.1
sys/lib/libkern/crc32.h: revision 1.1
sys/lib/libkern/libkern.h: revision 1.89
sys/lib/libkern/arch/i386/Makefile.inc: revision 1.28
sys/net/zlib.h: revision 1.14 via patch
sys/opencrypto/crypto.c: revision 1.33
sys/opencrypto/cryptodev.c: revision 1.46
sys/opencrypto/cryptodev.h: revision 1.16
sys/opencrypto/cryptosoft.c: revision 1.24
sys/opencrypto/cryptosoft.h: revision 1.6
sys/opencrypto/deflate.h: revision 1.6
sys/opencrypto/cryptosoft_xform.c: revision 1.12
sys/opencrypto/deflate.c: revision 1.13
sys/opencrypto/files.opencrypto: revision 1.20
sys/opencrypto/ocryptodev.c: revision 1.1
sys/opencrypto/ocryptodev.h: revision 1.1
sys/opencrypto/xform.c: revision 1.18
sys/opencrypto/xform.h: revision 1.10
Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.82.4.2.4.1 07-Jan-2011  matt Fix KASSERTMSG.
 1.82.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.82.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.85.2.2 23-Jul-2009  jym Sync with HEAD.
 1.85.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.93.4.4 06-Mar-2011  rmind sync with head (and fix few botches with this)
 1.93.4.3 05-Mar-2011  rmind sync with head
 1.93.4.2 30-May-2010  rmind sync with head
 1.93.4.1 25-Apr-2010  rmind Pull-up rev 1.94
 1.93.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.94.4.2 05-Mar-2011  bouyer Sync with HEAD
 1.94.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.94.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.103.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.103.2.2 30-Oct-2012  yamt sync with head
 1.103.2.1 17-Apr-2012  yamt sync with head
 1.104.2.1 18-Feb-2012  mrg merge to -current.
 1.106.2.2 03-Dec-2017  jdolecek update from HEAD
 1.106.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.107.2.2 18-May-2014  rmind sync with head
 1.107.2.1 28-Aug-2013  rmind sync with head
 1.113.2.3 10-Aug-2014  tls Rebase.
 1.113.2.2 09-Aug-2014  tls (Temporarily) disable LZF in libkern -- it introduces a dependency from
src/sys to src/external which I'll need to fix by moving the LZF sources.
 1.113.2.1 07-Apr-2014  tls LZF in the kernel. As an entropy estimator for now but it's very small, and
we could use it for ipcomp, for hibernation, for paging, for core dumps, etc.
 1.115.2.1 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.116.2.4 29-May-2016  skrll Sync with HEAD
 1.116.2.3 22-Sep-2015  skrll Sync with HEAD
 1.116.2.2 06-Jun-2015  skrll Sync with HEAD
 1.116.2.1 06-Apr-2015  skrll Sync with HEAD
 1.126.4.4 21-Apr-2020  martin Sync with HEAD
 1.126.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.126.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.126.4.1 10-Jun-2019  christos Sync with HEAD
 1.126.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.126.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.139.2.1 20-Apr-2020  bouyer Sync with HEAD
 1.140.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.142.6.1 31-May-2021  cjep sync with head
 1.142.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.145.6.1 02-Aug-2025  perseant Sync with HEAD
 1.6 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file lmax.c was added on branch magnum on 1993-10-13 05:40:40 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.6 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file lmin.c was added on branch magnum on 1993-10-13 05:40:41 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.3 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file locc.c was added on branch magnum on 1993-10-13 05:40:42 +0000
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 20-Oct-2002  scw branches: 1.7.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.6 27-Mar-1998  cgd branches: 1.6.26;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file lshldi3.c was added on branch magnum on 1993-12-04 05:01:43 +0000
 1.6.26.1 11-Nov-2002  nathanw Catch up to -current
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 20-Oct-2002  scw branches: 1.7.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.6 27-Mar-1998  cgd branches: 1.6.26;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file lshrdi3.c was added on branch magnum on 1993-12-04 05:01:44 +0000
 1.6.26.1 11-Nov-2002  nathanw Catch up to -current
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.8 03-Sep-2018  riastradh Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.7 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.6 14-Mar-2009  dsl branches: 1.6.62; 1.6.64;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file max.c was added on branch magnum on 1993-10-13 05:40:44 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.6.64.1 10-Jun-2019  christos Sync with HEAD
 1.6.62.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.16 20-Dec-2005  christos Use common sources with userland.
 1.15 11-Dec-2005  christos merge ktrace-lwp.
 1.14 02-Oct-2005  chs put mcount.c in the normal object list, so that "make depend" works.
use a gcc attribute to prevent it from being instrumented.
 1.13 26-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 07-Aug-2003  agc branches: 1.12.8; 1.12.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 05-Sep-2000  thorpej branches: 1.11.24;
Move the Alpha _mcount() into a .S file so that it can be
pre-processed, like other Alpha assembly files.
 1.10 17-Jan-1999  mrg branches: 1.10.8;
update from libc; RCSID, register.
 1.9 27-Mar-1998  cgd branches: 1.9.4;
sync with libc
 1.8 07-Dec-1996  fvdl Move _MCOUNT_DECL prototype back here again (grmbl).
 1.7 05-Dec-1996  fvdl Remove _MCOUNT_DECL prototype declaration of _mcount() again; move it
to <machine/profile.h>
 1.6 04-Dec-1996  fvdl Add prototype for _mcount, to make this compile with warnings on.
 1.5 29-Jun-1996  abrown Prevent recursive invocation of mcount() while in kernel by setting profiling
state to BUSY while in mcount(). This allows profiling to work when mcount()
calls a profiled routine (for example, udiv on the SPARC).
 1.4 12-Jun-1996  cgd copy down from libkern:
>use p->hashfraction when doing non-time-critical calculations, rather than
>using HASHFRACTION directly. in time-critical calculations, if HASHFRACTION
>is a power of two, check that p->hashfraction == HASHFRACTION and if so do
>the calculation with the compiled-in value so that the compiler can optimize
>out (potentially) expensive divisions. if p->hashfraction != HASHFRACTION,
>actually do the division. This has the result that on machines with slow
>division, the division can be optimized out of the common case, but that
>if HASHFRACTION changes from the compiled-in value (for whatever reason),
>profiling will still work. Changes suggested by Chris Torek.
 1.3 28-Mar-1995  jtc branches: 1.3.6;
KERNEL -> _KERNEL
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 14-May-1994  cgd add libkern mcount
 1.3.6.1 12-Jun-1996  cgd copy down from libkern.
 1.9.4.1 25-Feb-1999  chs sync with HEAD - profiling fixes.
 1.10.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.11.24.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.24.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.24.1 03-Aug-2004  skrll Sync with HEAD
 1.12.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.8.1 29-Apr-2005  kent sync with -current
 1.13.4.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 04-Dec-2003  keihan branches: 1.3.16;
NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.2 15-Nov-2001  lukem branches: 1.2.16;
don't need <sys/types.h> when including <sys/param.h>
 1.1 08-Dec-2000  deberg branches: 1.1.2; 1.1.4; 1.1.6;
in-kernel MD4 implementation, from libc
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.1 08-Dec-2000  bouyer file md4c.c was added on branch thorpej_scsipi on 2000-12-13 15:50:23 +0000
 1.2.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.13 20-Dec-2005  christos Use common sources with userland.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 30-Jun-2004  christos branches: 1.11.12;
remove useless typedef and casts
 1.10 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.9 15-Nov-2001  lukem branches: 1.9.16;
don't need <sys/types.h> when including <sys/param.h>
 1.8 16-Oct-1999  ragge branches: 1.8.12; 1.8.14;
Include <lib/libkern/libkern.h> after sys/param.h, to avoid warnings
when memcpy et al is static inline.
 1.7 16-Sep-1999  sommerfeld branches: 1.7.2;
Include <lib/libkern/libkern.h> instead of <sys/systm.h>.
(the former no longer has mem* prototypes).
Remove the b* vs mem* kludge.
This change allows standalone libkern to build on alpha again.
 1.6 10-Sep-1999  drochner sync with libc
 1.5 04-Feb-1999  fvdl Check for _STANDALONE as well as _KERNEL to make it compile again. Fold
some includes together in one #if as a result of this.
 1.4 04-Feb-1999  explorer sync with userland
 1.3 12-Sep-1998  ragge Include <sys/param.h> instead of <sys/types.h>, to get mem* inlines.
(At least on vax)
 1.2 27-Mar-1998  cgd sync with libc
 1.1 30-Apr-1997  thorpej Add the libc md5 implementation to libkern.
 1.7.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.14.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.9.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.16.1 03-Aug-2004  skrll Sync with HEAD
 1.11.12.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 01-Jul-2004  christos branches: 1.7.12;
add __UNCONST
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 27-Mar-1998  cgd branches: 1.5.48;
sync with libc
 1.4 22-Feb-1998  mycroft Don't even think about cdefs.h here...
 1.3 21-Jan-1998  cgd sync with libc
 1.2 24-Oct-1997  mjacob Add missing NULL define for KERNEL case and prototype into libkern.h.
 1.1 24-Oct-1997  chuck add memchr() to libkern
 1.5.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.12.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 07-Aug-2003  agc branches: 1.4.8; 1.4.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 27-Mar-1998  cgd branches: 1.3.48;
sync with libc
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 15-Aug-1996  jtc branches: 1.1.10;
Added to libkern in preparation for change from b* to mem*.
 1.1.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.48.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.48.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 04-Aug-1998  perry branches: 1.1.62;
replace several special targets with stub .c files, as in libc/string
 1.1.62.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 04-Aug-1998  perry branches: 1.1.62;
replace several special targets with stub .c files, as in libc/string
 1.1.62.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 07-Aug-2003  agc branches: 1.8.8; 1.8.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 14-Sep-1998  leo branches: 1.7.46;
Fix "unused variable `c'" warning. (From Julian Coleman)
 1.6 27-Mar-1998  cgd copy from libc:
limits.h if user-land, machine/limits.h if kernel or standalone
 1.5 27-Mar-1998  cgd sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 15-Aug-1996  jtc branches: 1.3.10;
Added to libkern in preparation for change from b* to mem*.
 1.2 11-Mar-1996  scottr Back out previous change.
 1.1 11-Mar-1996  thorpej Provide a memset() for the i386 (assembly version), and move memset.c
out into the libkern proper in case other ports want to use it.
i386 kernels with COMPAT_LINUX should compile now.
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.46.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.46.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.9 14-Dec-2019  riastradh Remove never-used Mersenne twister from libkern.
 1.8 28-Apr-2008  martin branches: 1.8.88;
Remove clause 3 and 4 from TNF licenses
 1.7 17-Feb-2008  matt branches: 1.7.2; 1.7.8; 1.7.10; 1.7.12; 1.7.14;
Don't need to that particular in mtprng_random(). Use 2 values instead of 8.
 1.6 02-Feb-2008  matt branches: 1.6.2;
Improve my version of mtprng_random. Reshuffle things. Add an compatible
version of init_by_array.
 1.5 31-Jan-2008  simonb Check _STANDALONE as well as _KERNEL when choosing headers to include.
Also pull in <lib/libkern/libkern.h> so we get prototypes and a struct
mtprng_state declaration.
 1.4 31-Jan-2008  simonb Have mtprng_random() call mtprng_rawrandom() to get more
random data instead of calling itself. Much nicer to the
stack...
 1.3 31-Jan-2008  simonb Check against correct constant in a KASSERT().
 1.2 31-Jan-2008  matt Add Mersenne Twister prototypes and state struct to libkern.h
Cleanup a comment. s/RLEN/MTPRNG_RLEN/g s/POS1/MTPRNG_POS1/g
Remove unneeded test code.
 1.1 31-Jan-2008  matt Add Mersenne Twister PRNG implementation. This is a new implementation.
 1.6.2.3 27-Feb-2008  yamt sync with head.
 1.6.2.2 04-Feb-2008  yamt sync with head.
 1.6.2.1 02-Feb-2008  yamt file mertwist.c was added on branch yamt-lazymbuf on 2008-02-04 09:24:27 +0000
 1.7.14.1 16-May-2008  yamt sync with head.
 1.7.12.1 18-May-2008  yamt sync with head.
 1.7.10.2 23-Mar-2008  matt sync with HEAD
 1.7.10.1 17-Feb-2008  matt file mertwist.c was added on branch matt-armv6 on 2008-03-23 02:05:02 +0000
 1.7.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.7.2.1 17-Feb-2008  mjf file mertwist.c was added on branch mjf-devfs on 2008-02-18 21:06:59 +0000
 1.8.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5 02-Sep-2020  thorpej Update to the SoftFloat-2c version of milieu.h. This includes a
simplification of the license and updates the comments. NFC.
 1.4 19-Apr-2018  christos s/static inline/static __inline/g for consistency.
 1.3 28-Apr-2008  martin branches: 1.3.86;
Remove clause 3 and 4 from TNF licenses
 1.2 22-Apr-2003  christos branches: 1.2.100; 1.2.102; 1.2.104;
don't define TRUE and FALSE locally.
 1.1 26-Apr-2001  ross branches: 1.1.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 26-Apr-2001  nathanw file milieu.h was added on branch nathanw_sa on 2001-06-21 20:07:16 +0000
 1.2.104.1 16-May-2008  yamt sync with head.
 1.2.102.1 18-May-2008  yamt sync with head.
 1.2.100.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.86.1 22-Apr-2018  pgoyette Sync with HEAD
 1.8 03-Sep-2018  riastradh Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.7 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.6 14-Mar-2009  dsl branches: 1.6.62; 1.6.64;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file min.c was added on branch magnum on 1993-10-13 05:40:45 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.6.64.1 10-Jun-2019  christos Sync with HEAD
 1.6.62.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file moddi3.c was added on branch magnum on 1993-12-04 05:01:45 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 07-Aug-2003  agc branches: 1.8.8; 1.8.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 20-Oct-2002  scw branches: 1.7.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.6 27-Mar-1998  cgd branches: 1.6.26;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file muldi3.c was added on branch magnum on 1993-12-04 05:01:47 +0000
 1.6.26.1 11-Nov-2002  nathanw Catch up to -current
 1.7.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file negdi2.c was added on branch magnum on 1993-12-04 05:01:49 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file notdi2.c was added on branch magnum on 1993-12-04 05:01:51 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.13 20-Dec-2005  christos Use common sources with userland.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 04-Dec-2003  keihan branches: 1.11.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.10 22-Aug-2001  itojun branches: 1.10.20;
sync argument/return type of [hn]to[nh][ls] to XNET 5.2 (uint{16,32}_t).
as discussed on tech-net.
 1.9 27-Mar-1998  cgd branches: 1.9.26; 1.9.28;
sync with libc
 1.8 17-Oct-1996  cgd pull down from libc
 1.7 29-May-1996  cgd Copy from libkern:
Add some casts so that we're not bitten by type promotions on 64-bit
systems. Not a great concern since the only 64-bit system currently
supported by NetBSD (Alpha) uses assembly versions of these routines.
 1.6 07-Oct-1995  mycroft branches: 1.6.6;
Update from libc.
 1.5 06-Jan-1995  cgd copy back from libc
 1.4 06-Jan-1995  cgd from libc
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file ntohl.c was added on branch magnum on 1993-10-27 22:00:49 +0000
 1.6.6.1 29-May-1996  cgd Pull changes copied from libc to the release branch: Add some casts so
that we're not bitten by type promotions on 64-bit systems.
 1.9.28.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.9.26.1 21-Sep-2001  nathanw Catch up to -current.
 1.10.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.20.1 03-Aug-2004  skrll Sync with HEAD
 1.11.16.1 21-Jun-2006  yamt sync with head.
 1.12 20-Dec-2005  christos Use common sources with userland.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 04-Dec-2003  keihan branches: 1.10.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.9 22-Aug-2001  itojun branches: 1.9.20;
sync argument/return type of [hn]to[nh][ls] to XNET 5.2 (uint{16,32}_t).
as discussed on tech-net.
 1.8 27-Mar-1998  cgd branches: 1.8.26; 1.8.28;
sync with libc
 1.7 17-Oct-1996  cgd pull down from libc
 1.6 29-May-1996  cgd Copy from libkern:
Add some casts so that we're not bitten by type promotions on 64-bit
systems. Not a great concern since the only 64-bit system currently
supported by NetBSD (Alpha) uses assembly versions of these routines.
 1.5 07-Oct-1995  mycroft branches: 1.5.6;
Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 17-Apr-1994  glass missing. not noticed because all the ports have their own version.
 1.5.6.1 29-May-1996  cgd Pull changes copied from libc to the release branch: Add some casts so
that we're not bitten by type promotions on 64-bit systems.
 1.8.28.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.8.26.1 21-Sep-2001  nathanw Catch up to -current.
 1.9.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.20.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.9 09-Oct-2024  gutteridge pmatch.c: fix a typo in a comment
 1.8 24-Aug-2024  christos Not really a bug since the value is not used, but avoid reading uninitialized
memory anyway (CID-1597959)
 1.7 21-Jan-2021  thorpej branches: 1.7.24;
Allow this to be built for the strlist.c unit tests.
 1.6 14-Mar-2009  dsl branches: 1.6.76;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 07-Aug-2003  agc branches: 1.3.8; 1.3.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 15-Nov-2001  lukem branches: 1.2.16;
don't need <sys/types.h> when including <sys/param.h>
 1.1 21-Jun-1998  christos branches: 1.1.26; 1.1.28;
Add a small string pattern matching function to facilitate pcmcia cis string
matches.
 1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.6.76.1 03-Apr-2021  thorpej Sync with HEAD.
 1.7.24.1 02-Aug-2025  perseant Sync with HEAD
 1.13 20-Dec-2005  christos Use common sources with userland.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 07-Aug-2003  agc branches: 1.10.8; 1.10.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 20-Oct-2002  scw branches: 1.9.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.8 12-Dec-2000  mycroft branches: 1.8.2;
Update from libc.
 1.7 10-Sep-1999  drochner branches: 1.7.2;
sync with libc
 1.6 27-Mar-1998  cgd sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 16-Jun-1994  glass wierd fix for very wierd pmax compile problem. terry hit this too
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file qdivrem.c was added on branch magnum on 1993-12-04 05:01:53 +0000
 1.7.2.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.8.2.1 11-Nov-2002  nathanw Catch up to -current
 1.9.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.18 20-Dec-2005  christos Use common sources with userland.
 1.17 11-Dec-2005  christos merge ktrace-lwp.
 1.16 07-Aug-2003  agc branches: 1.16.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.15 20-Oct-2002  scw branches: 1.15.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.14 05-May-2000  thorpej branches: 1.14.6;
Use __GNUC_PREREQ__().
 1.13 27-Mar-2000  simonb Remove duplicate declaration of __cmpdi2()
 1.12 10-Sep-1999  drochner branches: 1.12.2;
sync with libc
 1.11 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.10 30-Aug-1998  enami As a temporary work around to make kernel links again, protect
renaming of quad type library only when !__NetBSD__ && sun && __svr4__.
XXX. Probably need to check __GNUC_MINOR__.
 1.9 29-Aug-1998  eeh Some more 64-bit-ification.
 1.8 27-Mar-1998  cgd sync with libc
 1.7 18-Apr-1996  cgd don't include user-land headers in libkern files when compiling for
the kernel.
 1.6 14-Mar-1996  christos - Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.5 12-Oct-1995  jtc Fix from Jochen Pohl which fixes case where quad multiply
goes awry if bit 31 of at least one of the operands is set
(PR #1591).
 1.4 07-Oct-1995  mycroft branches: 1.4.2;
Update from libc.
 1.3 06-Jan-1995  cgd copy back from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
oops; we need this
 1.1.2.2 04-Dec-1993  cgd oops; we need this
 1.1.2.1 04-Dec-1993  cgd file quad.h was added on branch magnum on 1993-12-04 05:09:15 +0000
 1.4.2.1 12-Oct-1995  jtc Fix from Jochen Pohl which fixes case where quad multiply
goes awry if bit 31 of at least one of the operands is set
(PR #1591).
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.6.1 11-Nov-2002  nathanw Catch up to -current
 1.15.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.6.1 03-Aug-2004  skrll Sync with HEAD
 1.16.16.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 30-Mar-2000  augustss branches: 1.4.28;
Kill some more register declarations.
 1.3 13-Nov-1996  cgd branches: 1.3.28;
include libkern.h, not types.h, to get prototype. (libkern.h includes types.h)
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 03-Jun-1994  glass needed by some multicast thing
 1.3.28.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.21 30-Jun-2008  matt Move rb.c from sys/lib/libkern to common so it can be in both libc and libkern.
 1.20 30-Jun-2008  matt Add some significant improvements to the red-black tree implementation.
Shrink size of rb_node by 25% (merge parent/father pointer and flags).
 1.19 25-Jun-2008  matt Nuke MOVED support. Move rb_parent out of rb_nodes and make it it's own
member.
 1.18 25-Jun-2008  christos Make rb use masks instead of bitfields, because it is more portable (bitfields
to unsigned long are not portable), and produces tighter code. Tested on
amd64. approved by gimpy.
 1.17 06-Jun-2008  tron branches: 1.17.2;
Use proper C99 syntax to statically initialize a "rb_node" structure to
fix the build.
 1.16 04-Jun-2008  ad Move lib/libkern/rb.h to sys/rb.h, so it can be used by kernel header
files.
 1.15 28-Apr-2008  martin branches: 1.15.2;
Remove clause 3 and 4 from TNF licenses
 1.14 21-Nov-2007  matt branches: 1.14.14; 1.14.16; 1.14.18;
Make rb_tree_insert_node return true/false whether the node was inserted
or not.
 1.13 20-Nov-2007  yamt rename
RB_LEFT
RB_RIGHT
RB_OTHER
to
RB_DIR_LEFT
RB_DIR_RIGHT
RB_DIR_OTHER
so that it can coexist with sys/tree.h.
 1.12 20-Nov-2007  yamt fix compilation in the case of _KERNEL && DIAGNOSTIC && !RBDEBUG.
 1.11 10-Sep-2006  matt branches: 1.11.24; 1.11.26; 1.11.30; 1.11.32;
Add a way for a user to know what nodes have changed when a node has been
inserted or removed. Refactor node insertion to not require rebalancing
all the time or a loop if it does. In rb_tree_swap_prune_and_rebalance,
don't call rb_tree_reparent_nodes, instead do the work ourselves (since
we will eventually undo half of the work of rb_tree_reparent_nodes).
 1.10 09-Sep-2006  matt Shrink rb_tree to 4 pointers (2 if RBSMALL is defined). Move compare
functions to a separate rb_tree_ops structure. Make every int explicit
in being signed or unsigned. Use RBDEBUG to enable debug code. Move
rbt_count to RBSTATS. Use RBSMALL to not keep track of min/max.
 1.9 09-Sep-2006  matt Add rb_tree_find_node_{geq,leq}. Add stats. Make TAILQ DEBUG only.
Keep track of tree's min/max nodes for easier iteration. Improve comments.
Move functions around to improve locality.
 1.8 08-Sep-2006  matt Fix and simplify node removal. Add lots of assertions and comments.
 1.7 06-Sep-2006  thorpej branches: 1.7.2;
Use static at the function decl if the prototype also uses static.
 1.6 05-Sep-2006  matt Rewrite of red-black tree code.
 1.5 02-Sep-2006  matt Make this compile in _KERNEL || _STANDALONE. Make gcc4 happy.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.8;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 08-Oct-2002  simonb branches: 1.2.6; 1.2.14; 1.2.16;
Add RCS ids.
 1.1 24-Oct-2001  matt branches: 1.1.2; 1.1.4; 1.1.6;
Add "Red Black +" balanced binary tree routines to libkern. These provide
O(log(N)) insertation, deletion, and lookup times. However, unlike most
red-black implemenations, this one does no additional memory allocations.
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 24-Oct-2001  thorpej file rb.c was added on branch kqueue on 2002-01-10 20:00:28 +0000
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 24-Oct-2001  nathanw file rb.c was added on branch nathanw_sa on 2001-11-14 19:16:50 +0000
 1.1.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.1 24-Oct-2001  thorpej file rb.c was added on branch thorpej-mips-cache on 2001-11-12 21:19:04 +0000
 1.2.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.14.1 29-Apr-2005  kent sync with -current
 1.2.6.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.2 07-Dec-2007  yamt sync with head
 1.3.4.1 30-Dec-2006  yamt sync with head.
 1.4.8.2 14-Sep-2006  yamt sync with head.
 1.4.8.1 03-Sep-2006  yamt sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.7.2.1 18-Nov-2006  ad Sync with head.
 1.11.32.1 08-Dec-2007  mjf Sync with HEAD.
 1.11.30.1 21-Nov-2007  bouyer Sync with HEAD
 1.11.26.1 09-Jan-2008  matt sync with HEAD
 1.11.24.1 21-Nov-2007  joerg Sync with HEAD.
 1.14.18.2 04-May-2009  yamt sync with head.
 1.14.18.1 16-May-2008  yamt sync with head.
 1.14.16.2 17-Jun-2008  yamt sync with head.
 1.14.16.1 18-May-2008  yamt sync with head.
 1.14.14.4 02-Jul-2008  mjf Sync with HEAD.
 1.14.14.3 29-Jun-2008  mjf Sync with HEAD.
 1.14.14.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.14.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.2.2 07-Sep-2008  wrstuden Delete a bunch of things that are now gone in head.
 1.15.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.17.2.2 01-Jul-2008  matt More rb.c / wapbl fallout cleanup.
 1.17.2.1 27-Jun-2008  simonb Sync with head.
 1.11 04-Jun-2008  ad Move lib/libkern/rb.h to sys/rb.h, so it can be used by kernel header
files.
 1.10 28-Apr-2008  martin branches: 1.10.2;
Remove clause 3 and 4 from TNF licenses
 1.9 21-Nov-2007  matt branches: 1.9.14; 1.9.16; 1.9.18;
Make rb_tree_insert_node return true/false whether the node was inserted
or not.
 1.8 20-Nov-2007  yamt rename
RB_LEFT
RB_RIGHT
RB_OTHER
to
RB_DIR_LEFT
RB_DIR_RIGHT
RB_DIR_OTHER
so that it can coexist with sys/tree.h.
 1.7 10-Sep-2006  matt branches: 1.7.24; 1.7.26; 1.7.30; 1.7.32;
Add a way for a user to know what nodes have changed when a node has been
inserted or removed. Refactor node insertion to not require rebalancing
all the time or a loop if it does. In rb_tree_swap_prune_and_rebalance,
don't call rb_tree_reparent_nodes, instead do the work ourselves (since
we will eventually undo half of the work of rb_tree_reparent_nodes).
 1.6 09-Sep-2006  matt Shrink rb_tree to 4 pointers (2 if RBSMALL is defined). Move compare
functions to a separate rb_tree_ops structure. Make every int explicit
in being signed or unsigned. Use RBDEBUG to enable debug code. Move
rbt_count to RBSTATS. Use RBSMALL to not keep track of min/max.
 1.5 09-Sep-2006  matt Add rb_tree_find_node_{geq,leq}. Add stats. Make TAILQ DEBUG only.
Keep track of tree's min/max nodes for easier iteration. Improve comments.
Move functions around to improve locality.
 1.4 08-Sep-2006  matt Fix and simplify node removal. Add lots of assertions and comments.
 1.3 05-Sep-2006  matt branches: 1.3.2;
Rewrite of red-black tree code.
 1.2 08-Oct-2002  simonb branches: 1.2.22; 1.2.36; 1.2.40;
Add RCS ids.
 1.1 24-Oct-2001  matt branches: 1.1.2; 1.1.4; 1.1.6;
Add "Red Black +" balanced binary tree routines to libkern. These provide
O(log(N)) insertation, deletion, and lookup times. However, unlike most
red-black implemenations, this one does no additional memory allocations.
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 24-Oct-2001  thorpej file rb.h was added on branch kqueue on 2002-01-10 20:00:28 +0000
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 24-Oct-2001  nathanw file rb.h was added on branch nathanw_sa on 2001-11-14 19:16:50 +0000
 1.1.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.1 24-Oct-2001  thorpej file rb.h was added on branch thorpej-mips-cache on 2001-11-12 21:19:04 +0000
 1.2.40.1 14-Sep-2006  yamt sync with head.
 1.2.36.1 09-Sep-2006  rpaulo sync with head
 1.2.22.2 07-Dec-2007  yamt sync with head
 1.2.22.1 30-Dec-2006  yamt sync with head.
 1.3.2.1 18-Nov-2006  ad Sync with head.
 1.7.32.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.30.1 21-Nov-2007  bouyer Sync with HEAD
 1.7.26.1 09-Jan-2008  matt sync with HEAD
 1.7.24.1 21-Nov-2007  joerg Sync with HEAD.
 1.9.18.2 04-May-2009  yamt sync with head.
 1.9.18.1 16-May-2008  yamt sync with head.
 1.9.16.2 17-Jun-2008  yamt sync with head.
 1.9.16.1 18-May-2008  yamt sync with head.
 1.9.14.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.9.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.2.2 23-Jun-2008  wrstuden Remove files removed on branch. Updating using patch has its
drawbacks. :-)
 1.10.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5 01-Nov-2003  jdolecek g/c index.c and rindex.c (not used anywhere)
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 27-Mar-1998  cgd branches: 1.3.48;
sync with libc
 1.2 22-Feb-1998  mycroft Don't even think about cdefs.h here...
 1.1 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.3.48.1 03-Aug-2004  skrll Sync with HEAD
 1.4 03-Sep-2018  riastradh We have popcount; no need to reimplement it.
 1.3 28-Mar-2016  riastradh branches: 1.3.16; 1.3.18;
Fix relation in rngtest failure message to match reality.
 1.2 25-Nov-2011  joerg branches: 1.2.6; 1.2.10; 1.2.28;
Spell restrict with __.
 1.1 19-Nov-2011  tls First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.2.28.1 22-Apr-2016  skrll Sync with HEAD
 1.2.10.1 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 17-Apr-2012  yamt sync with head
 1.2.6.1 25-Nov-2011  yamt file rngtest.c was added on branch yamt-pagecache on 2012-04-17 00:08:33 +0000
 1.3.18.1 10-Jun-2019  christos Sync with HEAD
 1.3.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 09-Aug-2001  lukem branches: 1.6.20;
convert to ansi knf, and fix a bug where the last arg was incorrectly
'u_char' instead of 'int' (per the prototype and usage and other scanc
implementations)
 1.5 30-Mar-2000  augustss branches: 1.5.4; 1.5.6; 1.5.8;
Kill some more register declarations.
 1.4 24-Oct-1996  cgd branches: 1.4.28;
second and third args to scanc() (string and table) are not and should not
be modified. Make them 'const'.
 1.3 14-Mar-1996  christos - Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file scanc.c was added on branch magnum on 1993-10-13 05:40:46 +0000
 1.4.28.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.8.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.5.6.1 24-Aug-2001  nathanw Catch up with -current.
 1.5.4.1 25-Nov-2001  he Pull up revision 1.6 (requested by lukem):
Fix scanc() arguments.
 1.6.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.20.1 03-Aug-2004  skrll Sync with HEAD
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 30-Jun-2005  tron branches: 1.9.2;
Don't use a static buffer in SHA1Transform() because it might cause
various problems including sporadic IPSec authentification failures
if this code is used by multiple instances in parallel.
 1.8 30-Jun-2004  christos branches: 1.8.10;
avoid string const cast-aways.
 1.7 23-Sep-2003  martin Same treatment as libc/hash/sha1.c: ifdef the sparc64 compiler bug
workaround for old gcc only.
 1.6 17-Sep-2000  eeh branches: 1.6.24;
Prevent the compiler from blowing up on sparc64. From mrg.
 1.5 16-Sep-1999  sommerfeld branches: 1.5.2; 1.5.12;
Include <lib/libkern/libkern.h> instead of <sys/systm.h>.
(the former no longer has mem* prototypes).
Remove the b* vs mem* kludge.
This change allows standalone libkern to build on alpha again.
 1.4 09-May-1999  eeh Allocating a byte-array and then accessing it as 32-bit integers just won't work
on any machine that has alignment restrictions.
 1.3 12-Sep-1998  ragge branches: 1.3.8;
Include <sys/param.h> instead of <sys/types.h>, to get mem* inlines.
(At least on vax)
 1.2 29-May-1998  hannken Didn't find sha1.h compiling sys/arch/sparc/stand/boot.
 1.1 27-May-1998  explorer add sha1.c, and build it.
 1.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.12.1 19-Oct-2000  he Pull up revision 1.6 (requested by eeh):
Prevent the compiler from blowing up on sparc64.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.24.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 05-Jul-2005  riz Pull up revision 1.9 (requested by tron in ticket #515):
Don't use a static buffer in SHA1Transform() because it might cause
various problems including sporadic IPSec authentification failures
if this code is used by multiple instances in parallel.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 11-Dec-2005  christos branches: 1.6.74; 1.6.84; 1.6.90;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 30-Mar-2000  augustss branches: 1.4.28;
Kill some more register declarations.
 1.3 14-Mar-1996  christos branches: 1.3.30;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file skpc.c was added on branch magnum on 1993-10-13 05:40:47 +0000
 1.3.30.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.6.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.6.74.1 04-May-2009  yamt sync with head.
 1.3 01-Sep-2020  thorpej Update to the SoftFloat-2c version of softfloat-macros.h. This has 3
small changes:
- Simplification of the license.
- Minor style changes to 3 comments.
- Fixes a bug in shift128Right() for shift counts >= 64;
 1.2 01-Sep-2020  thorpej Update to the SoftFloat-2b version of softfloat-macros.h. This makes a
clarifying change to the warranty disclaimer and updates the comments. NFC.
 1.1 26-Apr-2001  ross branches: 1.1.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 26-Apr-2001  nathanw file softfloat-macros.h was added on branch nathanw_sa on 2001-06-21 20:07:17 +0000
 1.3 02-Sep-2020  thorpej Update to the SoftFloat-2c version of softfloat-specialize.h and softfloat.h.
This includes a simplification of the license and updates the comments. NFC.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 26-Apr-2001  ross branches: 1.1.2; 1.1.122; 1.1.124; 1.1.126;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.1.126.1 16-May-2008  yamt sync with head.
 1.1.124.1 18-May-2008  yamt sync with head.
 1.1.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 26-Apr-2001  nathanw file softfloat-specialize.h was added on branch nathanw_sa on 2001-06-21 20:07:18 +0000
 1.8 02-Sep-2020  thorpej Reduce diffs to upstream: get rid of FLOAT64_{,DE}MANGLE(); it's no longer
used.
 1.7 02-Sep-2020  thorpej Update to the SoftFloat-2b version of softfloat.c. This makes a clarifying
change to the warranty disclaimer and updates the comments. NFC.
 1.6 31-Dec-2017  martin PR port-alpha/52520: provide float64 -> uint64 conversion and use
that when converting positive numbers.
 1.5 03-Nov-2013  christos branches: 1.5.22;
mark some variables as unused, but keep them around as comments
 1.4 11-Dec-2005  christos branches: 1.4.94; 1.4.110; 1.4.120; 1.4.126;
merge ktrace-lwp.
 1.3 04-Dec-2003  keihan netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.2 05-Dec-2002  thorpej branches: 1.2.6;
Wrap this file in "#ifndef _STANDALONE".
 1.1 26-Apr-2001  ross branches: 1.1.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.1.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 26-Apr-2001  nathanw file softfloat.c was added on branch nathanw_sa on 2001-06-21 20:07:18 +0000
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.4.126.1 18-May-2014  rmind sync with head
 1.4.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.94.2 08-Feb-2011  cliff - remove erroneous include of opt_multiprocessor.h
("MULTIPROCESSOR" instance was inside a comment)
 1.4.94.1 05-Feb-2011  cliff - include opt_multiprocessor.h for explicit MULTIPROCESSOR dependency
 1.5.22.1 26-Feb-2018  snj Pull up following revision(s) (requested by maya in ticket #584):
sys/arch/alpha/alpha/fp_complete.c: 1.22
sys/lib/libkern/softfloat.c: 1.6
sys/lib/libkern/softfloat.h: 1.5
PR port-alpha/52520: provide float64 -> uint64 conversion and use
that when converting positive numbers.
 1.6 02-Sep-2020  thorpej Update to the SoftFloat-2c version of softfloat-specialize.h and softfloat.h.
This includes a simplification of the license and updates the comments. NFC.
 1.5 31-Dec-2017  martin PR port-alpha/52520: provide float64 -> uint64 conversion and use
that when converting positive numbers.
 1.4 28-Apr-2008  martin branches: 1.4.80;
Remove clause 3 and 4 from TNF licenses
 1.3 16-Feb-2006  perry branches: 1.3.64; 1.3.66; 1.3.68;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.2 24-Dec-2005  perry branches: 1.2.2; 1.2.4; 1.2.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.1 26-Apr-2001  ross branches: 1.1.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 26-Apr-2001  nathanw file softfloat.h was added on branch nathanw_sa on 2001-06-21 20:07:19 +0000
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 18-Feb-2006  yamt sync with head.
 1.3.68.1 16-May-2008  yamt sync with head.
 1.3.66.1 18-May-2008  yamt sync with head.
 1.3.64.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.80.1 26-Feb-2018  snj Pull up following revision(s) (requested by maya in ticket #584):
sys/arch/alpha/alpha/fp_complete.c: 1.22
sys/lib/libkern/softfloat.c: 1.6
sys/lib/libkern/softfloat.h: 1.5
PR port-alpha/52520: provide float64 -> uint64 conversion and use
that when converting positive numbers.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 01-Nov-2000  thorpej branches: 1.1.2; 1.1.26; 1.1.34; 1.1.36;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.1.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.34.1 29-Apr-2005  kent sync with -current
 1.1.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 01-Nov-2000  bouyer file strcasecmp.c was added on branch thorpej_scsipi on 2000-11-22 16:05:34 +0000
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.12 20-Dec-2005  christos Use common sources with userland.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 07-Aug-2003  agc branches: 1.10.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 27-Mar-1998  cgd branches: 1.9.48;
sync with libc
 1.8 13-Oct-1997  lukem rcsid fascism
 1.7 18-Apr-1996  cgd branches: 1.7.12;
don't include user-land headers in libkern files when compiling for
the kernel.
 1.6 14-Mar-1996  christos - Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file strcat.c was added on branch magnum on 1993-10-27 22:00:50 +0000
 1.7.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.48.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 01-Jul-2004  christos branches: 1.7.12;
add __UNCONST
 1.6 01-Nov-2003  jdolecek g/c index.c and rindex.c (not used anywhere)
 1.5 04-Aug-1998  perry branches: 1.5.46;
replace several special targets with stub .c files, as in libc/string
 1.4 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.3 21-Jan-1998  cgd sync with libc version. (just rcs id changes.)
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 18-Jan-1997  cgd branches: 1.1.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.1.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.46.1 03-Aug-2004  skrll Sync with HEAD
 1.7.12.1 21-Jun-2006  yamt sync with head.
 1.12 20-Dec-2005  christos Use common sources with userland.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 07-Aug-2003  agc branches: 1.10.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 27-Mar-1998  cgd branches: 1.9.48;
sync with libc
 1.8 13-Oct-1997  lukem rcsid fascism
 1.7 24-Oct-1996  cgd branches: 1.7.10;
when casting const pointers, preserve const qualifiers. (-Wcast-qual)
 1.6 18-Apr-1996  cgd don't include user-land headers in libkern files when compiling for
the kernel.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file strcmp.c was added on branch magnum on 1993-10-27 22:00:51 +0000
 1.7.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.48.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.12 20-Dec-2005  christos Use common sources with userland.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 07-Aug-2003  agc branches: 1.10.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 27-Mar-1998  cgd branches: 1.9.48;
sync with libc
 1.8 13-Oct-1997  lukem rcsid fascism
 1.7 18-Apr-1996  cgd branches: 1.7.12;
don't include user-land headers in libkern files when compiling for
the kernel.
 1.6 14-Mar-1996  christos - Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file strcpy.c was added on branch magnum on 1993-10-27 22:00:51 +0000
 1.7.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.48.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 15-May-2003  itojun branches: 1.2.18;
latest copyright notice (more loose). noted by wiz
 1.1 15-May-2003  itojun add strl{cpy,cat} to libkern. code from lib/libc/string (originally from openbsd).
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 15-May-2003  itojun branches: 1.2.18;
latest copyright notice (more loose). noted by wiz
 1.1 15-May-2003  itojun add strl{cpy,cat} to libkern. code from lib/libc/string (originally from openbsd).
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 27-Mar-1998  cgd branches: 1.8.48;
sync with libc
 1.7 13-Oct-1997  lukem rcsid fascism
 1.6 18-Apr-1996  cgd branches: 1.6.12;
don't include user-land headers in libkern files when compiling for
the kernel.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file strlen.c was added on branch magnum on 1993-10-27 22:00:52 +0000
 1.6.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.48.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.3 11-Aug-2023  mrg avoid uninitialised variable warnings (likely incorrect ones.)

cry wolved by GCC 12.
 1.2 23-Jan-2021  thorpej branches: 1.2.4;
Fix building in the _STANDALONE case.
 1.1 21-Jan-2021  thorpej Add a generic set of routines for interacting with OpenFirmware-style
string lists.
 1.2.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.2.4.1 23-Jan-2021  thorpej file strlist.c was added on branch thorpej-futex on 2021-04-03 22:29:00 +0000
 1.1 21-Jan-2021  thorpej branches: 1.1.4;
Add a generic set of routines for interacting with OpenFirmware-style
string lists.
 1.1.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.1.4.1 21-Jan-2021  thorpej file strlist.h was added on branch thorpej-futex on 2021-04-03 22:29:00 +0000
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 27-Mar-1998  cgd branches: 1.5.48; 1.5.56; 1.5.58;
sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Apr-1996  cgd branches: 1.3.12;
don't include user-land headers in libkern files when compiling for
the kernel.
 1.2 06-Feb-1996  christos Make it really work like strncasecmp, instead of 0/1 return codes.
 1.1 06-Feb-1996  christos Add strncasecmp.c; extracted from ADOSFS adlookup.c.
 1.3.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.58.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.56.1 29-Apr-2005  kent sync with -current
 1.5.48.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.12 20-Dec-2005  christos Use common sources with userland.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 07-Aug-2003  agc branches: 1.10.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 27-Mar-1998  cgd branches: 1.9.48;
sync with libc
 1.8 13-Oct-1997  lukem rcsid fascism
 1.7 24-Oct-1996  cgd branches: 1.7.10;
when casting const pointers, preserve const qualifiers. (-Wcast-qual)
 1.6 18-Apr-1996  cgd don't include user-land headers in libkern files when compiling for
the kernel.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 05-Nov-1993  cgd branches: 1.1.2;
added files copied in from libc. version numbers are screwed,
but are screwed for the rest of libkern's files, anyway.
 1.1.2.2 05-Nov-1993  cgd added files copied in from libc. version numbers are screwed,
but are screwed for the rest of libkern's files, anyway.
 1.1.2.1 05-Nov-1993  cgd file strncmp.c was added on branch magnum on 1993-11-05 22:40:49 +0000
 1.7.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.48.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 27-Mar-1998  cgd branches: 1.8.48;
sync with libc
 1.7 13-Oct-1997  lukem rcsid fascism
 1.6 18-Apr-1996  cgd branches: 1.6.12;
don't include user-land headers in libkern files when compiling for
the kernel.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Oct-1993  jtc branches: 1.1.2;
Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.2 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.1.2.1 27-Oct-1993  jtc file strncpy.c was added on branch magnum on 1993-10-27 22:00:53 +0000
 1.6.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.48.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.1 02-May-2016  christos branches: 1.1.2; 1.1.18;
move scsipi_strvis -> libkern:strnvisx()
change the prototype to match userland
fix sizes of strings passed to it
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 02-May-2016  jdolecek file strnvisx.c was added on branch tls-maxphys on 2017-12-03 11:38:46 +0000
 1.1.2.2 29-May-2016  skrll Sync with HEAD
 1.1.2.1 02-May-2016  skrll file strnvisx.c was added on branch nick-nhusb on 2016-05-29 08:44:37 +0000
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 01-Jul-2004  christos branches: 1.3.12;
add __UNCONST
 1.2 01-Nov-2003  jdolecek g/c index.c and rindex.c (not used anywhere)
 1.1 04-Aug-1998  perry branches: 1.1.46;
replace several special targets with stub .c files, as in libc/string
 1.1.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.46.1 03-Aug-2004  skrll Sync with HEAD
 1.3.12.1 21-Jun-2006  yamt sync with head.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 01-Jul-2004  christos branches: 1.4.12;
add __UNCONST
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 08-Oct-2002  jdolecek branches: 1.2.2; 1.2.8;
need to include <sys/param.h> to get inline strlen() on vax; found
with help of Matt Thomas
 1.1 04-Oct-2002  junyoung Add strstr() to libkern. For now, it's only used in i386 (for processor
identification).
 1.2.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.8.1 03-Aug-2004  skrll Sync with HEAD
 1.2.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.1 08-Oct-2002  nathanw file strstr.c was added on branch nathanw_sa on 2002-10-18 02:44:59 +0000
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 01-Jul-2004  christos branches: 1.8.12;
add __UNCONST
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 07-Jun-2003  briggs branches: 1.6.2;
Provide a strtoul() implementation based on the one in libc instead of the
totally different version that was here. This version, of course, has an
BSD license on it while the old one did not. This one also compiles down
to tighter code--the smaller the better for libkern & libsa.
 1.5 25-May-2000  msaitoh branches: 1.5.6;
fix the null pointer access bug when arg2 (char **endptr) == NULL
 1.4 29-Nov-1999  simonb branches: 1.4.2;
Copied from arch/arm32/arm32/strtoul.c,v
 1.3 05-Jan-1998  perry RCSID Police.
 1.2 18-Feb-1997  mark Limit valid numeric digits to between 0 and min(base, 9) inclusive so that
puntuation characters are not evaluated.
 1.1 31-Jan-1996  mark branches: 1.1.8;
Initial commit of the NetBSD/arm32 port.
 1.1.8.1 11-Mar-1997  is merge in changes from Trunk.
 1.4.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.6.1 25-May-2000  bouyer file strtoul.c was added on branch thorpej_scsipi on 2000-11-20 18:09:20 +0000
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.12.1 21-Jun-2006  yamt sync with head.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 20-Oct-2002  scw branches: 1.7.6;
Sync with libc/quad:

As discussed (briefly) on tech-userlevel, fix our quad support to work
correctly on LP64 platforms. This is mostly just s/long/int/ in the
appropriate places.
 1.6 27-Mar-1998  cgd branches: 1.6.26;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file subdi3.c was added on branch magnum on 1993-12-04 05:01:55 +0000
 1.6.26.1 11-Nov-2002  nathanw Catch up to -current
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file ucmpdi2.c was added on branch magnum on 1993-12-04 05:01:57 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file udivdi3.c was added on branch magnum on 1993-12-04 05:01:59 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.1 03-Sep-2018  riastradh branches: 1.1.2; 1.1.6;
Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 03-Sep-2018  christos file uimax.c was added on branch phil-wifi on 2019-06-10 22:09:04 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 03-Sep-2018  pgoyette file uimax.c was added on branch pgoyette-compat on 2018-09-06 06:56:42 +0000
 1.1 03-Sep-2018  riastradh branches: 1.1.2; 1.1.6;
Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 03-Sep-2018  christos file uimin.c was added on branch phil-wifi on 2019-06-10 22:09:04 +0000
 1.1.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.1.2.1 03-Sep-2018  pgoyette file uimin.c was added on branch pgoyette-compat on 2018-09-06 06:56:42 +0000
 1.6 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file ulmax.c was added on branch magnum on 1993-10-13 05:40:48 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.6 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.84; 1.5.90;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 14-Mar-1996  christos branches: 1.3.64;
- Add missing prototypes
- Bring prototypes into scope
- Correct prototype for skpc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file ulmin.c was added on branch magnum on 1993-10-13 05:40:49 +0000
 1.3.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file umoddi3.c was added on branch magnum on 1993-12-04 05:02:00 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.10 02-Mar-2025  jakllsch xlat_mbr_fstype: handle MBR_PTYPE_EFI as FS_MSDOS
 1.9 02-Mar-2013  christos branches: 1.9.74;
recognize OpenBSD too
 1.8 16-Jan-2012  christos branches: 1.8.6;
PR/45796: Evgeniy Ivanov minixfs3 support.
 1.7 28-Apr-2008  martin branches: 1.7.34; 1.7.38;
Remove clause 3 and 4 from TNF licenses
 1.6 16-Jul-2006  rillig branches: 1.6.54; 1.6.56; 1.6.58;
Fixed the gcc warning that "static" should come before "const".
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 12-Nov-2004  uwe branches: 1.3.4; 1.3.6;
MBR_PTYPE_APPLE_UFS is now spelled with an underscore.
 1.2 08-Oct-2003  lukem branches: 1.2.4;
sort entries, and add a couple
 1.1 07-Jul-2003  dsl Add xlat_mbr_fstype - converts mbr type to disklabel type
 1.2.4.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.5 14-Nov-2004  skrll Sync with HEAD.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 08-Oct-2003  skrll file xlat_mbr_fstype.c was added on branch ktrace-lwp on 2004-08-03 10:53:31 +0000
 1.3.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.4.1 29-Apr-2005  kent sync with -current
 1.4.4.1 30-Dec-2006  yamt sync with head.
 1.5.8.1 11-Aug-2006  yamt sync with head
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.58.1 16-May-2008  yamt sync with head.
 1.6.56.1 18-May-2008  yamt sync with head.
 1.6.54.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.38.1 18-Feb-2012  mrg merge to -current.
 1.7.34.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.34.1 17-Apr-2012  yamt sync with head
 1.8.6.1 23-Jun-2013  tls resync from head
 1.9.74.1 02-Aug-2025  perseant Sync with HEAD
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Mar-1998  cgd branches: 1.6.48;
sync with libc
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 06-Jan-1995  cgd copy back from libc
 1.3 06-Jan-1995  cgd from libc
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
quad support copied in from libc.
 1.1.2.2 04-Dec-1993  cgd quad support copied in from libc.
 1.1.2.1 04-Dec-1993  cgd file xordi3.c was added on branch magnum on 1993-12-04 05:02:01 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.2 16-Mar-2018  ryo use memmove.S
 1.1 10-Aug-2014  matt branches: 1.1.4; 1.1.28;
Preliminary files for AARCH64 (64-bit ARM) support.
Enough for a distribution build.
 1.1.28.1 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.1.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.4.1 10-Aug-2014  tls file Makefile.inc was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.2 17-Oct-1996  cgd copy down changes from libc
 1.1 13-Feb-1995  cgd Alpha support from libc.
 1.28 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.27 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.26 18-Mar-2009  tsutsui - remove bcmp(9), bcopy(9), and bzero(9) from libkern since <sys/systm.h> has
macro which replace them with mem*() functions in #ifdef _KERNEL as noted
in man pages
- move declarations of bcopy(3) and bzero(3) into <lib/libsa/stand.h>
since they are still in libsa for some MD standalone sources
(I guess all bcmp(3) in standalone sources have been replaced with memcmp(3)
but they should be replaced with memcmp() anyway)
 1.25 11-Dec-2005  christos branches: 1.25.74; 1.25.84; 1.25.90;
merge ktrace-lwp.
 1.24 22-Apr-2005  reed Use ${TOOL_M4} instead of "m4". (I only tested this fix
for sparc but not sparc64 or alpha yet.)

Noticed problem when building NetBSD/sparc from a Linux/i386 host
that didn't have "m4".
 1.23 24-Apr-2002  ross branches: 1.23.10; 1.23.18;
Add strtoul.c
 1.22 13-Jul-2001  thorpej Provide bcopy() here.
 1.21 26-Apr-2001  ross branches: 1.21.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.20 01-Nov-2000  thorpej branches: 1.20.2;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.19 05-Sep-2000  thorpej Move the Alpha _mcount() into a .S file so that it can be
pre-processed, like other Alpha assembly files.
 1.18 15-Jan-1999  bouyer branches: 1.18.8;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.17 04-Aug-1998  perry add memcmp.c memmove.S
 1.16 22-Feb-1998  mycroft Use the assembler version of memcpy().
 1.15 22-Feb-1998  mycroft We need memcpy().
 1.14 22-Feb-1998  mycroft Add some missing things.
 1.13 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.12 24-Oct-1997  chuck add memchr() to libkern
 1.11 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.10 18-Jan-1997  cgd branches: 1.10.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.9 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.8 21-Aug-1996  cgd fix up for new libkern path specs
 1.7 15-Jul-1996  cgd add an assembly version of ffs(), copied down from libc
 1.6 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.5 17-Apr-1996  cgd files copied from libc
 1.4 13-Apr-1996  cgd add strncasecmp.c to ports' libkern Makefile.inc's. When adding a new
source file to libkern, it should be added to _ALL_ ports makefiles if
it is machine-independent and used by machine-independent code (in
this case adosfs). (There are several arguments that say that
strncasecmp should not be in libkern at all, and i think they're
good ones, but as long as ADOSFS needs it to link, it has to be here
for all architectures.)
 1.3 20-Oct-1995  cgd use NetBSD RCS id format. use bzero.S, not bzerro.c
 1.2 28-Jun-1995  cgd update dependencies to deal with the alpha
 1.1 13-Feb-1995  cgd Alpha support from libc.
 1.10.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.18.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.20.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.20.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.20.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.21.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.1 03-Aug-2001  lukem update to -current
 1.23.18.1 29-Apr-2005  kent sync with -current
 1.23.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.25.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.74.2 19-Aug-2009  yamt sync with head.
 1.25.74.1 04-May-2009  yamt sync with head.
 1.3 17-Oct-1996  cgd copy down changes from libc
 1.2 26-Sep-1996  cgd label changes, pulled down from libc
 1.1 13-Feb-1995  cgd Alpha support from libc.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 05-Sep-2000  thorpej branches: 1.1.2; 1.1.26; 1.1.34; 1.1.36;
Move the Alpha _mcount() into a .S file so that it can be
pre-processed, like other Alpha assembly files.
 1.1.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.34.1 29-Apr-2005  kent sync with -current
 1.1.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.2.1 05-Sep-2000  bouyer file _mcount.S was added on branch thorpej_scsipi on 2000-11-20 18:09:21 +0000
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 22-Feb-1998  mycroft branches: 1.1.64;
Use the assembler version of memcpy().
 1.1.64.1 21-Jun-2006  yamt sync with head.
 1.2 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1 12-Oct-1997  bouyer branches: 1.1.2;
Ops, forgot to 'cvs add' theses. Pointed out by enami tsugutomo.
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 12-Oct-1997  thorpej file bswap16.S was added on branch marc-pcmcia on 1997-10-14 10:27:00 +0000
 1.2 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1 12-Oct-1997  bouyer branches: 1.1.2;
Ops, forgot to 'cvs add' theses. Pointed out by enami tsugutomo.
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 12-Oct-1997  thorpej file bswap32.S was added on branch marc-pcmcia on 1997-10-14 10:27:01 +0000
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 22-Jan-1999  mycroft branches: 1.4.58;
Sync with libc.
 1.3 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2 17-Oct-1996  cgd copy down changes from libc
 1.1 17-Apr-1996  cgd files copied from libc
 1.4.58.1 21-Jun-2006  yamt sync with head.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 22-Jan-1999  mycroft branches: 1.5.58;
Sync with libc.
 1.4 15-Jan-1999  thorpej Fix an unterminated macro call.
 1.3 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2 17-Oct-1996  cgd copy down changes from libc
 1.1 17-Apr-1996  cgd files copied from libc
 1.5.58.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 17-Oct-1996  cgd branches: 1.2.78;
copy down changes from libc
 1.1 20-Oct-1995  cgd copy from libkern
 1.2.78.1 21-Jun-2006  yamt sync with head.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 26-Feb-2005  perry nuke trailing whitespace
 1.6 24-Jan-2002  ross branches: 1.6.16; 1.6.24; 1.6.26;
sync
 1.5 17-Oct-1996  cgd branches: 1.5.40; 1.5.42;
copy down changes from libc
 1.4 26-Sep-1996  cgd label changes, pulled down from libc
 1.3 20-Oct-1995  cgd update from libc
 1.2 03-Mar-1995  cgd copy down from libc.
 1.1 13-Feb-1995  cgd Alpha support from libc.
 1.5.42.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.40.1 28-Feb-2002  nathanw Catch up to -current.
 1.6.26.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.24.1 29-Apr-2005  kent sync with -current
 1.6.16.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 17-Oct-1996  cgd branches: 1.3.78;
copy down changes from libc
 1.2 15-Jul-1996  cgd frob the mask so that only the low set bit is set, to avoid lossage.
 1.1 15-Jul-1996  cgd add an assembly version of ffs(), copied down from libc
 1.3.78.1 21-Jun-2006  yamt sync with head.
 1.1 17-Apr-1996  cgd files copied from libc
 1.1 17-Apr-1996  cgd files copied from libc
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 22-Feb-1998  mycroft branches: 1.1.64;
Use the assembler version of memcpy().
 1.1.64.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 04-Aug-1998  perry branches: 1.1.62;
add memmove.S
 1.1.62.1 21-Jun-2006  yamt sync with head.
 1.1 17-Apr-1996  cgd files copied from libc
 1.1 17-Apr-1996  cgd files copied from libc
 1.21 29-Jan-2014  joerg Include compiler-rt in libc, libm and libkern.
 1.20 20-Aug-2013  matt Some assembly files need to compiled -marm since they are Thumb compatible.
 1.19 12-Aug-2013  matt Add EHABI unwind stubs to libkern so prevent errors in linking if unwind
tables are present.
 1.18 21-Jun-2013  matt branches: 1.18.2;
Add back {,u}modsi3 for libkern since if we are building standalone tools
we might be using the old ABI and might need them.
 1.17 20-Jun-2013  matt modsi3/umodsi3 are only needed !EABI arm
 1.16 02-May-2013  matt This change arm, armeb, earm, earmeb, earmhf, earmhfeb so all builds that
share a MACHINE_ARCH for userland so that except for etc, will produce
identical sets.

usr/include/machine now points to usr/include/arm
 1.15 06-Feb-2013  matt Modify earm rule to match any machine_arch starting with earm.
 1.14 23-Jan-2013  matt Add strnlen.c to SRCS (which will automatically use the .S version if it
exists).
 1.13 23-Jan-2013  macallan pull in strnlen.S
 1.12 30-Oct-2012  christos add new divsi3 related files.
 1.11 10-Oct-2012  christos add split files.
 1.10 06-Aug-2012  matt branches: 1.10.2;
If earm*, compile new aeabi runtime routines.
 1.9 14-Aug-2009  dsl branches: 1.9.12; 1.9.18; 1.9.20;
Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.8 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.7 14-Oct-2008  matt Add a _clzsi2 for armv4 platforms.
 1.6 23-Nov-2002  chris branches: 1.6.104; 1.6.108; 1.6.114;
Sync arm asm libkern files with libc's asm files.
 1.5 16-Nov-2002  rearnsha Add an assembler version of strcmp, based on example code from the ARM
ARM. As an example of the performance difference that this provides
a Dhrystone score on my Shark goes from 213k to 261k.
 1.4 17-Aug-2002  chris pull in ffs.S from libc for arm.
The main benefit is that ffs always runs in constant time.
 1.3 20-Nov-2001  chris branches: 1.3.8;
Tidy up some memory copying cruft:
bcopy.S is no longer needed
memmove and memcpy were both stacking r0 and unstacking it to keep the return value, so push this down into _memcpy.
rename _memcpy.S to memcpy.S.
memmove.S is now just a placeholder otherwise the make system automagically adds a memmove.c file to libkern.
memmove is just another entry point for memcpy.
 1.2 06-Jul-2001  toshii branches: 1.2.2;
Remove bcmp, bcopy and bzero. We don't need them as they aren't
called from asm code, and we shouldn't have them if we don't need them.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.4;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.4.4 11-Dec-2002  thorpej Sync with HEAD.
 1.1.4.3 27-Aug-2002  nathanw Catch up to -current.
 1.1.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.4.1 24-Aug-2001  nathanw Catch up with -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file Makefile.inc was added on branch thorpej_scsipi on 2001-01-08 14:56:54 +0000
 1.2.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.8.1 29-Aug-2002  gehenna catch up with -current.
 1.6.114.1 19-Oct-2008  haad Sync with HEAD.
 1.6.108.2 19-Aug-2009  yamt sync with head.
 1.6.108.1 04-May-2009  yamt sync with head.
 1.6.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.20.1 28-Nov-2012  matt Deal with div/mod changes.
 1.9.18.1 19-Nov-2012  riz Pull up following revision(s) (requested by christos in ticket #654):
common/lib/libc/arch/arm/gen/modsi3.S: revision 1.1
common/lib/libc/arch/arm/gen/umodsi3.S: revision 1.1
sys/lib/libkern/arch/arm/Makefile.inc: revision 1.11
sys/lib/libkern/arch/arm/Makefile.inc: revision 1.12
common/lib/libc/arch/arm/gen/divide.S: revision 1.1
lib/libc/arch/arm/gen/Makefile.inc: revision 1.20
common/lib/libc/arch/arm/gen/divsi3.S: revision 1.3
common/lib/libc/arch/arm/gen/udivsi3.S: revision 1.1
common/lib/libc/arch/arm/gen/divsi3.S: revision 1.4
Split out modsi3 and umodsi3 from the divsi3 file. This is so that
we don't get re-defined symbols in libc from libgcc in static linking.
Example: cc -pthread -static main-calls-pthread-create.c
add split files.
add new divsi3 related files.
add new files to fix static linking
split udivsi3 and divsi3 to fix static linking. This could be done better.
Fixes PR#47139
 1.9.12.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.12.2 16-Jan-2013  yamt sync with (a bit old) head
 1.9.12.1 30-Oct-2012  yamt sync with head
 1.10.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.2.3 23-Jun-2013  tls resync from head
 1.10.2.2 25-Feb-2013  tls resync with head
 1.10.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.18.2.2 18-May-2014  rmind sync with head
 1.18.2.1 28-Aug-2013  rmind sync with head
 1.3 20-Nov-2001  chris Tidy up some memory copying cruft:
bcopy.S is no longer needed
memmove and memcpy were both stacking r0 and unstacking it to keep the return value, so push this down into _memcpy.
rename _memcpy.S to memcpy.S.
memmove.S is now just a placeholder otherwise the make system automagically adds a memmove.c file to libkern.
memmove is just another entry point for memcpy.
 1.2 23-Jan-2001  bjh21 branches: 1.2.2; 1.2.4;
Sync with libc for licence update.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file _memcpy.S was added on branch thorpej_scsipi on 2001-01-08 14:56:55 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.2 20-Nov-2001  chris Tidy up some memory copying cruft:
bcopy.S is no longer needed
memmove and memcpy were both stacking r0 and unstacking it to keep the return value, so push this down into _memcpy.
rename _memcpy.S to memcpy.S.
memmove.S is now just a placeholder otherwise the make system automagically adds a memmove.c file to libkern.
memmove is just another entry point for memcpy.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.4; 1.1.6;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file bcopy.S was added on branch thorpej_scsipi on 2001-01-08 14:56:56 +0000
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 05-Apr-2003  bjh21 branches: 1.3.2; 1.3.10; 1.3.12;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.2 01-Jul-2002  bjh21 Avoid leaving junk in the top half of R0 on return.
This fixes port-arm/17440.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.4; 1.1.6; 1.1.18; 1.1.20;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.20.1 02-Jul-2002  lukem Pull up revision 1.2 (requested by bjh21 in ticket #419):
Avoid leaving junk in the top half of R0 on return.
This fixes port-arm/17440.
 1.1.18.1 15-Jul-2002  gehenna catch up with -current.
 1.1.6.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file byte_swap_2.S was added on branch thorpej_scsipi on 2001-01-08 14:56:56 +0000
 1.3.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 05-Apr-2003  bjh21 branches: 1.2.18;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file byte_swap_4.S was added on branch thorpej_scsipi on 2001-01-08 14:56:57 +0000
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.2 09-Nov-2003  scw bzero is no longer used in the kernel.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.26;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file bzero.S was added on branch thorpej_scsipi on 2001-01-08 14:56:58 +0000
 1.7 29-Jan-2014  joerg Include compiler-rt in libc, libm and libkern.
 1.6 21-Aug-2013  matt Thumbify
 1.5 11-Aug-2013  matt Support thumb
 1.4 01-Sep-2012  matt branches: 1.4.2; 1.4.4;
Add ARMv5 support the clz instruction
 1.3 15-Oct-2008  matt branches: 1.3.2; 1.3.10; 1.3.16; 1.3.34;
Use RET/RETc as appropriate
 1.2 14-Oct-2008  matt Need to be __clz[sd]i2
 1.1 14-Oct-2008  matt Add a _clzsi2 for armv4 platforms.
 1.3.34.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.34.1 30-Oct-2012  yamt sync with head
 1.3.16.2 04-May-2009  yamt sync with head.
 1.3.16.1 15-Oct-2008  yamt file clzsi2.S was added on branch yamt-nfs-mp on 2009-05-04 08:13:50 +0000
 1.3.10.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.10.1 15-Oct-2008  mjf file clzsi2.S was added on branch mjf-devfs2 on 2009-01-17 13:29:21 +0000
 1.3.2.2 19-Oct-2008  haad Sync with HEAD.
 1.3.2.1 15-Oct-2008  haad file clzsi2.S was added on branch haad-dm on 2008-10-19 22:17:40 +0000
 1.4.4.2 18-May-2014  rmind sync with head
 1.4.4.1 28-Aug-2013  rmind sync with head
 1.4.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 05-Apr-2003  bjh21 branches: 1.4.2; 1.4.10; 1.4.12;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.3 15-Aug-2002  briggs Use .L prefix for all local labels.
 1.2 13-Nov-2001  chris branches: 1.2.8;
Sync to libc version of divsi3.S. This is to fix up the stack for 8 byte alignment.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.4; 1.1.6;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file divsi3.S was added on branch thorpej_scsipi on 2001-01-08 14:56:59 +0000
 1.2.8.1 29-Aug-2002  gehenna catch up with -current.
 1.4.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.10.1 29-Apr-2005  kent sync with -current
 1.4.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 05-Apr-2003  bjh21 branches: 1.3.2; 1.3.10; 1.3.12;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.2 17-Aug-2002  thorpej branches: 1.2.2; 1.2.4; 1.2.6;
Local label fixup.
 1.1 17-Aug-2002  chris pull in ffs.S from libc for arm.
The main benefit is that ffs always runs in constant time.
 1.2.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 17-Aug-2002  jdolecek file ffs.S was added on branch kqueue on 2002-09-06 08:48:27 +0000
 1.2.4.2 29-Aug-2002  gehenna catch up with -current.
 1.2.4.1 17-Aug-2002  gehenna file ffs.S was added on branch gehenna-devsw on 2002-08-29 05:23:19 +0000
 1.2.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.1 17-Aug-2002  nathanw file ffs.S was added on branch nathanw_sa on 2002-08-27 23:47:44 +0000
 1.3.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 23-Oct-2003  scw branches: 1.4.16;
Duh, fix the align-to-32-bits code.
 1.3 13-Oct-2003  scw Xscale-optimised mem* functions, contributed by Wasabi Systems.
(Note: memcmp/memset improvements also benefit non-Xscale).

memcmp() - Compare 32-bits at a time if possible. Special-case 6-byte
comparisons, for the benefit of the network stack.

memset() - More loop unrolling, plus use of 'strd' instruction,
results in > 100% speedup on Xscale.

memcpy() - Big-endian support, unrolled loops, 'strd/ldrd/pld', plus
special-cases for very common length/alignment combinations
(at least in the kernel). Benchmarks show ~50% improvment on
Xscale.

memmove() - Big-endian support. Use fast memcpy(), above, if the regions
don't overlap. Otherwise unchanged.
 1.2 05-Apr-2003  bjh21 branches: 1.2.2;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.1 23-Nov-2002  chris branches: 1.1.2;
Sync arm asm libkern files with libc's asm files.
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 23-Nov-2002  thorpej file memcmp.S was added on branch nathanw_sa on 2002-12-11 06:46:24 +0000
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 13-Oct-2003  scw branches: 1.6.16;
Xscale-optimised mem* functions, contributed by Wasabi Systems.
(Note: memcmp/memset improvements also benefit non-Xscale).

memcmp() - Compare 32-bits at a time if possible. Special-case 6-byte
comparisons, for the benefit of the network stack.

memset() - More loop unrolling, plus use of 'strd' instruction,
results in > 100% speedup on Xscale.

memcpy() - Big-endian support, unrolled loops, 'strd/ldrd/pld', plus
special-cases for very common length/alignment combinations
(at least in the kernel). Benchmarks show ~50% improvment on
Xscale.

memmove() - Big-endian support. Use fast memcpy(), above, if the regions
don't overlap. Otherwise unchanged.
 1.5 09-Oct-2003  ichiro big endian support

thanks to smi@sm.sony.co.jp
 1.4 05-Apr-2003  bjh21 branches: 1.4.2;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.3 15-Aug-2002  briggs Use .L prefix for all local labels.
 1.2 20-Nov-2001  chris branches: 1.2.8;
Tidy up some memory copying cruft:
bcopy.S is no longer needed
memmove and memcpy were both stacking r0 and unstacking it to keep the return value, so push this down into _memcpy.
rename _memcpy.S to memcpy.S.
memmove.S is now just a placeholder otherwise the make system automagically adds a memmove.c file to libkern.
memmove is just another entry point for memcpy.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.4; 1.1.6;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file memcpy.S was added on branch thorpej_scsipi on 2001-01-08 14:56:59 +0000
 1.2.8.1 29-Aug-2002  gehenna catch up with -current.
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 02-Jun-2005  scw branches: 1.3.2;
Re-sync with libc version of memcpy_arm.S, which has deals correctly
with big-endian ARM (non-XScale) systems.
 1.2 26-Feb-2005  perry nuke trailing whitespace
 1.1 13-Oct-2003  scw branches: 1.1.4; 1.1.10; 1.1.12;
Xscale-optimised mem* functions, contributed by Wasabi Systems.
(Note: memcmp/memset improvements also benefit non-Xscale).

memcmp() - Compare 32-bits at a time if possible. Special-case 6-byte
comparisons, for the benefit of the network stack.

memset() - More loop unrolling, plus use of 'strd' instruction,
results in > 100% speedup on Xscale.

memcpy() - Big-endian support, unrolled loops, 'strd/ldrd/pld', plus
special-cases for very common length/alignment combinations
(at least in the kernel). Benchmarks show ~50% improvment on
Xscale.

memmove() - Big-endian support. Use fast memcpy(), above, if the regions
don't overlap. Otherwise unchanged.
 1.1.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.10.1 29-Apr-2005  kent sync with -current
 1.1.4.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.4.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Oct-2003  skrll file memcpy_arm.S was added on branch ktrace-lwp on 2004-08-03 10:53:42 +0000
 1.3.2.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.2; 1.2.4;
nuke trailing whitespace
 1.1 13-Oct-2003  scw branches: 1.1.4; 1.1.10; 1.1.12;
Xscale-optimised mem* functions, contributed by Wasabi Systems.
(Note: memcmp/memset improvements also benefit non-Xscale).

memcmp() - Compare 32-bits at a time if possible. Special-case 6-byte
comparisons, for the benefit of the network stack.

memset() - More loop unrolling, plus use of 'strd' instruction,
results in > 100% speedup on Xscale.

memcpy() - Big-endian support, unrolled loops, 'strd/ldrd/pld', plus
special-cases for very common length/alignment combinations
(at least in the kernel). Benchmarks show ~50% improvment on
Xscale.

memmove() - Big-endian support. Use fast memcpy(), above, if the regions
don't overlap. Otherwise unchanged.
 1.1.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.10.1 29-Apr-2005  kent sync with -current
 1.1.4.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 13-Oct-2003  skrll file memcpy_xscale.S was added on branch ktrace-lwp on 2004-08-03 10:53:42 +0000
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.2.2.1 26-Aug-2007  bouyer Apply patch, requested by scw in ticket #1806:
lib/libc/arch/arm/string/memcpy_xscale.S: patch
sys/lib/libkern/arch/arm/memcpy_xscale.S: patch
Apply the patch, with some minor tweaks, supplied in PR/36513.
This prevents a possible prefetch past the end of the source buffer.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.2; 1.4.4;
nuke trailing whitespace
 1.3 13-Oct-2003  scw branches: 1.3.8; 1.3.10;
Xscale-optimised mem* functions, contributed by Wasabi Systems.
(Note: memcmp/memset improvements also benefit non-Xscale).

memcmp() - Compare 32-bits at a time if possible. Special-case 6-byte
comparisons, for the benefit of the network stack.

memset() - More loop unrolling, plus use of 'strd' instruction,
results in > 100% speedup on Xscale.

memcpy() - Big-endian support, unrolled loops, 'strd/ldrd/pld', plus
special-cases for very common length/alignment combinations
(at least in the kernel). Benchmarks show ~50% improvment on
Xscale.

memmove() - Big-endian support. Use fast memcpy(), above, if the regions
don't overlap. Otherwise unchanged.
 1.2 20-Nov-2001  chris branches: 1.2.16;
Tidy up some memory copying cruft:
bcopy.S is no longer needed
memmove and memcpy were both stacking r0 and unstacking it to keep the return value, so push this down into _memcpy.
rename _memcpy.S to memcpy.S.
memmove.S is now just a placeholder otherwise the make system automagically adds a memmove.c file to libkern.
memmove is just another entry point for memcpy.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.4; 1.1.6;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file memmove.S was added on branch thorpej_scsipi on 2001-01-08 14:57:00 +0000
 1.2.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 22-Jun-2007  liamjfoy Pull up following revision(s) (requested by scw in ticket #1805):
common/lib/libc/arch/arm/string/memmove.S: revision 1.2
Apply the patch supplied in PR/36512 to fix the buffer overlap check. The patch
to memmove.S was provided via patch.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 13-Oct-2003  scw branches: 1.4.16;
Xscale-optimised mem* functions, contributed by Wasabi Systems.
(Note: memcmp/memset improvements also benefit non-Xscale).

memcmp() - Compare 32-bits at a time if possible. Special-case 6-byte
comparisons, for the benefit of the network stack.

memset() - More loop unrolling, plus use of 'strd' instruction,
results in > 100% speedup on Xscale.

memcpy() - Big-endian support, unrolled loops, 'strd/ldrd/pld', plus
special-cases for very common length/alignment combinations
(at least in the kernel). Benchmarks show ~50% improvment on
Xscale.

memmove() - Big-endian support. Use fast memcpy(), above, if the regions
don't overlap. Otherwise unchanged.
 1.3 05-Apr-2003  bjh21 branches: 1.3.2;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.2 15-Aug-2002  briggs Use .L prefix for all local labels.
 1.1 29-Dec-2000  bjh21 branches: 1.1.2; 1.1.4; 1.1.6; 1.1.18;
Create a shared set of ARM sources for libkern and move arm26 over to using
them.

These are identical to the current arm32 sources with the following exceptions:
- References to C labels are wrapped in _C_LABEL().
- Function returns have an alternate version inside #ifdef __APCS_26__.
 1.1.18.1 29-Aug-2002  gehenna catch up with -current.
 1.1.6.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 27-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 29-Dec-2000  bouyer file memset.S was added on branch thorpej_scsipi on 2001-01-08 14:57:01 +0000
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 05-Apr-2003  bjh21 branches: 1.3.18;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.2 23-Nov-2002  chris branches: 1.2.2;
Sync arm asm libkern files with libc's asm files.
 1.1 16-Nov-2002  rearnsha Add an assembler version of strcmp, based on example code from the ARM
ARM. As an example of the performance difference that this provides
a Dhrystone score on my Shark goes from 213k to 261k.
 1.2.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.1 23-Nov-2002  thorpej file strcmp.S was added on branch nathanw_sa on 2002-12-11 06:46:24 +0000
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 05-Apr-2003  bjh21 branches: 1.2.18;
NetBSD/acorn26 has used APCS-32 for years, so unifdef -U__APCS_26__.
 1.1 23-Nov-2002  chris branches: 1.1.2;
Sync arm asm libkern files with libc's asm files.
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 23-Nov-2002  thorpej file strncmp.S was added on branch nathanw_sa on 2002-12-11 06:46:24 +0000
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.2 12-Aug-2013  matt branches: 1.2.2; 1.2.6; 1.2.10;
Fix typos (prX not cpX)
 1.1 12-Aug-2013  matt Add EHABI unwind stubs to libkern so prevent errors in linking if unwind
tables are present.
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 12-Aug-2013  tls file unwind_stub.c was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.2.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.6.1 12-Aug-2013  yamt file unwind_stub.c was added on branch yamt-pagecache on 2014-05-22 11:41:04 +0000
 1.2.2.2 28-Aug-2013  rmind sync with head
 1.2.2.1 12-Aug-2013  rmind file unwind_stub.c was added on branch rmind-smpnet on 2013-08-28 23:59:35 +0000
 1.13 13-Jun-2022  skrll Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.

PR/56878 (hppa: kernel module lua fails to load)
 1.12 13-Mar-2014  pooka branches: 1.12.34;
remove compiler-rt duplicates to fix build
 1.11 22-Sep-2009  pooka branches: 1.11.12; 1.11.22; 1.11.26;
Don't build spcopy for rumpkern. Fixes hp700 build failure pointed
out by nick.

XXX: spcopy should be in the main kernel instead of libkern in any case
 1.10 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.9 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.8 18-Mar-2009  tsutsui - remove bcmp(9), bcopy(9), and bzero(9) from libkern since <sys/systm.h> has
macro which replace them with mem*() functions in #ifdef _KERNEL as noted
in man pages
- move declarations of bcopy(3) and bzero(3) into <lib/libsa/stand.h>
since they are still in libsa for some MD standalone sources
(I guess all bcmp(3) in standalone sources have been replaced with memcmp(3)
but they should be replaced with memcmp() anyway)
 1.7 04-Feb-2006  uwe branches: 1.7.68; 1.7.78; 1.7.84;
Add bswap16.c and bswap32.c to SRCS. We need fallback versions for
kernels compiled without optimization (and thus without inlining of
bswap16 and bswap32)
 1.6 27-Dec-2005  yamt branches: 1.6.2; 1.6.4; 1.6.6;
fix build of bzero.
XXX is it better to remove it as i386?
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 21-Oct-2003  tsutsui branches: 1.4.16;
Add bswap64.c, required by options FFS_EI.
 1.3 11-Sep-2003  chs the asm version of strlcpy() was buggy, just use the C version.
 1.2 21-Sep-2002  chs branches: 1.2.6;
add strtoul.c, it's now used in MI code.
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4;
Added hppa support to libkern.
 1.1.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file Makefile.inc was added on branch kqueue on 2002-06-23 17:49:46 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file Makefile.inc was added on branch gehenna-devsw on 2002-06-20 16:02:24 +0000
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 18-Feb-2006  yamt sync with head.
 1.7.84.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.78.1 28-Apr-2009  skrll Sync with HEAD.
 1.7.68.3 11-Mar-2010  yamt sync with head
 1.7.68.2 19-Aug-2009  yamt sync with head.
 1.7.68.1 04-May-2009  yamt sync with head.
 1.11.26.1 18-May-2014  rmind sync with head
 1.11.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.34.1 14-Jun-2022  martin Pull up following revision(s) (requested by skrll in ticket #1472):

sys/lib/libkern/arch/hppa/Makefile.inc: revision 1.13
sys/lib/libkern/arch/hppa/milli.S: revision 1.3
sys/lib/libkern/arch/hppa/milli_extra.S: revision 1.1

Don't need $$sh_func_adrs

Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.
PR/56878 (hppa: kernel module lua fails to load)
 1.17 09-Aug-2021  andvar fix typos in asymmetry, asymmetric(al), symmetrical.
 1.16 16-Jan-2021  chs remove unused "_DIAGNOSTIC" option and opt_diagnostic.h.
note that this is unrelated to the widely used "DIAGNOSTIC" option.
 1.15 30-Aug-2015  uebayasi branches: 1.15.30;
Include opt_diagnostic.h.
 1.14 31-Jan-2011  skrll branches: 1.14.14; 1.14.32;
This file needs opt_multiprocessor.h early so we pick up the right
definition from cpu.h, etc.

XXX should revisit the _STANDALONE vs _KERNEL split
 1.13 24-Jan-2011  skrll Fix build.
 1.12 22-Jan-2011  skrll Fix MULTIPROCESSOR curlwp/curcpu handling... missed in previous commit.
 1.11 20-Mar-2010  chs branches: 1.11.2; 1.11.4;
fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.10 10-Dec-2009  skrll branches: 1.10.2; 1.10.4;
Rename L_ADDR to L_PCB
 1.9 01-Dec-2009  skrll Remove U_PCB as requested by rmind.

Same code before and after.
 1.8 30-Apr-2009  skrll Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.
 1.7 28-Apr-2008  martin branches: 1.7.8; 1.7.14;
Remove clause 3 and 4 from TNF licenses
 1.6 04-Mar-2007  christos branches: 1.6.36; 1.6.38; 1.6.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 11-Dec-2005  christos branches: 1.5.26;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 10-Oct-2003  chs branches: 1.3.8; 1.3.10;
update for new gas syntax. from Jochen Kunz.
 1.2 31-Aug-2003  chs update for LWPs, and some lite cleanup.
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4; 1.1.10;
Added hppa support to libkern.
 1.1.10.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.10.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file bcopy.S was added on branch kqueue on 2002-06-23 17:49:46 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file bcopy.S was added on branch gehenna-devsw on 2002-06-20 16:02:24 +0000
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 03-Sep-2007  yamt sync with head.
 1.5.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.40.4 11-Aug-2010  yamt sync with head.
 1.6.40.3 11-Mar-2010  yamt sync with head
 1.6.40.2 04-May-2009  yamt sync with head.
 1.6.40.1 16-May-2008  yamt sync with head.
 1.6.38.1 18-May-2008  yamt sync with head.
 1.6.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.8.1 27-Oct-2008  skrll Commit work in progress.
 1.10.4.2 05-Mar-2011  rmind sync with head
 1.10.4.1 30-May-2010  rmind sync with head
 1.10.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.11.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.32.1 22-Sep-2015  skrll Sync with HEAD
 1.14.14.1 03-Dec-2017  jdolecek update from HEAD
 1.15.30.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4;
Added hppa support to libkern.
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file memcpy.S was added on branch kqueue on 2002-06-23 17:49:46 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file memcpy.S was added on branch gehenna-devsw on 2002-06-20 16:02:24 +0000
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4;
Added hppa support to libkern.
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file memmove.S was added on branch kqueue on 2002-06-23 17:49:46 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file memmove.S was added on branch gehenna-devsw on 2002-06-20 16:02:24 +0000
 1.3 13-Jun-2022  skrll Don't need $$sh_func_adrs
 1.2 17-Aug-2021  andvar fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4; 1.1.204;
Added hppa support to libkern.
 1.1.204.1 14-Jun-2022  martin Pull up following revision(s) (requested by skrll in ticket #1472):

sys/lib/libkern/arch/hppa/Makefile.inc: revision 1.13
sys/lib/libkern/arch/hppa/milli.S: revision 1.3
sys/lib/libkern/arch/hppa/milli_extra.S: revision 1.1

Don't need $$sh_func_adrs

Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.
PR/56878 (hppa: kernel module lua fails to load)
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file milli.S was added on branch kqueue on 2002-06-23 17:49:47 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file milli.S was added on branch gehenna-devsw on 2002-06-20 16:02:25 +0000
 1.2 15-Jun-2022  skrll Fix a dumb typo/thinko

Thanks to Tom Lane for spotting it.
 1.1 13-Jun-2022  skrll branches: 1.1.2;
Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.

PR/56878 (hppa: kernel module lua fails to load)
 1.1.2.3 16-Jun-2022  martin Pull up following revision(s) (requested by skrll in ticket #1473):

sys/lib/libkern/arch/hppa/milli_extra.S: revision 1.2

Fix a dumb typo/thinko

Thanks to Tom Lane for spotting it.
 1.1.2.2 14-Jun-2022  martin Pull up following revision(s) (requested by skrll in ticket #1472):

sys/lib/libkern/arch/hppa/Makefile.inc: revision 1.13
sys/lib/libkern/arch/hppa/milli.S: revision 1.3
sys/lib/libkern/arch/hppa/milli_extra.S: revision 1.1

Don't need $$sh_func_adrs

Provide a __canonicalize_funcptr_for_compare which only needs to return
the passed value as the kernel doesn't do PLABELS.
PR/56878 (hppa: kernel module lua fails to load)
 1.1.2.1 13-Jun-2022  martin file milli_extra.S was added on branch netbsd-9 on 2022-06-14 10:41:18 +0000
 1.2 12-Sep-2013  joerg Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4; 1.1.148; 1.1.158; 1.1.164;
Added hppa support to libkern.
 1.1.164.1 18-May-2014  rmind sync with head
 1.1.158.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.148.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file prefix.h was added on branch kqueue on 2002-06-23 17:49:47 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file prefix.h was added on branch gehenna-devsw on 2002-06-20 16:02:25 +0000
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4;
Added hppa support to libkern.
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file spcopy.S was added on branch kqueue on 2002-06-23 17:49:47 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file spcopy.S was added on branch gehenna-devsw on 2002-06-20 16:02:25 +0000
 1.2 11-Sep-2003  chs the asm version of strlcpy() was buggy, just use the C version.
 1.1 06-Jun-2002  fredette branches: 1.1.2; 1.1.4; 1.1.10;
Added hppa support to libkern.
 1.1.10.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 06-Jun-2002  jdolecek file strlcpy.S was added on branch kqueue on 2002-06-23 17:49:48 +0000
 1.1.2.2 20-Jun-2002  gehenna catch up with -current.
 1.1.2.1 06-Jun-2002  gehenna file strlcpy.S was added on branch gehenna-devsw on 2002-06-20 16:02:25 +0000
 1.6 10-Sep-1999  drochner -don't use DEFS.h nor SYS.h in libkern
-remove setjmp.S, it's not useful for libkern
 1.5 13-Oct-1997  lukem rcsid fascism
 1.4 07-Oct-1995  mycroft branches: 1.4.14;
Update from libc.
 1.3 05-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 05-Nov-1993  cgd branches: 1.1.2;
added files copied in from libc. version numbers are screwed,
but are screwed for the rest of libkern's files, anyway.
 1.1.2.2 05-Nov-1993  cgd added files copied in from libc. version numbers are screwed,
but are screwed for the rest of libkern's files, anyway.
 1.1.2.1 05-Nov-1993  cgd file DEFS.h was added on branch magnum on 1993-11-05 22:40:56 +0000
 1.4.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32 27-Jan-2020  ad Make x86 use the C version of memcmp().
 1.31 14-Aug-2009  dsl branches: 1.31.64; 1.31.70;
Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.30 12-Aug-2009  skrll Put back random.S. Hi dsl!
 1.29 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.28 25-Mar-2009  darran Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.27 11-Dec-2005  christos branches: 1.27.74; 1.27.84; 1.27.86; 1.27.90; 1.27.94;
merge ktrace-lwp.
 1.26 26-Oct-2003  junyoung Remove bcmp.S and bzero.S from list. They were doing nothing but wasting
kernel bits for a long time (2 years?).
 1.25 05-Apr-2001  thorpej branches: 1.25.22;
Build strtoul.c
 1.24 01-Nov-2000  thorpej branches: 1.24.2;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.23 15-Jan-1999  bouyer branches: 1.23.8;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.22 04-Aug-1998  perry add memcmp.S
 1.21 04-Aug-1998  perry Fix formatting, and add memmove.S
 1.20 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.19 22-Feb-1998  mycroft Add strchr.S and strrchr.S.
 1.18 22-Feb-1998  mycroft Sync with libc.
 1.17 22-Feb-1998  mycroft Add some missing things.
 1.16 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.15 24-Oct-1997  chuck add memchr() to libkern
 1.14 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.13 18-Jan-1997  cgd branches: 1.13.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.12 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.11 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.10 13-Apr-1996  cgd add strncasecmp.c to ports' libkern Makefile.inc's. When adding a new
source file to libkern, it should be added to _ALL_ ports makefiles if
it is machine-independent and used by machine-independent code (in
this case adosfs). (There are several arguments that say that
strncasecmp should not be in libkern at all, and i think they're
good ones, but as long as ADOSFS needs it to link, it has to be here
for all architectures.)
 1.9 11-Mar-1996  scottr Back out previous change.
 1.8 11-Mar-1996  thorpej Provide a memset() for the i386 (assembly version), and move memset.c
out into the libkern proper in case other ports want to use it.
i386 kernels with COMPAT_LINUX should compile now.
 1.7 07-Oct-1995  mycroft Remove bzero.S and setjmp.S, as these functions are in locore.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 24-Feb-1994  mycroft Assembler versions of these.
 1.4 04-Dec-1993  cgd use .S files
 1.3 15-Oct-1993  cgd branches: 1.3.2;
add strncmp to anything
 1.2 15-Oct-1993  cgd add __main()
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.3.2.2 04-Dec-1993  cgd use quad support; we need it
 1.3.2.1 15-Oct-1993  cgd file Makefile.inc was added on branch magnum on 1993-12-04 05:07:53 +0000
 1.13.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.8.2 21-Apr-2001  bouyer Sync with HEAD
 1.23.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.24.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.25.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.25.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.25.22.1 03-Aug-2004  skrll Sync with HEAD
 1.27.94.1 21-Apr-2010  matt sync to netbsd-5
 1.27.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.27.86.1 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
sys/lib/libkern/Makefile: patch
sys/lib/libkern/crc32.c: revision 1.1
sys/lib/libkern/crc32.h: revision 1.1
sys/lib/libkern/libkern.h: revision 1.89
sys/lib/libkern/arch/i386/Makefile.inc: revision 1.28
sys/net/zlib.h: revision 1.14 via patch
sys/opencrypto/crypto.c: revision 1.33
sys/opencrypto/cryptodev.c: revision 1.46
sys/opencrypto/cryptodev.h: revision 1.16
sys/opencrypto/cryptosoft.c: revision 1.24
sys/opencrypto/cryptosoft.h: revision 1.6
sys/opencrypto/deflate.h: revision 1.6
sys/opencrypto/cryptosoft_xform.c: revision 1.12
sys/opencrypto/deflate.c: revision 1.13
sys/opencrypto/files.opencrypto: revision 1.20
sys/opencrypto/ocryptodev.c: revision 1.1
sys/opencrypto/ocryptodev.h: revision 1.1
sys/opencrypto/xform.c: revision 1.18
sys/opencrypto/xform.h: revision 1.10
Fixes PR kern/41069 and PR kern/41070.

Extends the Opencrypto API to allow the destination buffer size to be
specified when its not the same size as the input buffer (i.e. for
operations like compress and decompress).
The crypto_op and crypt_n_op structures gain a u_int dst_len field.
The session_op structure gains a comp_alg field to specify a compression
algorithm.
Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT,
and CIOCNCRYPTM.
Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION,
OCIOCCRYPT, and OCIOCNCRYPTM.

Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which
implement the original ioctls and set dst_len and comp_alg to 0.

Adds user-space access to compression features.

Adds software gzip support (CRYPTO_GZIP_COMP).

Adds the fast version of crc32 from zlib to libkern. This should be generally
useful and provide a place to start normalizing the various crc32 routines
in the kernel. The crc32 routine is used in this patch to support GZIP.

With input and support from tls@NetBSD.org.
 1.27.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.27.74.2 19-Aug-2009  yamt sync with head.
 1.27.74.1 04-May-2009  yamt sync with head.
 1.31.70.1 29-Feb-2020  ad Sync with head.
 1.31.64.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10 10-Sep-1999  drochner -don't use DEFS.h nor SYS.h in libkern
-remove setjmp.S, it's not useful for libkern
 1.9 23-Aug-1999  kleink Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.8 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.7 22-Feb-1998  mycroft Sync with libc.
 1.6 13-Oct-1997  lukem rcsid fascism
 1.5 07-Oct-1995  mycroft branches: 1.5.14;
Update from libc.
 1.4 05-Feb-1995  mycroft Sync with libc.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 15-Feb-1994  mycroft Update from libc.
 1.1 05-Nov-1993  cgd branches: 1.1.2;
added files copied in from libc. version numbers are screwed,
but are screwed for the rest of libkern's files, anyway.
 1.1.2.2 05-Nov-1993  cgd added files copied in from libc. version numbers are screwed,
but are screwed for the rest of libkern's files, anyway.
 1.1.2.1 05-Nov-1993  cgd file SYS.h was added on branch magnum on 1993-11-05 22:40:58 +0000
 1.5.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7 26-Oct-2003  junyoung Goodbye to bcmp.S, bcopy.S, and bzero.S. They are defined as macros in
sys/systm.h.
 1.6 22-Feb-1998  mycroft branches: 1.6.48;
Move random.S from arch/i386/i386.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 05-Feb-1995  mycroft Sync with libc.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file bcmp.S was added on branch magnum on 1993-12-04 03:05:17 +0000
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.5 26-Oct-2003  junyoung Goodbye to bcmp.S, bcopy.S, and bzero.S. They are defined as macros in
sys/systm.h.
 1.4 15-Apr-2003  dsl branches: 1.4.2;
Significantly faster memcpy/memmove/bcopy and memset/bzero
 1.3 10-Jul-2002  kent Avoid redundant memory access.
 1.2 22-Feb-1998  mycroft branches: 1.2.26; 1.2.28; 1.2.40;
Move random.S from arch/i386/i386.
 1.1 22-Feb-1998  mycroft Sync with libc.
 1.2.40.1 15-Jul-2002  gehenna catch up with -current.
 1.2.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.26.1 01-Aug-2002  nathanw Catch up to -current.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.3 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2 13-Oct-1997  lukem branches: 1.2.2;
rcsid fascism
 1.1 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.2.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 13-Oct-1997  thorpej file bswap16.S was added on branch marc-pcmcia on 1997-10-14 10:27:28 +0000
 1.3 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2 13-Oct-1997  lukem branches: 1.2.2;
rcsid fascism
 1.1 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.2.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 13-Oct-1997  thorpej file bswap32.S was added on branch marc-pcmcia on 1997-10-14 10:27:29 +0000
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 14-Dec-2000  mycroft branches: 1.2.24;
ALTENTRY() must die.
 1.1 15-Jan-1999  bouyer branches: 1.1.8;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1.8.1 05-Jan-2001  bouyer Sync with HEAD
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 14-Dec-2000  mycroft branches: 1.2.24;
ALTENTRY() must die.
 1.1 15-Jan-1999  bouyer branches: 1.1.8;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1.8.1 05-Jan-2001  bouyer Sync with HEAD
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.8 26-Oct-2003  junyoung Goodbye to bcmp.S, bcopy.S, and bzero.S. They are defined as macros in
sys/systm.h.
 1.7 15-Apr-2003  dsl branches: 1.7.2;
Significantly faster memcpy/memmove/bcopy and memset/bzero
 1.6 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 05-Feb-1995  mycroft Sync with libc.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file bzero.S was added on branch magnum on 1993-12-04 03:05:45 +0000
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 04-Dec-2003  keihan branches: 1.8.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.7 23-Aug-1999  kleink branches: 1.7.36;
Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.6 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 05-Feb-1995  mycroft Sync with libc.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file ffs.S was added on branch magnum on 1993-12-04 03:06:04 +0000
 1.7.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.36.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.8 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.7 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.6 22-Feb-1998  mycroft Sync with libc.
 1.5 13-Oct-1997  lukem rcsid fascism
 1.4 07-Oct-1995  mycroft branches: 1.4.14;
Update from libc.
 1.3 05-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file htonl.S was added on branch magnum on 1993-12-04 03:06:13 +0000
 1.4.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.8 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.7 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.6 22-Feb-1998  mycroft Sync with libc.
 1.5 13-Oct-1997  lukem rcsid fascism
 1.4 07-Oct-1995  mycroft branches: 1.4.14;
Update from libc.
 1.3 05-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file htons.S was added on branch magnum on 1993-12-04 03:06:23 +0000
 1.4.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.3 27-Oct-2003  junyoung index() shouldn't be used in the kernel. Use strchr() instead.
 1.2 23-Aug-1999  kleink branches: 1.2.36;
Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.1 22-Feb-1998  mycroft And index.S...
 1.2.36.1 03-Aug-2004  skrll Sync with HEAD
 1.3 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 24-Feb-1994  mycroft Assembler versions of these.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 04-Dec-2003  keihan branches: 1.5.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.4 23-Aug-1999  kleink branches: 1.4.36;
Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.3 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.2 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly. :-)
 1.1 24-Oct-1997  chuck add memchr() to libkern
 1.4.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.36.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 04-Dec-2003  keihan branches: 1.3.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.2 21-Sep-2001  fvdl branches: 1.2.18;
Make new gas happy. Use movzbl instead of xorl + movb.
 1.1 04-Aug-1998  perry branches: 1.1.24; 1.1.26; 1.1.28;
add memcmp.S
 1.1.28.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.24.1 21-Sep-2001  nathanw Catch up to -current.
 1.2.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.18.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 15-Apr-2004  yamt branches: 1.5.12;
add '.L' prefixes to local labels.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 15-Apr-2003  dsl branches: 1.3.2;
Significantly faster memcpy/memmove/bcopy and memset/bzero
 1.2 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.1 22-Feb-1998  mycroft Sync with libc.
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.12.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 15-Apr-2003  dsl branches: 1.2.18;
Significantly faster memcpy/memmove/bcopy and memset/bzero
 1.1 04-Aug-1998  perry add memmove.S
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 15-Apr-2004  yamt branches: 1.6.12;
add '.L' prefixes to local labels.
 1.5 15-Apr-2003  dsl branches: 1.5.2;
Significantly faster memcpy/memmove/bcopy and memset/bzero
 1.4 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.3 22-Feb-1998  mycroft Sync with libc.
 1.2 11-Mar-1996  scottr Back out previous change.
 1.1 11-Mar-1996  thorpej Provide a memset() for the i386 (assembly version), and move memset.c
out into the libkern proper in case other ports want to use it.
i386 kernels with COMPAT_LINUX should compile now.
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.12.1 21-Jun-2006  yamt sync with head.
 1.8 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.7 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.6 22-Feb-1998  mycroft Sync with libc.
 1.5 13-Oct-1997  lukem rcsid fascism
 1.4 07-Oct-1995  mycroft branches: 1.4.14;
Update from libc.
 1.3 05-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file ntohl.S was added on branch magnum on 1993-12-04 03:06:33 +0000
 1.4.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.8 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.7 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.6 22-Feb-1998  mycroft Sync with libc.
 1.5 13-Oct-1997  lukem rcsid fascism
 1.4 07-Oct-1995  mycroft branches: 1.4.14;
Update from libc.
 1.3 05-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file ntohs.S was added on branch magnum on 1993-12-04 03:06:43 +0000
 1.4.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.6 07-Sep-2010  pooka Rename jump label to something a little more negative. No, I'm
not doing it for cosmetic value or out of angst. See, PIC_PROLOGUE
on i386 uses the "1" label internally. Now, everything would be
fine and dandy for the first 551245 calls to random. After that
p+q is negative and the jump is taken. However, it is taken into
the middle of PIC_PROLOGUE instead of where upon superficial
examination we assumed we are jumping. This causes wrong(tm) things
to happen and "ret" triggers a jump into hyperspace.

(no, I did not see that coming)
 1.5 04-Jan-2009  pooka branches: 1.5.4; 1.5.6;
Support PIC for inclusion in librump. (m68k untested)
 1.4 28-Apr-2008  martin branches: 1.4.8;
Remove clause 3 and 4 from TNF licenses
 1.3 15-Aug-1998  mycroft branches: 1.3.144; 1.3.146; 1.3.148;
Assign my copyrights to TNF.
 1.2 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.1 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.3.148.3 09-Oct-2010  yamt sync with head
 1.3.148.2 04-May-2009  yamt sync with head.
 1.3.148.1 16-May-2008  yamt sync with head.
 1.3.146.1 18-May-2008  yamt sync with head.
 1.3.144.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.6.1 05-Mar-2011  rmind sync with head
 1.5.4.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.3 05-Nov-2003  junyoung rindex() shouldn't be used in the kernel. Use strrchr() instead.
 1.2 23-Aug-1999  kleink branches: 1.2.36;
Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.1 22-Feb-1998  mycroft And rindex.S...
 1.2.36.1 03-Aug-2004  skrll Sync with HEAD
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 10-Sep-1999  drochner branches: 1.8.134; 1.8.136; 1.8.138;
-don't use DEFS.h nor SYS.h in libkern
-remove setjmp.S, it's not useful for libkern
 1.7 15-Aug-1998  mycroft Assign copyrights to TNF.
 1.6 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 23-Mar-1994  mycroft Much faster on 486s and Pentiums; a little slower on 386s.
 1.3 24-Feb-1994  mycroft Minor speedup.
 1.2 24-Feb-1994  mycroft Minutely faster.
 1.1 24-Feb-1994  mycroft Assembler versions of these.
 1.8.138.1 16-May-2008  yamt sync with head.
 1.8.136.1 18-May-2008  yamt sync with head.
 1.8.134.1 02-Jun-2008  mjf Sync with HEAD.
 1.6 10-Sep-1999  drochner -don't use DEFS.h nor SYS.h in libkern
-remove setjmp.S, it's not useful for libkern
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 21-Oct-1993  jtc branches: 1.4.2;
So many files in arch/i386 have been changed I might as well run my
remove unecessary trailing whitespace script.
 1.3 21-Oct-1993  jtc Change instances of LIBC_RCS back to LIBC_SCCS. If we are going to change
th LIBC_RCS, the entire source tree should be updated at once.
Remove && !defined(lint) from conditionals around rcs id's. No one is
ever going to pass a *.s file through lint.
 1.2 20-Oct-1993  jtc Replaced instructions with immediate operands with compatible alternatives
saving a few bytes while the cycle count remains the same --- could
actually be faster, depending on the cache, prefetch queue, etc.
 1.1 07-Oct-1993  cgd make an arch directory in libc, and move all machine dirs into it
 1.4.2.2 21-Oct-1993  jtc So many files in arch/i386 have been changed I might as well run my
remove unecessary trailing whitespace script.
 1.4.2.1 21-Oct-1993  jtc file setjmp.S was added on branch magnum on 1993-10-21 01:48:17 +0000
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 10-Sep-1999  drochner branches: 1.5.134; 1.5.136; 1.5.138;
-don't use DEFS.h nor SYS.h in libkern
-remove setjmp.S, it's not useful for libkern
 1.4 15-Aug-1998  mycroft Assign copyrights to TNF.
 1.3 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 24-Feb-1994  mycroft Assembler versions of these.
 1.5.138.1 16-May-2008  yamt sync with head.
 1.5.136.1 18-May-2008  yamt sync with head.
 1.5.134.1 02-Jun-2008  mjf Sync with HEAD.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 04-Dec-2003  keihan branches: 1.9.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.8 23-Aug-1999  kleink branches: 1.8.36;
Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.7 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.6 07-Oct-1995  mycroft Update from libc.
 1.5 05-Feb-1995  mycroft Sync with libc.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 15-Feb-1994  mycroft Update from libc.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file strcat.S was added on branch magnum on 1993-12-04 03:06:54 +0000
 1.8.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.36.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 04-Dec-2003  keihan branches: 1.3.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.2 27-Oct-2003  junyoung index() shouldn't be used in the kernel. Use strchr() instead.
 1.1 22-Feb-1998  mycroft branches: 1.1.48;
Add these as well.
 1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 04-Dec-2003  keihan branches: 1.9.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.8 23-Aug-1999  kleink branches: 1.8.36;
Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.7 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.6 07-Oct-1995  mycroft Update from libc.
 1.5 05-Feb-1995  mycroft Sync with libc.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 15-Feb-1994  mycroft Update from libc.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file strcmp.S was added on branch magnum on 1993-12-04 03:07:08 +0000
 1.8.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.36.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 04-Dec-2003  keihan branches: 1.9.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.8 23-Aug-1999  kleink branches: 1.8.36;
Sync with libc: use _ALIGN_TEXT from <machine/asm.h>.
 1.7 22-Feb-1998  mycroft Move random.S from arch/i386/i386.
 1.6 07-Oct-1995  mycroft Update from libc.
 1.5 05-Feb-1995  mycroft Sync with libc.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 15-Feb-1994  mycroft Update from libc.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file strcpy.S was added on branch magnum on 1993-12-04 03:07:22 +0000
 1.8.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.36.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 04-Dec-2003  keihan branches: 1.7.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.6 22-Feb-1998  mycroft branches: 1.6.48;
Move random.S from arch/i386/i386.
 1.5 07-Oct-1995  mycroft Update from libc.
 1.4 05-Feb-1995  mycroft Sync with libc.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 04-Dec-1993  cgd branches: 1.1.2;
change to use MACHINE_ARCH and update from libc
 1.1.2.2 04-Dec-1993  cgd change to use MACHINE_ARCH and update from libc
 1.1.2.1 04-Dec-1993  cgd file strlen.S was added on branch magnum on 1993-12-04 03:07:40 +0000
 1.6.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.48.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 27-Oct-1993  jtc Did a ``make copy-to-libkern'' from libc to copy libc files to libkern.
Checking them in to make people happy.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 04-Dec-2003  keihan branches: 1.3.8; 1.3.10;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.2 05-Nov-2003  junyoung rindex() shouldn't be used in the kernel. Use strrchr() instead.
 1.1 22-Feb-1998  mycroft branches: 1.1.48;
Add these as well.
 1.1.48.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.5 05-Aug-2016  scole PR port-ia64/51261

Use common/lib/libc/arch/ia64/string functions
 1.4 14-Aug-2009  dsl branches: 1.4.22; 1.4.40; 1.4.44;
Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.3 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.2 20-Jul-2009  kiyohara Fix little bit, and add a few files.
current status is to see following thread.
http://mail-index.netbsd.org/port-ia64/2009/06/18/msg000102.html
 1.1 07-Apr-2006  cherry branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.14; 1.1.20; 1.1.74; 1.1.90;
Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.1.90.1 23-Jul-2009  jym Sync with HEAD.
 1.1.74.1 19-Aug-2009  yamt sync with head.
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 07-Apr-2006  rpaulo file Makefile.inc was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 07-Apr-2006  yamt file Makefile.inc was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.1.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.10.1 07-Apr-2006  tron file Makefile.inc was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.1.6.2 22-Apr-2006  simonb Sync with head.
 1.1.6.1 07-Apr-2006  simonb file Makefile.inc was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.1.4.2 19-Apr-2006  elad sync with head.
 1.1.4.1 07-Apr-2006  elad file Makefile.inc was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.1.2.2 11-Apr-2006  yamt sync with head
 1.1.2.1 07-Apr-2006  yamt file Makefile.inc was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.4.44.1 06-Aug-2016  pgoyette Sync with HEAD
 1.4.40.1 05-Oct-2016  skrll Sync with HEAD
 1.4.22.1 03-Dec-2017  jdolecek update from HEAD
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file bswap16.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file bswap16.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file bswap16.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file bswap16.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file bswap16.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file bswap16.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file bswap32.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file bswap32.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file bswap32.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file bswap32.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file bswap32.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file bswap32.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.1 20-Jul-2009  kiyohara branches: 1.1.2; 1.1.4;
Fix little bit, and add a few files.
current status is to see following thread.
http://mail-index.netbsd.org/port-ia64/2009/06/18/msg000102.html
 1.1.4.2 19-Aug-2009  yamt sync with head.
 1.1.4.1 20-Jul-2009  yamt file bswap64.S was added on branch yamt-nfs-mp on 2009-08-19 18:48:19 +0000
 1.1.2.2 23-Jul-2009  jym Sync with HEAD.
 1.1.2.1 20-Jul-2009  jym file bswap64.S was added on branch jym-xensuspend on 2009-07-23 23:32:45 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file byte_swap_2.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file byte_swap_2.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file byte_swap_2.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file byte_swap_2.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file byte_swap_2.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file byte_swap_2.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file byte_swap_4.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file byte_swap_4.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file byte_swap_4.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file byte_swap_4.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file byte_swap_4.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file byte_swap_4.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.1 20-Jul-2009  kiyohara branches: 1.1.2; 1.1.4;
Fix little bit, and add a few files.
current status is to see following thread.
http://mail-index.netbsd.org/port-ia64/2009/06/18/msg000102.html
 1.1.4.2 19-Aug-2009  yamt sync with head.
 1.1.4.1 20-Jul-2009  yamt file byte_swap_8.S was added on branch yamt-nfs-mp on 2009-08-19 18:48:19 +0000
 1.1.2.2 23-Jul-2009  jym Sync with HEAD.
 1.1.2.1 20-Jul-2009  jym file byte_swap_8.S was added on branch jym-xensuspend on 2009-07-23 23:32:45 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file divdi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file divdi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file divdi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file divdi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file divdi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file divdi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file divsi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file divsi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file divsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file divsi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file divsi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file divsi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.1 07-Apr-2006  cherry branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.14; 1.1.20;
Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 07-Apr-2006  rpaulo file htonl.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 07-Apr-2006  yamt file htonl.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.1.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.10.1 07-Apr-2006  tron file htonl.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.1.6.2 22-Apr-2006  simonb Sync with head.
 1.1.6.1 07-Apr-2006  simonb file htonl.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.1.4.2 19-Apr-2006  elad sync with head.
 1.1.4.1 07-Apr-2006  elad file htonl.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.1.2.2 11-Apr-2006  yamt sync with head
 1.1.2.1 07-Apr-2006  yamt file htonl.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 05-Aug-2016  scole PR port-ia64/51261

Use common/lib/libc/arch/ia64/string functions
 1.1 07-Apr-2006  cherry branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.14; 1.1.20; 1.1.120; 1.1.140; 1.1.144;
Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.1.144.1 06-Aug-2016  pgoyette Sync with HEAD
 1.1.140.1 05-Oct-2016  skrll Sync with HEAD
 1.1.120.1 03-Dec-2017  jdolecek update from HEAD
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 07-Apr-2006  rpaulo file memcpy.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 07-Apr-2006  yamt file memcpy.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.1.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.10.1 07-Apr-2006  tron file memcpy.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.1.6.2 22-Apr-2006  simonb Sync with head.
 1.1.6.1 07-Apr-2006  simonb file memcpy.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.1.4.2 19-Apr-2006  elad sync with head.
 1.1.4.1 07-Apr-2006  elad file memcpy.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.1.2.2 11-Apr-2006  yamt sync with head
 1.1.2.1 07-Apr-2006  yamt file memcpy.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file moddi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file moddi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file moddi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file moddi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file moddi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file moddi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file modsi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file modsi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file modsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file modsi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file modsi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file modsi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.1 07-Apr-2006  cherry branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.14; 1.1.20;
Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 07-Apr-2006  rpaulo file ntohl.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 07-Apr-2006  yamt file ntohl.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.1.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.10.1 07-Apr-2006  tron file ntohl.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.1.6.2 22-Apr-2006  simonb Sync with head.
 1.1.6.1 07-Apr-2006  simonb file ntohl.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.1.4.2 19-Apr-2006  elad sync with head.
 1.1.4.1 07-Apr-2006  elad file ntohl.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.1.2.2 11-Apr-2006  yamt sync with head
 1.1.2.1 07-Apr-2006  yamt file ntohl.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file udivdi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file udivdi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file udivdi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file udivdi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file udivdi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file udivdi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file udivsi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file udivsi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file udivsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file udivsi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file udivsi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file udivsi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file umoddi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file umoddi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file umoddi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file umoddi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file umoddi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file umoddi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.2 07-Apr-2006  cherry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.20;
Fixed CVS version headers
 1.1 07-Apr-2006  cherry Initial import of arch/ia64 sources.
These sources are ported from FreeBSD/ia64 code.
See individual source files for credits.
In addition, code from NetBSD/alpha NetBSD/sparc64,
NetBSD/i386 and NetBSD/amd64 were used as templates,
along with my own additions.
 1.2.20.2 09-Sep-2006  rpaulo sync with head
 1.2.20.1 07-Apr-2006  rpaulo file umodsi3.S was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:57:52 +0000
 1.2.14.2 21-Jun-2006  yamt sync with head.
 1.2.14.1 07-Apr-2006  yamt file umodsi3.S was added on branch yamt-lazymbuf on 2006-06-21 15:10:22 +0000
 1.2.10.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 07-Apr-2006  tron file umodsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2.6.2 22-Apr-2006  simonb Sync with head.
 1.2.6.1 07-Apr-2006  simonb file umodsi3.S was added on branch simonb-timecounters on 2006-04-22 11:40:05 +0000
 1.2.4.2 19-Apr-2006  elad sync with head.
 1.2.4.1 07-Apr-2006  elad file umodsi3.S was added on branch elad-kernelauth on 2006-04-19 04:36:01 +0000
 1.2.2.2 11-Apr-2006  yamt sync with head
 1.2.2.1 07-Apr-2006  yamt file umodsi3.S was added on branch yamt-pdpolicy on 2006-04-11 11:55:48 +0000
 1.4 11-Nov-1999  thorpej Sync w/ libc.
 1.3 22-Feb-1998  mycroft branches: 1.3.14; 1.3.16; 1.3.20;
Sync with libc, and add random.S.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.3.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.16.1 15-Nov-1999  fvdl Sync with -current
 1.3.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.38 31-May-2020  rin Add m68k assembler version of __muldi3().

This is intended for 68060:
- GCC does not emit __muldi3() for 68020-40, that have 32 * 32 --> 64 mulul
- mulsl (and moveml), used in this code, are not implemented for 68010

In comparison with that from compiler_rt, this version saves:
- 12% of processing time
- 12 bytes of stack
- 50 bytes of code size
Also, slightly faster, memory saving, and smaller than libgcc version.

By examining with evcnt(9), __muldi3() is invoked more than 1000 times per
sec by kernel, which should justify to introduce assembler version of this
function.
 1.37 30-Jul-2015  tsutsui Revert untested and unnecessary change in previous rev 1.36.

Our autobuild doesn't always reflect the latest fixes.
 1.36 30-Jul-2015  christos add mulsi3, needed by inet_addr.o
 1.35 08-Sep-2014  joerg branches: 1.35.2;
Revert 1.33 and 1.34 for now, until either .INVISIBLE is reinstanciated
or random.S dropped.
 1.34 01-Sep-2014  matt Make random.S invisible for coldfire too (e.g. anything not "m68k")
 1.33 27-Aug-2014  christos use .INVISIBLE to hide random.S, instead of extra rules.
 1.32 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.31 18-Jul-2013  matt Reorder a little to make clearer.
 1.30 14-Aug-2009  dsl branches: 1.30.12; 1.30.22; 1.30.26; 1.30.34;
Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.29 12-Aug-2009  dsl Remove some .c files accidentally left on the .S lines
 1.28 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.27 18-Mar-2009  tsutsui - remove bcmp(9), bcopy(9), and bzero(9) from libkern since <sys/systm.h> has
macro which replace them with mem*() functions in #ifdef _KERNEL as noted
in man pages
- move declarations of bcopy(3) and bzero(3) into <lib/libsa/stand.h>
since they are still in libsa for some MD standalone sources
(I guess all bcmp(3) in standalone sources have been replaced with memcmp(3)
but they should be replaced with memcmp() anyway)
 1.26 11-Dec-2005  christos branches: 1.26.74; 1.26.84; 1.26.90;
merge ktrace-lwp.
 1.25 29-Oct-2003  mycroft Don't try to build random.S on 68010.
 1.24 21-Sep-2002  chs branches: 1.24.6;
add strtoul.c, it's now used in MI code.
 1.23 26-Mar-2002  fredette Added brand-new integer multiply and divide support, used only
on the m68000.
 1.22 22-Mar-2002  fredette On the m68000, if and only if gcc doesn't seem to know
where libgcc.a is, fall back to one under DESTDIR.
 1.21 16-May-2001  fredette branches: 1.21.2;
When MACHINE_ARCH is m68000, compile ffs.c and random.c
instead of ffs.s and random.s, and sneak the libgcc
integer support routines into the list of library objects.
 1.20 01-Nov-2000  thorpej branches: 1.20.2;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.19 04-Aug-1998  perry branches: 1.19.12;
add memcmp.S memmove.S
 1.18 22-Feb-1998  mycroft Use the new .S files.
 1.17 22-Feb-1998  mycroft Sync with libc, and add random.S.
 1.16 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.15 24-Oct-1997  chuck add memchr() to libkern
 1.14 11-Oct-1997  scottr Implement assembly byte-swap functions.
 1.13 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.12 18-Jan-1997  cgd branches: 1.12.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.11 03-Dec-1996  thorpej We use C flavors of the quad support functions in libkern.
 1.10 30-Nov-1996  jtc Sync with libc
 1.9 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.8 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.7 18-Apr-1996  cgd use assembly version of strcat (copied down from libc)
 1.6 06-Feb-1996  christos Add strncasecmp.c; extracted from ADOSFS adlookup.c.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 05-Dec-1993  cgd use .S
 1.3 04-Dec-1993  cgd branches: 1.3.2;
change to use MACHINE_ARCH and update from libc
 1.2 29-Nov-1993  briggs Move the SRCS from hp300 over to here, changing ffs.c to ffs.s.
Am I missing something obvious in doing this? This makes the
${ARCH}/Makefile.inc for 68k able to just set ARCH=m68k.
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.3.2.2 05-Dec-1993  cgd use .S
 1.3.2.1 04-Dec-1993  cgd file Makefile.inc was added on branch magnum on 1993-12-05 01:52:18 +0000
 1.12.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19.12.1 22-Nov-2000  bouyer Sync with HEAD.
 1.20.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.20.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.20.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.21.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.21.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.24.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.6.1 03-Aug-2004  skrll Sync with HEAD
 1.26.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.26.74.2 19-Aug-2009  yamt sync with head.
 1.26.74.1 04-May-2009  yamt sync with head.
 1.30.34.1 23-Jul-2013  riastradh sync with HEAD
 1.30.26.1 28-Aug-2013  rmind sync with head
 1.30.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.2.1 22-Sep-2015  skrll Sync with HEAD
 1.8 30-Mar-2006  tsutsui Remove unused file. Pointed out by uwe.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 07-Aug-2003  agc branches: 1.5.8; 1.5.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 11-Nov-1999  thorpej branches: 1.4.28;
Sync w/ libc.
 1.3 22-Feb-1998  mycroft branches: 1.3.14; 1.3.16; 1.3.20;
Sync with libc, and add random.S.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.3.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.16.1 15-Nov-1999  fvdl Sync with -current
 1.3.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.7.10.1 19-Apr-2006  elad sync with head.
 1.7.8.1 01-Apr-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.12 20-Dec-2005  christos Use common sources with userland.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 07-Aug-2003  agc branches: 1.9.8; 1.9.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 16-May-2001  fredette branches: 1.8.22;
On the 68010, we are forced to do bytewise compares
and copies if the two addresses aren't of the same
evenness.
 1.7 11-Nov-1999  thorpej branches: 1.7.6;
Sync w/ libc.
 1.6 15-May-1997  jtc branches: 1.6.22; 1.6.24; 1.6.28;
Sync with libc
 1.5 13-May-1997  jtc Sync with libc.
 1.4 30-Nov-1996  jtc Sync with libc
 1.3 08-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.6.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.24.1 15-Nov-1999  fvdl Sync with -current
 1.6.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.7.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.22.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.22.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 07-Aug-2003  agc branches: 1.4.8; 1.4.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 16-May-2001  fredette branches: 1.3.22;
On the 68010, we are forced to do bytewise compares
and copies if the two addresses aren't of the same
evenness.
 1.2 11-Nov-1999  thorpej branches: 1.2.6;
Sync w/ libc.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.22.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.22.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 11-Nov-1999  thorpej branches: 1.2.44;
Sync w/ libc.
 1.1 11-Oct-1997  scottr branches: 1.1.2; 1.1.18; 1.1.20; 1.1.24;
Implement assembly byte-swap functions.
 1.1.24.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.20.1 15-Nov-1999  fvdl Sync with -current
 1.1.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 11-Oct-1997  thorpej file bswap16.S was added on branch marc-pcmcia on 1997-10-14 10:27:38 +0000
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 11-Nov-1999  thorpej branches: 1.2.44;
Sync w/ libc.
 1.1 11-Oct-1997  scottr branches: 1.1.2; 1.1.18; 1.1.20; 1.1.24;
Implement assembly byte-swap functions.
 1.1.24.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.20.1 15-Nov-1999  fvdl Sync with -current
 1.1.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 11-Oct-1997  thorpej file bswap32.S was added on branch marc-pcmcia on 1997-10-14 10:27:39 +0000
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 11-Nov-1999  thorpej branches: 1.2.44;
Sync w/ libc.
 1.1 11-Oct-1997  scottr branches: 1.1.2; 1.1.18; 1.1.20; 1.1.24;
Implement assembly byte-swap functions.
 1.1.24.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.20.1 15-Nov-1999  fvdl Sync with -current
 1.1.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 11-Oct-1997  thorpej file bswap64.S was added on branch marc-pcmcia on 1997-10-14 10:27:41 +0000
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 07-Aug-2003  agc branches: 1.7.8; 1.7.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 11-Nov-1999  thorpej branches: 1.6.28;
Sync w/ libc.
 1.5 13-May-1997  jtc branches: 1.5.22; 1.5.24; 1.5.28;
Sync with libc.
 1.4 30-Nov-1996  jtc Sync with libc
 1.3 08-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.5.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.24.1 15-Nov-1999  fvdl Sync with -current
 1.5.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.28.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.4 23-Apr-2020  rin Remove "#ifndef __mc68010__ #error" I added when these {,u}divsi3.S and
{,u}modsi3.S were moved here (It was better to split the commit, sorry);
bootloader for sun3 still depends on them.
 1.3 22-Apr-2020  rin Restrict usage of m68k assembler versions of {,u}divsi3 and {,u}divsi3 to
kernel and bootloader for 68010.

They requires a special calling convention to udivsi3, and cannot to be
mixed up in normal routines provided by libgcc or compiler_rt. Although,
there's no problem for using in a controlled situation, i.e., kernel and
standalone programs.

Note that this does not affect m68k ports other than sun2, since codes
generated by gcc do not call these routines.

Assembler files are moved from common/lib/libc/arch/m68k/gen to
sys/lib/libkern/arch/m68k in order not to be compiled in libc.

Revert hack introduced to lib/libc/compiler_rt/Makefile.inc rev 1.37:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/compiler_rt/Makefile.inc#rev1.37

Proposed on port-sun2@ with no response...
(Again, this does not affect m68k ports other than sun2.)
http://mail-index.netbsd.org/port-sun2/2020/03/10/msg000102.html
 1.2 20-Dec-2005  christos branches: 1.2.100;
Use common sources with userland.
 1.1 26-Mar-2002  fredette branches: 1.1.2; 1.1.8; 1.1.30;
Added brand-new integer multiply and divide support, used only
on the m68000.
 1.1.30.1 21-Jun-2006  yamt sync with head.
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 26-Mar-2002  jdolecek file divsi3.S was added on branch kqueue on 2002-06-23 17:49:48 +0000
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 26-Mar-2002  nathanw file divsi3.S was added on branch nathanw_sa on 2002-04-01 07:48:05 +0000
 1.2.100.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 29-Oct-2003  mycroft branches: 1.8.8; 1.8.10;
Refresh from libc to get 68010 version.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 11-Nov-1999  thorpej branches: 1.6.28;
Sync w/ libc.
 1.5 13-May-1997  jtc branches: 1.5.22; 1.5.24; 1.5.28;
Sync with libc.
 1.4 08-Feb-1995  mycroft Sync with libc.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 09-Sep-1994  mycroft Use bfffo rather than a slow loop.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.5.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.24.1 15-Nov-1999  fvdl Sync with -current
 1.5.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.28.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 11-Nov-1999  thorpej branches: 1.4.28;
Sync w/ libc.
 1.3 22-Feb-1998  mycroft branches: 1.3.14; 1.3.16; 1.3.20;
Sync with libc, and add random.S.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.3.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.16.1 15-Nov-1999  fvdl Sync with -current
 1.3.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 11-Nov-1999  thorpej branches: 1.4.28;
Sync w/ libc.
 1.3 22-Feb-1998  mycroft branches: 1.3.14; 1.3.16; 1.3.20;
Sync with libc, and add random.S.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.3.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.16.1 15-Nov-1999  fvdl Sync with -current
 1.3.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 11-Nov-1999  thorpej branches: 1.2.28;
Sync w/ libc.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.28.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.3 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file locc.S was added on branch magnum on 1993-10-13 05:41:03 +0000
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 11-Nov-1999  thorpej branches: 1.2.28;
Add register prefixes.
 1.1 04-Aug-1998  perry branches: 1.1.12; 1.1.14; 1.1.18;
add memcmp.S memmove.S
 1.1.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.14.1 15-Nov-1999  fvdl Sync with -current
 1.1.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.28.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 11-Nov-1999  thorpej branches: 1.2.44;
Sync w/ libc.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 11-Nov-1999  thorpej branches: 1.2.44;
Sync w/ libc.
 1.1 04-Aug-1998  perry branches: 1.1.12; 1.1.14; 1.1.18;
add memcmp.S memmove.S
 1.1.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.14.1 15-Nov-1999  fvdl Sync with -current
 1.1.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 07-Aug-2003  agc branches: 1.4.8; 1.4.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 06-Sep-2001  fredette branches: 1.3.20;
On the 68010, don't bother with the by-8-longwords loop, instead
only 16-bit align the region and use loop mode with longwords
to do the bulk of the work.

On the 68020+, fixed an optimization bug where all regions that start
on odd addresses would not be properly longword aligned.
 1.2 11-Nov-1999  thorpej branches: 1.2.6; 1.2.8;
Sync w/ libc.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.8.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.6.1 21-Sep-2001  nathanw Catch up to -current.
 1.3.20.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.20.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.4 23-Apr-2020  rin Remove "#ifndef __mc68010__ #error" I added when these {,u}divsi3.S and
{,u}modsi3.S were moved here (It was better to split the commit, sorry);
bootloader for sun3 still depends on them.
 1.3 22-Apr-2020  rin Restrict usage of m68k assembler versions of {,u}divsi3 and {,u}divsi3 to
kernel and bootloader for 68010.

They requires a special calling convention to udivsi3, and cannot to be
mixed up in normal routines provided by libgcc or compiler_rt. Although,
there's no problem for using in a controlled situation, i.e., kernel and
standalone programs.

Note that this does not affect m68k ports other than sun2, since codes
generated by gcc do not call these routines.

Assembler files are moved from common/lib/libc/arch/m68k/gen to
sys/lib/libkern/arch/m68k in order not to be compiled in libc.

Revert hack introduced to lib/libc/compiler_rt/Makefile.inc rev 1.37:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/compiler_rt/Makefile.inc#rev1.37

Proposed on port-sun2@ with no response...
(Again, this does not affect m68k ports other than sun2.)
http://mail-index.netbsd.org/port-sun2/2020/03/10/msg000102.html
 1.2 20-Dec-2005  christos branches: 1.2.100;
Use common sources with userland.
 1.1 26-Mar-2002  fredette branches: 1.1.2; 1.1.8; 1.1.30;
Added brand-new integer multiply and divide support, used only
on the m68000.
 1.1.30.1 21-Jun-2006  yamt sync with head.
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 26-Mar-2002  jdolecek file modsi3.S was added on branch kqueue on 2002-06-23 17:49:49 +0000
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 26-Mar-2002  nathanw file modsi3.S was added on branch nathanw_sa on 2002-04-01 07:48:05 +0000
 1.2.100.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 26-Mar-2002  fredette branches: 1.1.2; 1.1.8; 1.1.30;
Added brand-new integer multiply and divide support, used only
on the m68000.
 1.1.30.1 21-Jun-2006  yamt sync with head.
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 26-Mar-2002  jdolecek file mulsi3.S was added on branch kqueue on 2002-06-23 17:49:49 +0000
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 26-Mar-2002  nathanw file mulsi3.S was added on branch nathanw_sa on 2002-04-01 07:48:06 +0000
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 11-Nov-1999  thorpej branches: 1.4.28;
Sync w/ libc.
 1.3 22-Feb-1998  mycroft branches: 1.3.14; 1.3.16; 1.3.20;
Sync with libc, and add random.S.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.3.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.16.1 15-Nov-1999  fvdl Sync with -current
 1.3.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 11-Nov-1999  thorpej branches: 1.4.28;
Sync w/ libc.
 1.3 22-Feb-1998  mycroft branches: 1.3.14; 1.3.16; 1.3.20;
Sync with libc, and add random.S.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.3.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.16.1 15-Nov-1999  fvdl Sync with -current
 1.3.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.5 18-Jul-2013  matt Don't use %d2 (violates the ABI since it wasn't saved), use %a0 instead.
Use a pcrelative access for the local data avoiding the GOT.
 1.4 06-Jan-2009  pooka branches: 1.4.14; 1.4.24; 1.4.28; 1.4.36;
Fix PIC version, it was missing one dereference. Thanks to spz
for access to m68k hardware for testing.
 1.3 04-Jan-2009  pooka Support PIC for inclusion in librump. (m68k untested)
 1.2 11-Nov-1999  thorpej branches: 1.2.126; 1.2.130; 1.2.140;
Add register prefixes.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.140.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.130.1 04-May-2009  yamt sync with head.
 1.2.126.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.36.1 23-Jul-2013  riastradh sync with HEAD
 1.4.28.1 28-Aug-2013  rmind sync with head
 1.4.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 11-Nov-1999  thorpej branches: 1.2.28;
Sync w/ libc.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.28.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.10 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.9 18-Jul-2013  matt Adjust for coldfire
 1.8 18-Jul-2013  matt Keep stack longword aligned.
Use longword ops for %d2.
 1.7 18-Jul-2013  matt Convert to motorola syntax
 1.6 08-Feb-2011  rmind branches: 1.6.4; 1.6.14; 1.6.18; 1.6.26;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.5 11-Dec-2005  christos branches: 1.5.98; 1.5.104; 1.5.106;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 11-Nov-1999  thorpej branches: 1.3.28;
Add register prefixes.
 1.2 26-Oct-1994  cgd branches: 1.2.32; 1.2.34; 1.2.38;
new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file scanc.S was added on branch magnum on 1993-10-13 05:41:04 +0000
 1.2.38.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.34.1 15-Nov-1999  fvdl Sync with -current
 1.2.32.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.106.1 17-Feb-2011  bouyer Sync with HEAD
 1.5.104.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.98.1 05-Mar-2011  rmind sync with head
 1.6.26.1 23-Jul-2013  riastradh sync with HEAD
 1.6.18.1 28-Aug-2013  rmind sync with head
 1.6.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.10 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.9 18-Jul-2013  matt Adjust for coldfire
 1.8 18-Jul-2013  matt Fix typo.
 1.7 18-Jul-2013  matt Convert to morotola syntax
 1.6 08-Feb-2011  rmind branches: 1.6.4; 1.6.14; 1.6.18; 1.6.26;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.5 11-Dec-2005  christos branches: 1.5.98; 1.5.104; 1.5.106;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 11-Nov-1999  thorpej branches: 1.3.28;
Add register prefixes.
 1.2 26-Oct-1994  cgd branches: 1.2.32; 1.2.34; 1.2.38;
new RCS ID format.
 1.1 13-Oct-1993  cgd branches: 1.1.2;
move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.2 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.1.2.1 13-Oct-1993  cgd file skpc.S was added on branch magnum on 1993-10-13 05:41:06 +0000
 1.2.38.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.34.1 15-Nov-1999  fvdl Sync with -current
 1.2.32.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.106.1 17-Feb-2011  bouyer Sync with HEAD
 1.5.104.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.98.1 05-Mar-2011  rmind sync with head
 1.6.26.1 23-Jul-2013  riastradh sync with HEAD
 1.6.18.1 28-Aug-2013  rmind sync with head
 1.6.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 07-Aug-2003  agc branches: 1.4.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 11-Nov-1999  thorpej branches: 1.3.28;
Sync w/ libc.
 1.2 13-May-1997  jtc branches: 1.2.22; 1.2.24; 1.2.28;
Sync with libc.
 1.1 18-Apr-1996  cgd use assembly version of strcat (copied down from libc)
 1.2.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.24.1 15-Nov-1999  fvdl Sync with -current
 1.2.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.28.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.3 18-Apr-1996  cgd use assembly version of strcat (copied down from libc)
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 11-Nov-1999  thorpej branches: 1.2.44;
Sync w/ libc.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 04-Dec-2003  keihan branches: 1.9.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.8 16-May-2001  fredette branches: 1.8.22;
Use the EXTBL macro where we want the extbl instruction.
On the 68010 this expands to an extw/extl combination.
 1.7 28-Nov-2000  is branches: 1.7.2;
Sync with libc: make function exit one instruction faster, and function one
instruction shorter (Horimoto).
 1.6 11-Nov-1999  thorpej Sync w/ libc.
 1.5 20-Jun-1997  jtc branches: 1.5.22; 1.5.24; 1.5.28;
sync with libc
 1.4 13-May-1997  jtc Sync with libc.
 1.3 08-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.5.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.24.1 15-Nov-1999  fvdl Sync with -current
 1.5.22.2 08-Dec-2000  bouyer Sync with HEAD.
 1.5.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.22.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 11-Nov-1999  thorpej branches: 1.5.28;
Sync w/ libc.
 1.4 13-May-1997  jtc branches: 1.4.22; 1.4.24; 1.4.28;
Sync with libc.
 1.3 08-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.4.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.24.1 15-Nov-1999  fvdl Sync with -current
 1.4.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.28.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 11-Nov-1999  thorpej branches: 1.5.28;
Sync w/ libc.
 1.4 13-May-1997  jtc branches: 1.4.22; 1.4.24; 1.4.28;
Sync with libc.
 1.3 08-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.4.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.24.1 15-Nov-1999  fvdl Sync with -current
 1.4.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.28.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.10 20-Dec-2005  christos Use common sources with userland.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 04-Dec-2003  keihan branches: 1.8.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.7 16-May-2001  fredette branches: 1.7.22;
Use the EXTBL macro where we want the extbl instruction.
On the 68010 this expands to an extw/extl combination.
 1.6 11-Nov-1999  thorpej branches: 1.6.6;
Sync w/ libc.
 1.5 20-Jun-1997  jtc branches: 1.5.22; 1.5.24; 1.5.28;
sync with libc
 1.4 13-May-1997  jtc Sync with libc.
 1.3 08-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.5.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.24.1 15-Nov-1999  fvdl Sync with -current
 1.5.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.22.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 27-Nov-2000  is branches: 1.6.24;
Sync with libc strncpy.S 1.11: optimized code by Hiroshi Horimoto.
 1.5 11-Nov-1999  thorpej Sync w/ libc.
 1.4 13-May-1997  jtc branches: 1.4.22; 1.4.24; 1.4.28;
Sync with libc.
 1.3 08-Feb-1995  mycroft Sync with libc.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-Mar-1994  chopps copied over so lib/libc/arch not needed to build kernel.
 1.4.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.24.1 15-Nov-1999  fvdl Sync with -current
 1.4.22.2 08-Dec-2000  bouyer Sync with HEAD.
 1.4.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.24.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 11-Nov-1999  thorpej branches: 1.2.44;
Sync w/ libc.
 1.1 22-Feb-1998  mycroft branches: 1.1.14; 1.1.16; 1.1.20;
Sync with libc, and add random.S.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.6 23-Apr-2020  rin Remove "#ifndef __mc68010__ #error" I added when these {,u}divsi3.S and
{,u}modsi3.S were moved here (It was better to split the commit, sorry);
bootloader for sun3 still depends on them.
 1.5 22-Apr-2020  rin Restrict usage of m68k assembler versions of {,u}divsi3 and {,u}divsi3 to
kernel and bootloader for 68010.

They requires a special calling convention to udivsi3, and cannot to be
mixed up in normal routines provided by libgcc or compiler_rt. Although,
there's no problem for using in a controlled situation, i.e., kernel and
standalone programs.

Note that this does not affect m68k ports other than sun2, since codes
generated by gcc do not call these routines.

Assembler files are moved from common/lib/libc/arch/m68k/gen to
sys/lib/libkern/arch/m68k in order not to be compiled in libc.

Revert hack introduced to lib/libc/compiler_rt/Makefile.inc rev 1.37:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/compiler_rt/Makefile.inc#rev1.37

Proposed on port-sun2@ with no response...
(Again, this does not affect m68k ports other than sun2.)
http://mail-index.netbsd.org/port-sun2/2020/03/10/msg000102.html
 1.4 20-Dec-2005  christos branches: 1.4.100;
Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 26-Mar-2002  fredette branches: 1.1.2; 1.1.8; 1.1.14; 1.1.22; 1.1.24;
Added brand-new integer multiply and divide support, used only
on the m68000.
 1.1.24.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.22.1 29-Apr-2005  kent sync with -current
 1.1.14.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 26-Mar-2002  jdolecek file udivsi3.S was added on branch kqueue on 2002-06-23 17:49:49 +0000
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 26-Mar-2002  nathanw file udivsi3.S was added on branch nathanw_sa on 2002-04-01 07:48:06 +0000
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.4.100.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.4 23-Apr-2020  rin Remove "#ifndef __mc68010__ #error" I added when these {,u}divsi3.S and
{,u}modsi3.S were moved here (It was better to split the commit, sorry);
bootloader for sun3 still depends on them.
 1.3 22-Apr-2020  rin Restrict usage of m68k assembler versions of {,u}divsi3 and {,u}divsi3 to
kernel and bootloader for 68010.

They requires a special calling convention to udivsi3, and cannot to be
mixed up in normal routines provided by libgcc or compiler_rt. Although,
there's no problem for using in a controlled situation, i.e., kernel and
standalone programs.

Note that this does not affect m68k ports other than sun2, since codes
generated by gcc do not call these routines.

Assembler files are moved from common/lib/libc/arch/m68k/gen to
sys/lib/libkern/arch/m68k in order not to be compiled in libc.

Revert hack introduced to lib/libc/compiler_rt/Makefile.inc rev 1.37:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/compiler_rt/Makefile.inc#rev1.37

Proposed on port-sun2@ with no response...
(Again, this does not affect m68k ports other than sun2.)
http://mail-index.netbsd.org/port-sun2/2020/03/10/msg000102.html
 1.2 20-Dec-2005  christos branches: 1.2.100;
Use common sources with userland.
 1.1 26-Mar-2002  fredette branches: 1.1.2; 1.1.8; 1.1.30;
Added brand-new integer multiply and divide support, used only
on the m68000.
 1.1.30.1 21-Jun-2006  yamt sync with head.
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 26-Mar-2002  jdolecek file umodsi3.S was added on branch kqueue on 2002-06-23 17:49:49 +0000
 1.1.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.1 26-Mar-2002  nathanw file umodsi3.S was added on branch nathanw_sa on 2002-04-01 07:48:06 +0000
 1.2.100.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.24 03-Sep-2018  riastradh Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.23 20-Jan-2010  pgoyette branches: 1.23.62; 1.23.64;
Remove kern_assert.c - it's not needed here cuz it's already pulled in
by sys/lib/libkern/Makefile.libkern

OK pooka@
 1.22 20-Jan-2010  pooka __assert.c -> kern_assert.c

(I don't fully understand why __assert.c is needed here. maybe it
can be removed, but I don't have time to do a full set of mips builds
tonight)
 1.21 14-Dec-2009  matt Merge from matt-nb5-mips64
 1.20 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.19 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.18 27-Dec-2001  shin branches: 1.18.120; 1.18.138;
we need ffs().
 1.17 01-Nov-2000  thorpej branches: 1.17.2; 1.17.4;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.16 29-Nov-1999  simonb Add strtoul.c and sort sources alphabetically.
 1.15 15-Mar-1999  jonathan branches: 1.15.8; 1.15.14;
Use merged memcpy()/memset() based on old bcopy rather than C-coded memmove.
TODO: change register usage so memcpy()/memmove() is default, put test
for back-copy before memcpy() and back-copy loop after memcpy().
 1.14 23-Feb-1999  simonb Add memset.S instead of memset.c, and remove __main.c.
 1.13 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.12 15-Jan-1999  castor Break out utility functions from locore.S
 1.11 11-Sep-1998  jonathan Changes to sys/arch/mips from ARC port, from Noriyuki Soda <soda@sra.co.jp>.
Adds (most) support for ARC platform to port-independent mips code.

Some changes (e.g., clean up of overlapping CPU/FPU ids) inspired by
comparison to the OpenBSD 2.1 codebase of Soda's ARC port.

Open issues:
* Still no support for r4600 or mipsIV CPUs with two-way L1 cache.
Code derived from Per Fogelstrom's OpenBSD source doesn't work
on mips3 pmaxes with L2 cache.

* Still some port-specific #ifdefs, for interrupt enable and
pmax L2 cache-size. Needs more thought, but overlaps with
work-in-progress by Tohru and Tsubai on spl()s and related stuff.
 1.10 20-Aug-1998  tls update for b->mem change in sys/kern; now we need memcmp and memset, not just memchr. AFAIK, memcpy is provided by the compiler or by locore on this platform.
 1.9 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.8 24-Oct-1997  chuck add memchr() to libkern
 1.7 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.6 18-Jan-1997  cgd branches: 1.6.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.5 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.4 13-Apr-1996  cgd add strncasecmp.c to ports' libkern Makefile.inc's. When adding a new
source file to libkern, it should be added to _ALL_ ports makefiles if
it is machine-independent and used by machine-independent code (in
this case adosfs). (There are several arguments that say that
strncasecmp should not be in libkern at all, and i think they're
good ones, but as long as ADOSFS needs it to link, it has to be here
for all architectures.)
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 15-Jun-1994  glass fix typo: scan.c -> scanc.c
 1.1 03-Jun-1994  glass works in bootstrapping caseee
 1.6.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.15.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.17.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.18.138.2 05-Sep-2009  matt Add an assmebly version of bswap64
 1.18.138.1 18-Aug-2009  matt Update to use new memset2.c
 1.18.120.2 11-Mar-2010  yamt sync with head
 1.18.120.1 19-Aug-2009  yamt sync with head.
 1.23.64.1 10-Jun-2019  christos Sync with HEAD
 1.23.62.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 10-Nov-2002  thorpej branches: 1.5.6;
ABICALLS -> __ABICALLS__
 1.4 27-Feb-2001  cgd branches: 1.4.2;
copy from lib/libc/arch/mips/gen
 1.3 20-Apr-1999  simonb branches: 1.3.2;
Until <bsd.lib.mk> is fixed, don't try to guess whether or not to
use abicalls in kernel source.
 1.2 17-Mar-1999  simonb branches: 1.2.2;
Don't add .abicalls if NO_ABICALLS is defined even if ABICALLS is defined.
 1.1 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2.2.1 27-Apr-1999  perry branches: 1.2.2.1.2;
pullup 1.2->1.3 (simonb)
 1.2.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.4.2.1 11-Nov-2002  nathanw Catch up to -current
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 10-Nov-2002  thorpej branches: 1.6.6;
ABICALLS -> __ABICALLS__
 1.5 27-Feb-2001  cgd branches: 1.5.2;
copy from lib/libc/arch/mips/gen
 1.4 20-Apr-1999  simonb branches: 1.4.2;
Until <bsd.lib.mk> is fixed, don't try to guess whether or not to
use abicalls in kernel source.
 1.3 17-Mar-1999  simonb branches: 1.3.2;
Don't add .abicalls if NO_ABICALLS is defined even if ABICALLS is defined.
 1.2 18-Jan-1999  castor Make bswap32 be the "real" entrypoint and htonl, ntohl aliases.
 1.1 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.3.2.1 27-Apr-1999  perry branches: 1.3.2.1.2;
pullup 1.3->1.4 (simonb)
 1.3.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.5.2.1 11-Nov-2002  nathanw Catch up to -current
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 07-Aug-2003  agc branches: 1.5.8; 1.5.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 10-Nov-2002  thorpej branches: 1.4.6;
ABICALLS -> __ABICALLS__
 1.3 02-Jan-2002  uch branches: 1.3.2; 1.3.4;
R5900 short-loop bug.
 1.2 27-Dec-2001  shin don't use .abicalls in kernel.
 1.1 27-Dec-2001  shin copy from libc/arch/mips/string
 1.3.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 02-Jan-2002  thorpej file ffs.S was added on branch kqueue on 2002-01-10 20:00:32 +0000
 1.3.2.5 11-Nov-2002  nathanw Catch up to -current
 1.3.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.3 11-Jan-2002  nathanw More catchup.
 1.3.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.2.1 02-Jan-2002  nathanw file ffs.S was added on branch nathanw_sa on 2002-01-08 00:32:50 +0000
 1.4.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.11 20-Dec-2005  christos Use common sources with userland.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 29-Sep-2004  sekiya branches: 1.8.4; 1.8.6;
Use 64-bit-clean addition/subtraction opcodes for pointer arithmetic iff
_LP64 is defined.
 1.7 16-Oct-2001  uch branches: 1.7.18;
R5900 miss-prediction of branch targets for short-loop.
 1.6 10-Oct-2000  jeffs branches: 1.6.2; 1.6.4;
Set return value correctly for memcpy/memmove.
 1.5 18-Jul-2000  enami Fix an obvious typo in comment introduced by previous commit; the instruction
now compares a0 against a1 + a2, not a0 + a2.
 1.4 17-Jul-2000  jeffs Make memcpy() the favored interface an swizzle the args for ovbcopy. Also
move bcopy XLEAF here from locore.S. For 64b clean compilation add a
ld/sd section to the block copy.
 1.3 15-Mar-1999  jonathan branches: 1.3.8; 1.3.18;
Use merged memcpy()/memset() based on old bcopy rather than C-coded memmove.
TODO: change register usage so memcpy()/memmove() is default, put test
for back-copy before memcpy() and back-copy loop after memcpy().
 1.2 15-Jan-1999  castor Break out utility functions from locore.S
 1.1 11-Sep-1998  jonathan Changes to sys/arch/mips from ARC port, from Noriyuki Soda <soda@sra.co.jp>.
Adds (most) support for ARC platform to port-independent mips code.

Some changes (e.g., clean up of overlapping CPU/FPU ids) inspired by
comparison to the OpenBSD 2.1 codebase of Soda's ARC port.

Open issues:
* Still no support for r4600 or mipsIV CPUs with two-way L1 cache.
Code derived from Per Fogelstrom's OpenBSD source doesn't work
on mips3 pmaxes with L2 cache.

* Still some port-specific #ifdefs, for interrupt enable and
pmax L2 cache-size. Needs more thought, but overlaps with
work-in-progress by Tohru and Tsubai on spl()s and related stuff.
 1.3.18.1 19-Jul-2000  jeffs Pull up revision memcpy.S 1.4-1.5 and locore.S 1.105 (approved by thorpej).
Make memcpy() the favored interface an swizzle the args for ovbcopy. Also
move bcopy XLEAF here from locore.S. For 64b clean compilation add a
ld/sd section to the block copy.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.1 22-Oct-2001  nathanw Catch up to -current.
 1.7.18.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.18.1 19-Oct-2004  skrll Sync with HEAD
 1.8.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 15-Mar-1999  jonathan branches: 1.1.58;
Use merged memcpy()/memset() based on old bcopy rather than C-coded memmove.
TODO: change register usage so memcpy()/memmove() is default, put test
for back-copy before memcpy() and back-copy loop after memcpy().
 1.1.58.1 21-Jun-2006  yamt sync with head.
 1.7 20-Dec-2005  christos Use common sources with userland.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 29-Sep-2004  sekiya branches: 1.4.4; 1.4.6;
Use 64-bit-clean addition/subtraction opcodes for pointer arithmetic iff
_LP64 is defined.
 1.3 16-Oct-2001  uch branches: 1.3.18;
R5900 miss-prediction of branch targets for short-loop.
 1.2 15-Mar-1999  jonathan branches: 1.2.20; 1.2.22;
Fix bug in construction of word-length version of 'c'.
Preserve input string and return it as per userlevel spec.
 1.1 28-Jan-1999  jonathan memset, derived from old kernel bcopy.
Uses negative register offsets in memory writes, to avoid r4k silicon bugs.
 1.2.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.20.1 22-Oct-2001  nathanw Catch up to -current.
 1.3.18.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.18.1 19-Oct-2004  skrll Sync with HEAD
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 29-Sep-2004  sekiya branches: 1.2.4; 1.2.6;
Use 64-bit-clean addition/subtraction opcodes for pointer arithmetic iff
_LP64 is defined.
 1.1 15-Jan-1999  castor branches: 1.1.42;
Break out utility functions from locore.S
 1.1.42.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.42.1 19-Oct-2004  skrll Sync with HEAD
 1.2.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.4.1 29-Apr-2005  kent sync with -current
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 29-Sep-2004  sekiya branches: 1.2.12;
Use 64-bit-clean addition/subtraction opcodes for pointer arithmetic iff
_LP64 is defined.
 1.1 15-Jan-1999  castor branches: 1.1.42;
Break out utility functions from locore.S
 1.1.42.1 19-Oct-2004  skrll Sync with HEAD
 1.2.12.1 21-Jun-2006  yamt sync with head.
 1.1 03-Sep-2014  matt branches: 1.1.18;
New files for OR1K support
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 03-Sep-2014  jdolecek file Makefile.inc was added on branch tls-maxphys on 2017-12-03 11:38:46 +0000
 1.34 30-May-2022  rin Restrict strictly-aligned versions of memcmp(9), memcpy(9), and
memmove(9) to 403, instead of all evbppc machines.

Introduce strict-align LIBKERN_MD_FLAGS for this purpose.
 1.33 26-Jul-2021  rin Improve previous:

- Add suffix ``d'' for mkdep(1).
- Improve comment a little...
 1.32 24-Jul-2021  rin For evbppc, use C version of memcpy(3), memcmp(3), and memmove(3)
consistently for *.{po,pico,go} (for RUMP), in order to avoid
alignment faults for 403.
 1.31 02-Jul-2011  matt branches: 1.31.70;
Add the _restgpr* and _savegpr* entries that GCC 4.5 wants. This file is
designed to support the other GCC 4.5 variants that may be required.
 1.30 17-Jan-2011  matt Kill _NOREGNAMES. Everything should be using %rX now. If it doesn't it
soon will.
 1.29 16-Jan-2011  matt branches: 1.29.2;
Add -D_NOREGNAMES
 1.28 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.27 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.26 18-Mar-2009  tsutsui - remove bcmp(9), bcopy(9), and bzero(9) from libkern since <sys/systm.h> has
macro which replace them with mem*() functions in #ifdef _KERNEL as noted
in man pages
- move declarations of bcopy(3) and bzero(3) into <lib/libsa/stand.h>
since they are still in libsa for some MD standalone sources
(I guess all bcmp(3) in standalone sources have been replaced with memcmp(3)
but they should be replaced with memcmp() anyway)
 1.25 18-Apr-2008  garbled branches: 1.25.4; 1.25.12; 1.25.18;
Back out the ppc assembler changes for memcpy/memmove/memcmp on evbppc.
It breaks the explora because the cpu (403) cannot deal with unaligned
accesses. Reported by Juergen Hannken-Illjes.
 1.24 11-Dec-2005  christos branches: 1.24.70;
merge ktrace-lwp.
 1.23 10-Aug-2003  matt Add a memset.S (does not use dcbz; to be added later). It does both bzero
and memset.
 1.22 25-Feb-2003  matt branches: 1.22.2;
Switch back to generic bzero/memset until new one is shown to work.
 1.21 24-Feb-2003  matt Actually use bzero.S. Also fix bzero to use GET_CPUINFO
 1.20 24-Feb-2003  matt Don't make memset.c since bzero.o has memset in addition to bzero.
 1.19 02-Dec-2001  mjl Disable bzero/memset assembler implementation until the dependency
problem on assym.h is sorted out and TRW to get at CACHELINESIZE in
the kernel is determined.
 1.18 30-Nov-2001  mjl Add assembler version of strlen.
 1.17 29-Nov-2001  mjl Add assembler versions of ffs, bzero and memset.
 1.16 01-Nov-2000  thorpej branches: 1.16.2; 1.16.4;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.15 01-Feb-2000  danw add strtoul
 1.14 17-Apr-1999  ws branches: 1.14.2;
Modify syncicache on PowerPC from an inline to a real function.
Support different cache line sizes with the same object code in userland.
While here, move the function to implementation name space.
 1.13 04-Aug-1998  perry branches: 1.13.8;
remove memcpy.c -- I forgot this gets built anyway
 1.12 04-Aug-1998  perry remove memmove.c -- I forgot this gets built anyway
 1.11 04-Aug-1998  perry add memcmp.c memcpy.c memmove.c
 1.10 22-Feb-1998  mycroft Fix typo.
 1.9 22-Feb-1998  mycroft Don't list bcopy.c here, since we only want memcpy() and not bcopy().
XXX What a kluge!
 1.8 22-Feb-1998  mycroft We need memcpy().
 1.7 22-Feb-1998  mycroft Add some missing things.
 1.6 22-Feb-1998  mycroft Pull in [hn]to[nh][ls].c.
 1.5 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.4 24-Oct-1997  chuck add memchr() to libkern
 1.3 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.2 18-Jan-1997  cgd branches: 1.2.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.1 30-Sep-1996  ws PowerPC port
 1.2.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.14.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.14.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.16.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.4.2 19-Aug-2009  yamt sync with head.
 1.25.4.1 04-May-2009  yamt sync with head.
 1.29.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.31.70.1 01-Aug-2021  thorpej Sync with HEAD.
 1.6 10-Aug-2003  matt Add a memset.S (does not use dcbz; to be added later). It does both bzero
and memset.
 1.5 24-Feb-2003  matt branches: 1.5.2;
Actually use bzero.S. Also fix bzero to use GET_CPUINFO
 1.4 30-Jul-2002  matt cpu_info is not in spr0, but spr_g_0.
 1.3 13-Mar-2002  eeh branches: 1.3.4;
Updated from libc.
 1.2 30-Nov-2001  mjl branches: 1.2.2; 1.2.4;
Outifdef some stuff not needed in the _KERNEL case.
 1.1 29-Nov-2001  mjl Add assembler versions of ffs, bzero and memset.
 1.2.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 30-Nov-2001  thorpej file bzero.S was added on branch kqueue on 2002-01-10 20:00:34 +0000
 1.2.2.4 01-Aug-2002  nathanw Catch up to -current.
 1.2.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.1 30-Nov-2001  nathanw file bzero.S was added on branch nathanw_sa on 2002-01-08 00:32:51 +0000
 1.3.4.1 29-Aug-2002  gehenna catch up with -current.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 29-Nov-2001  mjl branches: 1.1.2; 1.1.4; 1.1.36;
Add assembler versions of ffs, bzero and memset.
 1.1.36.1 21-Jun-2006  yamt sync with head.
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 29-Nov-2001  thorpej file ffs.S was added on branch kqueue on 2002-01-10 20:00:34 +0000
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 29-Nov-2001  nathanw file ffs.S was added on branch nathanw_sa on 2002-01-08 00:32:51 +0000
 1.4 28-Oct-2011  christos shouldn't need .size for ppc64.
 1.3 12-Aug-2011  matt Fix bug when only restoring r31 (lr was not being restored properly).
 1.2 02-Jul-2011  mrg fix the names of the _END symbols passed to .size; fixes rump issues,
and kernels still work fine, and ofwboot still links.
 1.1 02-Jul-2011  matt Add the _restgpr* and _savegpr* entries that GCC 4.5 wants. This file is
designed to support the other GCC 4.5 variants that may be required.
 1.7 17-Jan-2011  matt Don't define _NOREGNAMES since all of libkern is now compiled with it.
 1.6 04-Mar-2007  christos branches: 1.6.64;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 11-Dec-2005  christos branches: 1.5.26;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 04-Dec-2003  keihan branches: 1.3.4; 1.3.10; 1.3.12;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.2 27-Aug-2003  matt Actually the right instruction to fill a half-word.
From Juergen Hannken-Illjes hannken at eis dot cs dot tu-bs dot de
 1.1 10-Aug-2003  matt Add a memset.S (does not use dcbz; to be added later). It does both bzero
and memset.
 1.3.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.4.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 04-Dec-2003  skrll file memset.S was added on branch ktrace-lwp on 2004-08-03 10:53:49 +0000
 1.4.4.1 03-Sep-2007  yamt sync with head.
 1.5.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.64.1 05-Mar-2011  rmind sync with head
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 04-Dec-2003  keihan branches: 1.2.8; 1.2.10;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 30-Nov-2001  mjl branches: 1.1.2; 1.1.4; 1.1.20;
Add assembler version of strlen.
 1.1.20.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.20.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 30-Nov-2001  thorpej file strlen.S was added on branch kqueue on 2002-01-10 20:00:35 +0000
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 30-Nov-2001  nathanw file strlen.S was added on branch nathanw_sa on 2002-01-08 00:32:52 +0000
 1.2.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.14 18-Mar-2008  he When compiling for _STANDALONE, omit a bunch of headers which aren't really
needed and which trigger build problems.

(These two files should probably be unified and put under common/...)
 1.13 24-Dec-2005  perry branches: 1.13.46; 1.13.66; 1.13.70;
__asm__ -> __asm
 1.12 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 27-Jul-2005  simonb KNF nit.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 28-Mar-2002  matt branches: 1.8.10; 1.8.18; 1.8.20;
Refresh from libc.
 1.7 26-Mar-2002  matt Use size_t in prototype (so this will be LP64 clean for PPC64 someday).
Calculate len separately for icache & dcache in case each has different
cacheline widths. Make the code for both loops the same except for the
dcbst/icbi. Deal with sizes >=2GB properly (like that'll happen but ...)
 1.6 18-Mar-2002  dbj make compile with _STANDALONE
 1.5 13-Mar-2002  eeh Updated from libc.
 1.4 22-Aug-2001  matt 7450 requires a sync before the the isync (MPC7450UM - 3.4.4.8)
 1.3 27-Jun-2000  mrg branches: 1.3.2; 1.3.4;
<vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 05-May-1999  tsubai branches: 1.2.2; 1.2.4;
Copy from libc.
 1.1 17-Apr-1999  ws Modify syncicache on PowerPC from an inline to a real function.
Support different cache line sizes with the same object code in userland.
While here, move the function to implementation name space.
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.3.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.8.20.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.18.1 29-Apr-2005  kent sync with -current
 1.8.10.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.10.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.4.2 24-Mar-2008  yamt sync with head.
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.13.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.66.1 24-Mar-2008  keiichi sync with head.
 1.13.46.1 23-Mar-2008  matt sync with HEAD
 1.1 19-Sep-2014  matt branches: 1.1.18;
New files for Userland support of UCB RISC-V (both 32-bit and 64-bit)
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 19-Sep-2014  jdolecek file Makefile.inc was added on branch tls-maxphys on 2017-12-03 11:38:46 +0000
 1.19 04-Aug-2011  uwe For unsignad integer division gcc used to emit a call to __udivsi3
"millicode" function that uses compiler-private ABI. Newer gcc uses
heavily tuned __udivsi3_i4i that is NOT compatible with __udivsi3
because it's expected to clobber different registers. We don't want
to link the kernel against libgcc and we don't have resources to write
heavily tuned version ourselves, so clone __udivsi3 but adjust it to
conform to the __udivsi3_i4i clobber spec.

Ditto for signed division.

You can make gcc use old routines with -mdiv=call-div1 to avoid few
extra instructions to save/restore the right registers in the signed
division funcion.
 1.18 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.17 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.16 14-Mar-2007  uwe branches: 1.16.36;
Provide __movmemSI12_i4 (gcc4) a.k.a. __movstrSI12_i4 (gcc3) that gcc
emits for sh4 to copy 12 bytes at certain optimization levels.
Discovered by compiling landisk kernel with -Os.

Use gcc3 naming ("movstr") to match the rest of the "movstr" files.
 1.15 11-Dec-2005  christos branches: 1.15.24; 1.15.26; 1.15.30; 1.15.32;
merge ktrace-lwp.
 1.14 14-Nov-2003  uwe branches: 1.14.16;
Use assembler version of bswap64.
 1.13 13-Nov-2003  uwe Eliminate bzero.
 1.12 08-Nov-2003  uwe Nuke bcopy. Move the code to memmove.S (which it is) make memmove the
primary entry point and comment out the bcopy entry point.

Kernels before and after the change are identical.
 1.11 08-Nov-2003  jdolecek no need for bcmp.c
 1.10 20-Nov-2002  itohy branches: 1.10.6;
Use assembly version of bzero() and memset().
 1.9 21-Sep-2002  chs add strtoul.c, it's now used in MI code.
 1.8 05-Sep-2002  msaitoh Add __movstr_i4_{odd,even} for -m4.
Written by SHIMIZU Ryo.
 1.7 24-Aug-2002  itohy Use assembly version of ffs(3).
 1.6 01-Nov-2000  thorpej branches: 1.6.2; 1.6.4; 1.6.16;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.5 21-Jul-2000  msaitoh compile byte_swap_2.S and byte_swap_4.S
 1.4 09-Jun-2000  msaitoh branches: 1.4.2;
new bcopy.S
 1.3 20-Apr-2000  msaitoh branches: 1.3.2;
asm bcopy() for sh3
 1.2 21-Oct-1999  msaitoh add strncasecmp.c
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.4; 1.1.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.4.1 15-Nov-1999  fvdl Sync with -current
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.2.1 11-Aug-2000  msaitoh Pullup revision 1.5 (approved by thorpej):

compile byte_swap_*.S
 1.6.16.1 29-Aug-2002  gehenna catch up with -current.
 1.6.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.6.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.6.2.1 27-Aug-2002  nathanw Catch up to -current.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 03-Aug-2004  skrll Sync with HEAD
 1.14.16.1 03-Sep-2007  yamt sync with head.
 1.15.32.1 11-Jul-2007  mjf Sync with head.
 1.15.30.1 10-Apr-2007  ad Sync with head.
 1.15.26.1 24-Mar-2007  yamt sync with head.
 1.15.24.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by uwe in ticket #585):
sys/lib/libkern/arch/sh3/Makefile.inc: revision 1.16
sys/lib/libkern/arch/sh3/movstrSI12_i4.S: revision 1.1
Provide __movmemSI12_i4 (gcc4) a.k.a. __movstrSI12_i4 (gcc3) that gcc
emits for sh4 to copy 12 bytes at certain optimization levels.
Discovered by compiling landisk kernel with -Os.
Use gcc3 naming ("movstr") to match the rest of the "movstr" files.
 1.16.36.1 19-Aug-2009  yamt sync with head.
 1.7 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.6 22-May-2006  uwe branches: 1.6.2; 1.6.58; 1.6.62; 1.6.72;
G/c #ifdef PIC we inherited from the userland.
 1.5 22-Apr-2006  uwe branches: 1.5.2; 1.5.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.4 20-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8;
Use common sources with userland.
 1.3 14-Feb-2001  msaitoh branches: 1.3.40;
don't profile (use NENTRY() and ALTENTRY())
 1.2 14-Feb-2001  msaitoh _C_LABEL()
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.3.40.1 21-Jun-2006  yamt sync with head.
 1.4.8.1 24-May-2006  yamt sync with head.
 1.4.6.1 01-Jun-2006  kardel Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.4.1 19-Jun-2006  chap Sync with head.
 1.5.2.2 11-May-2006  elad sync with head
 1.5.2.1 22-Apr-2006  elad file ashiftrt.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.6.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.62.1 04-May-2009  yamt sync with head.
 1.6.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.6.2.1 22-May-2006  tron file ashiftrt.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.6 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.5 22-May-2006  uwe branches: 1.5.2; 1.5.58; 1.5.62; 1.5.72;
G/c #ifdef PIC we inherited from the userland.
 1.4 22-Apr-2006  uwe branches: 1.4.2; 1.4.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.3 20-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8;
Use common sources with userland.
 1.2 14-Feb-2001  msaitoh branches: 1.2.40;
_C_LABEL()
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.2.40.1 21-Jun-2006  yamt sync with head.
 1.3.8.1 24-May-2006  yamt sync with head.
 1.3.6.1 01-Jun-2006  kardel Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.4.1 19-Jun-2006  chap Sync with head.
 1.4.2.2 11-May-2006  elad sync with head
 1.4.2.1 22-Apr-2006  elad file ashlsi3.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.5.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.62.1 04-May-2009  yamt sync with head.
 1.5.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.2.1 22-May-2006  tron file ashlsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.6 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.5 22-May-2006  uwe branches: 1.5.2; 1.5.58; 1.5.62; 1.5.72;
G/c #ifdef PIC we inherited from the userland.
 1.4 22-Apr-2006  uwe branches: 1.4.2; 1.4.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.3 20-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8;
Use common sources with userland.
 1.2 14-Feb-2001  msaitoh branches: 1.2.40;
_C_LABEL()
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.2.40.1 21-Jun-2006  yamt sync with head.
 1.3.8.1 24-May-2006  yamt sync with head.
 1.3.6.1 01-Jun-2006  kardel Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.4.1 19-Jun-2006  chap Sync with head.
 1.4.2.2 11-May-2006  elad sync with head
 1.4.2.1 22-Apr-2006  elad file ashrsi3.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.5.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.62.1 04-May-2009  yamt sync with head.
 1.5.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.2.1 22-May-2006  tron file ashrsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.4 08-Nov-2003  uwe Nuke bcopy. Move the code to memmove.S (which it is) make memmove the
primary entry point and comment out the bcopy entry point.

Kernels before and after the change are identical.
 1.3 20-Nov-2002  itohy branches: 1.3.6;
memcpy() and memmove() must return the first parameter.
Problem found by itohy, fixed by SHIMIZU Ryo.
 1.2 09-Jun-2000  msaitoh branches: 1.2.4; 1.2.6;
new bcopy.S
 1.1 20-Apr-2000  msaitoh branches: 1.1.2;
asm bcopy() for sh3
 1.1.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.6.1 11-Dec-2002  thorpej Sync with HEAD.
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.4.1 09-Jun-2000  bouyer file bcopy.S was added on branch thorpej_scsipi on 2000-11-20 18:09:30 +0000
 1.3.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6 14-Apr-2006  nonaka Always _LOCORE is defined for standalone program.
 1.5 04-Feb-2006  uwe branches: 1.5.2; 1.5.4; 1.5.6;
Truncate the argument to 16 bit with extu.w
 1.4 11-Dec-2005  christos branches: 1.4.2; 1.4.4; 1.4.6;
merge ktrace-lwp.
 1.3 09-Nov-2003  uwe branches: 1.3.16;
Compile identity ntoh*/hton* only for big endian case.
 1.2 21-Jul-2000  msaitoh branches: 1.2.24;
support "big endian", too.
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.12;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.12.1 11-Aug-2000  msaitoh Pullup revision 1.5 (approved by thorpej):

support big endian, too.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.4.2.1 18-Feb-2006  yamt sync with head.
 1.5.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.4.1 19-Apr-2006  elad sync with head.
 1.5.2.1 24-May-2006  yamt sync with head.
 1.5 14-Apr-2006  nonaka Always _LOCORE is defined for standalone program.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.12;
merge ktrace-lwp.
 1.3 09-Nov-2003  uwe branches: 1.3.16;
Compile identity ntoh*/hton* only for big endian case.
 1.2 21-Jul-2000  msaitoh branches: 1.2.24;
support "big endian", too.
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.12;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.12.1 11-Aug-2000  msaitoh Pullup revision 1.2 (approved by thorpej):

support big endian, too.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.4.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.4.10.1 19-Apr-2006  elad sync with head.
 1.4.8.1 24-May-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 14-Nov-2003  uwe branches: 1.1.4;
bswap64 written in assembler.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 14-Nov-2003  skrll file byte_swap_8.S was added on branch ktrace-lwp on 2004-08-03 10:53:49 +0000
 1.2 13-Nov-2003  uwe Eliminate bzero.
 1.1 20-Nov-2002  itohy branches: 1.1.2; 1.1.8;
Assembly version of bzero()/memset().
Written by SHIMIZU Ryo.
 1.1.8.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 20-Nov-2002  thorpej file bzero.S was added on branch nathanw_sa on 2002-12-11 06:46:25 +0000
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 01-Sep-2002  itohy branches: 1.4.2; 1.4.24;
Save 1-4 instructions on all cases except for the ret=0 case.

This is probably the last version from me. :)
You are welcome to speed it up, of course. :)

Here's a benchmark on SH-4 200MHz.
9.2% faster if all the cases occur evenly.

return value C version previous vers this version speed ratio
of ffs() (ns/call) *1 (ns/call) (ns/call) *2 (*1/*2)
 1.3 28-Aug-2002  itohy branches: 1.3.2;
Slightly improved version of ffs(3).
Partially from SHIMIZU Ryo <ryo@iij.ad.jp>. Thanks.
Some cases are slower, but other most cases are faster.

Here's a benchmark on SH-4 200MHz.

return value C version previous vers this version speed ratio
of ffs() (ns/call) *1 (ns/call) (ns/call) *2 (*1/*2)
 1.2 24-Aug-2002  itohy branches: 1.2.2;
Oops, SYSLIBC_SCCS -> LIBC_SCCS
 1.1 24-Aug-2002  itohy Assembly version of ffs(3).
Confirmed to return the same value as that of the C version.

The results of a simple benchmark on SH-4 200MHz, is shown below.
I think this shows acceptable performance.

return value C version this version speed
of ffs() (ns/call) (ns/call) ratio
 1.2.2.3 17-Sep-2002  nathanw Catch up to -current.
 1.2.2.2 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.1 24-Aug-2002  nathanw file ffs.S was added on branch nathanw_sa on 2002-08-27 23:47:46 +0000
 1.3.2.2 29-Aug-2002  gehenna catch up with -current.
 1.3.2.1 28-Aug-2002  gehenna file ffs.S was added on branch gehenna-devsw on 2002-08-29 05:23:20 +0000
 1.4.24.1 21-Jun-2006  yamt sync with head.
 1.4.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.2.1 01-Sep-2002  jdolecek file ffs.S was added on branch kqueue on 2002-09-06 08:48:31 +0000
 1.6 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.5 22-May-2006  uwe branches: 1.5.2; 1.5.58; 1.5.62; 1.5.72;
G/c #ifdef PIC we inherited from the userland.
 1.4 22-Apr-2006  uwe branches: 1.4.2; 1.4.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.3 20-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8;
Use common sources with userland.
 1.2 14-Feb-2001  msaitoh branches: 1.2.40;
_C_LABEL()
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.2.40.1 21-Jun-2006  yamt sync with head.
 1.3.8.1 24-May-2006  yamt sync with head.
 1.3.6.1 01-Jun-2006  kardel Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.4.1 19-Jun-2006  chap Sync with head.
 1.4.2.2 11-May-2006  elad sync with head
 1.4.2.1 22-Apr-2006  elad file lshrsi3.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.5.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.62.1 04-May-2009  yamt sync with head.
 1.5.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.2.1 22-May-2006  tron file lshrsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 09-Jun-2000  msaitoh branches: 1.2.4; 1.2.44;
new bcopy.S
 1.1 20-Apr-2000  msaitoh branches: 1.1.2;
asm bcopy() for sh3
 1.1.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.44.1 21-Jun-2006  yamt sync with head.
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.4.1 09-Jun-2000  bouyer file memcpy.S was added on branch thorpej_scsipi on 2000-11-20 18:09:31 +0000
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 09-Nov-2003  uwe branches: 1.4.16;
Get rid of bcopy relics. Minimize diffs against the libc version.
 1.3 08-Nov-2003  uwe Nuke bcopy. Move the code to memmove.S (which it is) make memmove the
primary entry point and comment out the bcopy entry point.

Kernels before and after the change are identical.
 1.2 09-Jun-2000  msaitoh branches: 1.2.4; 1.2.28;
new bcopy.S
 1.1 20-Apr-2000  msaitoh branches: 1.1.2;
asm bcopy() for sh3
 1.1.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.28.1 03-Aug-2004  skrll Sync with HEAD
 1.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.4.1 09-Jun-2000  bouyer file memmove.S was added on branch thorpej_scsipi on 2000-11-20 18:09:31 +0000
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 20-Nov-2002  itohy branches: 1.1.2; 1.1.24;
Assembly version of bzero()/memset().
Written by SHIMIZU Ryo.
 1.1.24.1 21-Jun-2006  yamt sync with head.
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 20-Nov-2002  thorpej file memset.S was added on branch nathanw_sa on 2002-12-11 06:46:25 +0000
 1.9 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.8 22-May-2006  uwe branches: 1.8.2; 1.8.58; 1.8.62; 1.8.72;
Provide __movmem* aliases to __movstr* functions.
Gcc4 uses movmem, older versions use movstr.
 1.7 22-May-2006  uwe G/c #ifdef PIC we inherited from the userland.
 1.6 22-Apr-2006  uwe branches: 1.6.2; 1.6.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.5 20-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8;
Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 14-Feb-2001  msaitoh branches: 1.2.24; 1.2.32; 1.2.34;
_C_LABEL()
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.2.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.32.1 29-Apr-2005  kent sync with -current
 1.2.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.5.8.1 24-May-2006  yamt sync with head.
 1.5.6.1 01-Jun-2006  kardel Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.4.1 19-Jun-2006  chap Sync with head.
 1.6.2.2 11-May-2006  elad sync with head
 1.6.2.1 22-Apr-2006  elad file movstr.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.8.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.62.1 04-May-2009  yamt sync with head.
 1.8.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.2.1 22-May-2006  tron file movstr.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2 16-Sep-1999  msaitoh unused file (we have an asm version)
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.8 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.7 22-May-2006  uwe branches: 1.7.2; 1.7.58; 1.7.62; 1.7.72;
Provide __movmem* aliases to __movstr* functions.
Gcc4 uses movmem, older versions use movstr.
 1.6 22-May-2006  uwe G/c #ifdef PIC we inherited from the userland.
 1.5 22-Apr-2006  uwe branches: 1.5.2; 1.5.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.4 20-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8;
Use common sources with userland.
 1.3 14-Feb-2001  msaitoh branches: 1.3.40;
don't profile (use NENTRY() and ALTENTRY())
 1.2 14-Feb-2001  msaitoh ENTRY()
 1.1 09-Jun-2000  msaitoh branches: 1.1.4; 1.1.6;
movstrSI*() for gcc -Os
 1.1.6.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.6.1 09-Jun-2000  bouyer file movstrSI.S was added on branch thorpej_scsipi on 2000-11-20 18:09:31 +0000
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 09-Jun-2000  minoura file movstrSI.S was added on branch minoura-xpg4dl on 2000-06-22 17:09:28 +0000
 1.3.40.1 21-Jun-2006  yamt sync with head.
 1.4.8.1 24-May-2006  yamt sync with head.
 1.4.6.1 01-Jun-2006  kardel Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.4.1 19-Jun-2006  chap Sync with head.
 1.5.2.2 11-May-2006  elad sync with head
 1.5.2.1 22-Apr-2006  elad file movstrSI.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.7.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.62.1 04-May-2009  yamt sync with head.
 1.7.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.2.1 22-May-2006  tron file movstrSI.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.1 14-Mar-2007  uwe branches: 1.1.4; 1.1.6; 1.1.10; 1.1.12; 1.1.22; 1.1.42; 1.1.46; 1.1.56;
Provide __movmemSI12_i4 (gcc4) a.k.a. __movstrSI12_i4 (gcc3) that gcc
emits for sh4 to copy 12 bytes at certain optimization levels.
Discovered by compiling landisk kernel with -Os.

Use gcc3 naming ("movstr") to match the rest of the "movstr" files.
 1.1.56.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.46.1 04-May-2009  yamt sync with head.
 1.1.42.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.22.2 03-Sep-2007  yamt sync with head.
 1.1.22.1 14-Mar-2007  yamt file movstrSI12_i4.S was added on branch yamt-lazymbuf on 2007-09-03 14:41:30 +0000
 1.1.12.2 11-Jul-2007  mjf Sync with head.
 1.1.12.1 14-Mar-2007  mjf file movstrSI12_i4.S was added on branch mjf-ufs-trans on 2007-07-11 20:10:28 +0000
 1.1.10.2 20-Apr-2007  bouyer Pull up following revision(s) (requested by uwe in ticket #585):
sys/lib/libkern/arch/sh3/Makefile.inc: revision 1.16
sys/lib/libkern/arch/sh3/movstrSI12_i4.S: revision 1.1
Provide __movmemSI12_i4 (gcc4) a.k.a. __movstrSI12_i4 (gcc3) that gcc
emits for sh4 to copy 12 bytes at certain optimization levels.
Discovered by compiling landisk kernel with -Os.
Use gcc3 naming ("movstr") to match the rest of the "movstr" files.
 1.1.10.1 14-Mar-2007  bouyer file movstrSI12_i4.S was added on branch netbsd-4 on 2007-04-20 20:35:32 +0000
 1.1.6.2 10-Apr-2007  ad Sync with head.
 1.1.6.1 14-Mar-2007  ad file movstrSI12_i4.S was added on branch vmlocking on 2007-04-10 13:26:18 +0000
 1.1.4.2 24-Mar-2007  yamt sync with head.
 1.1.4.1 14-Mar-2007  yamt file movstrSI12_i4.S was added on branch yamt-idlelwp on 2007-03-24 14:56:07 +0000
 1.6 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.5 22-May-2006  uwe branches: 1.5.2; 1.5.58; 1.5.62; 1.5.72;
Provide __movmem* aliases to __movstr* functions.
Gcc4 uses movmem, older versions use movstr.
 1.4 22-May-2006  uwe G/c #ifdef PIC we inherited from the userland.
 1.3 22-Apr-2006  uwe branches: 1.3.2; 1.3.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.2 20-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8;
Use common sources with userland.
 1.1 05-Sep-2002  msaitoh branches: 1.1.2; 1.1.4; 1.1.26;
Add __movstr_i4_{odd,even} for -m4.
Written by SHIMIZU Ryo.
 1.1.26.1 21-Jun-2006  yamt sync with head.
 1.1.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.4.1 05-Sep-2002  jdolecek file movstr_i4.S was added on branch kqueue on 2002-10-10 18:43:26 +0000
 1.1.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.1.2.1 05-Sep-2002  nathanw file movstr_i4.S was added on branch nathanw_sa on 2002-09-17 21:22:35 +0000
 1.2.8.1 24-May-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.4.1 19-Jun-2006  chap Sync with head.
 1.3.2.2 11-May-2006  elad sync with head
 1.3.2.1 22-Apr-2006  elad file movstr_i4.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.5.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.62.1 04-May-2009  yamt sync with head.
 1.5.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.2.1 22-May-2006  tron file movstr_i4.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.6 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.5 22-May-2006  uwe branches: 1.5.2; 1.5.58; 1.5.62; 1.5.72;
G/c #ifdef PIC we inherited from the userland.
 1.4 22-Apr-2006  uwe branches: 1.4.2; 1.4.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.3 20-Dec-2005  christos branches: 1.3.4; 1.3.6; 1.3.8;
Use common sources with userland.
 1.2 14-Feb-2001  msaitoh branches: 1.2.40;
_C_LABEL()
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.2.40.1 21-Jun-2006  yamt sync with head.
 1.3.8.1 24-May-2006  yamt sync with head.
 1.3.6.1 01-Jun-2006  kardel Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.4.1 19-Jun-2006  chap Sync with head.
 1.4.2.2 11-May-2006  elad sync with head
 1.4.2.1 22-Apr-2006  elad file mulsi3.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.5.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.62.1 04-May-2009  yamt sync with head.
 1.5.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.2.1 22-May-2006  tron file mulsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.12 05-Aug-2011  uwe Reword the comment about "millicode" nature of these functions and add
it to sdivsi3.S too.

Remove !_KERNEL code left over from the days when we shared these
files with userland.

Use .L prefix for local label.
 1.11 14-Jul-2011  mrg revert the _i4i aliases. they are not the right thing.
 1.10 06-Jul-2011  mrg add weak aliases for __sdivsi3_i4i and __udivsi3_i4i.
 1.9 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.8 22-May-2006  uwe branches: 1.8.2; 1.8.58; 1.8.62; 1.8.72;
G/c #ifdef PIC we inherited from the userland.
 1.7 22-Apr-2006  uwe branches: 1.7.2; 1.7.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.6 20-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8;
Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 07-Aug-2003  agc branches: 1.4.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 09-Sep-2000  msaitoh branches: 1.3.24;
check _STANDALONE macro, too.
 1.2 03-Jan-2000  msaitoh branches: 1.2.4;
don't clobber r4 and r5
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.4.1 21-Sep-2000  msaitoh pullup revision 1.3 (approved by thorpej):

check _STANDALONE macro, too (for boot-loader)
 1.3.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.24.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.6.8.1 24-May-2006  yamt sync with head.
 1.6.6.1 01-Jun-2006  kardel Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.4.1 19-Jun-2006  chap Sync with head.
 1.7.2.2 11-May-2006  elad sync with head
 1.7.2.1 22-Apr-2006  elad file sdivsi3.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.8.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.62.1 04-May-2009  yamt sync with head.
 1.8.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.2.1 22-May-2006  tron file sdivsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2 05-Aug-2011  uwe Reword the comment about "millicode" nature of these functions and add
it to sdivsi3_i4i.S too.
 1.1 04-Aug-2011  uwe For unsignad integer division gcc used to emit a call to __udivsi3
"millicode" function that uses compiler-private ABI. Newer gcc uses
heavily tuned __udivsi3_i4i that is NOT compatible with __udivsi3
because it's expected to clobber different registers. We don't want
to link the kernel against libgcc and we don't have resources to write
heavily tuned version ourselves, so clone __udivsi3 but adjust it to
conform to the __udivsi3_i4i clobber spec.

Ditto for signed division.

You can make gcc use old routines with -mdiv=call-div1 to avoid few
extra instructions to save/restore the right registers in the signed
division funcion.
 1.11 05-Aug-2011  uwe Reword the comment about "millicode" nature of these functions and add
it to sdivsi3.S too.

Remove !_KERNEL code left over from the days when we shared these
files with userland.

Use .L prefix for local label.
 1.10 14-Jul-2011  mrg revert the _i4i aliases. they are not the right thing.
 1.9 06-Jul-2011  mrg add weak aliases for __sdivsi3_i4i and __udivsi3_i4i.
 1.8 07-Jan-2009  uwe These copy of gcc millicode routines is now included in librump (that
sucks in all libkern sources), so mark them ".hidden". I'm not sure
if this is the best course of action (dropping millicode from librump
might be a better idea), but it's the quickest fix to get sh3 builds
going again for now.
 1.7 22-May-2006  uwe branches: 1.7.2; 1.7.58; 1.7.62; 1.7.72;
G/c #ifdef PIC we inherited from the userland.
 1.6 22-Apr-2006  uwe branches: 1.6.2; 1.6.4;
libc gets gcc millicode from libgcc, so we don't need to keep it
in src/common. Move it to sys/lib/libkern/arch/sh3.
 1.5 20-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8;
Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 21-Dec-1999  msaitoh branches: 1.2.28;
check _STANDALONE
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.8;
Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.28.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.5.8.1 24-May-2006  yamt sync with head.
 1.5.6.1 01-Jun-2006  kardel Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.4.1 19-Jun-2006  chap Sync with head.
 1.6.2.2 11-May-2006  elad sync with head
 1.6.2.1 22-Apr-2006  elad file udivsi3.S was added on branch elad-kernelauth on 2006-05-11 23:31:08 +0000
 1.7.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.62.1 04-May-2009  yamt sync with head.
 1.7.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.2.1 22-May-2006  tron file udivsi3.S was added on branch peter-altq on 2006-05-24 15:50:42 +0000
 1.2 05-Aug-2011  uwe Reword the comment about "millicode" nature of these functions and add
it to sdivsi3_i4i.S too.
 1.1 04-Aug-2011  uwe For unsignad integer division gcc used to emit a call to __udivsi3
"millicode" function that uses compiler-private ABI. Newer gcc uses
heavily tuned __udivsi3_i4i that is NOT compatible with __udivsi3
because it's expected to clobber different registers. We don't want
to link the kernel against libgcc and we don't have resources to write
heavily tuned version ourselves, so clone __udivsi3 but adjust it to
conform to the __udivsi3_i4i clobber spec.

Ditto for signed division.

You can make gcc use old routines with -mdiv=call-div1 to avoid few
extra instructions to save/restore the right registers in the signed
division funcion.
 1.3 18-Nov-1996  pk sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.36 17-Mar-2013  nakayama Revert previous. christos fixed the root cause.
 1.35 14-Mar-2013  nakayama Make sparc64 32-bit kernel buildable.
 1.34 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.33 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.32 11-Dec-2005  christos branches: 1.32.74;
merge ktrace-lwp.
 1.31 22-Apr-2005  reed Use ${TOOL_M4} instead of "m4". (I only tested this fix
for sparc but not sparc64 or alpha yet.)

Noticed problem when building NetBSD/sparc from a Linux/i386 host
that didn't have "m4".
 1.30 08-Nov-2003  lukem branches: 1.30.8;
Add '.SUFFIXES: .m4' here, now that <sys.mk> doesn't provide it anymore.
It appears that .PATH.m4: needs it.
Should fix problem noted in private mail by Markus W Kilbinger.
 1.29 08-Nov-2003  jdolecek don't need bcmp() and bzero()
 1.28 16-Apr-2002  martin branches: 1.28.10;
Add strtoul.c, otherwise kernels using "wi* at pcmcia?" do not work
anymore.

Why only four archs provide this is beyound me.
 1.27 01-Jul-2001  kleink branches: 1.27.2;
Sync with libc: use bzero-based assembly version of memset().
 1.26 01-Nov-2000  thorpej branches: 1.26.2;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.25 09-May-1999  pk branches: 1.25.2;
Add .PATH.m4
 1.24 24-Feb-1999  chs branches: 1.24.4;
don't list any *.S files in SRCS multiple times, once is enough.
 1.23 04-Aug-1998  perry branches: 1.23.2;
add memcmp.c
 1.22 22-Feb-1998  mycroft Move random() from kernel.
 1.21 22-Feb-1998  mycroft Don't list bcopy.c here, since we only want memcpy() and not bcopy().
XXX What a kluge!
 1.20 22-Feb-1998  mycroft We need memcpy().
 1.19 22-Feb-1998  mycroft Add some missing things.
 1.18 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.17 24-Oct-1997  chuck add memchr() to libkern
 1.16 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.15 18-Jan-1997  cgd branches: 1.15.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.14 18-Nov-1996  pk Remove `chmod 444's.
 1.13 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.12 23-Apr-1996  christos Remove memset.c; it is not currently used, and .c files should belong in
the MI portion of libkern. When/if we move to use mem* routines in the kernel
we can add it to the MI portion/write a memset.s.
 1.11 13-Apr-1996  cgd add strncasecmp.c to ports' libkern Makefile.inc's. When adding a new
source file to libkern, it should be added to _ALL_ ports makefiles if
it is machine-independent and used by machine-independent code (in
this case adosfs). (There are several arguments that say that
strncasecmp should not be in libkern at all, and i think they're
good ones, but as long as ADOSFS needs it to link, it has to be here
for all architectures.)
 1.10 07-Oct-1995  mycroft Remove setjmp() and ffs().
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 15-Sep-1994  deraadt gcc automatically calls memset in certain situations.
 1.7 30-Jun-1994  deraadt find divrem.m4 automatically
 1.6 22-Mar-1994  deraadt delete some unneeded things
 1.5 15-Jan-1994  pk Find source in the right places.
 1.4 05-Dec-1993  cgd use .S
 1.3 15-Oct-1993  cgd branches: 1.3.2;
add strncmp to anything
 1.2 15-Oct-1993  cgd add __main()
 1.1 13-Oct-1993  cgd move 'boot' and 'libkern' into 'lib'. generally clean up 'kernel library'
building and dependencies.
 1.3.2.2 05-Dec-1993  cgd use .S
 1.3.2.1 15-Oct-1993  cgd file Makefile.inc was added on branch magnum on 1993-12-05 01:52:48 +0000
 1.15.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.1 09-Nov-1998  chs initial snapshot. lots left to do.
 1.24.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.25.2.1 22-Nov-2000  bouyer Sync with HEAD.
 1.26.2.2 17-Apr-2002  nathanw Catch up to -current.
 1.26.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.27.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.28.10.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.10.1 03-Aug-2004  skrll Sync with HEAD
 1.30.8.1 29-Apr-2005  kent sync with -current
 1.32.74.1 19-Aug-2009  yamt sync with head.
 1.9 30-Mar-2006  uwe G/c this stale copy of SYS.h. It has not been updated since 1999. It
has not been used since an unused copy of setjmp.S has been removed
from here in 2002 (i386 removed its own in 1999).
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.10; 1.8.12;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 07-Aug-2003  agc branches: 1.6.8; 1.6.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.8.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.8.10.1 19-Apr-2006  elad sync with head.
 1.8.8.1 01-Apr-2006  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.6 27-Oct-2002  chs remove setjmp/longjmp from libkern, they're not used.
 1.5 05-Mar-1999  pk branches: 1.5.20;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.20.1 11-Nov-2002  nathanw Catch up to -current
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 01-Jul-2001  kleink branches: 1.6.22;
Sync with libc: use bzero-based assembly version of memset().
 1.5 05-Mar-1999  pk branches: 1.5.20;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.20.1 24-Aug-2001  nathanw Catch up with -current.
 1.6.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.22.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.9 13-Jun-2011  mrg catch up with the userland copy:
>revision 1.6
>date: 2011/03/23 20:54:35; author: martin; state: Exp; lines: +2 -2
>Avoid using %g7

fixes rump on sparc, at least somewhat.
tested that normal kernels runs fine this with this change, too.
 1.8 11-Dec-2005  christos branches: 1.8.108;
merge ktrace-lwp.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 05-Mar-1999  pk branches: 1.6.42;
Sync with libc
 1.5 13-Oct-1997  lukem rcsid fascism
 1.4 18-Nov-1996  pk branches: 1.4.10;
sync with libc source: remove DEFS.h
 1.3 22-Apr-1995  pk eserve the equality "x == y*(x/y)+(x%y)" for negative y; from Lon Willett.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.4.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.42.1 03-Aug-2004  skrll Sync with HEAD
 1.8.108.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.14 20-Dec-2005  christos Use common sources with userland.
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 07-Aug-2003  agc branches: 1.12.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 13-May-2001  kleink branches: 1.11.22;
Make this work for PIC (as opposed to pic) without taking chances of fitting
__ffstab into a GOT13 relocation; from Eduardo Horvath.
 1.10 06-Sep-1999  chs branches: 1.10.14;
sync with libc:
use RODATA() instead of ENTRY() for __ffstab so that it works when profiling.
 1.9 05-Mar-1999  pk Sync with libc
 1.8 24-Feb-1999  chs use RODATA(__ffstab) instead of ENTRY().
this makes profiling kernels work on the sparc.
 1.7 07-May-1998  pk branches: 1.7.4;
Sync with libc.
 1.6 22-Feb-1998  mycroft Fix omission in last.
 1.5 22-Feb-1998  mycroft Copy up.
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.4.1 25-Feb-1999  chs sync with HEAD - profiling fixes.
 1.10.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.22.1 03-Aug-2004  skrll Sync with HEAD
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 01-Jul-2001  kleink branches: 1.1.4; 1.1.40;
Sync with libc: use bzero-based assembly version of memset().
 1.1.40.1 21-Jun-2006  yamt sync with head.
 1.1.4.2 24-Aug-2001  nathanw Catch up with -current.
 1.1.4.1 01-Jul-2001  nathanw file memset.S was added on branch nathanw_sa on 2001-08-24 00:11:52 +0000
 1.6 23-Apr-1996  christos Remove memset.c; it is not currently used, and .c files should belong in
the MI portion of libkern. When/if we move to use mem* routines in the kernel
we can add it to the MI portion/write a memset.s.
 1.5 18-Apr-1996  cgd don't include user-land headers in libkern files when compiling for
the kernel. memset.c does not belong here. it either belongs in
the MI libkern directory, or does not belong in libkern at all.
 1.4 11-Mar-1996  scottr Back out previous change.
 1.3 11-Mar-1996  thorpej Provide a memset() for the i386 (assembly version), and move memset.c
out into the libkern proper in case other ports want to use it.
i386 kernels with COMPAT_LINUX should compile now.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 15-Sep-1994  deraadt gcc automatically calls memset in certain situations.
 1.9 20-Dec-2005  christos Use common sources with userland.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 07-Aug-2003  agc branches: 1.6.8; 1.6.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.5 07-Mar-2014  nakayama Align explicitly to make kernels compiled by clang generate
properly aligned code.
 1.4 12-Sep-2013  joerg Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.3 05-Jan-2009  pooka branches: 1.3.14; 1.3.24; 1.3.28;
Fix previous. I have no idea what crack I was on when I "tested" them.
 1.2 04-Jan-2009  pooka Support PIC for inclusion in librump. (m68k untested)
 1.1 22-Feb-1998  mycroft branches: 1.1.146; 1.1.150; 1.1.160;
Move random() from kernel.
 1.1.160.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.150.1 04-May-2009  yamt sync with head.
 1.1.146.1 17-Jan-2009  mjf Sync with HEAD.
 1.3.28.1 18-May-2014  rmind sync with head
 1.3.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.6 27-Oct-2002  chs remove setjmp/longjmp from libkern, they're not used.
 1.5 05-Mar-1999  pk branches: 1.5.20;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.20.1 11-Nov-2002  nathanw Catch up to -current
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 05-Mar-1999  pk branches: 1.5.42;
Sync with libc
 1.4 13-Oct-1997  lukem rcsid fascism
 1.3 18-Nov-1996  pk branches: 1.3.10;
sync with libc source: remove DEFS.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jun-1994  deraadt auto-copied from libc
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.11 17-Mar-2013  nakayama Remove duplicate source files.
 1.10 14-Aug-2009  dsl branches: 1.10.12; 1.10.22;
Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.9 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.8 11-Dec-2005  christos branches: 1.8.74;
merge ktrace-lwp.
 1.7 22-Apr-2005  reed Use ${TOOL_M4} instead of "m4". (I only tested this fix
for sparc but not sparc64 or alpha yet.)

Noticed problem when building NetBSD/sparc from a Linux/i386 host
that didn't have "m4".
 1.6 09-Nov-2003  martin branches: 1.6.8;
bzero is gone from the kernel
 1.5 05-May-2002  martin branches: 1.5.10;
Add strtoul.
 1.4 01-Nov-2000  thorpej branches: 1.4.2; 1.4.4;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.3 09-May-1999  eeh branches: 1.3.2;
Find the udivrem.m4 in the proper directory.
 1.2 04-Aug-1998  perry branches: 1.2.8;
add memcmp.c
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Second half of the sparc64 stuff.
 1.2.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 22-Nov-2000  bouyer Sync with HEAD.
 1.4.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.1 20-Jun-2002  nathanw Catch up to -current.
 1.5.10.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.10.1 03-Aug-2004  skrll Sync with HEAD
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.8.74.1 19-Aug-2009  yamt sync with head.
 1.10.22.1 23-Jun-2013  tls resync from head
 1.10.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6 30-Mar-2006  martin Remove an unused, obsolete copy (pointed out by Valeriy E. Ushakov).
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8; 1.5.10; 1.5.12;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 07-Aug-2003  agc branches: 1.3.8; 1.3.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 15-Feb-1999  hubertf branches: 1.2.42;
RCS ID police
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Second half of the sparc64 stuff.
 1.2.42.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.42.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.5.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.5.10.1 19-Apr-2006  elad sync with head.
 1.5.8.1 01-Apr-2006  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.2 27-Oct-2002  chs remove setjmp/longjmp from libkern, they're not used.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.26;
Second half of the sparc64 stuff.
 1.1.1.1.26.1 11-Nov-2002  nathanw Catch up to -current
 1.3 09-Nov-2003  martin bzero is gone from the kernel
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 29-Oct-2002  chs branches: 1.3.6;
move includes to the top so that this builds in libc context too.
 1.2 27-Oct-2002  chs use %g5 instead of %g7 (since we want to use %g7 for the cpu_info pointer
in the kernel). resync libc and libkern versions of this file.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.26;
Second half of the sparc64 stuff.
 1.1.1.1.26.1 11-Nov-2002  nathanw Catch up to -current
 1.3.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6 20-Dec-2005  christos Use common sources with userland.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 07-Aug-2003  agc branches: 1.3.8; 1.3.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 26-Nov-1998  eeh branches: 1.2.44;
Fixup ffstab naming conflict between locore.s, libkern/arch/sparc/ffs.S and
libkern/arch/sparc64/ffs.S
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Second half of the sparc64 stuff.
 1.2.44.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.44.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.44.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.44.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.8 20-Dec-2005  christos Use common sources with userland.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 07-Aug-2003  agc branches: 1.5.8; 1.5.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 26-Nov-1998  eeh branches: 1.4.44;
Forgot to specify a label for the branch target. Oops.
 1.3 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.2 29-Aug-1998  eeh Some more 64-bit-ification.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Second half of the sparc64 stuff.
 1.4.44.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.44.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.44.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.44.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.5 07-Mar-2014  nakayama Align explicitly to make kernels compiled by clang generate
properly aligned code.
 1.4 12-Sep-2013  joerg Pass PICFLAGS down to cc-as-as and use __PIC__ to decide if it is small
vs big PIC mode. Retire -DPIC and -DBIGPIC.
 1.3 05-Jan-2009  pooka branches: 1.3.14; 1.3.24; 1.3.28;
Fix previous. I have no idea what crack I was on when I "tested" them.
 1.2 04-Jan-2009  pooka Support PIC for inclusion in librump. (m68k untested)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.146; 1.1.1.1.150; 1.1.1.1.160;
Second half of the sparc64 stuff.
 1.1.1.1.160.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.1.1.150.1 04-May-2009  yamt sync with head.
 1.1.1.1.146.1 17-Jan-2009  mjf Sync with HEAD.
 1.3.28.1 18-May-2014  rmind sync with head
 1.3.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.2 27-Oct-2002  chs remove setjmp/longjmp from libkern, they're not used.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.26;
Second half of the sparc64 stuff.
 1.1.1.1.26.1 11-Nov-2002  nathanw Catch up to -current
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Second half of the sparc64 stuff.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 03-Sep-2018  riastradh Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.3 14-Aug-2009  dsl branches: 1.3.62; 1.3.64;
Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.2 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.1 29-Dec-2007  jmcneill branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.18;
libkern bits for usermode port.
 1.1.18.1 19-Aug-2009  yamt sync with head.
 1.1.8.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.8.1 29-Dec-2007  mjf file Makefile.inc was added on branch mjf-devfs on 2008-02-18 21:06:59 +0000
 1.1.6.2 21-Jan-2008  yamt sync with head
 1.1.6.1 29-Dec-2007  yamt file Makefile.inc was added on branch yamt-lazymbuf on 2008-01-21 09:46:36 +0000
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 29-Dec-2007  matt file Makefile.inc was added on branch matt-armv6 on 2008-01-09 01:56:35 +0000
 1.1.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 29-Dec-2007  bouyer file Makefile.inc was added on branch bouyer-xeni386 on 2008-01-02 21:56:29 +0000
 1.3.64.1 10-Jun-2019  christos Sync with HEAD
 1.3.62.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.25 03-Sep-2018  riastradh Rename min.c -> uimin.c, max.c -> uimax.c in libkern.
 1.24 15-Mar-2010  uwe branches: 1.24.60; 1.24.62;
Add memset to libkern on vax, moving existing memset.S to src/common.

While kernel source code is supposed to use <machine/macros.h> via
<sys/param.h> and pick an inline asm version from there, gcc itself
can generate direct calls to memset() for structure initialization, so
the symbol must be provided.

Fixes INSTALL kernel, for which -Os caused gcc to use memset() call to
initialize a struct in uvm_fault_internal().
 1.23 14-Aug-2009  dsl branches: 1.23.2;
Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.22 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.21 18-Jun-2009  he Back out the addition of memset.c to the vax libkern, and instead do
as tsutsui@ suggested, and include <sys/param.h> in sha2.c instead.
On the vax, this causes <machine/macros.h> to be included, and it contains
that machine's memset() macro+inline.
 1.20 18-Jun-2009  he Add memset.c, so that the references from sha2.c can be satisfied, and
so that the kernel and puffs applications can link again.
 1.19 13-Apr-2007  matt branches: 1.19.32; 1.19.48;
Include byte_swap_[24].c for kernels compiled with -O0
 1.18 11-Dec-2005  christos branches: 1.18.26; 1.18.30; 1.18.32;
merge ktrace-lwp.
 1.17 13-Aug-2003  ragge branches: 1.17.16;
Include the C versions of the string instructions.
Replace blkcpy() with a version that can handle overlapping data areas.
 1.16 19-Sep-2002  ragge branches: 1.16.6;
Need strtoul() also.
 1.15 24-Feb-2002  matt Upon further reflection, move udiv/urem to libkern and out of vax/vax.
 1.14 10-Feb-2002  thorpej Add __blkcpy() and __blkset() (renamed/modified from __blkclr()) to
libkern.
 1.13 01-Nov-2000  thorpej branches: 1.13.2; 1.13.4;
Add a strcasecmp(), modified from chopps's strncasecmp().
 1.12 19-Jul-2000  matt We need strncasecmp.c now.
 1.11 15-Jan-1999  bouyer branches: 1.11.8; 1.11.18;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.10 08-Aug-1998  ragge Lots of kernlib functions rewritten as inline macros.
 1.9 22-Feb-1998  mycroft Move random.S from kernel.
 1.8 21-Jan-1998  cgd add rules like those in libc to build strchr() and strrchr() (the latter
is being added to libkern by this commit). remove strchr.c from
archs' Makefile.inc files to go along with this. (If an arch has
a .S version, it should be copied down and added to the apropriate
Makefile.inc.)
 1.7 24-Oct-1997  chuck add memchr() to libkern
 1.6 09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.5 18-Jan-1997  cgd branches: 1.5.8;
add strchr() to libkern. strchr.c copied from libc's "index.c", but with
appropriate definitions so that it'll build strchr(), and so that it builds
correctly in libkern (needed to #define NULL).
 1.4 27-Aug-1996  cgd Add machine-independent assertion-checking support. macros are:

assert() which always does assertion checking
unless "NDEBUG" is defined.

KASSERT() which does assertion checking if DIAGNOSTIC
is defined.

KDASSERT() which does assertion checking if DEBUG is
define. This macro exists for compatibility
with existing ports' assertion checking macros.
(Assertion checking is not typically an
"expensive" operation, and DIAGNOSTIC should be
used for inexpensive consistency checks.)
 1.3 10-Jun-1996  cgd locc() is unused. Remove it from the machine-independent kernel interface.
 1.2 13-Apr-1996  cgd add strncasecmp.c to ports' libkern Makefile.inc's. When adding a new
source file to libkern, it should be added to _ALL_ ports makefiles if
it is machine-independent and used by machine-independent code (in
this case adosfs). (There are several arguments that say that
strncasecmp should not be in libkern at all, and i think they're
good ones, but as long as ADOSFS needs it to link, it has to be here
for all architectures.)
 1.1 18-Apr-1995  ragge Added VAX specific makefile. (In libkern/arch/vax)
 1.5.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.18.1 27-Jul-2000  matt Pull up revision 1.12 (requested by matt)
add strncasecmp.c (needed for cd9660)
 1.11.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.11.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.13.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.13.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.13.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.13.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.17.16.1 03-Sep-2007  yamt sync with head.
 1.18.32.1 11-Jul-2007  mjf Sync with head.
 1.18.30.1 08-Jun-2007  ad Sync with head.
 1.18.26.1 15-Apr-2007  yamt sync with head.
 1.19.48.1 23-Jul-2009  jym Sync with HEAD.
 1.19.32.4 11-Aug-2010  yamt sync with head.
 1.19.32.3 19-Aug-2009  yamt sync with head.
 1.19.32.2 18-Jul-2009  yamt sync with head.
 1.19.32.1 20-Jun-2009  yamt sync with head
 1.23.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.62.1 10-Jun-2019  christos Sync with HEAD
 1.24.60.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 13-Aug-2003  ragge Include the C versions of the string instructions.
Replace blkcpy() with a version that can handle overlapping data areas.
 1.2 24-Feb-2002  matt branches: 1.2.2; 1.2.8; 1.2.20;
Upon further reflection, move udiv/urem to libkern and out of vax/vax.
 1.1 10-Feb-2002  thorpej Add __blkcpy() and __blkset() (renamed/modified from __blkclr()) to
libkern.
 1.2.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.20.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 24-Feb-2002  jdolecek file blkcpy.S was added on branch kqueue on 2002-03-16 16:01:56 +0000
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 24-Feb-2002  nathanw file blkcpy.S was added on branch nathanw_sa on 2002-02-28 04:14:50 +0000
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 24-Feb-2002  matt branches: 1.3.2; 1.3.8; 1.3.20; 1.3.28; 1.3.30;
Upon further reflection, move udiv/urem to libkern and out of vax/vax.
 1.2 19-Feb-2002  ragge blkset() used a register for set value that get clobbered by movc5,
causing the set area to get unpredictable contents.
 1.1 10-Feb-2002  thorpej Add __blkcpy() and __blkset() (renamed/modified from __blkclr()) to
libkern.
 1.3.30.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.28.1 29-Apr-2005  kent sync with -current
 1.3.20.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.1 24-Feb-2002  jdolecek file blkset.S was added on branch kqueue on 2002-03-16 16:01:56 +0000
 1.3.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.1 24-Feb-2002  nathanw file blkset.S was added on branch nathanw_sa on 2002-02-28 04:14:50 +0000
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 24-Feb-2002  matt branches: 1.3.32;
Upon further reflection, move udiv/urem to libkern and out of vax/vax.
 1.2 19-Jan-1999  ragge branches: 1.2.20; 1.2.22;
#include <machine/asm.h> instead of (nonexistent) "DEFS.h".
 1.1 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2.22.1 16-Mar-2002  jdolecek Catch up with -current.
 1.2.20.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.32.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 15-Feb-1999  hubertf branches: 1.2.58;
RCS ID police
 1.1 08-Aug-1998  ragge Lots of kernlib functions rewritten as inline macros.
 1.2.58.1 21-Jun-2006  yamt sync with head.
 1.3 20-Dec-2005  christos Use common sources with userland.
 1.2 15-Feb-1999  hubertf branches: 1.2.58;
RCS ID police
 1.1 08-Aug-1998  ragge Lots of kernlib functions rewritten as inline macros.
 1.2.58.1 21-Jun-2006  yamt sync with head.
 1.4 14-Jan-2007  ragge Repair copyright that has been broken since -94.
Gently requested by Otto Moerbeek.
 1.3 24-Feb-2002  matt branches: 1.3.32; 1.3.62;
Upon further reflection, move udiv/urem to libkern and out of vax/vax.
 1.2 19-Jul-2000  matt branches: 1.2.2; 1.2.4;
ELFify
 1.1 22-Feb-1998  mycroft branches: 1.1.14;
Move random.S from kernel.
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.2.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.62.1 01-Feb-2007  ad Sync with head.
 1.3.32.1 26-Feb-2007  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 24-Feb-2002  matt branches: 1.2.2; 1.2.8; 1.2.20;
Add register prefixes to these.
 1.1 24-Feb-2002  matt Upon further reflection, move udiv/urem to libkern and out of vax/vax.
 1.2.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.20.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 24-Feb-2002  jdolecek file udiv.S was added on branch kqueue on 2002-03-16 16:01:57 +0000
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 24-Feb-2002  nathanw file udiv.S was added on branch nathanw_sa on 2002-02-28 04:14:50 +0000
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.5 20-Dec-2005  christos Use common sources with userland.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 24-Feb-2002  matt branches: 1.2.2; 1.2.8; 1.2.20;
Add register prefixes to these.
 1.1 24-Feb-2002  matt Upon further reflection, move udiv/urem to libkern and out of vax/vax.
 1.2.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.20.1 03-Aug-2004  skrll Sync with HEAD
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 24-Feb-2002  jdolecek file urem.S was added on branch kqueue on 2002-03-16 16:01:57 +0000
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 24-Feb-2002  nathanw file urem.S was added on branch nathanw_sa on 2002-02-28 04:14:51 +0000
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.7 27-Jan-2020  ad Make x86 use the C version of memcmp().
 1.6 14-Jan-2010  joerg branches: 1.6.64; 1.6.70;
Move AMD64's bswap64 implementation from libc to src/common and share it
with the kernel.
 1.5 14-Aug-2009  dsl Move that majority of the 'SRCS+= foo.c' into the main Makefile.libkern.
Any .S files added by the arch/*/Makefile.inc cause the .c file to
be excluded.
Specific exclusions added using NO_SRCS to match previous files.
At least sparc, sparc64, i386, amd64 and vax GENERIC still build.
(There is a fubar with the naming of the byte-swap files ...)
 1.4 12-Aug-2009  dsl Split the lines that add .c to SRCS from those that add .S
No changes (apart from the order) intended.
 1.3 18-Mar-2009  tsutsui - remove bcmp(9), bcopy(9), and bzero(9) from libkern since <sys/systm.h> has
macro which replace them with mem*() functions in #ifdef _KERNEL as noted
in man pages
- move declarations of bcopy(3) and bzero(3) into <lib/libsa/stand.h>
since they are still in libsa for some MD standalone sources
(I guess all bcmp(3) in standalone sources have been replaced with memcmp(3)
but they should be replaced with memcmp() anyway)
 1.2 25-Nov-2002  fvdl branches: 1.2.108; 1.2.118; 1.2.124;
Add strtoul.c
 1.1 19-Jun-2001  fvdl Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.2.124.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.118.1 28-Apr-2009  skrll Sync with HEAD.
 1.2.108.3 11-Mar-2010  yamt sync with head
 1.2.108.2 19-Aug-2009  yamt sync with head.
 1.2.108.1 04-May-2009  yamt sync with head.
 1.6.70.1 29-Feb-2020  ad Sync with head.
 1.6.64.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 19-Jun-2001  fvdl branches: 1.1.38;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.38.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 19-Jun-2001  fvdl branches: 1.1.38;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.38.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 19-Jun-2001  fvdl branches: 1.1.38;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.38.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.3 30-Oct-2017  maxv Add END().
 1.2 28-Apr-2008  martin branches: 1.2.44;
Remove clause 3 and 4 from TNF licenses
 1.1 19-Jun-2001  fvdl branches: 1.1.120; 1.1.122; 1.1.124;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.124.1 16-May-2008  yamt sync with head.
 1.1.122.1 18-May-2008  yamt sync with head.
 1.1.120.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.44.1 03-Dec-2017  jdolecek update from HEAD
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.3 30-Oct-2017  maxv Add END().
 1.2 28-Apr-2008  martin branches: 1.2.44;
Remove clause 3 and 4 from TNF licenses
 1.1 19-Jun-2001  fvdl branches: 1.1.120; 1.1.122; 1.1.124;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.124.1 16-May-2008  yamt sync with head.
 1.1.122.1 18-May-2008  yamt sync with head.
 1.1.120.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.44.1 03-Dec-2017  jdolecek update from HEAD
 1.3 30-Oct-2017  maxv Add END().
 1.2 28-Apr-2008  martin branches: 1.2.44;
Remove clause 3 and 4 from TNF licenses
 1.1 19-Jun-2001  fvdl branches: 1.1.120; 1.1.122; 1.1.124;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.124.1 16-May-2008  yamt sync with head.
 1.1.122.1 18-May-2008  yamt sync with head.
 1.1.120.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.44.1 03-Dec-2017  jdolecek update from HEAD
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 19-Jun-2001  fvdl branches: 1.1.38;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.38.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.4 20-Dec-2005  christos Use common sources with userland.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 04-Dec-2003  keihan branches: 1.2.16;
netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.1 19-Jun-2001  fvdl branches: 1.1.22;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.22.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 21-Jun-2006  yamt sync with head.
 1.2 20-Dec-2005  christos Use common sources with userland.
 1.1 19-Jun-2001  fvdl branches: 1.1.38;
Initial commit of the port to AMD's upcoming 64 bit architecture, the
x86-64. Since there's no hardware available yet, this port is only
known to run on the Simics simulator for at the moment, and as such
uses the PC devices that it simulates for now. It will be developed
more (and cleaned up) as the hardware becomes available.
 1.1.38.1 21-Jun-2006  yamt sync with head.
 1.98 29-Jun-2024  rin libsa: Hook getopt.c

Its declaration (as well as `optarg` et al.) is already in stand.h.
 1.97 07-Oct-2023  rin Drop -O[01] hacks for vax; no longer necessary for patched GCC 10

PR port-vax/57646: Import major vax toolchain fix by Kalvis Duckmanton

XXXRO: GCC 12 may require hacks for a while, but it turned out that
GCC 12 should be treated differently from older versions; a lot of new
files need -O[01] flags, while some may no longer require it.

I will take a look later.

Note that these hacks are not required if Kalvis's patches for GCC 12
are applied.

Keep doc/HACKS entries for a while (will be sync with update for GCC 12).

diff --git a/crypto/external/bsd/openssh/lib/Makefile b/crypto/external/bsd/openssh/lib/Makefile
index 96a93f5e396..4e38be1b642 100644
--- a/crypto/external/bsd/openssh/lib/Makefile
+++ b/crypto/external/bsd/openssh/lib/Makefile
@@ -117,12 +117,6 @@ COPTS.${f}.c+= -Wno-pointer-sign
# XXX
COPTS.channels.c+= -fno-strict-aliasing

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.poly1305.c+= -O0
-COPTS.umac.c+= -O0
-.endif
-
COPTS.hostfile.c+= ${CC_WNO_FORMAT_TRUNCATION}
COPTS.sshkey.c+= ${CC_WNO_FORMAT_TRUNCATION}
COPTS.cipher.c+= -Wno-error=deprecated-declarations
diff --git a/distrib/utils/x_ping/Makefile b/distrib/utils/x_ping/Makefile
index f1c452a0d60..8ee77580a3f 100644
--- a/distrib/utils/x_ping/Makefile
+++ b/distrib/utils/x_ping/Makefile
@@ -12,10 +12,6 @@ CPPFLAGS+= -I${SRCDIR} -DCRUNCHOPS
DPADD= ${LIBM}
LDADD= -lm

-.if ${MACHINE_ARCH} == "vax"
-COPTS.ping.c=-O0
-.endif
-
.include <bsd.prog.mk>

.PATH: ${SRCDIR}
diff --git a/external/apache2/argon2/lib/libargon2/Makefile.inc b/external/apache2/argon2/lib/libargon2/Makefile.inc
index d3f4470c6c7..6a1dd146d7d 100644
--- a/external/apache2/argon2/lib/libargon2/Makefile.inc
+++ b/external/apache2/argon2/lib/libargon2/Makefile.inc
@@ -16,7 +16,3 @@ CFLAGS+= -pthread
LDADD+=-lpthread
DPADD+=${LIBPTHREAD}
.endif
-
-.if ${MACHINE} == "vax"
-COPTS.blake2b.c+= -O0
-.endif
diff --git a/external/bsd/jemalloc/lib/Makefile.inc b/external/bsd/jemalloc/lib/Makefile.inc
index 2f524358f46..d5da774f293 100644
--- a/external/bsd/jemalloc/lib/Makefile.inc
+++ b/external/bsd/jemalloc/lib/Makefile.inc
@@ -53,12 +53,6 @@ COPTS.ctl.c+=-Wno-error=stack-protector
COPTS.stats.c+=-Wno-error=stack-protector
COPTS.tcache.c+=-Wno-error=stack-protector

-.if ${MACHINE_ARCH} == "vax"
-# in merge_overlapping_regs, at regrename.c
-COPTS.arena.c+=-O0
-COPTS.extent.c+=-O0
-.endif
-
SRCS+=${JEMALLOC_SRCS}

jemalloc.d jemalloc.pico jemalloc.o jemalloc.ln jemalloc.po jemalloc.go: \
diff --git a/external/bsd/mdocml/lib/libmandoc/Makefile b/external/bsd/mdocml/lib/libmandoc/Makefile
index 40d7e29ae88..dfd3077a2c7 100644
--- a/external/bsd/mdocml/lib/libmandoc/Makefile
+++ b/external/bsd/mdocml/lib/libmandoc/Makefile
@@ -39,11 +39,6 @@ tbl_opts.c

MAN= mandoc.3

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.mdoc_macro.c+=-O0
-.endif
-
COPTS.man_validate.c+=-Wno-error=array-bounds

.include <bsd.lib.mk>
diff --git a/external/gpl3/binutils.old/lib/libbfd/Makefile b/external/gpl3/binutils.old/lib/libbfd/Makefile
index 03477232b55..74a354532fa 100644
--- a/external/gpl3/binutils.old/lib/libbfd/Makefile
+++ b/external/gpl3/binutils.old/lib/libbfd/Makefile
@@ -41,10 +41,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
-DDEBUGDIR=\"${DEBUGDIR}\" -DLIBDIR=\"${LIBDIR}\" \
-DBINDIR=\"${BINDIR}\"

-.if (${BFD_MACHINE_ARCH} == "vax")
-CPPFLAGS.elf.c += -O0
-.endif
-
COPTS.pei-x86_64.c+= -Wno-stack-protector
COPTS.elfxx-mips.c+= -Wno-stack-protector
COPTS.elf.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-overflow :}
diff --git a/external/gpl3/binutils/lib/libbfd/Makefile b/external/gpl3/binutils/lib/libbfd/Makefile
index 00cb2b20081..a3f0c25fd35 100644
--- a/external/gpl3/binutils/lib/libbfd/Makefile
+++ b/external/gpl3/binutils/lib/libbfd/Makefile
@@ -41,10 +41,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
-DDEBUGDIR=\"${DEBUGDIR}\" -DLIBDIR=\"${LIBDIR}\" \
-DBINDIR=\"${BINDIR}\"

-.if (${BFD_MACHINE_ARCH} == "vax")
-CPPFLAGS.elf.c += -O0
-.endif
-
COPTS.pei-x86_64.c+= -Wno-stack-protector
COPTS.elfxx-mips.c+= -Wno-stack-protector
COPTS.elf.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-overflow :}
diff --git a/external/gpl3/gcc.old/lib/Makefile.sanitizer b/external/gpl3/gcc.old/lib/Makefile.sanitizer
index efd36ae4bee..5173a5109a0 100644
--- a/external/gpl3/gcc.old/lib/Makefile.sanitizer
+++ b/external/gpl3/gcc.old/lib/Makefile.sanitizer
@@ -88,22 +88,3 @@ COPTS+=-fno-builtin -fno-exceptions -fno-rtti -funwind-tables

# Can't profile without it`
#-fomit-frame-pointer
-
-.if ${MACHINE_ARCH} == "vax"
-COPTS.sanitizer_allocator.cc += -O1
-COPTS.sanitizer_common.cc += -O1
-COPTS.sanitizer_common_libcdep.cc += -O1
-COPTS.sanitizer_coverage_libcdep.cc += -O1
-COPTS.sanitizer_coverage_mapping_libcdep.cc += -O1
-COPTS.sanitizer_deadlock_detector1.cc += -O1
-COPTS.sanitizer_mac.cc += -O1
-COPTS.sanitizer_netbsd.cc += -O1
-COPTS.sanitizer_posix.cc += -O1
-COPTS.sanitizer_printf.cc += -O1
-COPTS.sanitizer_procmaps_common.cc += -O1
-COPTS.sanitizer_stackdepot.cc += -O1
-COPTS.sanitizer_symbolizer_libcdep.cc += -O1
-COPTS.sanitizer_symbolizer_report.cc += -O1
-COPTS.ubsan_diag.cc += -O1
-COPTS.ubsan_init.cc += -O1
-.endif
diff --git a/external/gpl3/gcc.old/lib/libasan/Makefile b/external/gpl3/gcc.old/lib/libasan/Makefile
index 1e6f9608abe..3da7bbf2f58 100644
--- a/external/gpl3/gcc.old/lib/libasan/Makefile
+++ b/external/gpl3/gcc.old/lib/libasan/Makefile
@@ -49,14 +49,6 @@ LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
LIBDPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread
CPPFLAGS+=-DCAN_SANITIZE_UB=0

-.if ${MACHINE_ARCH} == "vax"
-COPTS.asan_allocator.cc += -O1
-COPTS.asan_report.cc += -O1
-COPTS.sanitizer_file.cc += -O1
-COPTS.ubsan_diag.cc += -O1
-COPTS.ubsan_init.cc += -O1
-.endif
-
.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
COPTS.asan_interceptors.cc += -O1
.endif
diff --git a/external/gpl3/gcc.old/lib/liblsan/Makefile b/external/gpl3/gcc.old/lib/liblsan/Makefile
index 4578544a9a8..ddb7981077c 100644
--- a/external/gpl3/gcc.old/lib/liblsan/Makefile
+++ b/external/gpl3/gcc.old/lib/liblsan/Makefile
@@ -16,11 +16,6 @@ LSAN_SRCS+= \
lsan_linux.cc \
lsan_thread.cc

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lsan_allocator.cc += -O1
-COPTS.sanitizer_file.cc += -O1
-.endif
-
LIB= lsan
SRCS+= ${LSAN_SRCS}
LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
diff --git a/external/gpl3/gcc.old/lib/libubsan/Makefile b/external/gpl3/gcc.old/lib/libubsan/Makefile
index 2e2faca7b1c..9de82550d14 100644
--- a/external/gpl3/gcc.old/lib/libubsan/Makefile
+++ b/external/gpl3/gcc.old/lib/libubsan/Makefile
@@ -26,10 +26,6 @@ UBSAN_SRCS= \
COPTS.${_s}.cc+=-frtti
.endfor

-.if ${MACHINE_ARCH} == "vax"
-COPTS.sanitizer_file.cc += -O1
-.endif
-
LIB= ubsan
SRCS+= ${UBSAN_SRCS}
LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
diff --git a/external/gpl3/gcc.old/usr.bin/cc1/Makefile b/external/gpl3/gcc.old/usr.bin/cc1/Makefile
index c55e292ee8e..ff12a5be524 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1/Makefile
@@ -46,17 +46,6 @@ CPPFLAGS.default-c.c+= -I${BACKENDOBJ}
BUILDSYMLINKS+= ${GNUHOSTDIST}/gcc/config/sh/sh-c.cc sh-c.c
.endif

-.if ${MACHINE_CPU} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1-checksum.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile b/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
index 3123ee0d60b..aab82ad3448 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
@@ -44,16 +44,8 @@ COPTS.objc-act.c+= -Wno-stack-protector
COPTS.objc-gnu-runtime-abi-01.c+= -Wno-stack-protector
COPTS.objc-next-runtime-abi-01.c+= -Wno-stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1obj-checksum.c+=-O0
-.endif
+COPTS.c-cppbuiltin.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}
+COPTS.c-typeck.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}

.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
diff --git a/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile b/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
index b9c108251c5..e04e8fc7f53 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
@@ -69,18 +69,6 @@ COPTS.objc-act.c+= -Wno-stack-protector
COPTS.objc-gnu-runtime-abi-01.c+= -Wno-stack-protector
COPTS.objc-next-runtime-abi-01.c+= -Wno-stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1obj-checksum.c+=-O0
-COPTS.decl.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile b/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
index 7936efd3a5e..7c54559e21a 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
@@ -31,23 +31,6 @@ CHECKSUM_OBJS= ${LIBBACKTRACEOBJ}/libbacktrace.a \

CFLAGS+= -Wno-error=stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.call.c+=-O0
-COPTS.decl.c+=-O0
-COPTS.typeck2.c+=-O0
-COPTS.class.c+=-O0
-COPTS.typeck.c+=-O0
-COPTS.init.c+=-O0
-COPTS.semantics.c+=-O0
-COPTS.mangle.c+=-O0
-COPTS.constexpr.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1plus-checksum.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/gcc/Makefile b/external/gpl3/gcc.old/usr.bin/gcc/Makefile
index 7a66d77ffc7..a5a4b1c3adf 100644
--- a/external/gpl3/gcc.old/usr.bin/gcc/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/gcc/Makefile
@@ -25,9 +25,6 @@ ${SRCS}: ${GCCARCH}/defs.mk
.include <bsd.info.mk>

COPTS.gcc.c= -Wno-stack-protector
-.if ${MACHINE_ARCH} == "vax"
-COPTS.dse.c= -O1
-.endif

.PATH: ${DIST}/gcc ${DIST}/gcc/doc ${DIST}/gcc/c

diff --git a/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile b/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
index 751d1513eec..33aeb1c9898 100644
--- a/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
@@ -14,10 +14,6 @@ SRCS= decNumber.c decContext.c decimal32.c decimal64.c decimal128.c
CPPFLAGS+= -I${.CURDIR}/arch/${GCC_MACHINE_ARCH} -I${DIST}/libdecnumber
CPPFLAGS+= -I${DIST}/libgcc

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.include <bsd.lib.mk>

# Force using C++ for this
diff --git a/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile b/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
index 90f44a9fcf6..fd251464fb7 100644
--- a/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
@@ -24,11 +24,6 @@ COPTS.lto-common.c+= -Wno-stack-protector
.include "../Makefile.backtrace"
.include "../Makefile.libdecnumber"

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lto-lang.c+=-O0
-COPTS.lto-symtab.c+=-O0
-.endif
-
LDADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} -lintl -lz -lm
DPADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} ${LIBINTL} ${LIBZ} ${LIBM}

diff --git a/external/gpl3/gcc.old/usr.bin/lto1/Makefile b/external/gpl3/gcc.old/usr.bin/lto1/Makefile
index 4c49161a64c..340d3c6124f 100644
--- a/external/gpl3/gcc.old/usr.bin/lto1/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/lto1/Makefile
@@ -21,11 +21,6 @@ COPTS.lto-common.c+= -Wno-stack-protector
.include "../Makefile.libcpp"
.include "../Makefile.libdecnumber"

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lto-lang.c+=-O0
-COPTS.lto-symtab.c+=-O0
-.endif
-
LDADD+= ${LIBIBERTYOBJ}/libiberty.a
DPADD+= ${LIBIBERTYOBJ}/libiberty.a
LDADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} -lintl -lz -lm
diff --git a/external/gpl3/gdb.old/lib/libdecnumber/Makefile b/external/gpl3/gdb.old/lib/libdecnumber/Makefile
index bcd4ae5b222..ce28811526b 100644
--- a/external/gpl3/gdb.old/lib/libdecnumber/Makefile
+++ b/external/gpl3/gdb.old/lib/libdecnumber/Makefile
@@ -18,10 +18,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${GDB_MACHINE_ARCH} \

SRCS= ${G_OBJS:.o=.c} ${G_SOURCES}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.PATH: ${DIST}/libdecnumber ${DIST}/libdecnumber/dpd

.include <bsd.lib.mk>
diff --git a/external/gpl3/gdb/lib/libdecnumber/Makefile b/external/gpl3/gdb/lib/libdecnumber/Makefile
index c95d36e3dfa..e3169865304 100644
--- a/external/gpl3/gdb/lib/libdecnumber/Makefile
+++ b/external/gpl3/gdb/lib/libdecnumber/Makefile
@@ -18,10 +18,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${GDB_MACHINE_ARCH} \

SRCS= ${G_OBJS:.o=.c} ${G_SOURCES}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.PATH: ${DIST}/libdecnumber ${DIST}/libdecnumber/dpd ${DIST}/libdecnumber/bid

.include <bsd.lib.mk>
diff --git a/external/gpl3/gdb/lib/libgdb/Makefile b/external/gpl3/gdb/lib/libgdb/Makefile
index b87a515d13a..c118c363975 100644
--- a/external/gpl3/gdb/lib/libgdb/Makefile
+++ b/external/gpl3/gdb/lib/libgdb/Makefile
@@ -66,12 +66,6 @@ CFLAGS:= ${CXXFLAGS} -std=gnu++17 -Wno-error=stack-protector

ada-exp.c: ada-lex.c

-.if ${MACHINE} == "vax"
-. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
-COPTS.read.c+= -O0
-. endif
-.endif
-
# These are generated by implicit rules and are not easy to generate
CLEANDIRFILES+= \
ada-exp.c ada-lex.c \
diff --git a/external/mit/xorg/lib/gallium.old/Makefile b/external/mit/xorg/lib/gallium.old/Makefile
index 55b2fe3d1c1..bfa40c8974f 100644
--- a/external/mit/xorg/lib/gallium.old/Makefile
+++ b/external/mit/xorg/lib/gallium.old/Makefile
@@ -1211,10 +1211,6 @@ SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHL
COPTS+= ${${ACTIVE_CC} == "clang":? -Wa,-Av8plus :}
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.nir.c += -O1
-.endif
-
# XXXGCC12
.if ${MACHINE_ARCH} == "m68k"
COPTS.st_glsl_to_tgsi.cpp += -O1
diff --git a/external/mit/xorg/lib/gallium/Makefile b/external/mit/xorg/lib/gallium/Makefile
index 6778a8c11c8..9f1422080fe 100644
--- a/external/mit/xorg/lib/gallium/Makefile
+++ b/external/mit/xorg/lib/gallium/Makefile
@@ -1428,10 +1428,6 @@ SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHL
COPTS+= ${${ACTIVE_CC} == "clang":? -Wa,-Av8plus :}
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.nir.c += -O1
-.endif
-
COPTS.u_atomic.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-builtin-declaration-mismatch :}

.include <bsd.lib.mk>
diff --git a/external/mit/xorg/lib/libX11/Makefile.libx11 b/external/mit/xorg/lib/libX11/Makefile.libx11
index e103d9ace12..0e55c2a4732 100644
--- a/external/mit/xorg/lib/libX11/Makefile.libx11
+++ b/external/mit/xorg/lib/libX11/Makefile.libx11
@@ -471,11 +471,6 @@ COPTS.OpenDis.c+= -Wno-error # XXX xf86bigfstr.h
COPTS.XlibInt.c+= -Wno-error # XXX xcmiscstr.h
COPTS.XKBBind.c+= -Wno-deprecated-declarations # uses XKeycodeToKeysym

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.lcWrap.c+= -O0
-.endif
-
CWARNFLAGS.clang+= -Wno-string-plus-int

.include "${NETBSDSRCDIR}/external/mit/xorg/tools/makekeys/Makefile.makekeys"
diff --git a/games/gomoku/Makefile b/games/gomoku/Makefile
index e86a63aaea7..678537066ed 100644
--- a/games/gomoku/Makefile
+++ b/games/gomoku/Makefile
@@ -9,10 +9,6 @@ LDADD= -lcurses -lterminfo
HIDEGAME=hidegame
CPPFLAGS+= ${DEBUG:D-DDEBUG}

-.if ${MACHINE} == "vax"
-COPTS.pickmove.c += -O0
-.endif
-
#WARNS= 6 # would produce warnings about small integer types
LINTFLAGS+= -w # treat warnings as errors
LINTFLAGS+= -T # strict bool mode
diff --git a/games/phantasia/Makefile b/games/phantasia/Makefile
index e9c53f23ae5..b919dac17c6 100644
--- a/games/phantasia/Makefile
+++ b/games/phantasia/Makefile
@@ -52,7 +52,3 @@ map: map.c
./map | plot > /dev/tty

.include <bsd.prog.mk>
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.misc.c+= -O0
-.endif
diff --git a/lib/i18n_module/UTF7/Makefile b/lib/i18n_module/UTF7/Makefile
index 712c1515d42..7136f7f0cc3 100644
--- a/lib/i18n_module/UTF7/Makefile
+++ b/lib/i18n_module/UTF7/Makefile
@@ -3,6 +3,3 @@
SRCPRE=citrus_
.include <bsd.lib.mk>

-.if ${MACHINE_ARCH} == "vax" && defined(HAVE_GCC)
-COPTS.citrus_utf7.c+= -O0
-.endif
diff --git a/lib/libbz2/Makefile b/lib/libbz2/Makefile
index b2aea1e04b0..e60a2862d48 100644
--- a/lib/libbz2/Makefile
+++ b/lib/libbz2/Makefile
@@ -15,11 +15,6 @@ SRCS= blocksort.c huffman.c crctable.c randtable.c compress.c \
INCS= bzlib.h
INCSDIR= /usr/include

-# XXX huffman.c gets mis-compiled with 2.95.3
-.if ${MACHINE_ARCH} == "vax"
-COPTS+= -O0
-.endif
-
COPTS+= ${CC_WNO_IMPLICIT_FALLTHROUGH}

# XXX blocksort.c gets mis-compiled with 4.1
diff --git a/lib/libc/gdtoa/Makefile.inc b/lib/libc/gdtoa/Makefile.inc
index 132686fc33d..609da919803 100644
--- a/lib/libc/gdtoa/Makefile.inc
+++ b/lib/libc/gdtoa/Makefile.inc
@@ -44,10 +44,3 @@ SRCS+= dmisc.c \
.if ${MACHINE_ARCH} != "vax"
SRCS+= strtord.c
.endif
-
-# XXX revisit with newer GCC.
-# Ensure numbers like 0xffff319f5fa95963 print correctly
-# ("999999999999999.98", not garbage like "?A>C>@>C:BA;A><.:<")
-.if ${MACHINE_ARCH} == "vax" && defined(HAVE_GCC)
-COPTS.misc.c+= -O0
-.endif
diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile
index cb3f89d6d09..e9c8be820da 100644
--- a/lib/libcrypt/Makefile
+++ b/lib/libcrypt/Makefile
@@ -30,9 +30,6 @@ SRCS+= crypt-argon2.c
SRCS+= ${src}
COPTS.${src}+= -fvisibility=hidden
. endfor
-. if ${MACHINE} == "vax"
-COPTS.blake2b.c+= -O0
-. endif
.endif

WARNS?= 5
diff --git a/libexec/ld.elf_so/Makefile b/libexec/ld.elf_so/Makefile
index f5baae1e883..24f7e1121e5 100644
--- a/libexec/ld.elf_so/Makefile
+++ b/libexec/ld.elf_so/Makefile
@@ -141,10 +141,6 @@ CPPFLAGS+= -DRTLD_DEFAULT_LIBRARY_PATH=\"${SHLIBDIR}:${LIBDIR}\"
COPTS.rtld.c+= -Wno-stack-protector
COPTS.symbol.c+=-Wno-stack-protector

-.if ${MACHINE_CPU} == "vax"
-COPTS.rtld.c+= -O0
-.endif
-
LDADD+= -Wl,--version-script=${.CURDIR}/symbols.map
LDADD+= -L${CLIBOBJ} -L${DESTDIR}${LIBDIR}
.if ${MKPICLIB} != "no"
diff --git a/sbin/fsck_ffs/Makefile.common b/sbin/fsck_ffs/Makefile.common
index 765638b2801..824e3bf2628 100644
--- a/sbin/fsck_ffs/Makefile.common
+++ b/sbin/fsck_ffs/Makefile.common
@@ -36,7 +36,3 @@ COPTS.ffs_appleufs.c+= -Wno-pointer-sign
.if ${MACHINE_ARCH} == "m68000"
COPTS.pass1.c+= -fno-tree-fre -fno-tree-lrs
.endif
-.if ${MACHINE_ARCH} == "vax"
-COPTS.pass1.c+= -O0
-COPTS.inode.c+= -O0
-.endif
diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile
index c039f73a1eb..3b0331e5880 100644
--- a/sbin/fsdb/Makefile
+++ b/sbin/fsdb/Makefile
@@ -39,12 +39,6 @@ COPTS.${f}.c+= -Wno-pointer-sign
COPTS.pass1.c+= -fno-tree-fre -fno-tree-lrs
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.pass1.c+= -O0
-COPTS.inode.c+= -O0
-COPTS.fsdb.c+= -O0
-.endif
-
CWARNFLAGS.gcc+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

.include <bsd.prog.mk>
diff --git a/sbin/newfs_ext2fs/Makefile b/sbin/newfs_ext2fs/Makefile
index 40a44b9a038..ecfdbff4d3a 100644
--- a/sbin/newfs_ext2fs/Makefile
+++ b/sbin/newfs_ext2fs/Makefile
@@ -20,8 +20,4 @@ DPADD+=${LIBPROP}

.PATH: ${NETBSDSRCDIR}/sys/ufs/ext2fs ${FSCK}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.mke2fs.c=-O0
-.endif
-
.include <bsd.prog.mk>
diff --git a/sbin/ping/Makefile b/sbin/ping/Makefile
index 4f33501ea7a..1f7f56e3ea5 100644
--- a/sbin/ping/Makefile
+++ b/sbin/ping/Makefile
@@ -12,8 +12,4 @@ CPPFLAGS+= -DIPSEC
LDADD+= -lipsec
DPADD+= ${LIBIPSEC}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.ping.c=-O0
-.endif
-
.include <bsd.prog.mk>
diff --git a/sys/arch/vax/conf/Makefile.vax b/sys/arch/vax/conf/Makefile.vax
index cf095d54a86..c483eaa644a 100644
--- a/sys/arch/vax/conf/Makefile.vax
+++ b/sys/arch/vax/conf/Makefile.vax
@@ -34,7 +34,6 @@ GENASSYM_CONF= ${VAX}/vax/genassym.cf
CPPFLAGS+= -D_VAX_INLINE_
AFLAGS+= -x assembler-with-cpp -fno-pic
CFLAGS+= -fno-pic
-COPTS.wsmux.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -O1 :}


##
diff --git a/sys/lib/libsa/Makefile b/sys/lib/libsa/Makefile
index 718c97ce857..4ef3840c753 100644
--- a/sys/lib/libsa/Makefile
+++ b/sys/lib/libsa/Makefile
@@ -96,7 +96,3 @@ SRCS+= ufs.c
lib${LIB}.o:: ${OBJS:O} __buildstdlib

CPPFLAGS+= -Wno-pointer-sign
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.bootp.c+= -O0
-.endif
diff --git a/sys/lib/libz/Makefile b/sys/lib/libz/Makefile
index 6945c0da6c6..61fb7d4f652 100644
--- a/sys/lib/libz/Makefile
+++ b/sys/lib/libz/Makefile
@@ -25,7 +25,3 @@ CLEANFILES+= lib${LIB}.o
.include <bsd.lib.mk>

lib${LIB}.o:: ${OBJS:O} __buildstdlib
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.inftrees.c+= -O0
-.endif
diff --git a/sys/modules/lfs/Makefile b/sys/modules/lfs/Makefile
index 962538821a5..ea8f187e160 100644
--- a/sys/modules/lfs/Makefile
+++ b/sys/modules/lfs/Makefile
@@ -18,9 +18,4 @@ SRCS+= ulfs_bmap.c ulfs_dirhash.c ulfs_inode.c ulfs_lookup.c \

WARNS= 3

-.if ${MACHINE} == "vax"
-# GCC 6.5 and 7.4 cannot compile this with -DDIAGNOSTIC and -O2/-O1
-COPTS.lfs_inode.c+= -O0
-.endif
-
.include <bsd.kmodule.mk>
diff --git a/sys/rump/fs/lib/liblfs/Makefile b/sys/rump/fs/lib/liblfs/Makefile
index abade3767d9..68b74c62502 100644
--- a/sys/rump/fs/lib/liblfs/Makefile
+++ b/sys/rump/fs/lib/liblfs/Makefile
@@ -17,9 +17,6 @@ SRCS+= ulfs_bmap.c ulfs_dirhash.c ulfs_extattr.c \


CFLAGS+= -DLFS_KERNEL_RFW
-.if ${MACHINE_ARCH} == "vax"
-COPTS.lfs_inode.c+=-O0
-.endif

.include <bsd.lib.mk>
.include <bsd.klinks.mk>
diff --git a/usr.sbin/mtrace/Makefile b/usr.sbin/mtrace/Makefile
index aef09db6198..9c125c15265 100644
--- a/usr.sbin/mtrace/Makefile
+++ b/usr.sbin/mtrace/Makefile
@@ -12,10 +12,6 @@ PROG= mtrace
SRCS= igmp.c inet.c kern.c mtrace.c
MAN= mtrace.8

-.if ${MACHINE_ARCH} == "vax"
-COPTS.mtrace.c=-O0
-.endif
-
BINMODE=4555
BINOWN= root

diff --git a/external/gpl3/gcc.old/usr.bin/backend/Makefile b/external/gpl3/gcc.old/usr.bin/backend/Makefile
index d69a26fe619..99e881c783d 100644
--- a/external/gpl3/gcc.old/usr.bin/backend/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/backend/Makefile
@@ -533,68 +533,9 @@ COPTS.insn-recog.c+=-Wno-error

.if ${GCC_MACHINE_ARCH} == "vax"
CPPFLAGS+=-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${GCC_MACHINE_ARCH}
-COPTS.builtins.c+=-O0
-COPTS.calls.c+=-O0
-COPTS.convert.c+=-O0
-COPTS.data-streamer-out.c+=-O0
-COPTS.dse.c+=-O0 # XXX port-vax/51967
-COPTS.dwarf2out.c+=-O0
-COPTS.expmed.c+=-O0
-COPTS.expr.c+=-O0 -Wno-error=tautological-compare
-COPTS.fixed-value.c+=-O0
-COPTS.fold-const.c+=-O0
-COPTS.generic-match.c+=-O0
-COPTS.gimple-fold.c+=-O0
-COPTS.gimple-match.c+=-O0
-COPTS.gimple-ssa-strength-reduction.c+=-O0
-COPTS.gimple-ssa-warn-restrict.c+=-O0
-COPTS.gimple.c+=-O0
-COPTS.internal-fn.c+=-O0
-COPTS.lto-streamer-out.c+=-O0
-COPTS.omp-low.c+=-O0
-COPTS.predict.c+=-O0
-COPTS.range-op.cc+=-O0
-COPTS.recog.c+=-O0
-COPTS.sanopt.c+=-O0
-COPTS.stmt.c+=-O0
-COPTS.stor-layout.c+=-O0
-COPTS.targhooks.c+=-O0
-COPTS.tree-affine.c+=-O0
-COPTS.tree-cfg.c+=-O0
-COPTS.tree-data-ref.c+=-O0
-COPTS.tree-eh.c+=-O0
-COPTS.tree-if-conv.c+=-O0
-COPTS.tree-object-size.c+=-O0
-COPTS.tree-parloops.c+=-O0
-COPTS.tree-predcom.c+=-O0
-COPTS.tree-pretty-print.c+=-O0
-COPTS.tree-ssa-alias.c+=-O0
-COPTS.tree-ssa-ccp.c+=-O0
-COPTS.tree-ssa-forwprop.c+=-O0
-COPTS.tree-ssa-loop-ivopts.c+=-O0
-COPTS.tree-ssa-loop-manip.c+=-O0
-COPTS.tree-ssa-loop-niter.c+=-O0
-COPTS.tree-ssa-math-opts.c+=-O0
-COPTS.tree-ssa-phiopt.c+= -O0
-COPTS.tree-ssa-pre.c+=-O0
-COPTS.tree-ssa-reassoc.c+=-O0
-COPTS.tree-ssa-strlen.c+=-O0
-COPTS.tree-ssa-uninit.c+=-O0
-COPTS.tree-ssa.c+=-O0
-COPTS.tree-switch-conversion.c+=-O0
-COPTS.tree-vect-data-refs.c+=-O0
-COPTS.tree-vect-loop-manip.c+=-O0
-COPTS.tree-vect-loop.c+=-O0
-COPTS.tree-vect-patterns.c+=-O0
-COPTS.tree-vect-stmts.c+=-O0
-COPTS.tree-vrp.c+=-O0
-COPTS.tree.c+=-O0
-COPTS.ubsan.c+=-O0
-COPTS.varasm.c+=-O0
-COPTS.vr-values.c+=-O0
-COPTS.web.c+=-O0
-COPTS.wide-int-range.cc+=-O0
-COPTS.wide-int.cc+=-O0
+
+COPTS.expmed.c+=-Wno-error=tautological-compare
+COPTS.expr.c+=-Wno-error=tautological-compare
.else
COPTS.tree.c= ${${ACTIVE_CC} == "clang" :? -O0 :}
.endif
 1.96 30-Aug-2023  christos We don't want SSP/FORTIFY here.
 1.95 27-May-2021  mrg branches: 1.95.12;
add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.94 17-May-2021  mrg move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.93 07-Sep-2020  mrg branches: 1.93.6; 1.93.8;
oops, move GCC_NO_ADDR_OF_PACKED_MEMBER into the right header.
 1.92 07-Sep-2020  mrg apply GCC_NO_ADDR_OF_PACKED_MEMBER
 1.91 21-Jul-2019  rin Add SA_ENABLE_BIENDIAN option, which enable us to load kernel image of
opposite byte order (for arm EFI bootloader).

XXX
Currently, it is restricted to load_elf*.c. It would be nice if we can
recognize disklabel and filesystem of opposite byte order.
 1.90 02-Apr-2019  christos fix sign-compare and sign-passing errors.
 1.89 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.88 05-Jun-2018  christos branches: 1.88.2;
Use the standard build rules.
 1.87 22-Mar-2016  mrg branches: 1.87.16;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.86 07-Sep-2015  uebayasi Order library object build.
 1.85 07-Sep-2015  uebayasi Sprinkle more done messages.
 1.84 10-Aug-2014  isaki branches: 1.84.4;
Unify all arch/*/stand's atoi() to MI libsa.
lib/libsa/atoi.c was separated from lib/libsa/bootcfg.c.
PR/49084
 1.83 28-Jun-2014  rtr patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.
 1.82 14-Jun-2014  mrg remove remaining makefile support for GCC < 45 that i found.
 1.81 26-Mar-2014  christos branches: 1.81.2;
Remove {v,}sprintf
 1.80 12-Jan-2014  tsutsui Remove obsolete exec.c for a.out. It was superseded by loadfile() long ago.
 1.79 21-Aug-2013  matt Use LIBISPRIVATE?= yes
 1.78 10-Aug-2012  joerg branches: 1.78.2; 1.78.4;
Deal with optional HAVE_GCC.
 1.77 16-Jan-2012  christos PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.76 25-Dec-2011  tsutsui Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.75 03-Jul-2011  mrg branches: 1.75.2; 1.75.6;
apply some -O0 with gcc 4.5 and vax.
 1.74 20-Jun-2011  mrg remove HAVE_GCC == 4 conditional
 1.73 16-Jun-2011  joerg Don't use C versions of memcmp, memcpy, memmove, memset and strchr
on x86 for standalone code. The assembler versions are much smaller.
 1.72 11-May-2011  zoltan branches: 1.72.2;
Separate the IP and UDP code paths inside libsa, so I can add HTTP booting
later.
 1.71 10-Feb-2010  martin branches: 1.71.2; 1.71.4;
Utility function to lookup a symbol value in an elf symbol table - allows,
for example, a bootloader to access symbols in the just loaded kernel
(or module).
 1.70 25-Aug-2009  he branches: 1.70.2;
Uh, move loadfile_aout.c in under the check for ${SA_USE_LOADFILE}
again, so that it's not unconditionally compiled, fixing the previous.
 1.69 21-Aug-2009  he If we're on mips, don't build exec.c or loadfile_aout.c, since they
both deal with a.out format executables.
 1.68 20-Mar-2009  tsutsui Allow MD standalone Makefiles overriding MI libsa settings
by SA_EXTRADIR variable passed via SAMISCMAKEFLAGS.
 1.67 29-Aug-2008  gmcgarry branches: 1.67.2; 1.67.8;
Wrap compiler-specific flags with HAVE_GCC and HAVE_PCC as necessary. Add a few flags for PCC.
 1.66 11-May-2008  mlelstv branches: 1.66.4;
There is also ARP_DEBUG for those who need it.
 1.65 25-Mar-2008  christos branches: 1.65.2; 1.65.4; 1.65.6;
add bcopy and bzero for loadfile for now. Should get rid of it.
 1.64 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.63 14-Mar-2008  dsl Add a strchr() - for dosfs in particular.
The i386 asm version in src/common is rather larger than this one.
 1.62 25-Feb-2008  tsutsui Fix typo in comment.
 1.61 08-Dec-2007  tsutsui branches: 1.61.8; 1.61.12;
ufs_ls.c doesn't belong to lfs.
 1.60 01-Dec-2007  tsutsui branches: 1.60.2;
- build ext2fs.c
- put SRCS per each file system.
 1.59 12-May-2006  mrg branches: 1.59.22; 1.59.32; 1.59.34; 1.59.40;
apply -Wno-pointer-sign with GCC4.
 1.58 24-Jan-2006  christos branches: 1.58.2; 1.58.4; 1.58.6; 1.58.10;
PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
on an mbuf and ip_cksum() operates on a plain buffer. We should not call
functions that operate on different arguments the same name (this is not
c++).
 1.57 11-Dec-2005  christos branches: 1.57.2;
merge ktrace-lwp.
 1.56 13-Jun-2005  junyoung branches: 1.56.2;
Remove bcmp(). Use memcmp() instead.
 1.55 19-May-2004  abs Add qsort to libsa (taken from sys/dev/vinum/vinumqsort.c) and use instead of
bubblesort in acorn32 bootloader. Reduces time to sort memory on A710 equipped
RiscPC from over twenty seconds to effectively instantaneous.
Update boot version to 3.30
 1.54 11-Apr-2003  dsl branches: 1.54.2; 1.54.4;
Build ffsv1 and ffsv2
 1.53 12-Mar-2003  drochner separate ether_sprintf() from the rest of ethernet support -- sometimes
it makes sense to use the former w/o the latter (eg PXE)
 1.52 23-Feb-2003  simonb Add support for LFSv2 filesystems. From a libsa standpoint, LFSv1 and
LFSv2 are treated as separate filesystem types for size considerations.
 1.51 15-Mar-2002  simonb Move files[] from globals.c to its own file. Including all of globals.o
breaks the size limit for at least the pmax bootblocks.

Fixes PR port-pmax/15924 from Gregory McGarry.
 1.50 17-Feb-2002  thorpej Add a comment describing what SA_USE_LOADFILE is for.
 1.49 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.48 14-Nov-2001  tv Undefine DESTDIR; we don't want the special DESTDIR <bsd.lib.mk>
handling for kernel libraries.

XXX this build method should be replaced by something more sane
 1.47 31-Oct-2001  thorpej Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.46 31-Oct-2001  thorpej Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
objects.
 1.45 02-Sep-2001  tsutsui branches: 1.45.4;
Add a small version of memmove() for libsa.
Mostly identical with libsa/bcopy.c.
 1.44 31-Mar-2001  hubertf branches: 1.44.2;
Explain some SA_* options - reading compressed kernels, netboot
Useful for stripping down bootcode.
 1.43 02-Nov-2000  thorpej branches: 1.43.2;
Add a standalone MS-DOS file system reader package, lifted
from FreeBSD, and modified use NetBSD's already-existing
MS-DOS file system data structure definitions, rather than
defining our own.
 1.42 25-Oct-2000  thorpej Split the UDP routines out of net.c.
 1.41 13-Nov-1999  thorpej branches: 1.41.4;
Backout my libsa changes.
 1.40 12-Nov-1999  lukem add -DNET_DEBUG to the list of commented-out debug options
 1.39 12-Nov-1999  simonb Add strncpy().

Add prototypes for bcmp(), bzero() so the libsa compiles with WARNS=1
 1.38 11-Nov-1999  thorpej Small, MI strcat() and strcpy().
 1.37 11-Nov-1999  thorpej The hack needed to work around gcc lameness.
 1.36 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.35 11-Nov-1999  thorpej Add small, MI strcmp(), strlen(), and strncmp() functions. Modules within
libsa depend on them, to it seems rather silly to have to build an additional
library (e.g. libkern) to get them.
 1.34 09-Sep-1999  drochner branches: 1.34.2; 1.34.4; 1.34.8;
add a function to verify a password against an in-core md5 sum
 1.33 18-Aug-1999  cgd Add a standalone LFS implementation. Currently not merged with ufs (FFS),
but should be (and will be before too long). Until then, it and ufs.?
should be easily diffable.
 1.32 07-May-1999  drochner Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.31 28-Apr-1999  christos MI loadfile (used by i386, pmax and sparc shortly)
 1.30 14-Apr-1999  drochner move "ls" utility from i386/stand/libsa here
 1.29 01-Apr-1999  simonb branches: 1.29.4;
It's no use having a memcmp() that calls bcmp() if there's no bcmp() in
the SA library. Basically copied from ../libkern with a few less #if's
and #include's.
 1.28 30-Mar-1999  cgd Add bzero.c, errno.c, and memset.c to SRCS
 1.27 24-Feb-1999  drochner build tftp filesystem, rearrange .ifdef slightly so that network stuff
is not built if ${SA_INCLUDE_NET} is not set
 1.26 13-Feb-1999  pk Split the printf variants into separate files.
 1.25 13-Feb-1999  lukem convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.24 12-Feb-1999  drochner We can't prototype exit() publically because it might take an argument or
not, depending on the port-specific environment.
Separate panic() and exit() so that the mi/default panic() can be used
without conflicting with a local exit() definition, move exit(void)
prototype to the default exit() implementation.
Closes PR bin/6990 by Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>.
 1.23 24-Sep-1998  ross tfs -> ustarfs
 1.22 22-Sep-1998  ross Add tfs.c to SRCS.
 1.21 26-Oct-1997  lukem use COPTS instead of CFLAGS (entry currently commented out)
 1.20 26-Jun-1997  drochner branches: 1.20.8;
Don't define STANDALONE here, it is not used by sys/lib/libsa code.
Port dependant code depending on it must define it in its own Makefile.
 1.19 31-May-1997  cjs Back out BUILDDIR and NOINSTALL changes.
 1.18 30-May-1997  cjs Use new NOINSTALL option for libraries that are used only during the build
of a program, and not installed into the final system.
 1.17 07-May-1997  mycroft Use libinstall::, not install:, to prevent instaling LIB.
 1.16 16-Feb-1997  cgd branches: 1.16.2;
allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.15 23-Jan-1997  cgd clean up variable use, standardize with other kernel library Makefiles.
rename 'NO_NET' variable to SA_INCLUDE_NET, which defaults to 'yes' but can
be set differently. kill EXTRACFLAGS, add SACPPFLAGS (generated from
CPPFLAGS by Makefile.inc) to CFLAGS. Add support for including gzipped-file
read support, enabled by setting SA_USE_CREAD to yes (defaults to no).
 1.14 16-Jan-1997  cgd add memcmp, implemented as a wrapper around bcmp() (like memcpy() is
implemented as a wrapper around bcopy()).
 1.13 02-Oct-1996  ws branches: 1.13.2;
Remove superfluous -I. accidently introduced when I imported the PPC port
 1.12 30-Sep-1996  ws Add support for booting from cd9660 fs
Support directory traversal and symbolic links for nfs booting
Close device when file opening failed
Plug memory leak in ufs code
 1.11 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.10 01-Oct-1995  phil Don't add network files to SRCS if NO_NET is defined. (I'm getting
very short of disk space on STEELHEAD!) The pc532 doesn't use the
network (yet?) from boot.
 1.9 17-Sep-1995  pk De-activate DEBUGFLAGS again.
 1.8 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.7 14-Sep-1995  pk Mirror libkern makefiles.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 22-Aug-1994  brezak branches: 1.5.2;
Cleanup to make more ANSI compliant; checkpoint
 1.4 04-Aug-1994  brezak Make libsa compile again by not including sys/errno.h
 1.3 27-Jul-1994  cgd get includes from sys, and define KERNEL
 1.2 08-May-1994  brezak branches: 1.2.2;
Standalone networking for network boot loaders.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.2 05-Aug-1994  mycroft update from trunk, per Brezak
 1.2.2.1 27-Jul-1994  cgd update from trunk.
 1.5.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.5.2.1 22-Aug-1994  brezak file Makefile was added on branch netbsd-1-0 on 1994-08-22 21:55:59 +0000
 1.13.2.1 18-Jan-1997  thorpej Update from trunk.
 1.16.2.2 16-Feb-1997  cgd allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.16.2.1 16-Feb-1997  cgd file Makefile was added on branch is-newarp on 1997-02-16 21:25:21 +0000
 1.20.8.1 12-Nov-1997  thorpej Sync w/ trunk.
 1.29.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.34.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.34.4.1 15-Nov-1999  fvdl Sync with -current
 1.34.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.34.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.34.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.41.4.1 01-Apr-2001  he Pull up revision 1.44 (requested by hubertf):
Document some SA_* options, in case someone needs to strip down
the bootblock to enable or add new features, such as enabling
password support. Addressess PR#12506.
 1.43.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.43.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.43.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.43.2.4 14-Nov-2001  thorpej Merge from -current, required to cross-build kernels properly.
 1.43.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.43.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.43.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.44.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.44.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.44.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.45.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.54.4.1 22-May-2004  he Pull up revision 1.55 (requested by abs in ticket #369):
Add qsort to libsa (taken from sys/dev/vinum/vinumqsort.c)
and use instead of bubblesort in acorn32 bootloader. Reduces
time to sort memory on A710 equipped RiscPC from over twenty
seconds to effectively instantaneous. Update boot version
to 3.30
 1.54.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.54.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.54.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.54.2.1 03-Aug-2004  skrll Sync with HEAD
 1.56.2.5 17-Mar-2008  yamt sync with head.
 1.56.2.4 27-Feb-2008  yamt sync with head.
 1.56.2.3 21-Jan-2008  yamt sync with head
 1.56.2.2 07-Dec-2007  yamt sync with head
 1.56.2.1 21-Jun-2006  yamt sync with head.
 1.57.2.1 01-Feb-2006  yamt sync with head.
 1.58.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.58.6.1 24-May-2006  yamt sync with head.
 1.58.4.1 01-Jun-2006  kardel Sync with head.
 1.58.2.1 09-Sep-2006  rpaulo sync with head
 1.59.40.2 27-Dec-2007  mjf Sync with HEAD.
 1.59.40.1 08-Dec-2007  mjf Sync with HEAD.
 1.59.34.2 23-Mar-2008  matt sync with HEAD
 1.59.34.1 09-Jan-2008  matt sync with HEAD
 1.59.32.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.59.32.1 03-Dec-2007  joerg Sync with HEAD.
 1.59.22.1 09-Dec-2007  reinoud Pullup to HEAD
 1.60.2.1 08-Dec-2007  ad Sync with head.
 1.61.12.3 28-Sep-2008  mjf Sync with HEAD.
 1.61.12.2 02-Jun-2008  mjf Sync with HEAD.
 1.61.12.1 03-Apr-2008  mjf Sync with HEAD.
 1.61.8.1 24-Mar-2008  keiichi sync with head.
 1.65.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.65.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.65.4.4 11-Mar-2010  yamt sync with head
 1.65.4.3 16-Sep-2009  yamt sync with head
 1.65.4.2 04-May-2009  yamt sync with head.
 1.65.4.1 16-May-2008  yamt sync with head.
 1.65.2.1 18-May-2008  yamt sync with head.
 1.66.4.1 19-Oct-2008  haad Sync with HEAD.
 1.67.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.67.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.70.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.71.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.71.2.1 31-May-2011  rmind sync with head
 1.72.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.75.6.1 18-Feb-2012  mrg merge to -current.
 1.75.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.75.2.2 30-Oct-2012  yamt sync with head
 1.75.2.1 17-Apr-2012  yamt sync with head
 1.78.4.2 18-May-2014  rmind sync with head
 1.78.4.1 28-Aug-2013  rmind sync with head
 1.78.2.2 03-Dec-2017  jdolecek update from HEAD
 1.78.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.81.2.1 10-Aug-2014  tls Rebase.
 1.84.4.2 22-Apr-2016  skrll Sync with HEAD
 1.84.4.1 22-Sep-2015  skrll Sync with HEAD
 1.87.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.88.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.88.2.1 10-Jun-2019  christos Sync with HEAD
 1.93.8.1 31-May-2021  cjep sync with head
 1.93.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.95.12.1 08-Oct-2023  martin Pull up following revision(s) (requested by rin in ticket #394):

external/gpl3/binutils/dist/gas/config/tc-vax.h: revision 1.10
tools/gcc/Makefile: revision 1.109
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.16
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.17
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.18
external/gpl3/gcc.old/dist/gcc/recog.c: revision 1.12
external/gpl3/gcc.old/dist/gcc/function.c: revision 1.16
external/gpl3/gcc.old/dist/gcc/dse.c: revision 1.14 - 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.13
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.14
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.15
external/gpl3/gcc.old/dist/gcc/doc/tm.texi.in: revision 1.10
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.17
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.18
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.19
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.13
external/gpl3/gcc.old/usr.bin/backend/Makefile: revision 1.20
external/gpl3/gcc.old/dist/gcc/targhooks.c: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.14
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.15
external/gpl3/gcc.old/dist/gcc/config/vax/builtins.md: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/builtins.md: revision 1.13
external/gpl3/gcc.old/dist/gcc/doc/tm.texi: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.17
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.18
external/gpl3/gcc.old/dist/gcc/config/vax/elf.h: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/elf.h: revision 1.13
external/gpl3/gcc.old/dist/gcc/targhooks.h: revision 1.12
external/gpl3/gcc.old/dist/gcc/target.def: revision 1.10
external/gpl3/gcc.old/dist/gcc/rtlanal.c: revision 1.14
external/gpl3/gcc.old/dist/gcc/reload.c: revision 1.12
external/gpl3/gcc.old/usr.bin/gcc/Makefile: revision 1.11
external/gpl3/gcc.old/usr.bin/lto-dump/Makefile: revision 1.3
external/gpl3/gcc.old/lib/Makefile.sanitizer: revision 1.7
external/gpl3/binutils.old/lib/libbfd/Makefile: revision 1.10
distrib/utils/x_ping/Makefile: revision 1.9
games/phantasia/Makefile: revision 1.38
external/apache2/argon2/lib/libargon2/Makefile.inc: revision 1.2
external/gpl3/gcc.old/lib/libubsan/Makefile: revision 1.8
external/bsd/mdocml/lib/libmandoc/Makefile: revision 1.13
sbin/ping/Makefile: revision 1.18
sbin/newfs_ext2fs/Makefile: revision 1.7
sys/lib/libz/Makefile: revision 1.24
sys/lib/libsa/Makefile: revision 1.97
external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile: revision 1.3
external/gpl3/gdb/lib/libgdb/Makefile: revision 1.36
sys/modules/lfs/Makefile: revision 1.11
external/mit/xorg/lib/gallium/Makefile: revision 1.51
external/gpl3/gdb.old/lib/libdecnumber/Makefile: revision 1.10
external/mit/xorg/lib/libX11/Makefile.libx11: revision 1.26
libexec/ld.elf_so/Makefile: revision 1.148
external/bsd/jemalloc/lib/Makefile.inc: revision 1.16
external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile: revision 1.14
crypto/external/bsd/openssh/lib/Makefile: revision 1.38
external/gpl3/gcc.old/usr.bin/backend/Makefile: revision 1.21
external/gpl3/gcc.old/usr.bin/cc1/Makefile: revision 1.12
external/gpl3/gcc.old/lib/libasan/Makefile: revision 1.11
external/gpl3/gcc.old/usr.bin/cc1plus/Makefile: revision 1.13
lib/libcrypt/Makefile: revision 1.36
external/gpl3/gdb/lib/libdecnumber/Makefile: revision 1.5
lib/libc/gdtoa/Makefile.inc: revision 1.13
games/gomoku/Makefile: revision 1.13
sbin/fsdb/Makefile: revision 1.43
external/gpl3/gcc.old/usr.bin/lto1/Makefile: revision 1.9
external/mit/xorg/lib/gallium.old/Makefile: revision 1.8
lib/libbz2/Makefile: revision 1.22
external/gpl3/gcc.old/usr.bin/cc1obj/Makefile: revision 1.12
usr.sbin/mtrace/Makefile: revision 1.14
external/gpl3/gcc.old/usr.bin/cc1obj/Makefile: revision 1.13
sys/arch/vax/conf/Makefile.vax: revision 1.86
sys/rump/fs/lib/liblfs/Makefile: revision 1.18
sbin/fsck_ffs/Makefile.common: revision 1.3
external/gpl3/binutils/lib/libbfd/Makefile: revision 1.27
lib/i18n_module/UTF7/Makefile: revision 1.5
external/gpl3/gcc.old/lib/liblsan/Makefile: revision 1.7
doc/CHANGES (apply patch)
(all external/gpl3/gcc.old/ changes applied to external/gpl3/gcc/)

PR 57646: Import major vax toolchain fix.
 1.27 30-Aug-2023  christos explicitly pass COPTS
 1.26 07-Sep-2020  mrg remove GCC_NO_ADDR_OF_PACKED_MEMBER for several subdir builds
that are now handled by lfs_accessors.h internally.
 1.25 07-Sep-2020  mrg oops, move GCC_NO_ADDR_OF_PACKED_MEMBER into the right header.
 1.24 27-May-2018  christos - Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Revert :Q to work as before.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@
XXX: pullup 8
 1.23 22-Mar-2016  mrg branches: 1.23.10; 1.23.16;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.22 06-Sep-2015  uebayasi In kernel lib build, print message when things not only start bug also end.
 1.21 12-Dec-2012  matt branches: 1.21.14;
Pass down an empty CPUFLAGS since CPUFLAGS is contained in CFLAGS.
 1.20 26-May-2011  joerg branches: 1.20.4; 1.20.14;
Default to -Wno-sign-compare -Wno-pointer-sign for clang.
Push -Wno-array-bounds down to the cases that depend on it.
Selectively disable warnings for 3rd party software or non-trivial
issues to be reviewed later to get clang -Werror to build most of the
tree.
 1.19 26-Jan-2006  christos branches: 1.19.96; 1.19.102;
Add the source directory of zlib in the include paths so that cread.c can
find zlib.h which is needed from <lib/libz/libz.h>.
 1.18 11-Dec-2005  christos branches: 1.18.2;
merge ktrace-lwp.
 1.17 07-Nov-2003  dsl branches: 1.17.16;
Make 'dependall' generate dependencies in these libraries.
 1.16 21-Nov-2001  jmc branches: 1.16.16;
Don't make clean and cleandir depend on the lib subdir. Just check for it's
existance before running the submake. This makes it possible to run a
make build (which runs cleandir before make obj) in a r/o source tree
 1.15 05-Dec-2000  sommerfeld branches: 1.15.2; 1.15.4;
Have recursive make invocations depend on the .MAKE pseudo-target so
make knows to handle them specially.
 1.14 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.13 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.12 07-May-1999  drochner branches: 1.12.2;
Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.11 05-Sep-1998  lukem branches: 1.11.8;
distclean is a synonym for cleandir
 1.10 07-Feb-1998  cgd make sure that LORDER, TSORT, AR, NM, RANLIB, and SIZE are correctly
and consistently set when doing kernel library builds.
 1.9 16-Feb-1997  cgd branches: 1.9.2;
allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.8 23-Jan-1997  cgd clean up substantially. Transform clean, depend, cleandir targets from ::
to :, so they can be used e.g. with <bsd.prog.mk>. Standardize variable
names used to configure kernel libraries.

Variables used by these Makefile.inc's are:

S must be set to the top of the 'sys' tree.
${LIB}DST may be set to the location of the directory where library
objects are to be built. Defaults to ${.OBJDIR}/lib/${lib}.
${LIB}_AS may be set to 'obj' to build a object from the library's
object files. (Otherwise, a library will be built.)
Defaults to 'library'.
${LIB}MISCMAKEFLAGS
Miscellaneous flags to be passed to the library's Makefile when
building. See library's Makefile for more details about
supported flags and their default values.

(where LIB is KERN, SA, or Z, and lib is kern, sa, or z, depending on which
library's Makefile.inc is being discussed.)
 1.7 02-Jan-1997  christos Typo police from: Juergen Hannken-Illjes
 1.6 26-Dec-1996  christos PR/2981: use ${VAR:Q} instead of "${VAR}" to avoid quoting problems
 1.5 30-Sep-1996  ws Add support for booting from cd9660 fs
Support directory traversal and symbolic links for nfs booting
Close device when file opening failed
Plug memory leak in ufs code
 1.4 01-Oct-1995  phil Don't add network files to SRCS if NO_NET is defined. (I'm getting
very short of disk space on STEELHEAD!) The pc532 doesn't use the
network (yet?) from boot.
 1.3 14-Sep-1995  pk Mirror libkern makefiles.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.9.2.2 16-Feb-1997  cgd allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.9.2.1 16-Feb-1997  cgd file Makefile.inc was added on branch is-newarp on 1997-02-16 21:25:22 +0000
 1.11.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.15.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.16.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.16.1 03-Aug-2004  skrll Sync with HEAD
 1.17.16.1 21-Jun-2006  yamt sync with head.
 1.18.2.1 01-Feb-2006  yamt sync with head.
 1.19.102.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.96.1 31-May-2011  rmind sync with head
 1.20.14.1 25-Feb-2013  tls resync with head
 1.20.4.1 16-Jan-2013  yamt sync with (a bit old) head
 1.21.14.2 22-Apr-2016  skrll Sync with HEAD
 1.21.14.1 22-Sep-2015  skrll Sync with HEAD
 1.23.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.23.10.1 09-Jun-2018  martin Pull up following revision(s) (requested by christos in ticket #870):

sys/lib/libgnuefi/Makefile.inc: revision 1.5
external/mit/xorg/xorg-pkg-ver.mk: revision 1.9
sys/arch/i386/stand/lib/Makefile.inc: revision 1.17
sys/compat/common/Makefile.inc: revision 1.25
usr.bin/make/unit-tests/varquote.exp: revision 1.1, 1.2
sys/lib/libsa/Makefile.inc: revision 1.24
usr.bin/make/var.c: revision 1.220
sys/arch/ia64/stand/efi/libefi/Makefile.inc: revision 1.5
sys/arch/hppa/spmath/Makefile.inc: revision 1.10
usr.bin/make/unit-tests/varquote.mk: revision 1.1, 1.2
usr.bin/make/unit-tests/Makefile: revision 1.53
sys/lib/libkern/Makefile.inc: revision 1.45
sys/arch/acorn32/stand/lib/Makefile.inc: revision 1.4
sys/arch/m68k/fpsp/Makefile.inc: revision 1.21
usr.bin/make/make.1: revision 1.273
sys/lib/libz/Makefile.inc: revision 1.17

- Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@

XXX: pullup 8
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej The hack needed to work around gcc lameness.
 1.28 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.27 05-Jun-2016  maxv branches: 1.27.18;
Remove the ALLOC_FIRST_FIT and ALLOC_TRACE options. This is a rather simple
allocator, and it does not need to be that complicated.
 1.26 30-Jul-2011  jakllsch branches: 1.26.12; 1.26.30;
Fix printf formating in ifdef DEBUG sections.
 1.25 16-Jun-2011  joerg Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.24 25-Dec-2010  jakllsch branches: 1.24.6;
Correct recently exposed printf format problem.
 1.23 02-Dec-2007  tsutsui branches: 1.23.40;
unsigned -> unsigned int
 1.22 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.21 25-Jan-2006  christos branches: 1.21.42; 1.21.44; 1.21.50;
free -> dealloc
 1.20 11-Dec-2005  christos branches: 1.20.2;
merge ktrace-lwp.
 1.19 26-Feb-2005  perry branches: 1.19.4;
nuke trailing whitespace
 1.18 30-Jun-2004  christos branches: 1.18.4; 1.18.6;
help with casts, and lint hints.
 1.17 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16 01-Feb-2003  dsl branches: 1.16.2;
KNR, removing ugly 'unsigned' variables.
Probably should be size_t, but now matched prototype.
(mainly agreed with christos - he wanted size_t....)
 1.15 30-Mar-2000  augustss Kill some more register declarations.
 1.14 28-May-1999  cgd branches: 1.14.2;
don't bother initializing 'freelist' -- it can be bss
 1.13 11-Apr-1999  simonb The "found" label is not used if ALLOC_FIRST_FIT is defined.
 1.12 01-Apr-1999  simonb branches: 1.12.4;
bestsize is unused if ALLOC_FIRST_FIT is defined.
 1.11 17-Sep-1997  drochner fix printf() format warnings in debug output
 1.10 04-Jul-1997  drochner branches: 1.10.2;
Fix syntax error which appeared #ifdef DEBUG ("end[]").
Simplify the heap location stuff.
 1.9 26-Jun-1997  drochner Allow to define the location of the heap at runtime #if HEAP_VARIABLE.
That helps to test libsa code in user space.
 1.8 13-Jun-1997  drochner Bring prototypes into scope.
 1.7 16-Feb-1997  leo branches: 1.7.2;
Initialize 'bestf' to make this compile again with -Wall.
 1.6 04-Feb-1997  thorpej Add some debugging code to free(), to catch frees before the
start of the heap and beyond the end of the heap (if a heap limit
is defined).
 1.5 22-Jan-1997  cgd Add a whole bunch of features, from Matthias Drochner:
best-fit, rather than first-fit, algorithm.
ability to handle free()s with zero size (needed for gzip read
support).
ability to start the heap someplace else (defined by HEAP_START).
ability to limit growth of the heap (via HEAP_LIMIT).
debugging sanity checks (ifdef DEBUG).
allocation tracing support, to help debugging (ifdef ALLOC_TRACE).
and from me:
ability to pick a (smaller) first-fit algorithm (via ALLOC_FIRST_FIT).
lots of comments.

If heap limits and all of the debugging features are disabled (the default),
and ALLOC_FIRST_FIT is defined (not the default), compiled with -O on the
alpha the new version is the same (object) size as the old version.
 1.4 26-Sep-1996  cgd make sure new allocations are aligned.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 27-Jul-1994  cgd branches: 1.2.2;
use ALIGN, rather than hard-coded numbers
 1.1 26-Jan-1994  brezak branches: 1.1.2;
CMU/4.4 stand-alone library
 1.1.2.1 27-Jul-1994  cgd update from trunk.
 1.2.2.2 27-Jul-1994  cgd use ALIGN, rather than hard-coded numbers
 1.2.2.1 27-Jul-1994  cgd file alloc.c was added on branch netbsd-1-0 on 1994-07-27 07:39:18 +0000
 1.7.2.2 16-Feb-1997  leo Initialize 'bestf' to make this compile again with -Wall.
 1.7.2.1 16-Feb-1997  leo file alloc.c was added on branch is-newarp on 1997-02-16 13:03:00 +0000
 1.10.2.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.14.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.16.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.19.4.2 07-Dec-2007  yamt sync with head
 1.19.4.1 21-Jun-2006  yamt sync with head.
 1.20.2.1 01-Feb-2006  yamt sync with head.
 1.21.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.21.44.1 09-Jan-2008  matt sync with HEAD
 1.21.42.2 03-Dec-2007  joerg Sync with HEAD.
 1.21.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.23.40.1 05-Mar-2011  rmind sync with head
 1.24.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.26.30.1 09-Jul-2016  skrll Sync with HEAD
 1.26.12.1 03-Dec-2017  jdolecek update from HEAD
 1.27.18.1 10-Jun-2019  christos Sync with HEAD
 1.35 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.34 29-Mar-2014  jakllsch branches: 1.34.30;
Use ETHER_ADDR_LEN more.
 1.33 17-Jan-2009  tsutsui branches: 1.33.14; 1.33.24; 1.33.28;
Remove __P().
 1.32 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.31 25-Mar-2008  christos branches: 1.31.4; 1.31.12;
remove stray comment
 1.30 25-Mar-2008  christos fix typo
 1.29 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.28 24-Nov-2007  isaki branches: 1.28.14;
style, indent, and ANSI-fy.
 1.27 11-Dec-2005  christos branches: 1.27.44; 1.27.46; 1.27.52;
merge ktrace-lwp.
 1.26 13-Jun-2005  junyoung branches: 1.26.2;
Remove bcmp(). Use memcmp() instead.
 1.25 26-Feb-2005  perry nuke trailing whitespace
 1.24 31-Aug-2003  fvdl branches: 1.24.8; 1.24.10;
Fix signed/unsigned warnings.
 1.23 27-Sep-2002  provos branches: 1.23.6;
remove trailing \n in panic(). approved perry.
 1.22 18-Oct-2001  jdolecek Fix compilation on Alpha with ARP_DEBUG.
Fixes kern/6440 by R. C. Dowdeswell
 1.21 30-Mar-2000  augustss branches: 1.21.6; 1.21.8;
Kill some more register declarations.
 1.20 13-Nov-1999  thorpej Backout my libsa changes.
 1.19 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.18 07-Jul-1997  drochner branches: 1.18.20; 1.18.22; 1.18.26;
Don't use private copy of old netinet/if_ether.h.
Use <net/if_ether.h> for ethernet specific definitions, and insert private
definitions for ARP if needed. (The new ARP macros in <net/if_arp.h> are
not used because they create larger code, and we really don't need more
than ethernet/ip support here.)
 1.17 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.16 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.15 13-Oct-1996  christos branches: 1.15.6;
backout previous kprintf changes
 1.14 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 08-Dec-1995  gwr Check return value from sendrecv so that ARP timeout does not cause
garbage to be entered into the ARP table. Also fix ARP_DEBUG code.
 1.12 27-Sep-1995  pk branches: 1.12.2;
Careful with initializers.
 1.11 23-Sep-1995  gwr More cleanup: change some private types to eliminate casts,
replace some "goto xxx" with return(-1). (mostly cosmetic)
 1.10 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.9 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.8 13-Sep-1995  gwr Correct the padding to min Ethernet packet size.
 1.7 11-Sep-1995  thorpej Changes from Gordon Ross:
a) check against `my' ethernet or broadcast addresses done in
ether.c
b) changed interface to readether() to provide ethertype info
c) respond to arp requests when appropriate.
First two are clean-up. Last fixes hp300 and presumably mvme68k netboot
code.
 1.6 04-Aug-1995  thorpej Kill extra declaration of bcea[]. It's also defined in globals.c.
 1.5 27-Jun-1995  gwr Pad the request out to the minimum Ethernet length.
Improve some debug prints...
 1.4 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 04-Aug-1994  brezak branches: 1.2.2;
Make libsa compile again by not including sys/errno.h
 1.1 08-May-1994  brezak branches: 1.1.2;
Standalone networking for network boot loaders.
 1.1.2.1 05-Aug-1994  mycroft update from trunk, per Brezak
 1.2.2.2 04-Aug-1994  brezak Make libsa compile again by not including sys/errno.h
 1.2.2.1 04-Aug-1994  brezak file arp.c was added on branch netbsd-1-0 on 1994-08-04 19:39:35 +0000
 1.12.2.1 22-Jan-1996  gwr Do not enter garbage in the ARP cache if sendrecv() times out.
 1.15.6.1 07-Mar-1997  is Use the local copy of the old-style if_ether.h for the moment, til we have
time to modernize the libsa ARP support.
 1.18.26.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.22.1 15-Nov-1999  fvdl Sync with -current
 1.18.20.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.21.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.21.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.6.2 18-Oct-2002  nathanw Catch up to -current.
 1.21.6.1 22-Oct-2001  nathanw Catch up to -current.
 1.23.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.6.1 03-Aug-2004  skrll Sync with HEAD
 1.24.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.24.8.1 29-Apr-2005  kent sync with -current
 1.26.2.1 07-Dec-2007  yamt sync with head
 1.27.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.27.46.1 09-Jan-2008  matt sync with HEAD
 1.27.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.28.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.28.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.31.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.4.1 04-May-2009  yamt sync with head.
 1.33.28.1 18-May-2014  rmind sync with head
 1.33.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.30.1 10-Jun-2019  christos Sync with HEAD
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Minimal quad routines needed for libsa to be self-contained. The compiler
emits a reference to this one in the UFS code.
 1.2 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.1 10-Aug-2014  isaki branches: 1.1.4; 1.1.30;
Unify all arch/*/stand's atoi() to MI libsa.
lib/libsa/atoi.c was separated from lib/libsa/bootcfg.c.
PR/49084
 1.1.30.1 10-Jun-2019  christos Sync with HEAD
 1.1.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.4.1 10-Aug-2014  tls file atoi.c was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.7 13-Jun-2005  junyoung Remove bcmp(). Use memcmp() instead.
 1.6 01-Sep-2003  dsl Another attempt to get libsa to contain the right things.
- put a 'standards conforming' memcmp into memcmp.c
- make bcmp be a second label on the same code
- make bcmp.c be just #include "memcmp.c"
This means that libsa.o might contain both a memcmp.o and a bcmp.o, but
both contain the same code (defining both symbols) so it doesn't matter
which ld uses.
Saves worrying about which of bcmp.c and memcmp.c the architecture specific
Makefile requests.
 1.5 29-Aug-2003  dsl The __strong_alias() seems to have to be in the file with the definition.
So make bcmp.c define bcmp and memcmp.
This should (?) fix the atari build.
(I've now no idea why the previous change defined memcpy for the alpha build.)
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 13-Nov-1999  thorpej branches: 1.3.28;
Backout my libsa changes.
 1.2 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.1 01-Apr-1999  simonb branches: 1.1.8; 1.1.10; 1.1.14;
It's no use having a memcmp() that calls bcmp() if there's no bcmp() in
the SA library. Basically copied from ../libkern with a few less #if's
and #include's.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.10.1 15-Nov-1999  fvdl Sync with -current
 1.1.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.28.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.28.1 03-Aug-2004  skrll Sync with HEAD
 1.12 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.11 24-Nov-2007  isaki branches: 1.11.14;
style, indent, and ANSI-fy.
 1.10 11-Dec-2005  christos branches: 1.10.44; 1.10.46; 1.10.52;
merge ktrace-lwp.
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 30-Mar-2000  augustss branches: 1.8.28;
Kill some more register declarations.
 1.7 30-Mar-1999  cgd branches: 1.7.8;
#undef bcopy, so that this will still compile if LIBSA_USE_MEMCPY is defined
 1.6 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.5 22-Apr-1995  cgd various type fixups
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 27-Jul-1994  cgd branches: 1.3.2;
make bcopy work for overlapping regions, as is standard.
 1.2 26-Feb-1994  pk branches: 1.2.2;
Don't use aggregate initialization;
Add memcpy().
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.1 27-Jul-1994  cgd update from trunk.
 1.3.2.2 27-Jul-1994  cgd make bcopy work for overlapping regions, as is standard.
 1.3.2.1 27-Jul-1994  cgd file bcopy.c was added on branch netbsd-1-0 on 1994-07-27 07:38:18 +0000
 1.7.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.28.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 07-Dec-2007  yamt sync with head
 1.10.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.10.46.1 09-Jan-2008  matt sync with HEAD
 1.10.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.11.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.10 06-May-2025  pgoyette Allow the dev= command when processing /boot.cfg file. This
addresses kern/59207
 1.9 05-Jan-2022  andvar branches: 1.9.10;
fix typos, mainly s/comand/command/
 1.8 17-Oct-2021  jmcneill Only define DEFAULT_TIMEOUT if it is not already defined.
 1.7 07-Sep-2021  nia Remove banner printing code from bootloaders, add it to libsa.

This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.
 1.6 30-May-2021  mlelstv Add "root" command to provide a BTINFO_ROOTDEVICE parameter.
 1.5 27-Jun-2020  jmcneill branches: 1.5.6; 1.5.8;
Support loading boot.cfg from non file-system based devices.
 1.4 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.3 02-Apr-2018  nonaka branches: 1.3.2;
efiboot: try to read boot.cfg from /EFI/NetBSD on ESP of the booted disk.
 1.2 10-Aug-2014  isaki branches: 1.2.4; 1.2.22; 1.2.28;
Unify all arch/*/stand's atoi() to MI libsa.
lib/libsa/atoi.c was separated from lib/libsa/bootcfg.c.
PR/49084
 1.1 28-Jun-2014  rtr branches: 1.1.2;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 28-Jun-2014  tls file bootcfg.c was added on branch tls-earlyentropy on 2014-08-10 06:56:02 +0000
 1.2.28.1 07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.2.22.1 04-Apr-2018  martin Pull up following revision(s) (requested by nonaka in ticket #692):

sys/arch/i386/stand/efiboot/devopen.c: revision 1.4
sys/arch/i386/stand/efiboot/efidisk.c: revision 1.5
sys/arch/i386/stand/efiboot/devopen.h: revision 1.2
sys/arch/i386/stand/efiboot/efidisk.h: revision 1.3
sys/lib/libsa/bootcfg.h: revision 1.2
sys/arch/i386/stand/efiboot/boot.c: revision 1.9
sys/lib/libsa/bootcfg.c: revision 1.3
sys/arch/i386/stand/lib/bootmenu.c: revision 1.17
sys/arch/i386/stand/lib/biosdisk.c: revision 1.49
sys/arch/i386/stand/efiboot/TODO.efiboot: revision 1.5
sys/arch/i386/stand/lib/bootmenu.h: revision 1.6
sys/arch/i386/stand/lib/biosdisk.h: revision 1.10

efiboot: try to read boot.cfg from /EFI/NetBSD on ESP of the booted disk.
 1.2.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.4.1 10-Aug-2014  tls file bootcfg.c was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.3.2.1 10-Jun-2019  christos Sync with HEAD
 1.5.8.1 31-May-2021  cjep sync with head
 1.5.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.9.10.1 02-Aug-2025  perseant Sync with HEAD
 1.6 06-May-2025  pgoyette Allow the dev= command when processing /boot.cfg file. This
addresses kern/59207
 1.5 07-Sep-2021  nia branches: 1.5.10;
Remove banner printing code from bootloaders, add it to libsa.

This harmonizes efiboot and the various x86 bootloaders to use shared
code for printing the banner. By friendly coincidence, it also adds
support for specifying 'banner=' in arm efiboot's boot.cfg, as on x86.
 1.4 30-May-2021  mlelstv Add "root" command to provide a BTINFO_ROOTDEVICE parameter.
 1.3 31-Mar-2019  christos branches: 1.3.16; 1.3.18;
fix warnings, printf formats, etc.
 1.2 02-Apr-2018  nonaka branches: 1.2.2;
efiboot: try to read boot.cfg from /EFI/NetBSD on ESP of the booted disk.
 1.1 28-Jun-2014  rtr branches: 1.1.2; 1.1.6; 1.1.24; 1.1.30;
patch posted to tech-kern@ 2014/06/25 for review with minor changes
resulting from feedback.

move multiple copies of code for parsing boot.cfg file from sparc, i386
and zaurus into libsa/bootcfg.{h,c}. largely retained i386 parsing logic
in addition to keeping sparc dispatch function while remaining consistent
with boot.cfg(5).

previous sparc64 file format has been obsoleted but only used by boot
CDs distrib/sparc64/bootfs/boot.cfg has been updated to compensate.

exported names have been prefixed with either BOOTCFG_ or bootcfg_ as per
feedback from christos@

tested on amd64 & sparc64 but not zaurus.
 1.1.30.1 07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$
 1.1.24.1 04-Apr-2018  martin Pull up following revision(s) (requested by nonaka in ticket #692):

sys/arch/i386/stand/efiboot/devopen.c: revision 1.4
sys/arch/i386/stand/efiboot/efidisk.c: revision 1.5
sys/arch/i386/stand/efiboot/devopen.h: revision 1.2
sys/arch/i386/stand/efiboot/efidisk.h: revision 1.3
sys/lib/libsa/bootcfg.h: revision 1.2
sys/arch/i386/stand/efiboot/boot.c: revision 1.9
sys/lib/libsa/bootcfg.c: revision 1.3
sys/arch/i386/stand/lib/bootmenu.c: revision 1.17
sys/arch/i386/stand/lib/biosdisk.c: revision 1.49
sys/arch/i386/stand/efiboot/TODO.efiboot: revision 1.5
sys/arch/i386/stand/lib/bootmenu.h: revision 1.6
sys/arch/i386/stand/lib/biosdisk.h: revision 1.10

efiboot: try to read boot.cfg from /EFI/NetBSD on ESP of the booted disk.
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 28-Jun-2014  tls file bootcfg.h was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 28-Jun-2014  tls file bootcfg.h was added on branch tls-earlyentropy on 2014-08-10 06:56:02 +0000
 1.2.2.1 10-Jun-2019  christos Sync with HEAD
 1.3.18.1 31-May-2021  cjep sync with head
 1.3.16.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.5.10.1 02-Aug-2025  perseant Sync with HEAD
 1.43 05-Apr-2019  christos Go back ot using 0x%x instead of %#x because we don't always support the
format. See subr_prf.c
 1.42 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.41 25-Jun-2016  isaki branches: 1.41.18;
Fix typo.
 1.40 25-Jul-2015  isaki white space -> tab.
 1.39 20-Mar-2014  christos branches: 1.39.6;
kill sprintf
 1.38 11-May-2011  zoltan branches: 1.38.4; 1.38.14; 1.38.18;
Separate the IP and UDP code paths inside libsa, so I can add HTTP booting
later.
 1.37 10-Jul-2009  roy branches: 1.37.4; 1.37.6;
Use a function to add extra data to the vendor area so that data added
remains constant for both DISCOVER and REQUEST messages.
 1.36 10-Jul-2009  roy We should request the DHCP parameters we need.
 1.35 06-May-2009  roy We should check for potential overflows.

ok: martin
 1.34 17-Jan-2009  tsutsui branches: 1.34.2;
Remove __P().
 1.33 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.32 25-Mar-2008  christos branches: 1.32.4; 1.32.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.31 24-Nov-2007  isaki branches: 1.31.14;
style, indent, and ANSI-fy.
 1.30 01-Oct-2007  martin branches: 1.30.4;
Make a few debug outputs only happen when debugging.
 1.29 20-May-2006  mrg branches: 1.29.16; 1.29.30; 1.29.32; 1.29.34;
add (char *) cast to quieten GCC.
 1.28 11-Dec-2005  christos branches: 1.28.4; 1.28.6; 1.28.8; 1.28.12; 1.28.14;
merge ktrace-lwp.
 1.27 13-Jun-2005  junyoung branches: 1.27.2;
Remove bcmp(). Use memcmp() instead.
 1.26 26-Feb-2005  perry nuke trailing whitespace
 1.25 31-Aug-2003  fvdl branches: 1.25.8; 1.25.10;
Fix signed/unsigned warnings.
 1.24 12-Mar-2003  drochner branches: 1.24.2;
no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
 1.23 25-Feb-2003  ragge Remove bogus check for bogus netmask.
 1.22 20-Mar-2002  thorpej * Add a NetBSD Vendor Class Identifier option as proposed on tech-net
in message <20020216172527.C23901@dr-evil.shagadelic.org>.
* Print the bootp/dhcp response, as is done for rarp/bootparam
responses.
* Nuke bootp_flags and BOOTP_PXE; they're not used, nor should they be.
 1.21 19-Jul-2001  wiz Fix typo (`information' has an 'r').
 1.20 02-Nov-2000  thorpej branches: 1.20.2; 1.20.4;
Introduce a way for boot programs to modify the behavior of
bootp(). Add a BOOTP_PXE flag which causes bootp() to send
"PXEClient" in the DHCP class field.

Derived from similar code in FreeBSD.
 1.19 30-Mar-2000  augustss Kill some more register declarations.
 1.18 13-Nov-1999  thorpej Backout my libsa changes.
 1.17 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.16 12-Feb-1999  drochner branches: 1.16.8; 1.16.10; 1.16.14;
Add some #ifdef SUPPORT_LINUX code which specifies a BOOTP tag to pass
a command line for that kernel.
Minor sizeof() sanity.
 1.15 24-Apr-1998  drochner -catch zero and broadcast IP addresses sent by a DHCP server
-KNF
 1.14 16-Feb-1998  drochner Always set own IP address to 0.0.0.0 before BOOTP or DHCP.
 1.13 17-Sep-1997  drochner branches: 1.13.2;
Keep a copy of the original BOOTP bp_siaddr field, in case we want to
use it later for TFTP.
 1.12 06-Sep-1997  drochner -add DHCP support - this option also extends the vendor extension area
to 312 bytes (The classical 64 bytes are likely to be too small if a
rootpath is transferred.)
-make CMU vendor extension support optional
-remove code handling domain name/server (unneeded for boot code)
- -Wall fixes in debug code
 1.11 26-Jun-1997  drochner branches: 1.11.4;
Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.10 13-Oct-1996  christos backout previous kprintf changes
 1.9 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 26-Sep-1996  cgd enough 64-bit fixes to make network booting work on the Alpha. In general,
these are hacks (s/long/int/, etc.), but this code really needs a heavy
cleaning (including fixed-size typing) and I don't have time to give it one
now.
 1.7 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.6 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.5 22-Apr-1995  cgd cast ptrs to longs.
 1.4 21-Feb-1995  mycroft Clean up a little.
 1.3 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.11.4.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.2.2 08-May-1998  mycroft Pull up 1.14, per request of drochner.
 1.13.2.1 08-May-1998  mycroft Pull up 1.15, per request of drochner.
 1.16.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.10.1 15-Nov-1999  fvdl Sync with -current
 1.16.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.16.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.20.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.20.4.1 03-Aug-2001  lukem update to -current
 1.20.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.20.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.24.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.24.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.25.8.1 29-Apr-2005  kent sync with -current
 1.27.2.3 07-Dec-2007  yamt sync with head
 1.27.2.2 27-Oct-2007  yamt sync with head.
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.28.14.1 19-Jun-2006  chap Sync with head.
 1.28.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.28.8.1 24-May-2006  yamt sync with head.
 1.28.6.1 01-Jun-2006  kardel Sync with head.
 1.28.4.1 09-Sep-2006  rpaulo sync with head
 1.29.34.1 06-Oct-2007  yamt sync with head.
 1.29.32.2 09-Jan-2008  matt sync with HEAD
 1.29.32.1 06-Nov-2007  matt sync with HEAD
 1.29.30.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.29.30.1 02-Oct-2007  joerg Sync with HEAD.
 1.29.16.1 09-Oct-2007  ad Sync with head.
 1.30.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.31.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.31.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.32.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.32.4.3 18-Jul-2009  yamt sync with head.
 1.32.4.2 16-May-2009  yamt sync with head
 1.32.4.1 04-May-2009  yamt sync with head.
 1.34.2.2 23-Jul-2009  jym Sync with HEAD.
 1.34.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.37.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.37.4.1 31-May-2011  rmind sync with head
 1.38.18.1 18-May-2014  rmind sync with head
 1.38.14.2 03-Dec-2017  jdolecek update from HEAD
 1.38.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.39.6.2 09-Jul-2016  skrll Sync with HEAD
 1.39.6.1 22-Sep-2015  skrll Sync with HEAD
 1.41.18.1 10-Jun-2019  christos Sync with HEAD
 1.10 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.9 17-Jan-2009  tsutsui branches: 1.9.66;
Remove __P().
 1.8 24-Nov-2007  isaki branches: 1.8.18; 1.8.26;
style, indent, and ANSI-fy.
 1.7 20-Mar-2002  thorpej branches: 1.7.28; 1.7.84; 1.7.86; 1.7.92;
* Add a NetBSD Vendor Class Identifier option as proposed on tech-net
in message <20020216172527.C23901@dr-evil.shagadelic.org>.
* Print the bootp/dhcp response, as is done for rarp/bootparam
responses.
* Nuke bootp_flags and BOOTP_PXE; they're not used, nor should they be.
 1.6 02-Nov-2000  thorpej branches: 1.6.2; 1.6.4;
Introduce a way for boot programs to modify the behavior of
bootp(). Add a BOOTP_PXE flag which causes bootp() to send
"PXEClient" in the DHCP class field.

Derived from similar code in FreeBSD.
 1.5 11-Feb-1999  pk branches: 1.5.8;
Add missing prototypes.
 1.4 06-Sep-1997  drochner -add DHCP support - this option also extends the vendor extension area
to 312 bytes (The classical 64 bytes are likely to be too small if a
rootpath is transferred.)
-make CMU vendor extension support optional
-remove code handling domain name/server (unneeded for boot code)
- -Wall fixes in debug code
 1.3 26-Sep-1996  cgd branches: 1.3.10;
enough 64-bit fixes to make network booting work on the Alpha. In general,
these are hacks (s/long/int/, etc.), but this code really needs a heavy
cleaning (including fixed-size typing) and I don't have time to give it one
now.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.3.10.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.6.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.92.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.86.1 09-Jan-2008  matt sync with HEAD
 1.7.84.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.7.28.1 07-Dec-2007  yamt sync with head
 1.8.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.18.1 04-May-2009  yamt sync with head.
 1.9.66.1 10-Jun-2019  christos Sync with HEAD
 1.21 02-Apr-2019  christos fix sign-compare and sign-passing errors.
 1.20 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.19 21-Oct-2009  snj branches: 1.19.64;
Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.18 17-Jan-2009  tsutsui Remove __P().
 1.17 25-Mar-2008  christos branches: 1.17.4; 1.17.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.16 24-Nov-2007  isaki branches: 1.16.14;
style, indent, and ANSI-fy.
 1.15 19-Mar-2003  drochner branches: 1.15.18; 1.15.74; 1.15.76; 1.15.82;
Move global variables which are used only by bootparam here.
("domainname" is useless and could be removed, but adding code to
skip this in the RPC reply would probably be more expensive than leaving
it as a dummy variable.)
 1.14 12-Mar-2003  drochner no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
 1.13 13-Nov-1999  thorpej Backout my libsa changes.
 1.12 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.11 26-Jun-1997  drochner branches: 1.11.22; 1.11.24; 1.11.28;
Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.10 14-Oct-1996  thorpej Delete spurious #endif
 1.9 13-Oct-1996  christos backout previous kprintf changes
 1.8 10-Oct-1996  christos - printf -> kprintf, sprintf -> ksprintf
- use a debugging printf macro instead of #ifdef #endif everywhere.
 1.7 26-Feb-1996  gwr Make this code independent of <sys/nfs> now that we use very little
from there anyway, so we can ignore changes in the NFS code...
 1.6 08-Dec-1995  gwr Correct error which caused truncation of port number on i386 (PR#1823)
 1.5 23-Sep-1995  gwr More cleanup: change some private types to eliminate casts,
replace some "goto xxx" with return(-1). (mostly cosmetic)
 1.4 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.3 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.2 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.1 27-Jun-1995  gwr Support functions for NFS boot (get server address and root path).
 1.11.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.24.1 15-Nov-1999  fvdl Sync with -current
 1.11.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.15.82.1 08-Dec-2007  mjf Sync with HEAD.
 1.15.76.1 09-Jan-2008  matt sync with HEAD
 1.15.74.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.15.18.1 07-Dec-2007  yamt sync with head
 1.16.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.4.2 11-Mar-2010  yamt sync with head
 1.17.4.1 04-May-2009  yamt sync with head.
 1.19.64.1 10-Jun-2019  christos Sync with HEAD
 1.4 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.3 05-Jan-1998  perry branches: 1.3.64; 1.3.120; 1.3.122; 1.3.128;
RCSID Police.
 1.2 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.1 27-Jun-1995  gwr Support functions for NFS boot (get server address and root path).
 1.3.128.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.122.1 09-Jan-2008  matt sync with HEAD
 1.3.120.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.3.64.1 07-Dec-2007  yamt sync with head
 1.3 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.2 31-Oct-2001  thorpej branches: 1.2.2; 1.2.4; 1.2.6; 1.2.38; 1.2.94; 1.2.96; 1.2.102;
Add standalone 64-bit to/from {big,little}-endian routines.
 1.1 30-Oct-2001  thorpej Add standalone byte-swapping routines that don't require testing
the system's byte-order:
- host to {big,little}-endian {16,32}
- {big,little}-endian {16,32} to host

These are not intended to be used in libsa directly, but are rather
intended to be used by host tools which may use libsa routines (such
as loadfile()) which need to use explicit byte-ordering.
 1.2.102.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.96.1 09-Jan-2008  matt sync with HEAD
 1.2.94.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.2.38.1 07-Dec-2007  yamt sync with head
 1.2.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 31-Oct-2001  thorpej file byteorder.c was added on branch kqueue on 2002-01-10 20:00:36 +0000
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 31-Oct-2001  nathanw file byteorder.c was added on branch nathanw_sa on 2001-11-14 19:16:51 +0000
 1.2.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.2.2.1 31-Oct-2001  thorpej file byteorder.c was added on branch thorpej-mips-cache on 2001-11-12 21:19:04 +0000
 1.3 31-Oct-2001  thorpej branches: 1.3.2; 1.3.4; 1.3.6;
Oops, committed wrong copy of file in previous revision.
 1.2 31-Oct-2001  thorpej Add standalone 64-bit to/from {big,little}-endian routines.
 1.1 30-Oct-2001  thorpej Add standalone byte-swapping routines that don't require testing
the system's byte-order:
- host to {big,little}-endian {16,32}
- {big,little}-endian {16,32} to host

These are not intended to be used in libsa directly, but are rather
intended to be used by host tools which may use libsa routines (such
as loadfile()) which need to use explicit byte-ordering.
 1.3.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.6.1 31-Oct-2001  thorpej file byteorder.h was added on branch kqueue on 2002-01-10 20:00:37 +0000
 1.3.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.4.1 31-Oct-2001  nathanw file byteorder.h was added on branch nathanw_sa on 2001-11-14 19:16:51 +0000
 1.3.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.2.1 31-Oct-2001  thorpej file byteorder.h was added on branch thorpej-mips-cache on 2001-11-12 21:19:05 +0000
 1.5 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.4 24-Nov-2007  isaki branches: 1.4.14;
style, indent, and ANSI-fy.
 1.3 13-Nov-1999  thorpej branches: 1.3.44; 1.3.100; 1.3.102; 1.3.108;
Backout my libsa changes.
 1.2 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.1 30-Mar-1999  cgd branches: 1.1.8; 1.1.10; 1.1.14;
add simple (small) implementations of memset and bzero. the versions
in libkern are fine for the kernel, but the versions here are smaller
and in libsa the point is size.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.10.1 15-Nov-1999  fvdl Sync with -current
 1.1.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.108.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.102.1 09-Jan-2008  matt sync with HEAD
 1.3.100.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.3.44.1 07-Dec-2007  yamt sync with head
 1.4.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.2 26-Jan-1994  mycroft Clean up deleted files.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.32 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.31 08-Mar-2018  nonaka branches: 1.31.2;
Add missed file in previous commit.

> efiboot: system can boot from CD/DVD-ROM media.
 1.30 20-Mar-2014  christos branches: 1.30.22; 1.30.28;
reduce size by 1K by sharing the ls code.
 1.29 23-Jul-2012  mhitch branches: 1.29.2; 1.29.4;
Fix cd9660_read() to not read past the end of the file. This would result
in incorrect resid values, and causes the read of /boot.cfg to ignore the
file. If the requested transfer extends past the end of the file, force
the internal buffer to be used, and when transferring data from the
internal buffer, limit the transfer to what's left in the file. CDROM
boot will now process the /boot.cfg file.
 1.28 25-Dec-2011  tsutsui branches: 1.28.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.27 16-Jun-2011  joerg branches: 1.27.2; 1.27.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.26 18-Oct-2010  ws branches: 1.26.6;
Allow multiple path separators between/after directory names.
Problem found while analyzing PR kern/43963.
 1.25 22-Mar-2010  jakllsch Ensure cd9660_read() gives accurate EOF indication.
Should fix PR/42983.
 1.24 19-Nov-2008  ad branches: 1.24.6; 1.24.8;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.23 24-Nov-2007  isaki branches: 1.23.14; 1.23.18; 1.23.24; 1.23.26;
style, indent, and ANSI-fy.
 1.22 05-Mar-2007  he branches: 1.22.14; 1.22.16; 1.22.22;
We need char* for pointer arithmetic.
 1.21 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 25-Jan-2006  christos branches: 1.20.24;
free -> dealloc
 1.19 11-Dec-2005  christos branches: 1.19.2;
merge ktrace-lwp.
 1.18 13-Jun-2005  junyoung branches: 1.18.2;
Oops, missed a semicolon.
 1.17 13-Jun-2005  junyoung ANSI, De-__P(), and some cosmetic changes including
bcmp -> memcmp, bzero -> memset, bcopy -> memcpy.
 1.16 26-Feb-2005  perry nuke trailing whitespace
 1.15 18-Oct-2003  itohy branches: 1.15.8; 1.15.10;
Rename local variables `read' to `nread' to shut up -Wshadow.
 1.14 21-Aug-2003  elric make 'path' argument to cd9660_open 'const char *' and fix the fallout.
 1.13 30-Dec-2002  veego branches: 1.13.2;
Fix broken build due too the move of the cd9660 and msdosfs kernel source code.
 1.12 05-Apr-2001  thorpej libkern.h now has the ctype routines.
 1.11 23-Nov-1999  simonb branches: 1.11.6;
Remove leading '/' from pathnames, using same logic as ufs.c. Allows new
style (but not yet committed) pmax bootblocks to open "/boot.pmax" on an
ISO image. Same problem reported for NFS by Jason Thorpe.
 1.10 13-Nov-1999  thorpej Backout my libsa changes.
 1.9 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.8 31-Mar-1999  cgd branches: 1.8.8; 1.8.10; 1.8.14;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.7 26-Mar-1999  dbj Changes to compile the next68k bootblocks with
egcs -Wpointer-arith -Wstrict-prototypes
This closes pr 6653
 1.6 11-Feb-1999  pk Add missing prototypes.
 1.5 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.4 13-Jun-1997  drochner -Wall fixes
 1.3 24-Jan-1997  cgd isonum_722 and isonum_732 are now back in iso.h
 1.2 24-Jan-1997  cgd update for iso.h changes which remove the need for the nastiness that was here
 1.1 30-Sep-1996  ws Add support for booting from cd9660 fs
Support directory traversal and symbolic links for nfs booting
Close device when file opening failed
Plug memory leak in ufs code
 1.8.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.10.1 15-Nov-1999  fvdl Sync with -current
 1.8.8.2 21-Apr-2001  bouyer Sync with HEAD
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.11.6.2 30-Dec-2002  thorpej Sync with HEAD.
 1.11.6.1 09-Apr-2001  nathanw Catch up with -current.
 1.13.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.13.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.13.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.15.8.1 29-Apr-2005  kent sync with -current
 1.18.2.3 07-Dec-2007  yamt sync with head
 1.18.2.2 03-Sep-2007  yamt sync with head.
 1.18.2.1 21-Jun-2006  yamt sync with head.
 1.19.2.1 01-Feb-2006  yamt sync with head.
 1.20.24.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.16.1 09-Jan-2008  matt sync with HEAD
 1.22.14.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.23.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.24.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.18.2 11-Aug-2010  yamt sync with head.
 1.23.18.1 04-May-2009  yamt sync with head.
 1.23.14.1 17-Jan-2009  mjf Sync with HEAD.
 1.24.8.2 05-Mar-2011  rmind sync with head
 1.24.8.1 30-May-2010  rmind sync with head
 1.24.6.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.24.6.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.27.6.1 18-Feb-2012  mrg merge to -current.
 1.27.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.2.2 30-Oct-2012  yamt sync with head
 1.27.2.1 17-Apr-2012  yamt sync with head
 1.28.2.1 25-Jul-2012  martin Pull up following revision(s) (requested by mhitch in ticket #440):
sys/lib/libsa/cd9660.c: revision 1.29
Fix cd9660_read() to not read past the end of the file. This would result
in incorrect resid values, and causes the read of /boot.cfg to ignore the
file. If the requested transfer extends past the end of the file, force
the internal buffer to be used, and when transferring data from the
internal buffer, limit the transfer to what's left in the file. CDROM
boot will now process the /boot.cfg file.
 1.29.4.1 18-May-2014  rmind sync with head
 1.29.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.28.1 15-Mar-2018  pgoyette Synch with HEAD
 1.30.22.1 13-Mar-2018  martin Pull up following revision(s) (requested by nonaka in ticket #625):
sys/arch/i386/stand/efiboot/efidisk.c: revision 1.2
sys/arch/i386/stand/efiboot/devopen.c: revision 1.2
sys/arch/i386/stand/efiboot/efidisk.h: revision 1.2
sys/arch/i386/stand/efiboot/boot.c: revision 1.6
sys/arch/i386/stand/efiboot/efidisk_ll.c: revision 1.2
sys/arch/i386/stand/efiboot/efidev.c: revision 1.1
sys/arch/i386/stand/lib/biosdisk_ll.h: revision 1.16
sys/arch/i386/stand/lib/biosdisk.h: revision 1.9
sys/lib/libsa/cd9660.c: revision 1.31
sys/arch/i386/stand/efiboot/efiboot.c: revision 1.5
sys/arch/i386/stand/efiboot/efiboot.h: revision 1.6
sys/arch/i386/stand/lib/biosdisk.c: revision 1.47
sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.10
sys/arch/i386/stand/efiboot/TODO.efiboot: revision 1.4
efiboot: system can boot from CD/DVD-ROM media.

Add missed file in previous commit.
 1.31.2.1 10-Jun-2019  christos Sync with HEAD
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 21-Aug-2003  elric make 'path' argument to cd9660_open 'const char *' and fix the fallout.
 1.1 30-Sep-1996  ws branches: 1.1.62;
Add support for booting from cd9660 fs
Support directory traversal and symbolic links for nfs booting
Close device when file opening failed
Plug memory leak in ufs code
 1.1.62.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.62.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.62.1 03-Aug-2004  skrll Sync with HEAD
 1.11 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.10 05-Sep-2016  dholland branches: 1.10.16;
Check bounds on input. From Michael Plass.
 1.9 06-Jan-2011  jakllsch branches: 1.9.14; 1.9.18; 1.9.20; 1.9.28; 1.9.34; 1.9.36; 1.9.38; 1.9.42;
Pacify Clang -Wformat-security.
 1.8 24-Nov-2007  isaki branches: 1.8.40;
style, indent, and ANSI-fy.
 1.7 11-Dec-2005  christos branches: 1.7.44; 1.7.46; 1.7.52;
merge ktrace-lwp.
 1.6 13-Jun-2005  junyoung branches: 1.6.2;
Remove bcmp(). Use memcmp() instead.
 1.5 15-Apr-2003  dsl branches: 1.5.2;
Add interface to boot password checking code that takes password parameter.
 1.4 30-Mar-2000  augustss Kill some more register declarations.
 1.3 13-Nov-1999  thorpej Backout my libsa changes.
 1.2 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.1 09-Sep-1999  drochner branches: 1.1.2; 1.1.4; 1.1.8;
add a function to verify a password against an in-core md5 sum
 1.1.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.4.1 15-Nov-1999  fvdl Sync with -current
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.1 07-Dec-2007  yamt sync with head
 1.7.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.46.1 09-Jan-2008  matt sync with HEAD
 1.7.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.8.40.1 05-Mar-2011  rmind sync with head
 1.9.42.1 18-Jan-2017  skrll Sync with netbsd-5
 1.9.38.1 25-Sep-2016  bouyer Pull up following revision(s) (requested by dholland in ticket #1250):
sys/lib/libsa/checkpasswd.c: revision 1.10
Check bounds on input. From Michael Plass.
 1.9.36.1 05-Oct-2016  skrll Sync with HEAD
 1.9.34.1 25-Sep-2016  bouyer Pull up following revision(s) (requested by dholland in ticket #1250):
sys/lib/libsa/checkpasswd.c: revision 1.10
Check bounds on input. From Michael Plass.
 1.9.28.1 24-Sep-2016  bouyer Pull up following revision(s) (requested by dholland in ticket #1406):
sys/lib/libsa/checkpasswd.c: revision 1.10
Check bounds on input. From Michael Plass.
 1.9.20.1 24-Sep-2016  bouyer Pull up following revision(s) (requested by dholland in ticket #1406):
sys/lib/libsa/checkpasswd.c: revision 1.10
Check bounds on input. From Michael Plass.
 1.9.18.1 03-Dec-2017  jdolecek update from HEAD
 1.9.14.1 24-Sep-2016  bouyer Pull up following revision(s) (requested by dholland in ticket #1406):
sys/lib/libsa/checkpasswd.c: revision 1.10
Check bounds on input. From Michael Plass.
 1.10.16.1 10-Jun-2019  christos Sync with HEAD
 1.14 02-Dec-2007  tsutsui unsigned -> unsigned int
 1.13 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.12 11-Dec-2005  christos branches: 1.12.44; 1.12.46; 1.12.52;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 07-Aug-2003  agc branches: 1.10.8; 1.10.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 30-Mar-2000  augustss branches: 1.9.28;
Kill some more register declarations.
 1.8 31-Mar-1999  cgd branches: 1.8.8;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.7 22-Jan-1997  cgd define these functions with an 'o' prepended to their names if
__INTERNAL_LIBSA_CREAD is defined (so that they can be used by the
compressed-read code).
 1.6 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.5 06-Sep-1995  pk Avoid calling device-close routine when open() not completed. Otherwise you
lose if this sequence occurs: open()->devopen()->...->panic()->closeall().
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 22-Aug-1994  brezak branches: 1.3.2;
Cleanup to make more ANSI compliant; checkpoint
 1.2 08-May-1994  brezak Standalone networking for network boot loaders.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.3.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.3.2.1 22-Aug-1994  brezak file close.c was added on branch netbsd-1-0 on 1994-08-22 21:56:00 +0000
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.9.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.28.1 03-Aug-2004  skrll Sync with HEAD
 1.10.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.11.4.1 07-Dec-2007  yamt sync with head
 1.12.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.12.46.1 09-Jan-2008  matt sync with HEAD
 1.12.44.2 03-Dec-2007  joerg Sync with HEAD.
 1.12.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.5 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.4 11-Dec-2005  christos branches: 1.4.44; 1.4.46; 1.4.52;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 07-Aug-2003  agc branches: 1.2.8; 1.2.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 13-Jan-1996  leo branches: 1.1.64;
Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.1.64.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.64.1 03-Aug-2004  skrll Sync with HEAD
 1.2.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.3.4.1 07-Dec-2007  yamt sync with head
 1.4.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.4.46.1 09-Jan-2008  matt sync with HEAD
 1.4.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.2 26-Jan-1994  mycroft Clean up deleted files.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.29 14-Jun-2023  rin Add /* FALLTHROUGH */ comment for sure.
 1.28 17-Jan-2016  tsutsui Add an option (LIBSA_CREAD_NOCRC) to disable gunzip CRC32 calculation.

No obvious sideeffect on booting i386 GENERIC kernels (without the option).
Closes PR/50638 (Extreme slowness on loading gzipped kernels on old CPUs).
 1.27 25-Jul-2015  isaki white space -> tab.
 1.26 13-Oct-2013  joerg branches: 1.26.6;
Let's not use uninitialized variables to write to random memory
locations, shall we?
 1.25 11-Oct-2013  pgoyette Rework previous (1.24) change. Rather than depending on the
file's flags to decide if decompress cleanup is needed, just
check to see if the open() allocated the 'struct sd *' used for
decompression.

This fixes recent problem where presence of a "load=ffs" command
in my /boot.cfg resulted in a "heap full" error at boot time.

OK martin@
 1.24 14-Apr-2013  martin branches: 1.24.4;
Make the check in close() for a non-deflatable file mode symetric to
the one in open().
Avoids dealloc() calls on NULL.
 1.23 25-Mar-2009  tls branches: 1.23.12; 1.23.22;
Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.22 17-Jan-2009  tsutsui branches: 1.22.2;
Remove __P().
 1.21 25-Mar-2008  christos branches: 1.21.4; 1.21.12; 1.21.14; 1.21.20;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.20 02-Dec-2007  tsutsui branches: 1.20.14;
unsigned -> unsigned int
 1.19 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.18 25-Jan-2006  christos branches: 1.18.42; 1.18.44; 1.18.50;
free -> dealloc
 1.17 14-Jan-2006  christos Don't include zlib.h directly; redirect through libz.h; this mirrors how
libkern is done and let's us abstract where the real zlib.h is kept.
 1.16 11-Dec-2005  christos branches: 1.16.2;
merge ktrace-lwp.
 1.15 24-Mar-2004  drochner branches: 1.15.16;
remove license clauses 3 and 4 from my cpoyright notices
 1.14 18-Mar-2003  mycroft branches: 1.14.2;
Move some stuff into .rodata.
 1.13 26-Nov-2000  simonb Fix tyop in comment.
 1.12 03-Feb-2000  drochner cosmetics: remove double semicolon, whitespace
 1.11 13-Nov-1999  thorpej Backout my libsa changes.
 1.10 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.9 31-Mar-1999  cgd branches: 1.9.8; 1.9.10; 1.9.14;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.8 12-Feb-1999  drochner That got broken in KNFifying.
 1.7 11-Feb-1999  pk Add missing prototypes and KNF the lot.
 1.6 18-Oct-1997  cjs Change sd.transparent to sd.compressed, so that we default to non-
compressed mode when we zero out the structure. Check_header() now
does not force us to uncompressed mode if we read no data (EOF);
it leaves the default, so that if we check at the end of a file,
we don't set the file to uncompressed mode and blow up later lseeks
on it.
 1.5 04-Jul-1997  drochner Catch errors from underlying reads, ie where oread() returns -1.
(Original code used fread() which never returns -1, so this case was
not handled.)
 1.4 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.3 13-Jun-1997  drochner Bring prototypes into scope.
 1.2 04-Feb-1997  thorpej In close(), if the file descriptor was used for writing, don't free
data structures that weren't allocated. Fix sanity-checked
by Matthias Drochner.
 1.1 22-Jan-1997  cgd code to open/close/read/lseek gzipped files, from Matthias Drochner.
 1.9.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.10.1 15-Nov-1999  fvdl Sync with -current
 1.9.8.2 08-Dec-2000  bouyer Sync with HEAD.
 1.9.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.16.2 07-Dec-2007  yamt sync with head
 1.15.16.1 21-Jun-2006  yamt sync with head.
 1.16.2.2 01-Feb-2006  yamt sync with head.
 1.16.2.1 15-Jan-2006  yamt sync with head.
 1.18.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.18.44.1 09-Jan-2008  matt sync with HEAD
 1.18.42.2 03-Dec-2007  joerg Sync with HEAD.
 1.18.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.20.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.21.20.1 21-Apr-2010  matt sync to netbsd-5
 1.21.14.1 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
common/dist/zlib/zlib.h: revision 1.3
sys/lib/libkern/crc32.c: revision 1.2
sys/lib/libkern/libkern.h: revision 1.90 via patch
sys/lib/libsa/cread.c: revision 1.23
sys/lib/libz/Makefile: revision 1.16
Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.21.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.21.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.4.1 04-May-2009  yamt sync with head.
 1.22.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.22.3 03-Dec-2017  jdolecek update from HEAD
 1.23.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.22.1 23-Jun-2013  tls resync from head
 1.23.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.4.1 18-May-2014  rmind sync with head
 1.26.6.2 19-Mar-2016  skrll Sync with HEAD
 1.26.6.1 22-Sep-2015  skrll Sync with HEAD
 1.8 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.7 11-Dec-2005  christos branches: 1.7.44; 1.7.46; 1.7.52;
merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 30-Mar-1999  cgd branches: 1.5.42;
move errno to its own file; if you just need errno, you don't need dev.c's fns
 1.4 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Cleanup to make more ANSI compliant; checkpoint
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.2.2.1 22-Aug-1994  brezak file dev.c was added on branch netbsd-1-0 on 1994-08-22 21:56:02 +0000
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 07-Dec-2007  yamt sync with head
 1.7.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.46.1 09-Jan-2008  matt sync with HEAD
 1.7.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.27 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.26 17-Jul-2011  joerg branches: 1.26.54;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.25 08-Aug-2010  chs print the correct error code if nfs_mount() fails.
 1.24 17-Jan-2009  tsutsui branches: 1.24.4; 1.24.6;
Remove __P().
 1.23 28-Apr-2008  martin branches: 1.23.8;
Remove clause 3 and 4 from TNF licenses
 1.22 24-Nov-2007  isaki branches: 1.22.14; 1.22.16; 1.22.18;
style, indent, and ANSI-fy.
 1.21 27-Oct-2007  tsutsui branches: 1.21.2;
Include "bootp.h" for a function declaration of bootp().
 1.20 01-Oct-2007  martin branches: 1.20.2;
Make a few debug outputs only happen when debugging.
 1.19 17-Mar-2002  gmcgarry branches: 1.19.28; 1.19.70; 1.19.84; 1.19.86; 1.19.88;
Protect remaining references to 'debug' with NETIF_DEBUG.
 1.18 13-Nov-1999  thorpej branches: 1.18.6; 1.18.8;
Backout my libsa changes.
 1.17 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.16 07-May-1999  drochner branches: 1.16.2; 1.16.4; 1.16.8;
move intoa() from libsa:net.c to libkern, turn inet_ntoa() into a macro,
nuke ip_convertaddr()
 1.15 26-Mar-1999  dbj branches: 1.15.4;
Changes to compile the next68k bootblocks with
egcs -Wpointer-arith -Wstrict-prototypes
This closes pr 6653
 1.14 29-Jun-1998  gwr Be quiet if bootparamd gives us an empty gateway spec.
(which is quite normal). Just make noise if it was
missing, which explains the very long timeout...
(Would be nice if sendrecv said "retrying...")
 1.13 16-Jun-1998  gwr When the gateway bootparam is missing, be clear about that
in the error message instead of showing zero or nothing.
 1.12 10-Dec-1997  gwr Oops - forgot to set netmask=smask
 1.11 10-Dec-1997  gwr Request the "gateway" parameter and use its contents
to determine our gateway and subnet mask, consistent
with what is done by nfs_mountroot.
 1.10 22-Jul-1997  drochner Don't use "if_ether.h", it's not used.
 1.9 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.8 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.7 14-Mar-1997  gwr Fix a warning.
 1.6 14-Mar-1997  gwr Sun RPC/bootparams always enabled (No -DSUN_BOOTPARAMS needed)
Add SUPPORT_BOOTP (and global try_bootp) to allow MD code to
determine whether BOOTP is used (compile-time and run-time).
Thanks to Matthias Drochner for the SUPPORT_BOOTP ideas.
Copyright asigned to The NetBSD Foundation.
 1.5 11-Mar-1997  gwr Moved here (via repository copy) so they are more easily shared.
I did not add them to the library, but rather compile them where
the netboot program is built so I can add -DSUN_BOOTPARAMS, etc.
 1.4 29-Jan-1996  gwr branches: 1.4.8;
Clean-up open/close logic of "net" device. Fixes PR 1726
 1.3 23-Sep-1995  gwr Cleanup, and catch up with libsa changes.
 1.2 08-Aug-1995  gwr Add bcea[] here now that is is gone from arp.c
 1.1 09-Jun-1995  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 09-Jun-1995  gwr Have netboot!
 1.4.8.2 12-Mar-1997  is Merge in changes from The Trunk
 1.4.8.1 07-Mar-1997  is Use libsa copy of oldstyle if_ether.h for now
 1.15.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.16.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.4.1 15-Nov-1999  fvdl Sync with -current
 1.16.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.18.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.18.6.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.19.88.1 06-Oct-2007  yamt sync with head.
 1.19.86.2 09-Jan-2008  matt sync with HEAD
 1.19.86.1 06-Nov-2007  matt sync with HEAD
 1.19.84.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.19.84.2 28-Oct-2007  joerg Sync with HEAD.
 1.19.84.1 02-Oct-2007  joerg Sync with HEAD.
 1.19.70.1 09-Oct-2007  ad Sync with head.
 1.19.28.3 07-Dec-2007  yamt sync with head
 1.19.28.2 15-Nov-2007  yamt sync with head.
 1.19.28.1 27-Oct-2007  yamt sync with head.
 1.20.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.21.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.18.3 11-Aug-2010  yamt sync with head.
 1.22.18.2 04-May-2009  yamt sync with head.
 1.22.18.1 16-May-2008  yamt sync with head.
 1.22.16.1 18-May-2008  yamt sync with head.
 1.22.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.24.6.1 05-Mar-2011  rmind sync with head
 1.24.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.26.54.1 10-Jun-2019  christos Sync with HEAD
 1.6 17-Jan-2009  tsutsui Remove __P().
 1.5 27-Oct-2007  tsutsui branches: 1.5.20; 1.5.28;
Add an extern decl of try_bootp variable here since MD sources could set it.
 1.4 26-Mar-1999  dbj branches: 1.4.58; 1.4.94; 1.4.108; 1.4.114; 1.4.116; 1.4.120;
Changes to compile the next68k bootblocks with
egcs -Wpointer-arith -Wstrict-prototypes
This closes pr 6653
 1.3 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.2 11-Mar-1997  gwr Moved here (via repository copy) so they are more easily shared.
I did not add them to the library, but rather compile them where
the netboot program is built so I can add -DSUN_BOOTPARAMS, etc.
 1.1 09-Jun-1995  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 09-Jun-1995  gwr branches: 1.1.1.1.10;
Have netboot!
 1.1.1.1.10.1 12-Mar-1997  is Merge in changes from The Trunk
 1.4.120.1 13-Nov-2007  bouyer Sync with HEAD
 1.4.116.1 06-Nov-2007  matt sync with HEAD
 1.4.114.1 28-Oct-2007  joerg Sync with HEAD.
 1.4.108.1 06-Jan-2008  wrstuden Catch up to netbsd-4.0 release.
 1.4.94.1 04-Nov-2007  pavel Pull up following revisions (requested by tsutsui in ticket #974):
sys/arch/cobalt/cobalt/autoconf.c: revision 1.25-1.26
sys/arch/cobalt/cobalt/machdep.c: revision 1.89
sys/arch/cobalt/stand/boot/Makefile: revision 1.12
sys/arch/cobalt/stand/boot/boot.c: revision 1.10
sys/arch/cobalt/stand/boot/boot.h: revision 1.6
sys/arch/cobalt/stand/boot/cache.c: revision 1.1-1.2
sys/arch/cobalt/stand/boot/clock.c: revision 1.2
sys/arch/cobalt/stand/boot/conf.c: revision 1.5
sys/arch/cobalt/stand/boot/devopen.c: revision 1.4
sys/arch/cobalt/stand/boot/nif_tlp.c: revision 1.1
sys/arch/cobalt/stand/boot/start.S: revision 1.6
sys/arch/cobalt/stand/boot/tlp.c: revision 1.1-1.3
sys/arch/cobalt/stand/boot/version: revision 1.6
sys/lib/libsa/dev_net.h: revision 1.5
Add an extern decl of try_bootp variable here since MD sources could set it.

In device_register(), check booted devices more properly:
- check "tlp" name on netboot
- use ata channel and drive numbers to check wd unit

Assume netboot if "nfsroot=/path" is specified in bootstring.

Use PCI bus/dev/function numbers rather than device unit
to check first tlp in device_register().

Add support for netboot via tlp0 with standalone tlp(4) driver
taken from arch/sandpoint/stand/netboot.
There are still some kludge but it just works on RaQ and RaQ2.

Fix my stupid bug in cache flush code and remove one kludge for it.

- use chaned mode for RX descs and allocate only one desc per each cacheline
to avoid possible race condition between CPU writeback vs DMA write
- remove unnecessary FS and LS bits from RxD->xd0
(sys/dev/ic/tulipvar.h sets them but maybe they are ignored?)
 1.4.58.1 15-Nov-2007  yamt sync with head.
 1.5.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.20.1 04-May-2009  yamt sync with head.
 1.12 26-May-2021  mrg in getdisklabel() swap the other-endian disklabel, #ifdef LIBSA_DISKLABEL_EI
 1.11 17-May-2021  mrg move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.10 24-Nov-2007  isaki branches: 1.10.122; 1.10.124;
style, indent, and ANSI-fy.
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 30-Jun-2004  christos branches: 1.7.4; 1.7.6;
constification fixes.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 31-Mar-1999  cgd branches: 1.5.42;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.4 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Cleanup to make more ANSI compliant; checkpoint
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.2.2.1 22-Aug-1994  brezak file disklabel.c was added on branch netbsd-1-0 on 1994-08-22 21:56:03 +0000
 1.5.42.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.42.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.4.1 07-Dec-2007  yamt sync with head
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10.124.1 31-May-2021  cjep sync with head
 1.10.122.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.6 17-May-2021  mrg move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.5 11-Dec-2005  christos branches: 1.5.180; 1.5.182;
merge ktrace-lwp.
 1.4 30-Jun-2004  christos constification fixes.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 30-Mar-2000  augustss branches: 1.2.28;
Kill some more register declarations.
 1.1 13-Jan-1996  leo branches: 1.1.30;
Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.1.30.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.182.1 31-May-2021  cjep sync with head
 1.5.180.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.23 22-Jan-2020  martin To support big partitions we need to make sure all byte offsets are calculated
in 64 bit arithmetic. Pointed out by Rob Newberry.
Unfortunately this causes a code size increase breaking some boot blocks,
so conditionalize it and use 32 bit arithmetic if SA_DOSFS_NO_BIG_PART_SUPPORT
is defined.
 1.22 31-Mar-2019  christos branches: 1.22.6;
fix warnings, printf formats, etc.
 1.21 11-Mar-2016  christos branches: 1.21.18;
PR/50952: David Binderman: Clarify expression
 1.20 20-Mar-2014  christos branches: 1.20.6;
reduce size by 1K by sharing the ls code.
 1.19 20-Oct-2013  christos use new function to avoid array overflow
 1.18 25-Dec-2011  tsutsui branches: 1.18.6; 1.18.10;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.17 16-Jun-2011  joerg branches: 1.17.2; 1.17.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.16 24-Nov-2008  ad branches: 1.16.14;
msdosfs -> msdos
 1.15 19-Nov-2008  ad For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.14 25-Mar-2008  christos branches: 1.14.4; 1.14.10; 1.14.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.13 14-Mar-2008  dsl Add a local strcasecmp() instead of pulling the bloat from libkern.
 1.12 24-Nov-2007  isaki branches: 1.12.10; 1.12.14;
style, indent, and ANSI-fy.
 1.11 02-Dec-2006  dogcow branches: 1.11.18; 1.11.20; 1.11.26;
make bootxx_msdos fit in 8k again; thanks, __internal_memset_, for spilling
registers all over the place.
 1.10 25-Jan-2006  christos branches: 1.10.18; 1.10.20; 1.10.22;
free -> dealloc
 1.9 11-Dec-2005  christos branches: 1.9.2;
merge ktrace-lwp.
 1.8 31-Aug-2003  fvdl branches: 1.8.16;
Fix signed/unsigned warnings.
 1.7 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.6 15-Jul-2003  scw In lookup(), don't free "dir" on exit if we found a matching entry.
Otherwise the caller ends up with a pointer to free'd memory...
 1.5 30-Dec-2002  veego branches: 1.5.2;
Fix broken build due too the move of the cd9660 and msdosfs kernel source code.
 1.4 09-Nov-2000  matt branches: 1.4.2; 1.4.4;
dos_unmount is only is dos_close is present but so conditionalize it like
dos_close.
 1.3 08-Nov-2000  matt avoid pointer addition on void pointers
 1.2 02-Nov-2000  thorpej Sprinkle some const -- gets things out of the .data segment, which
is important in the i386 boot blocks (grmumble).
 1.1 02-Nov-2000  thorpej Add a standalone MS-DOS file system reader package, lifted
from FreeBSD, and modified use NetBSD's already-existing
MS-DOS file system data structure definitions, rather than
defining our own.
 1.4.4.1 30-Dec-2002  thorpej Sync with HEAD.
 1.4.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.1 09-Nov-2000  bouyer file dosfs.c was added on branch thorpej_scsipi on 2000-11-22 16:05:41 +0000
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.4 17-Mar-2008  yamt sync with head.
 1.8.16.3 07-Dec-2007  yamt sync with head
 1.8.16.2 30-Dec-2006  yamt sync with head.
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 01-Feb-2006  yamt sync with head.
 1.10.22.1 02-Dec-2006  bouyer Pull up following revision(s) (requested by dogcow in ticket #240):
sys/lib/libsa/dosfs.c: revision 1.11
make bootxx_msdos fit in 8k again; thanks, __internal_memset_, for spilling
registers all over the place.
 1.10.20.1 10-Dec-2006  yamt sync with head.
 1.10.18.1 12-Jan-2007  ad Sync with head.
 1.11.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.11.20.2 23-Mar-2008  matt sync with HEAD
 1.11.20.1 09-Jan-2008  matt sync with HEAD
 1.11.18.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.12.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.12.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.10.1 24-Mar-2008  keiichi sync with head.
 1.14.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.4.1 04-May-2009  yamt sync with head.
 1.16.14.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.17.6.1 18-Feb-2012  mrg merge to -current.
 1.17.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.2.1 17-Apr-2012  yamt sync with head
 1.18.10.1 18-May-2014  rmind sync with head
 1.18.6.2 03-Dec-2017  jdolecek update from HEAD
 1.18.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.6.1 19-Mar-2016  skrll Sync with HEAD
 1.21.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.21.18.1 10-Jun-2019  christos Sync with HEAD
 1.22.6.1 25-Jan-2020  ad Sync with head.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.1 02-Nov-2000  thorpej branches: 1.1.2; 1.1.26;
Add a standalone MS-DOS file system reader package, lifted
from FreeBSD, and modified use NetBSD's already-existing
MS-DOS file system data structure definitions, rather than
defining our own.
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 02-Nov-2000  bouyer file dosfs.h was added on branch thorpej_scsipi on 2000-11-22 16:05:42 +0000
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 30-Mar-1999  cgd branches: 1.1.42;
move errno to its own file; if you just need errno, you don't need dev.c's fns
 1.1.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.42.1 03-Aug-2004  skrll Sync with HEAD
 1.24 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.23 29-Mar-2014  jakllsch branches: 1.23.30;
Obtain and/or use ETHER_ADDR_LEN.
 1.22 12-Jan-2009  tsutsui branches: 1.22.14; 1.22.24; 1.22.28;
Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.21 24-Nov-2007  isaki branches: 1.21.14; 1.21.18; 1.21.26;
style, indent, and ANSI-fy.
 1.20 11-Dec-2005  christos branches: 1.20.44; 1.20.46; 1.20.52;
merge ktrace-lwp.
 1.19 13-Jun-2005  junyoung branches: 1.19.2;
Remove bcmp(). Use memcmp() instead.
 1.18 31-Aug-2003  fvdl Fix signed/unsigned warnings.
 1.17 12-Mar-2003  drochner branches: 1.17.2;
separate ether_sprintf() from the rest of ethernet support -- sometimes
it makes sense to use the former w/o the latter (eg PXE)
 1.16 12-Mar-2003  drochner no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
 1.15 30-Mar-2000  augustss Kill some more register declarations.
 1.14 13-Nov-1999  thorpej Backout my libsa changes.
 1.13 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.12 14-May-1998  drochner branches: 1.12.14; 1.12.16; 1.12.20;
egcs -Wall -Werror
 1.11 07-Jul-1997  drochner Don't use private copy of old netinet/if_ether.h.
Use <net/if_ether.h> for ethernet specific definitions, and insert private
definitions for ARP if needed. (The new ARP macros in <net/if_arp.h> are
not used because they create larger code, and we really don't need more
than ethernet/ip support here.)
 1.10 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.9 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.8 13-Oct-1996  christos branches: 1.8.6;
backout previous kprintf changes
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.5 11-Sep-1995  thorpej Changes from Gordon Ross:
a) check against `my' ethernet or broadcast addresses done in
ether.c
b) changed interface to readether() to provide ethertype info
c) respond to arp requests when appropriate.
First two are clean-up. Last fixes hp300 and presumably mvme68k netboot
code.
 1.4 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.3 19-Feb-1995  mycroft Remove duplicate defn of bcea.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.8.6.1 07-Mar-1997  is Use the local copy of the old-style if_ether.h for the moment, til we have
time to modernize the libsa ARP support.
 1.12.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.16.1 15-Nov-1999  fvdl Sync with -current
 1.12.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.17.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 07-Dec-2007  yamt sync with head
 1.20.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.46.1 09-Jan-2008  matt sync with HEAD
 1.20.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.21.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.18.1 04-May-2009  yamt sync with head.
 1.21.14.1 17-Jan-2009  mjf Sync with HEAD.
 1.22.28.1 18-May-2014  rmind sync with head
 1.22.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.30.1 10-Jun-2019  christos Sync with HEAD
 1.7 29-Mar-2014  jakllsch Obtain and use ETHER_ADDR_LEN where appropriate.
Drop unnecessary includes.

XXX libsa ether_sprintf() should maybe be ether_snprintf.
 1.6 24-Nov-2007  isaki branches: 1.6.52; 1.6.62; 1.6.68;
style, indent, and ANSI-fy.
 1.5 24-Jan-2006  christos branches: 1.5.42; 1.5.44; 1.5.50;
PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
on an mbuf and ip_cksum() operates on a plain buffer. We should not call
functions that operate on different arguments the same name (this is not
c++).
 1.4 11-Dec-2005  christos branches: 1.4.2;
merge ktrace-lwp.
 1.3 17-May-2005  christos branches: 1.3.2;
Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
 1.2 25-Mar-2003  mycroft branches: 1.2.2;
const! const!
 1.1 12-Mar-2003  drochner separate ether_sprintf() from the rest of ethernet support -- sometimes
it makes sense to use the former w/o the latter (eg PXE)
 1.2.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.2 07-Dec-2007  yamt sync with head
 1.3.2.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 01-Feb-2006  yamt sync with head.
 1.5.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.44.1 09-Jan-2008  matt sync with HEAD
 1.5.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.6.68.1 18-May-2014  rmind sync with head
 1.6.62.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.52.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29 12-Jan-2014  tsutsui Remove obsolete exec.c for a.out. It was superseded by loadfile() long ago.
 1.28 29-Dec-2009  elad branches: 1.28.12; 1.28.22; 1.28.26;
Don't abuse INSECURE for allowing exec() to load files not owned by uid 0.

Adjust references where this has been used.
 1.27 16-Aug-2009  matt Change include of <sys/exec.h> to <sys/exec_aout.h> since these files want
the a.out stuff.
 1.26 25-Mar-2008  christos branches: 1.26.4;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.25 24-Nov-2007  isaki branches: 1.25.14;
style, indent, and ANSI-fy.
 1.24 11-Dec-2005  christos branches: 1.24.44; 1.24.46; 1.24.52;
merge ktrace-lwp.
 1.23 31-Aug-2003  fvdl branches: 1.23.16;
Fix signed/unsigned warnings.
 1.22 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.21 23-Jun-2003  martin branches: 1.21.2;
Protect opt_*.h include by _KERNEL_OPT
 1.20 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.19 13-Nov-1999  thorpej Backout my libsa changes.
 1.18 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.17 28-Jun-1997  thorpej branches: 1.17.22; 1.17.24; 1.17.28;
- Fix ZMAGIC image loading.
- Deal with stripped kernels.
- Let machine-dependent code frob the start address.
- General cleanup.
From Matthias Pfaller <matthias@netbsd.org>
 1.16 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.15 13-Oct-1996  christos backout previous kprintf changes
 1.14 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 02-Jun-1996  ragge Fix include file order to confirm to KNF in master tree also.
 1.12 14-May-1996  leo branches: 1.12.4;
Fix gcc -Wall warnings about printf arguments.
 1.11 20-Oct-1995  cgd cast pointer to long, not int
 1.10 04-Aug-1995  thorpej Fix off-by-one error when padding text segment.
 1.9 22-Apr-1995  cgd cast ptrs to longs, etc.
 1.8 21-Feb-1995  mycroft Correct some error strings, and add a few more. Don't print error messages in
exec(); let the caller do it.
 1.7 21-Feb-1995  mycroft exec() doesn't need to return a value.
 1.6 21-Feb-1995  mycroft Add the security check in the hp300 code, and clean a little.
 1.5 21-Feb-1995  mycroft Add a generic twiddler.
 1.4 25-Nov-1994  deraadt round text segment to __LDPGSZ bytes
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Cleanup to make more ANSI compliant; checkpoint
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.2.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.2.2.1 22-Aug-1994  brezak file exec.c was added on branch netbsd-1-0 on 1994-08-22 21:56:04 +0000
 1.12.4.1 02-Jun-1996  ragge Fix include file order to confirm to KNF.
 1.17.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.24.1 15-Nov-1999  fvdl Sync with -current
 1.17.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.16.1 07-Dec-2007  yamt sync with head
 1.24.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.24.46.1 09-Jan-2008  matt sync with HEAD
 1.24.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.25.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.26.4.2 11-Mar-2010  yamt sync with head
 1.26.4.1 19-Aug-2009  yamt sync with head.
 1.28.26.1 18-May-2014  rmind sync with head
 1.28.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.16 11-Dec-2005  christos branches: 1.16.44; 1.16.46; 1.16.52;
merge ktrace-lwp.
 1.15 26-Feb-2005  perry branches: 1.15.4;
nuke trailing whitespace
 1.14 01-Jun-2002  itojun branches: 1.14.6; 1.14.14; 1.14.16;
use exit(int), not exit(void), consistently - even if the arg has no meaning.
 1.13 12-Feb-1999  drochner branches: 1.13.20; 1.13.22; 1.13.34;
We can't prototype exit() publically because it might take an argument or
not, depending on the port-specific environment.
Separate panic() and exit() so that the mi/default panic() can be used
without conflicting with a local exit() definition, move exit(void)
prototype to the default exit() implementation.
Closes PR bin/6990 by Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>.
 1.12 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.11 01-Dec-1996  pk kvprintf => vprintf (PR#2989, Juergen Hannken-Illjes).
 1.10 13-Oct-1996  christos backout previous kprintf changes
 1.9 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 09-Feb-1996  gwr use vprintf where appropriate
 1.7 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.6 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.5 22-Apr-1995  cgd note properly whether or not functions return, etc.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 22-Aug-1994  brezak branches: 1.3.2;
Cleanup to make more ANSI compliant; checkpoint
 1.2 08-May-1994  brezak Standalone networking for network boot loaders.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.3.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.3.2.1 22-Aug-1994  brezak file exit.c was added on branch netbsd-1-0 on 1994-08-22 21:56:05 +0000
 1.13.34.1 20-Jun-2002  gehenna catch up with -current.
 1.13.22.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.20.1 20-Jun-2002  nathanw Catch up to -current.
 1.14.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.14.1 29-Apr-2005  kent sync with -current
 1.14.6.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.4.1 07-Dec-2007  yamt sync with head
 1.16.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.16.46.1 09-Jan-2008  matt sync with HEAD
 1.16.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.34 29-Apr-2022  rin Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.
 1.33 27-Apr-2022  rin Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name: src
> Committed By: rin
> Date: Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
> src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
 1.32 27-Apr-2022  rin Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.
 1.31 24-Apr-2022  mlelstv Ask driver about sector size to support reading superblocks from fixed
byte offsets.
 1.30 19-Apr-2022  skrll Typo in comment. avoinds -> avoids
 1.29 24-Jan-2020  jakllsch Use dp->e2d_namlen rather than strlen(dp->e2d_name) in ext2fs_ls().

Prevents garbage beyond the end of the name from appearing on screen.
 1.28 24-Jun-2019  pgoyette branches: 1.28.4;
Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.
 1.27 05-Apr-2019  christos Go back ot using 0x%x instead of %#x because we don't always support the
format. See subr_prf.c
 1.26 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.25 21-Aug-2016  christos branches: 1.25.16;
delete now unused function .
 1.24 04-Aug-2016  rjs Another header change.
 1.23 04-Aug-2016  nonaka Sync with sys/ufs/ext2fs/ext2fs_bswap.c.
 1.22 04-Aug-2016  nonaka pass EXT2_DINODE_SIZE(fs) as isize to e2fs_iload().
should fix build failure.
 1.21 03-Aug-2016  rjs Adjust for change to kernel ext2fs headers.
 1.20 20-Mar-2014  christos branches: 1.20.6; 1.20.10;
reduce size by 1K by sharing the ls code.
 1.19 20-Oct-2013  christos XXX: gcc initializations
 1.18 23-Jun-2013  dholland branches: 1.18.2;
Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.17 23-Jun-2013  dholland fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.16 19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.15 10-May-2013  tsutsui Wrap >80 char lines that overflowed on NDADDR -> EXT2FS_NDADDR changes.
 1.14 22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.13 21-May-2012  dsl branches: 1.13.2;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.12 16-Jan-2012  christos branches: 1.12.2;
PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.11 25-Dec-2011  tsutsui Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.10 16-Jun-2011  joerg branches: 1.10.2; 1.10.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.9 02-Jan-2011  jakllsch branches: 1.9.6;
Zero the in-memory super block after allocation. It contains a pointer
that, if not properly initialized, could be improperly deallocated.
 1.8 19-Oct-2009  bouyer branches: 1.8.4;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.7 02-Mar-2009  tsutsui Use EXT2_DINODE_SIZE() to get offset of inode, not struct ext2fs_dinode array.
 1.6 01-Mar-2009  christos catch up with variable inode size.
 1.5 19-Nov-2008  ad branches: 1.5.4;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.4 02-Dec-2007  tsutsui branches: 1.4.2; 1.4.6; 1.4.8; 1.4.16; 1.4.22; 1.4.26; 1.4.32; 1.4.34; 1.4.36;
- also pass correct size on dealloc() of in-memory superblock data
- also call dealloc() for group descriptor blocks
 1.3 02-Dec-2007  tsutsui Allocate correct size for in-memory data struct m_ext2fs
(which is larger than SBSIZE).
 1.2 02-Dec-2007  tsutsui - fix description about index structure of an inode to match ext2fs_dinode
- put more byteswap ops on reading block numbers in indirect blocks
(XXX: untested on big endian machines)
 1.1 01-Dec-2007  tsutsui Add ext2fs support for libsa.

Mostly based on ufs.c, and some ext2fs specific stuff is pulled from
sys/ufs/ext2fs/ext2fs_bswap.c and sys/ufs/ext2fs/ext2fs_vfsops.c.

XXX1: Should we share ufs.c with #ifdef LIBSA_EXT2FS as ffs and lfs do?
XXX2: Maybe we should share ext2fs_bswap.c with kernel.
 1.4.36.1 16-Jan-2011  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1486):
sbin/fsck_ext2fs/setup.c: revision 1.26
sbin/newfs_ext2fs/mke2fs.c: revision 1.10
sbin/newfs_ext2fs/mke2fs.c: revision 1.11
sbin/newfs_ext2fs/mke2fs.c: revision 1.12
sbin/fsck_ext2fs/inode.c: revision 1.24
sys/lib/libsa/ext2fs.c: revision 1.6
sbin/newfs_ext2fs/extern.h: revision 1.3
sbin/fsck_ext2fs/inode.c: revision 1.25
sys/lib/libsa/ext2fs.c: revision 1.7
sbin/fsck_ext2fs/inode.c: revision 1.26
sys/ufs/ext2fs/ext2fs_inode.c: revision 1.68
sbin/fsck_ext2fs/inode.c: revision 1.27
sbin/fsck_ext2fs/inode.c: revision 1.28
sys/ufs/ext2fs/ext2fs_dinode.h: revision 1.18
sys/ufs/ext2fs/ext2fs_dinode.h: revision 1.19
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.5
sbin/newfs_ext2fs/newfs_ext2fs.8: revision 1.2
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.6
sbin/newfs_ext2fs/newfs_ext2fs.8: revision 1.3
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.142
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.7
sbin/newfs_ext2fs/newfs_ext2fs.8: revision 1.4
sbin/newfs_ext2fs/newfs_ext2fs.c: revision 1.8
PR/40936: Frederik Sausmikat: ext2fs: add support for inodes > 128 bytes
Support variable inode sizes.
catch up with variable inode size.
Don't use e2fs_inode_size in superblock on E2FS_REV0 file system.
- accept only EXT2_REV0_DINODE_SIZE inodesize on -O 0
- use inodesize to get offset of inode, not struct ext2fs_dinode array
Replace a magic number with a new EXT2_REV0_DINODE_SIZE macro.
Use EXT2_DINODE_SIZE() to get offset of inode, not struct ext2fs_dinode array.
Fix botched logic in inodesize check.
Use inodesize to get offset of inode in one more place.
- add a sanity check for e2fs_inode_size in readsb()
- use EXT2_DINODE_SIZE() rather than sizeof(struct ext2fs_dinode) or
struct ext2fs_dinode array/pointer to see e2fs_ipb and inode offsets
Sort options.
New sentence, new line.
Sort options in usage.
- unsigned -> unsigned int
- remove unnecessary casts from malloc(3) and free(3)
- fix a bogus indent
Use "size > INT32_MAX" rather than "size >= 0x80000000U" to check 2GB limit.
Add missed byteswap ops against ext2fs_dinode members.
Handle 32 bit uid field on E2FS_REV1.
 1.4.34.2 03-Mar-2009  skrll Sync with HEAD.
 1.4.34.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.32.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.26.2 11-Mar-2010  yamt sync with head
 1.4.26.1 04-May-2009  yamt sync with head.
 1.4.22.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.16.2 09-Jan-2008  matt sync with HEAD
 1.4.16.1 02-Dec-2007  matt file ext2fs.c was added on branch matt-armv6 on 2008-01-09 01:56:39 +0000
 1.4.8.2 08-Dec-2007  mjf Sync with HEAD.
 1.4.8.1 02-Dec-2007  mjf file ext2fs.c was added on branch mjf-devfs on 2007-12-08 18:20:52 +0000
 1.4.6.2 07-Dec-2007  yamt sync with head
 1.4.6.1 02-Dec-2007  yamt file ext2fs.c was added on branch yamt-lazymbuf on 2007-12-07 17:33:40 +0000
 1.4.2.2 03-Dec-2007  joerg Sync with HEAD.
 1.4.2.1 02-Dec-2007  joerg file ext2fs.c was added on branch jmcneill-pm on 2007-12-03 16:15:02 +0000
 1.5.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.4.1 05-Mar-2011  rmind sync with head
 1.9.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.2 02-Jun-2012  mrg sync to latest -current.
 1.10.6.1 18-Feb-2012  mrg merge to -current.
 1.10.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.2.3 23-Jan-2013  yamt sync with head
 1.10.2.2 23-May-2012  yamt sync with head.
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.12.2.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.13.2.4 03-Dec-2017  jdolecek update from HEAD
 1.13.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.2.2 23-Jun-2013  tls resync from head
 1.13.2.1 25-Feb-2013  tls resync with head
 1.18.2.1 18-May-2014  rmind sync with head
 1.20.10.1 06-Aug-2016  pgoyette Sync with HEAD
 1.20.6.1 05-Oct-2016  skrll Sync with HEAD
 1.25.16.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.25.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.25.16.1 10-Jun-2019  christos Sync with HEAD
 1.28.4.1 25-Jan-2020  ad Sync with head.
 1.1 01-Dec-2007  tsutsui branches: 1.1.2; 1.1.6; 1.1.8; 1.1.16;
Add ext2fs support for libsa.

Mostly based on ufs.c, and some ext2fs specific stuff is pulled from
sys/ufs/ext2fs/ext2fs_bswap.c and sys/ufs/ext2fs/ext2fs_vfsops.c.

XXX1: Should we share ufs.c with #ifdef LIBSA_EXT2FS as ffs and lfs do?
XXX2: Maybe we should share ext2fs_bswap.c with kernel.
 1.1.16.2 09-Jan-2008  matt sync with HEAD
 1.1.16.1 01-Dec-2007  matt file ext2fs.h was added on branch matt-armv6 on 2008-01-09 01:56:40 +0000
 1.1.8.2 08-Dec-2007  mjf Sync with HEAD.
 1.1.8.1 01-Dec-2007  mjf file ext2fs.h was added on branch mjf-devfs on 2007-12-08 18:20:52 +0000
 1.1.6.2 07-Dec-2007  yamt sync with head
 1.1.6.1 01-Dec-2007  yamt file ext2fs.h was added on branch yamt-lazymbuf on 2007-12-07 17:33:41 +0000
 1.1.2.2 03-Dec-2007  joerg Sync with HEAD.
 1.1.2.1 01-Dec-2007  joerg file ext2fs.h was added on branch jmcneill-pm on 2007-12-03 16:15:02 +0000
 1.1 27-May-2021  mrg branches: 1.1.2; 1.1.6;
add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.1.6.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.1.6.1 27-May-2021  thorpej file ffs_bswap.c was added on branch thorpej-i2c-spi-conf on 2021-06-17 04:46:34 +0000
 1.1.2.2 31-May-2021  cjep sync with head
 1.1.2.1 27-May-2021  cjep file ffs_bswap.c was added on branch cjep_staticlib_x on 2021-05-31 22:15:21 +0000
 1.10 17-Nov-2022  chs Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.9 24-Apr-2022  mlelstv Don't load filessytem module for filesystem that was found but isn't used
for booting.
 1.8 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.7 24-Jun-2019  pgoyette branches: 1.7.14; 1.7.16;
Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.
 1.6 21-May-2012  dsl branches: 1.6.40;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.5 25-Dec-2011  tsutsui branches: 1.5.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.4 19-Nov-2008  ad branches: 1.4.16; 1.4.20;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.74; 1.3.80; 1.3.84;
merge ktrace-lwp.
 1.2 31-Aug-2003  fvdl Fix signed/unsigned warnings.
 1.1 11-Apr-2003  dsl branches: 1.1.2;
Files to build ffsv1 and ffsv2 versions of ufs.c
 1.1.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.1 03-Aug-2004  skrll Sync with HEAD
 1.3.84.1 19-Jan-2009  skrll Sync with HEAD.
 1.3.80.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.74.1 04-May-2009  yamt sync with head.
 1.3.70.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.20.2 02-Jun-2012  mrg sync to latest -current.
 1.4.20.1 18-Feb-2012  mrg merge to -current.
 1.4.16.2 23-May-2012  yamt sync with head.
 1.4.16.1 17-Apr-2012  yamt sync with head
 1.5.2.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.6.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.16.1 31-May-2021  cjep sync with head
 1.7.14.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.10 17-Nov-2022  chs Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.9 24-Apr-2022  mlelstv Don't load filessytem module for filesystem that was found but isn't used
for booting.
 1.8 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.7 24-Jun-2019  pgoyette branches: 1.7.14; 1.7.16;
Now that the ufs module has been split out from ffs and ext2fs, we need
to update the boot-loader to push all modules required to support the
booted filesystem. We treat the fsmod string as a slash-separated list
of module names (relative to kern.module.path), rather than as a single
module path name.

Note that ffsv1 and ffsv2 are still exempted from the boot-loader's
auto-push, but the list of required filesystems is still noted in the
source.

Also note that arch/sandpoint needs a similar change. I have not made
this change because I am totally unable to test it.

Tested on my kernel with _no_ built-in file-systems and with the ffs
bootloader settings of fsmod enabled.
 1.6 21-May-2012  dsl branches: 1.6.40;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.5 25-Dec-2011  tsutsui branches: 1.5.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.4 19-Nov-2008  ad branches: 1.4.16; 1.4.20;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.74; 1.3.80; 1.3.84;
merge ktrace-lwp.
 1.2 31-Aug-2003  fvdl Fix signed/unsigned warnings.
 1.1 11-Apr-2003  dsl branches: 1.1.2;
Files to build ffsv1 and ffsv2 versions of ufs.c
 1.1.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.1 03-Aug-2004  skrll Sync with HEAD
 1.3.84.1 19-Jan-2009  skrll Sync with HEAD.
 1.3.80.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.74.1 04-May-2009  yamt sync with head.
 1.3.70.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.20.2 02-Jun-2012  mrg sync to latest -current.
 1.4.20.1 18-Feb-2012  mrg merge to -current.
 1.4.16.2 23-May-2012  yamt sync with head.
 1.4.16.1 17-Apr-2012  yamt sync with head
 1.5.2.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.6.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.16.1 31-May-2021  cjep sync with head
 1.7.14.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.2 24-Apr-2022  mlelstv Don't load filessytem module for filesystem that was found but isn't used
for booting.
 1.1 15-Mar-2002  simonb branches: 1.1.4; 1.1.10;
Move files[] from globals.c to its own file. Including all of globals.o
breaks the size limit for at least the pmax bootblocks.

Fixes PR port-pmax/15924 from Gregory McGarry.
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 15-Mar-2002  jdolecek file files.c was added on branch kqueue on 2002-06-23 17:49:52 +0000
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 15-Mar-2002  nathanw file files.c was added on branch nathanw_sa on 2002-04-01 07:48:08 +0000
 1.1 16-Jan-2012  christos branches: 1.1.4; 1.1.6;
PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.1.6.2 17-Apr-2012  yamt sync with head
 1.1.6.1 16-Jan-2012  yamt file fnmatch.c was added on branch yamt-pagecache on 2012-04-17 00:08:33 +0000
 1.1.4.2 18-Feb-2012  mrg merge to -current.
 1.1.4.1 16-Jan-2012  mrg file fnmatch.c was added on branch jmcneill-usbmp on 2012-02-18 07:35:35 +0000
 1.7 02-Dec-2007  tsutsui unsigned -> unsigned int
 1.6 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.5 11-Dec-2005  christos branches: 1.5.44; 1.5.46; 1.5.52;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc branches: 1.4.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 30-Mar-2000  augustss branches: 1.3.28;
Kill some more register declarations.
 1.2 31-Mar-1999  cgd branches: 1.2.8;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.1 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.28.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 07-Dec-2007  yamt sync with head
 1.5.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.46.1 09-Jan-2008  matt sync with HEAD
 1.5.44.2 03-Dec-2007  joerg Sync with HEAD.
 1.5.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10 11-Jun-2016  dholland PR 51200 gets in libsa considered harmful: use kgets
 1.9 24-Nov-2007  isaki branches: 1.9.62; 1.9.82;
style, indent, and ANSI-fy.
 1.8 11-Dec-2005  christos branches: 1.8.44; 1.8.46; 1.8.52;
merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 14-Oct-1996  cgd branches: 1.6.62;
fix a bogon in some new functionality apparently added in the last
commit (which was supposed only to back out the printf->kprintf changes).
The new functionality is: if the user enters control-D, return an error.
 1.5 13-Oct-1996  christos backout previous kprintf changes
 1.4 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Cleanup to make more ANSI compliant; checkpoint
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.2.2.1 22-Aug-1994  brezak file getfile.c was added on branch netbsd-1-0 on 1994-08-22 21:56:07 +0000
 1.6.62.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.62.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.62.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 07-Dec-2007  yamt sync with head
 1.8.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.8.46.1 09-Jan-2008  matt sync with HEAD
 1.8.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.9.82.1 09-Jul-2016  skrll Sync with HEAD
 1.9.62.1 03-Dec-2017  jdolecek update from HEAD
 1.15 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.14 27-Aug-2016  dholland branches: 1.14.16;
PR 51200 gets in libsa considered harmful: remove gets() from libsa.
 1.13 11-Jun-2016  dholland gets_s -> kgets.

The exact name isn't that important; but it is important not to use
"gets_s" and thereby allow anyone to falsely get the impression we're
implementing Annex K. We aren't.

ok core.
 1.12 05-Jun-2016  christos dedup
 1.11 05-Jun-2016  maxv Use gets_s instead of gets. The x86 bootloader prompt is easy to
overflow.
 1.10 24-Nov-2007  isaki branches: 1.10.62; 1.10.82;
style, indent, and ANSI-fy.
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52;
merge ktrace-lwp.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 30-Mar-2000  augustss branches: 1.7.28;
Kill some more register declarations.
 1.6 11-Oct-1995  pk branches: 1.6.30;
Conditionalize ancient `@' and `#' erasors.
 1.5 26-Oct-1994  cgd branches: 1.5.2;
new RCS ID format.
 1.4 22-Aug-1994  brezak branches: 1.4.2;
Cleanup to make more ANSI compliant; checkpoint
 1.3 09-Aug-1994  pk Echo terminating NL too.
 1.2 18-Jul-1994  pk do echo.
 1.1 26-Jan-1994  brezak branches: 1.1.2;
CMU/4.4 stand-alone library
 1.1.2.2 13-Aug-1994  mycroft update from trunk
 1.1.2.1 27-Jul-1994  cgd update from trunk.
 1.4.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.4.2.1 22-Aug-1994  brezak file gets.c was added on branch netbsd-1-0 on 1994-08-22 21:56:08 +0000
 1.5.2.1 13-Oct-1995  pk Update from trunk: erase characters.
 1.6.30.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.7.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.28.1 03-Aug-2004  skrll Sync with HEAD
 1.8.16.1 07-Dec-2007  yamt sync with head
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10.82.2 05-Oct-2016  skrll Sync with HEAD
 1.10.82.1 09-Jul-2016  skrll Sync with HEAD
 1.10.62.1 03-Dec-2017  jdolecek update from HEAD
 1.14.16.1 10-Jun-2019  christos Sync with HEAD
 1.12 24-Apr-2022  mlelstv Don't load filessytem module for filesystem that was found but isn't used
for booting.
 1.11 29-Mar-2014  jakllsch Obtain and/or use ETHER_ADDR_LEN.
 1.10 05-Jan-2014  jakllsch Make libsa fsmod string pointer const.
 1.9 21-May-2012  dsl branches: 1.9.2; 1.9.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.8 19-Nov-2008  ad branches: 1.8.16; 1.8.20; 1.8.22;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.7 27-Mar-2003  drochner branches: 1.7.100; 1.7.104; 1.7.110; 1.7.114;
There is no point in initializing "rootpath" to "/".
Move it into BSS.
 1.6 19-Mar-2003  drochner remove stuff just moved to bootparam.c and some variables which are
never used.
 1.5 15-Mar-2002  simonb Move files[] from globals.c to its own file. Including all of globals.o
breaks the size limit for at least the pmax bootblocks.

Fixes PR port-pmax/15924 from Gregory McGarry.
 1.4 23-Feb-2002  thorpej Move files[] from open.c to globals.c, so that it's possible to
use libsa in an application where there are no file systems or
devices.
 1.3 18-Sep-1995  pk branches: 1.3.44; 1.3.46;
Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.3.46.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.46.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.44.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.44.1 28-Feb-2002  nathanw Catch up to -current.
 1.7.114.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.110.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.104.1 04-May-2009  yamt sync with head.
 1.7.100.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.22.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.8.20.1 02-Jun-2012  mrg sync to latest -current.
 1.8.16.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8.16.1 23-May-2012  yamt sync with head.
 1.9.4.1 18-May-2014  rmind sync with head
 1.9.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.26 22-Jul-1997  drochner Remove this relict, it's not needed anymore.
 1.25 17-Jan-1997  mikel branches: 1.25.2;
fix my typo; found by Klaus Klein <kleink@layla.inka.de>
 1.24 17-Jan-1997  mikel add prototypes for ethers(3) functions; fixes PR 2471.
fix suggested by Jason Thorpe.
 1.23 09-Oct-1996  thorpej Merge netbsd-1-2 branch back into mainline.
 1.22 11-May-1996  mycroft branches: 1.22.4;
When sending an ARP request, use the interface address for the route, rather
than the first address assigned. This gives slightly different behaviour in
the presence of aliases. From Bill Fenner, via Pete Bentley.
 1.21 13-Feb-1996  christos netinet prototypes
 1.20 12-Jun-1995  mycroft Various cleanup, including:
* Convert several data structures to use queue.h.
* Split in_pcbnotify() into two parts; one for notifying a specific PCB, and
one for notifying all PCBs for a particular foreign address.
 1.19 16-May-1995  cgd parenthesize macro arg usage
 1.18 15-May-1995  cgd spacing fixups and KNF. #define ether address size, so it's not
hardcoded as '6' all over.
 1.17 17-Apr-1995  cgd spacing cleaup. also, minor type mixup fixups.
 1.16 13-Apr-1995  cgd be a bit more careful and explicit with types. (basically a large no-op.)
 1.15 10-Apr-1995  mycroft Remove now unneeded #ifdef. Prototype new function.
 1.14 29-Mar-1995  briggs KERNEL -> _KERNEL
 1.13 26-Mar-1995  jtc KERNEL -> _KERNEL
 1.12 06-Mar-1995  glass remove references to arptnew. fix spelling error
 1.11 27-Feb-1995  glass fix some typos. from frank@fwi.uva.nl (Frank van der Linden)
 1.10 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.9 13-May-1994  mycroft Update to 4.4-Lite networking code, with a few local changes.
 1.8 02-Feb-1994  hpeyerl Multicast is no longer optional.
 1.7 08-Jan-1994  mycroft Fix some inconsistent spacing; spaces at the end of lines, etc.
 1.6 30-Dec-1993  deraadt "struct ether_addr" for ethers(3) functions.
 1.5 13-Dec-1993  hpeyerl >From cmaeda@cs.washington.edu; part of the multicast patches derived
from the Multicast patches for BSDI.

(I am a "big dopey bear" for having forgotten this. Thanx Havard.)
 1.4 05-Sep-1993  cassidy Add definition for reverse address resolution protocol.
 1.3 20-May-1993  cgd more rcsid additions and file header cleanups
 1.2 19-Apr-1993  mycroft Add consistent multiple-inclusion protection.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.22.4.1 17-Jun-1996  gwr Pad the struct arpcom to avoid unnecessary misalignments on m68k ports.
 1.25.2.3 06-Mar-1997  is Wipe out double function prototypes.
 1.25.2.2 18-Feb-1997  is Having converted everything, remove the struct ether_arp definition completely.
Some small cleanup.
STILLTODO: some sanity checks of the (now) variable link level address length
in incoming packets..
 1.25.2.1 07-Feb-1997  is Snapshot of new ARP code.

Our old ARP code was hardwired for 6-byte length medium
addresses, while the protocol is designed for any size.

This snapshot contains a first hack at getting rid of
Ethernet specific data structures. The ep driver is updated
(and tested on the PCI bus), the iy and fpa drivers have been
updated, but not real life tested yet.

If you want to test this with other drivers, you have to update
them first yourself, and probably tag the relevant directories.
Better contact me if you want to do this.
 1.7 24-Jan-2006  christos PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
on an mbuf and ip_cksum() operates on a plain buffer. We should not call
functions that operate on different arguments the same name (this is not
c++).
 1.6 31-Mar-2000  castor branches: 1.6.44; 1.6.56;
Make standalone in_cksum work on little-endian machines, too, courtesy of
Jeff Smith, <jeffs@geocast.com>.
 1.5 30-Mar-2000  augustss Kill some more register declarations.
 1.4 11-Feb-1999  pk branches: 1.4.8;
Add missing prototypes.
 1.3 22-Apr-1995  cgd cast pointers to longs
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.4.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.56.1 01-Feb-2006  yamt sync with head.
 1.6.44.1 21-Jun-2006  yamt sync with head.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.11 02-Dec-2007  tsutsui unsigned -> unsigned int
 1.10 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 07-Aug-2003  agc branches: 1.7.8; 1.7.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 30-Mar-2000  augustss branches: 1.6.28;
Kill some more register declarations.
 1.5 31-Mar-1999  cgd branches: 1.5.8;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.4 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 08-May-1994  brezak Standalone networking for network boot loaders.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.5.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.28.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.4.1 07-Dec-2007  yamt sync with head
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.2 03-Dec-2007  joerg Sync with HEAD.
 1.9.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10 29-Mar-2014  jakllsch Obtain and/or use ETHER_ADDR_LEN.
 1.9 17-Jan-2009  tsutsui branches: 1.9.14; 1.9.24; 1.9.28;
Remove __P().
 1.8 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.74; 1.7.84;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry nuke trailing whitespace
 1.5 12-Mar-2003  drochner branches: 1.5.2; 1.5.10; 1.5.12;
separate the netif interface from the rest of the networking code,
so that it can be replaced easily in md code
 1.4 23-Sep-1995  gwr Fix/improve some comments.
 1.3 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.84.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.74.1 04-May-2009  yamt sync with head.
 1.7.70.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.28.1 18-May-2014  rmind sync with head
 1.9.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5 08-Jul-2022  skrll alredy -> already
 1.4 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.3 09-May-2018  maxv branches: 1.3.2;
Remove annoying things, style, and fix buffer overflows.
 1.2 13-May-2011  nakayama branches: 1.2.2; 1.2.6; 1.2.58;
Use %zd for ssize_t, and %zu for size_t.
 1.1 11-May-2011  zoltan Separate the IP and UDP code paths inside libsa, so I can add HTTP booting
later.
 1.2.58.1 21-May-2018  pgoyette Sync with HEAD
 1.2.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.6.1 13-May-2011  jruoho file ip.c was added on branch jruoho-x86intr on 2011-06-06 09:09:43 +0000
 1.2.2.2 31-May-2011  rmind sync with head
 1.2.2.1 13-May-2011  rmind file ip.c was added on branch rmind-uvmplock on 2011-05-31 03:05:05 +0000
 1.3.2.1 10-Jun-2019  christos Sync with HEAD
 1.2 25-Jan-2006  christos branches: 1.2.4; 1.2.18;
Changing len from int to size_t caused an infinite loop. Noticed by chuq.
 1.1 24-Jan-2006  christos PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
on an mbuf and ip_cksum() operates on a plain buffer. We should not call
functions that operate on different arguments the same name (this is not
c++).
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 25-Jan-2006  yamt file ip_cksum.c was added on branch yamt-lazymbuf on 2006-06-21 15:10:23 +0000
 1.2.4.2 01-Feb-2006  yamt sync with head.
 1.2.4.1 25-Jan-2006  yamt file ip_cksum.c was added on branch yamt-uio_vmspace on 2006-02-01 14:52:36 +0000
 1.12 16-Apr-2003  dsl lfs code is built from ufs.c
 1.11 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.10 23-Feb-2003  simonb Add support for LFSv2 filesystems. From a libsa standpoint, LFSv1 and
LFSv2 are treated as separate filesystem types for size considerations.
 1.9 23-Feb-2003  simonb Use the MAX() macro from <sys/param.h> instead of a local inline. Results
in same code size in ufs.c and removes an unused inline function in lfs.c.
 1.8 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.7 07-May-2002  simonb Remove two shadowed variables, one of which was set to what it was
shadowing(!) and the other a temporary variable (as was it's shadow).
Code generated with "gcc -O2" is the same before and after.
 1.6 30-Mar-2000  augustss branches: 1.6.6; 1.6.8;
Kill some more register declarations.
 1.5 13-Nov-1999  thorpej Backout my libsa changes.
 1.4 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.3 19-Aug-1999  simonb branches: 1.3.2; 1.3.4; 1.3.8;
Remove prototype for find_inode().
 1.2 18-Aug-1999  cgd note that these files should be easily diffable (until they share common code
 1.1 18-Aug-1999  cgd Add a standalone LFS implementation. Currently not merged with ufs (FFS),
but should be (and will be before too long). Until then, it and ufs.?
should be easily diffable.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.6.1 20-Jun-2002  nathanw Catch up to -current.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 23-Feb-2003  simonb branches: 1.2.2;
Add support for LFSv2 filesystems. From a libsa standpoint, LFSv1 and
LFSv2 are treated as separate filesystem types for size considerations.
 1.1 18-Aug-1999  cgd Add a standalone LFS implementation. Currently not merged with ufs (FFS),
but should be (and will be before too long). Until then, it and ufs.?
should be easily diffable.
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16 17-Nov-2022  chs Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.15 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.14 12-Aug-2015  dholland branches: 1.14.34; 1.14.36;
Hack up dinode usage to be 64 vs. 32 as needed. Part 1.

(This part changes the native lfs code; the ufs-derived code already
has 64 vs. 32 logic, but as aspects of it are unsafe, and don't
entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be
rehashing that.)
 1.13 12-Aug-2015  dholland Add IFILE32 and IFILE64 structures for the on-disk ifile entries.
Add and use accessors. There are also a bunch of places that cast and
I hope I've found them all...
 1.12 02-Aug-2015  dholland Add a (draft) 64-bit superblock. Make things build again.

Add pieces of support for using both superblock types where
convenient, and specifically to the superblock accessors, but don't
actually enable it anywhere.

First substantive step on PR 50000.
 1.11 24-Jul-2015  dholland Switch to accessor functions for elements of the LFS on-disk
superblock. This will allow switching between 32/64 bit forms on the
fly; it will also allow handling LFS_EI reasonably tidily. (That
currently doesn't work on the superblock.)

It also gets rid of cpp abuse in the form of fake structure member
macros.

Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg
inside the on-disk superblock, add extra elements to the in-memory
struct lfs for this. (XXX: these should be changed to condvars, but
not right now)

XXX: this migrates a structure needed by the lfs code in libsa (struct
salfs) into lfs.h, where it doesn't belong, but for the time being
this is necessary in order to allow the accessors (and the various
lfs macros and other goop that relies on them) to compile.
 1.10 24-Jul-2015  dholland Rearrange the structures in the lfs bootbollocks slightly.
This generates the same output (at least on amd64) but will be more
robust until we're ready to deploy lfs64 bootblocks too.

XXX: I don't think these actually work right now, and the logic for
picking between v1 and v2 lfs formats (which is not related to ffsv1
vs. ffsv2) is definitely broken. But I haven't made it any worse.
 1.9 23-Jun-2013  dholland branches: 1.9.10;
Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.8 19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.7 18-Jun-2013  christos Prefix most of the cpp macros with lfs_ and LFS_ to avoid conflicts with ffs.
This was done so that boot blocks that want to compile both FFS and LFS in
the same file work.
 1.6 09-Jun-2013  dholland Build properly against the lfs changes.
 1.5 21-May-2012  dsl branches: 1.5.2;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.4 25-Dec-2011  tsutsui branches: 1.4.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.3 19-Nov-2008  ad branches: 1.3.16; 1.3.20;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.2 11-Apr-2003  dsl branches: 1.2.100; 1.2.104; 1.2.110; 1.2.114;
Use common ffs/lfs file ufs.c instead of lfs specific version.
 1.1 23-Feb-2003  simonb Add support for LFSv2 filesystems. From a libsa standpoint, LFSv1 and
LFSv2 are treated as separate filesystem types for size considerations.
 1.2.114.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.110.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.104.1 04-May-2009  yamt sync with head.
 1.2.100.1 17-Jan-2009  mjf Sync with HEAD.
 1.3.20.2 02-Jun-2012  mrg sync to latest -current.
 1.3.20.1 18-Feb-2012  mrg merge to -current.
 1.3.16.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.16.2 23-May-2012  yamt sync with head.
 1.3.16.1 17-Apr-2012  yamt sync with head
 1.4.2.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.5.2.3 03-Dec-2017  jdolecek update from HEAD
 1.5.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.1 23-Jun-2013  tls resync from head
 1.9.10.1 22-Sep-2015  skrll Sync with HEAD
 1.14.36.1 31-May-2021  cjep sync with head
 1.14.34.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.16 17-Nov-2022  chs Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.15 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.14 12-Aug-2015  dholland branches: 1.14.34; 1.14.36;
Hack up dinode usage to be 64 vs. 32 as needed. Part 1.

(This part changes the native lfs code; the ufs-derived code already
has 64 vs. 32 logic, but as aspects of it are unsafe, and don't
entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be
rehashing that.)
 1.13 12-Aug-2015  dholland Add IFILE32 and IFILE64 structures for the on-disk ifile entries.
Add and use accessors. There are also a bunch of places that cast and
I hope I've found them all...
 1.12 02-Aug-2015  dholland Add a (draft) 64-bit superblock. Make things build again.

Add pieces of support for using both superblock types where
convenient, and specifically to the superblock accessors, but don't
actually enable it anywhere.

First substantive step on PR 50000.
 1.11 24-Jul-2015  dholland Switch to accessor functions for elements of the LFS on-disk
superblock. This will allow switching between 32/64 bit forms on the
fly; it will also allow handling LFS_EI reasonably tidily. (That
currently doesn't work on the superblock.)

It also gets rid of cpp abuse in the form of fake structure member
macros.

Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg
inside the on-disk superblock, add extra elements to the in-memory
struct lfs for this. (XXX: these should be changed to condvars, but
not right now)

XXX: this migrates a structure needed by the lfs code in libsa (struct
salfs) into lfs.h, where it doesn't belong, but for the time being
this is necessary in order to allow the accessors (and the various
lfs macros and other goop that relies on them) to compile.
 1.10 24-Jul-2015  dholland Rearrange the structures in the lfs bootbollocks slightly.
This generates the same output (at least on amd64) but will be more
robust until we're ready to deploy lfs64 bootblocks too.

XXX: I don't think these actually work right now, and the logic for
picking between v1 and v2 lfs formats (which is not related to ffsv1
vs. ffsv2) is definitely broken. But I haven't made it any worse.
 1.9 23-Jun-2013  dholland branches: 1.9.10;
Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.8 19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.7 18-Jun-2013  christos Prefix most of the cpp macros with lfs_ and LFS_ to avoid conflicts with ffs.
This was done so that boot blocks that want to compile both FFS and LFS in
the same file work.
 1.6 09-Jun-2013  dholland Build properly against the lfs changes.
 1.5 21-May-2012  dsl branches: 1.5.2;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.4 25-Dec-2011  tsutsui branches: 1.4.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.3 19-Nov-2008  ad branches: 1.3.16; 1.3.20;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.2 11-Apr-2003  dsl branches: 1.2.100; 1.2.104; 1.2.110; 1.2.114;
Use common ffs/lfs file ufs.c instead of lfs specific version.
 1.1 23-Feb-2003  simonb Add support for LFSv2 filesystems. From a libsa standpoint, LFSv1 and
LFSv2 are treated as separate filesystem types for size considerations.
 1.2.114.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.110.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.104.1 04-May-2009  yamt sync with head.
 1.2.100.1 17-Jan-2009  mjf Sync with HEAD.
 1.3.20.2 02-Jun-2012  mrg sync to latest -current.
 1.3.20.1 18-Feb-2012  mrg merge to -current.
 1.3.16.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.16.2 23-May-2012  yamt sync with head.
 1.3.16.1 17-Apr-2012  yamt sync with head
 1.4.2.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.5.2.3 03-Dec-2017  jdolecek update from HEAD
 1.5.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.1 23-Jun-2013  tls resync from head
 1.9.10.1 22-Sep-2015  skrll Sync with HEAD
 1.14.36.1 31-May-2021  cjep sync with head
 1.14.34.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.33 21-May-2021  jmcneill Capture the endianness of the ELF file loaded in 'netbsd_elf_data', the
same way we do already for the class in 'netbsd_elf_class'.
 1.32 05-Apr-2019  christos branches: 1.32.16; 1.32.18;
Go back ot using 0x%x instead of %#x because we don't always support the
format. See subr_prf.c
 1.31 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.30 20-May-2008  ad branches: 1.30.86;
Take $MACHINE into account when looking for modules.
 1.29 20-May-2008  ad Extract kernel version from the note section and stuff into a global
netbsd_version.
 1.28 28-Apr-2008  martin branches: 1.28.2;
Remove clause 3 and 4 from TNF licenses
 1.27 29-Dec-2007  tsutsui branches: 1.27.6; 1.27.8; 1.27.10;
ANSIfy.
 1.26 24-Nov-2007  isaki branches: 1.26.6;
style, indent, and ANSI-fy.
 1.25 09-Dec-2006  chs branches: 1.25.18; 1.25.20; 1.25.26;
in fdloadfile(), fail if we can't read the entire exec header.
 1.24 11-Dec-2005  christos branches: 1.24.20; 1.24.22; 1.24.24;
merge ktrace-lwp.
 1.23 07-Aug-2003  agc branches: 1.23.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.22 24-Feb-2003  pk branches: 1.22.2;
Introduce fdloadfile() to load an image from an open file descriptor;
implement loadfile() in terms of it.

This allows clients to open a file once and "load" it multiple times (e.g.
first with COUNT_KERNEL, then with LOAD_KERNEL) without the side-effects
of multiple open calls.
 1.21 11-Dec-2002  pk Only display the final progress counter if any of the LOAD_ flags was given.
Fix comment describing the return value.
 1.20 31-Oct-2001  thorpej Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.19 31-Oct-2001  thorpej Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
objects.
 1.18 30-Oct-2001  thorpej Split the exec formats included by loadfile() into separate files.
Primary goal: explcitly select which ELF format (elf32 or elf64) to
support for a cross tool which uses loadfile().
 1.17 31-Jul-2001  bjh21 branches: 1.17.4;
When loading ELF, zero out:
The e_shstrndx field in the ELF header, since we don't load .shstrtab.
The sh_name field in each section header, for the same reason.
The sh_offset field for any section we don't load.

This means the kernel has some chance of knowing what it's being given. It
also means that the behaviour of old kernels with new loaders should be
deterministic (if not terribly useful: they still can't find the symbol
table).
 1.16 31-Jul-2001  bjh21 G/C "off", since it was just tracking the difference between maxp and elfp.
 1.15 31-Jul-2001  bjh21 Fix a small memory leak when counting the size of the symbol table (shp was
ALLOC'ed if (LOAD_SYM|COUNT_SYM), but FREEd if (LOAD_SYM)).
 1.14 31-Jul-2001  bjh21 When loading an ELF kernel, don't load all the STRTAB sections. Instead, just
load those STRTAB sections that are referenced by a SYMTAB that we're loading.

The main advantage of this is that (at least with the binaries output by my
ARM ELF linker) this removes the need to seek backwards through the file, which
is a big win when loading a gzipped kernel.

While we're here, don't allocate space for string tables we don't load.
 1.13 19-Jul-2001  fvdl Avoid warnings about uninitialised usage.
 1.12 13-Jul-2001  christos Back out previous. The booter will need to find the symbol table itself,
as explained in the code.
 1.11 13-Jul-2001  christos From Nigel Pearson: Make SYMS and NSYMS work on ELF.
The MacOS booter needs them.
 1.10 03-Dec-2000  tsutsui branches: 1.10.2; 1.10.4;
Don't try to load a.out header if there is no space for it before text.
 1.9 11-Nov-2000  tsutsui Don't print "]" if loading kernel does not have symbol table.
 1.8 01-Nov-2000  ragge Add define NO_MID_CHECK that avoids checking of the a.out mid field.
 1.7 29-Dec-1999  hannken branches: 1.7.4;
Fix IS_DATA and IS_TEXT. PF_X and PF_W are valid on p_pflags, not p_ptype.
 1.6 13-Nov-1999  thorpej Backout my libsa changes.
 1.5 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.4 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.3 08-Oct-1999  itohy branches: 1.3.2; 1.3.4;
- a.out header is not a part of text segment in NMAGIC.
- Fix section alignment code.
Patch supplied by Izumi Tsutsui, PR #8575.
 1.2 28-Apr-1999  christos branches: 1.2.2; 1.2.4;
cosmetic printf change
 1.1 28-Apr-1999  christos MI loadfile (used by i386, pmax and sparc shortly)
 1.2.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.3.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.7.4.2 15-Mar-2003  he Apply patch (requested by gmcgarry in ticket #7):
Initialize some local variables so that this compiles cleanly with
later toolchains.
 1.7.4.1 15-Dec-2000  he Pull up revision 1.9 (requested by tsutsui):
Don't print ``]'' if loading kernel does not have a symbol table.
 1.10.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.4.1 03-Aug-2001  lukem update to -current
 1.10.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.10.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.10.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.17.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.16.3 21-Jan-2008  yamt sync with head
 1.23.16.2 07-Dec-2007  yamt sync with head
 1.23.16.1 30-Dec-2006  yamt sync with head.
 1.24.24.1 12-Jan-2007  bouyer Pull up following revision(s) (requested by chs in ticket #348):
sys/lib/libsa/loadfile.c: revision 1.25
in fdloadfile(), fail if we can't read the entire exec header.
 1.24.22.1 10-Dec-2006  yamt sync with head.
 1.24.20.1 12-Jan-2007  ad Sync with head.
 1.25.26.2 18-Feb-2008  mjf Sync with HEAD.
 1.25.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.25.20.1 09-Jan-2008  matt sync with HEAD
 1.25.18.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.26.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.27.10.2 04-May-2009  yamt sync with head.
 1.27.10.1 16-May-2008  yamt sync with head.
 1.27.8.2 04-Jun-2008  yamt sync with head
 1.27.8.1 18-May-2008  yamt sync with head.
 1.27.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.30.86.1 10-Jun-2019  christos Sync with HEAD
 1.32.18.1 31-May-2021  cjep sync with head
 1.32.16.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.15 21-May-2021  jmcneill Capture the endianness of the ELF file loaded in 'netbsd_elf_data', the
same way we do already for the class in 'netbsd_elf_class'.
 1.14 07-Oct-2017  maxv branches: 1.14.20; 1.14.22;
Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)
 1.13 03-Dec-2016  maxv Fix a wrong flag and KNF.
 1.12 25-Aug-2010  christos branches: 1.12.18; 1.12.36; 1.12.40;
add a LOAD_BACKWARDS flag on sections that might load backwards.
 1.11 25-Aug-2010  christos Add a new LOAD_MINIMAL flag to avoid loading sections that might seek backwards
and are not really needed like the note and the symbol section.
 1.10 25-Sep-2008  christos branches: 1.10.14; 1.10.16;
add a LOAD_NOTE flag to make loading the note optional.
 1.9 20-May-2008  ad branches: 1.9.4;
Take $MACHINE into account when looking for modules.
 1.8 20-May-2008  ad Extract kernel version from the note section and stuff into a global
netbsd_version.
 1.7 28-Apr-2008  martin branches: 1.7.2;
Remove clause 3 and 4 from TNF licenses
 1.6 05-Jun-2007  martin branches: 1.6.28; 1.6.30; 1.6.32;
Add a MARK_DATA marker containing the effective VA of the first loaded
data segment.
 1.5 29-Apr-2003  scw branches: 1.5.18; 1.5.60; 1.5.62;
Allow the default location of "machine/loadfile_machdep.h" to be
overridden if MACHINE_LOADFILE_MACHDEP is defined.
This makes life much simpler in the face of the myriad of
different boot options for the evb* ports.
 1.4 24-Feb-2003  pk Introduce fdloadfile() to load an image from an open file descriptor;
implement loadfile() in terms of it.

This allows clients to open a file once and "load" it multiple times (e.g.
first with COUNT_KERNEL, then with LOAD_KERNEL) without the side-effects
of multiple open calls.
 1.3 31-Oct-2001  thorpej Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.2 31-Oct-2001  thorpej Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
objects.
 1.1 28-Apr-1999  christos branches: 1.1.2; 1.1.16; 1.1.18; 1.1.22;
MI loadfile (used by i386, pmax and sparc shortly)
 1.1.22.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.18.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.16.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.62.1 11-Jul-2007  mjf Sync with head.
 1.5.60.1 09-Jun-2007  ad Sync with head.
 1.5.18.1 03-Sep-2007  yamt sync with head.
 1.6.32.3 09-Oct-2010  yamt sync with head
 1.6.32.2 04-May-2009  yamt sync with head.
 1.6.32.1 16-May-2008  yamt sync with head.
 1.6.30.2 04-Jun-2008  yamt sync with head
 1.6.30.1 18-May-2008  yamt sync with head.
 1.6.28.2 28-Sep-2008  mjf Sync with HEAD.
 1.6.28.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.7.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.9.4.1 19-Oct-2008  haad Sync with HEAD.
 1.10.16.1 05-Mar-2011  rmind sync with head
 1.10.14.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.12.40.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.12.36.1 05-Dec-2016  skrll Sync with HEAD
 1.12.18.1 03-Dec-2017  jdolecek update from HEAD
 1.14.22.1 31-May-2021  cjep sync with head
 1.14.20.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.15 20-Feb-2014  joerg Casting to void is the canonical way of marking a variable as
potentially unused.
 1.14 16-Aug-2009  matt branches: 1.14.12; 1.14.22; 1.14.26;
Change include of <sys/exec.h> to <sys/exec_aout.h> since these files want
the a.out stuff.
 1.13 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.12 29-Dec-2007  tsutsui branches: 1.12.6; 1.12.8; 1.12.10;
ANSIfy.
 1.11 03-Dec-2007  isaki branches: 1.11.6;
Use standard error code (EIO) instead of standalone error code
(ESHORT). Because loadfile_*() is used with or without
_STANDALONE, therefore, don't use error code in "saerrno.h".
Pointed out by and discussed with he@.
 1.10 23-Nov-2007  isaki loadfile_*() must set errno when it returns -1.
 1.9 05-Jun-2007  martin branches: 1.9.6; 1.9.8; 1.9.14;
Add a MARK_DATA marker containing the effective VA of the first loaded
data segment.
 1.8 11-Dec-2005  christos branches: 1.8.30; 1.8.32;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 31-Aug-2003  fvdl branches: 1.6.8; 1.6.10;
Fix signed/unsigned warnings.
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 10-Dec-2002  thorpej branches: 1.4.6;
Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.3 11-Feb-2002  reinoud Not all ports use the `offset' in their calulations and on those platforms
compile errors are generated due to it. By explicitly using `offset=offset'
the variable is used in the compilers view and is optimised away anyway.
 1.2 31-Oct-2001  thorpej branches: 1.2.2; 1.2.4; 1.2.6;
Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
objects.
 1.1 30-Oct-2001  thorpej Split the exec formats included by loadfile() into separate files.
Primary goal: explcitly select which ELF format (elf32 or elf64) to
support for a cross tool which uses loadfile().
 1.2.6.3 16-Mar-2002  jdolecek Catch up with -current.
 1.2.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 31-Oct-2001  thorpej file loadfile_aout.c was added on branch kqueue on 2002-01-10 20:00:38 +0000
 1.2.4.4 11-Dec-2002  thorpej Sync with HEAD.
 1.2.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 31-Oct-2001  nathanw file loadfile_aout.c was added on branch nathanw_sa on 2001-11-14 19:16:52 +0000
 1.2.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.2.2.1 31-Oct-2001  thorpej file loadfile_aout.c was added on branch thorpej-mips-cache on 2001-11-12 21:19:05 +0000
 1.4.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.8.1 29-Apr-2005  kent sync with -current
 1.7.4.3 21-Jan-2008  yamt sync with head
 1.7.4.2 07-Dec-2007  yamt sync with head
 1.7.4.1 03-Sep-2007  yamt sync with head.
 1.8.32.1 11-Jul-2007  mjf Sync with head.
 1.8.30.1 09-Jun-2007  ad Sync with head.
 1.9.14.2 18-Feb-2008  mjf Sync with HEAD.
 1.9.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.8.1 09-Jan-2008  matt sync with HEAD
 1.9.6.2 03-Dec-2007  joerg Sync with HEAD.
 1.9.6.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.11.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.10.2 19-Aug-2009  yamt sync with head.
 1.12.10.1 16-May-2008  yamt sync with head.
 1.12.8.1 18-May-2008  yamt sync with head.
 1.12.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.26.1 18-May-2014  rmind sync with head
 1.14.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 29-Dec-2007  tsutsui branches: 1.11.6; 1.11.8; 1.11.10;
ANSIfy.
 1.10 03-Dec-2007  isaki branches: 1.10.6;
Use standard error code (EIO) instead of standalone error code
(ESHORT). Because loadfile_*() is used with or without
_STANDALONE, therefore, don't use error code in "saerrno.h".
Pointed out by and discussed with he@.
 1.9 23-Nov-2007  isaki loadfile_*() must set errno when it returns -1.
 1.8 06-Jun-2007  martin branches: 1.8.6; 1.8.8; 1.8.14;
It is "data_start" not "data" - pointed out by Tom Spindler
 1.7 05-Jun-2007  martin Add a MARK_DATA marker containing the effective VA of the first loaded
data segment.
 1.6 11-Dec-2005  christos branches: 1.6.30; 1.6.32;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 11-Feb-2002  reinoud branches: 1.4.16; 1.4.24; 1.4.26;
Not all ports use the `offset' in their calulations and on those platforms
compile errors are generated due to it. By explicitly using `offset=offset'
the variable is used in the compilers view and is optimised away anyway.
 1.3 09-Nov-2001  christos branches: 1.3.2; 1.3.4; 1.3.6;
Remove USB copyrights. The coff and elf loading code did not come with BSD4.4.
 1.2 31-Oct-2001  thorpej Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
objects.
 1.1 30-Oct-2001  thorpej Split the exec formats included by loadfile() into separate files.
Primary goal: explcitly select which ELF format (elf32 or elf64) to
support for a cross tool which uses loadfile().
 1.3.6.3 16-Mar-2002  jdolecek Catch up with -current.
 1.3.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.6.1 09-Nov-2001  thorpej file loadfile_ecoff.c was added on branch kqueue on 2002-01-10 20:00:39 +0000
 1.3.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.4.1 09-Nov-2001  nathanw file loadfile_ecoff.c was added on branch nathanw_sa on 2001-11-14 19:16:52 +0000
 1.3.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.2.1 09-Nov-2001  thorpej file loadfile_ecoff.c was added on branch thorpej-mips-cache on 2001-11-12 21:19:05 +0000
 1.4.26.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.24.1 29-Apr-2005  kent sync with -current
 1.4.16.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.4.3 21-Jan-2008  yamt sync with head
 1.5.4.2 07-Dec-2007  yamt sync with head
 1.5.4.1 03-Sep-2007  yamt sync with head.
 1.6.32.1 11-Jul-2007  mjf Sync with head.
 1.6.30.1 09-Jun-2007  ad Sync with head.
 1.8.14.2 18-Feb-2008  mjf Sync with HEAD.
 1.8.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.8.8.1 09-Jan-2008  matt sync with HEAD
 1.8.6.2 03-Dec-2007  joerg Sync with HEAD.
 1.8.6.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.10.1 16-May-2008  yamt sync with head.
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.59 13-Sep-2020  jmcneill Elf64_Phdr::p_offset is 64 bits, not 32
 1.58 13-Sep-2020  jmcneill Elf64_Phdr::p_flags is 32 bits, not 64
 1.57 07-May-2020  maxv Update the comments.
 1.56 17-Oct-2019  maxv Make sure we're dealing with a static binary. Otherwise we could crash if
the user mistakenly tries to boot a KASLR kernel with 'boot' instead of
'pkboot'. Now we fail cleanly. Reported by cryo@.
 1.55 21-Jul-2019  rin branches: 1.55.2;
Add SA_ENABLE_BIENDIAN option, which enable us to load kernel image of
opposite byte order (for arm EFI bootloader).

XXX
Currently, it is restricted to load_elf*.c. It would be nice if we can
recognize disklabel and filesystem of opposite byte order.
 1.54 20-Jun-2019  maxv Add KASLR support in UEFI.
 1.53 23-Aug-2018  jmcneill Support loading read-only data sections. ARM64 ELF kernels need this. ok skrll@
 1.52 21-Dec-2017  maxv branches: 1.52.2; 1.52.4;
Make sure we're loading a relocatable binary, to give the user a chance to
correct the kernel name if he mistakenly typed pkboot on a static kernel,
without having to reboot the machine (currently the prekern sees it's a
static kernel and panics).
 1.51 15-Nov-2017  maxv Support large pages on KASLR kernels, in a way that does not reduce
randomness, but on the contrary that increases it.

The size of the kernel sub-blocks is changed to be 1MB. This produces a
kernel with sections that are always < 2MB in size, that can fit a large
page.

Each section is put in a 2MB physical chunk. In this chunk, there is a
padding of approximately 1MB. The prekern uses a random offset aligned to
sh_addralign, to shift the section in physical memory.

For example, physical memory layout created by the bootloader for .text.4
and .rodata.0:
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|+---------------+ |+---------------+ |
|| .text.4 | PAD || .rodata.0 | PAD |
|+---------------+ |+---------------+ |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
PA PA+2MB PA+4MB

Then, physical memory layout, after having been shifted by the prekern:
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
| P +---------------+ | +---------------+ |
| A | .text.4 | PAD | PAD | .rodata.0 | PAD |
| D +---------------+ | +---------------+ |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
PA PA+2MB PA+4MB

The kernel maps these 2MB physical chunks with 2MB large pages. Therefore,
randomness is enforced at both the virtual and physical levels, and the
resulting entropy is higher than that of our current implementaion until
now.

The padding around the section is filled by the prekern. Not to consume
too much memory, the sections that are smaller than PAGE_SIZE are mapped
with normal pages - because there is no point in optimizing them. In these
normal pages, the same shift is applied.

This change has two additional advantages: (a) the cache attacks based on
the TLB are mostly mitigated, because even if you are able to determine
that a given page-aligned range is mapped as executable you don't know
where exactly within that range the section actually begins, and (b) given
that we are slightly randomizing the physical layout we are making some
rare physical attacks more difficult to conduct.

NOTE: after this change you need to update GENERIC_KASLR / prekern /
bootloader.
 1.50 13-Nov-2017  maxv Don't process ELF sections that don't have the ALLOC flag set.

NOTE: you need to update both the prekern and the bootloader after this
change.
 1.49 13-Nov-2017  maxv Revert my last revision, that is to say, don't group sections into
segments anymore. Initially I did this because I wanted to compress the
sections by reducing the padding between them; but we'll handle that
differently.
 1.48 18-Oct-2017  maxv Group the sections into segments, and align to KERNALIGN only between
segments. Prerequisite for other changes. Unfortunately the code is not
very compact, but whatever.
 1.47 13-Oct-2017  maxv Introduce two functions, and dedup code.
 1.46 13-Oct-2017  maxv Constify offset, it must not change.
 1.45 08-Oct-2017  maxv Improve comments.
 1.44 07-Oct-2017  maxv Add a new option in libsa, to load dynamic binaries. A separate function
is used, and it does not break in any way the generic static loader. Then,
add a new "pkboot" command in the x86 bootloader, which boots a
GENERIC_KASLR kernel via the prekern. (See thread on tech-kern@.)
 1.43 05-Oct-2017  christos try a different style of __used.
 1.42 04-Oct-2017  christos mark first as used for platforms that define PROGRESS to nothing (mvme68k)
 1.41 25-Sep-2017  maxv Clean up and split loadfile, reduces a patch I have.
 1.40 18-Apr-2017  uwe Swap arguments to strncmp() so that the thing we are testing, the
section name, comes first; and so that the length of the string
constant is right next to that constant.
 1.39 18-Apr-2017  uwe Move deallocation of shstrsz inside the block where it is allocated.
 1.38 17-Apr-2017  uwe Section at index 0 is SHN_UNDEF. When searching for symbol sections
skip it and start with index 1.
 1.37 17-Apr-2017  uwe Don't hide first = 1 assignment inside for(), that just obscures the
loop. Same object code is generated.
 1.36 23-Feb-2017  nonaka update marks[MARK_DATA] with COUNT_DATA.
 1.35 23-Feb-2017  nonaka fix CTF section symbol size was not counted with COUNT_KERNEL.
 1.34 06-Jan-2017  maxv branches: 1.34.2;
Explain how all that mess works, without actually fixing it yet.
 1.33 03-Dec-2016  maxv Fix a wrong flag and KNF.
 1.32 31-Aug-2016  martin Initialize the marker for the data segment, in case the caller passes not
fully initialized markers to loadfile().
Pointed out by Mark Cave-Ayland.
 1.31 25-Jul-2015  isaki branches: 1.31.2;
white space -> tab.
 1.30 27-Nov-2013  jakllsch branches: 1.30.6;
Fix a use-after-free (well, dealloc actually) issue.
 1.29 17-Feb-2011  christos branches: 1.29.4; 1.29.14; 1.29.18;
revert bad whitespace change.
 1.28 17-Feb-2011  christos fix -Wself-assign warning
 1.27 16-Sep-2010  jym branches: 1.27.2; 1.27.4;
Use standard ELF types for ELF code, instead of paddr_t. paddr_t should
only be used for low level code, like virtual memory internals.
 1.26 02-Sep-2010  christos PR/43830: Valery Ushakov: libsa/loadfile_elf32.c loads .shstrtab into
unallocated memory. Don't load if counting.
 1.25 12-Mar-2010  darran branches: 1.25.2;
DTrace: Add support for CTF sections in the netbsd elf image, load these
at boot.
Add a ksyms_mod_foreach() function to iterate a callback function over the
set of elf symbols for a specific module (netbsd included).
Add kern_ctf.c and mod_ctf_get() to allow the retrieval and decompression
of CTF sections for a specific module.
 1.24 25-Sep-2008  christos branches: 1.24.14;
add a LOAD_NOTE flag to make loading the note optional.
 1.23 20-May-2008  ad branches: 1.23.4;
Extract kernel version from the note section and stuff into a global
netbsd_version.
 1.22 28-Apr-2008  martin branches: 1.22.2;
Remove clause 3 and 4 from TNF licenses
 1.21 29-Dec-2007  tsutsui branches: 1.21.6; 1.21.8; 1.21.10;
ANSIfy.
 1.20 03-Dec-2007  isaki branches: 1.20.6;
Use standard error code (EIO) instead of standalone error code
(ESHORT). Because loadfile_*() is used with or without
_STANDALONE, therefore, don't use error code in "saerrno.h".
Pointed out by and discussed with he@.
 1.19 02-Dec-2007  tsutsui unsigned -> unsigned int
 1.18 23-Nov-2007  isaki loadfile_*() must set errno when it returns -1.
 1.17 05-Jun-2007  martin branches: 1.17.6; 1.17.8; 1.17.14;
Add a MARK_DATA marker containing the effective VA of the first loaded
data segment.
 1.16 06-Apr-2006  cherry branches: 1.16.18; 1.16.20;
Pass by reference to MD_LOADSEG(). Thanks to Matt Thomas for pointing this out.
 1.15 03-Apr-2006  cherry Encapsulated the MD test: phdr[i].p_type & PT_LOPROC out of MI code,
and into MD_LOADSEG() as suggested by Christos.
 1.14 03-Apr-2006  cherry Allows processor ABI specific ELF segment loads.
If the macro MD_LOADSEG defined in
machine/loadfile_machdep.h evaluates to 1, the machine
specific segment is loaded.

See: http://mail-index.netbsd.org/tech-kern/2005/12/30/0003.html
 1.13 25-Jan-2006  christos branches: 1.13.2; 1.13.4; 1.13.6; 1.13.8; 1.13.10;
free -> dealloc
 1.12 11-Dec-2005  christos branches: 1.12.2;
merge ktrace-lwp.
 1.11 14-Jul-2005  christos rearrange free's and add a missing one.
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 23-Oct-2003  he branches: 1.9.8; 1.9.10;
The paddr_t type is integral, so no longer compatible with NULL,
so use 0 instead.
 1.8 31-Aug-2003  fvdl Fix signed/unsigned warnings.
 1.7 11-Feb-2002  reinoud branches: 1.7.16;
Not all ports use the `offset' in their calulations and on those platforms
compile errors are generated due to it. By explicitly using `offset=offset'
the variable is used in the compilers view and is optimised away anyway.
 1.6 09-Nov-2001  christos branches: 1.6.2; 1.6.4; 1.6.6;
Remove USB copyrights. The coff and elf loading code did not come with BSD4.4.
 1.5 09-Nov-2001  scw To avoid backwards seeks on sequential devices (eq. QIC tapes), read all
the program headers in one operation into an internal buffer.
 1.4 31-Oct-2001  thorpej Make the ELF loadfile routines byte-order independent when used in
a non-_STANDALONE environment (e.g. installboot(8)): internalize and
externalize the exec, program, and section headers as necessary.

Reviewed and OK'd by Christos.
 1.3 31-Oct-2001  thorpej Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.2 31-Oct-2001  thorpej Build the loadfile() a.out, ECOFF, and ELF back-ends as separate
objects.
 1.1 30-Oct-2001  thorpej Split the exec formats included by loadfile() into separate files.
Primary goal: explcitly select which ELF format (elf32 or elf64) to
support for a cross tool which uses loadfile().
 1.6.6.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.6.1 09-Nov-2001  thorpej file loadfile_elf32.c was added on branch kqueue on 2002-01-10 20:00:40 +0000
 1.6.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.6.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.6.4.1 09-Nov-2001  nathanw file loadfile_elf32.c was added on branch nathanw_sa on 2001-11-14 19:16:52 +0000
 1.6.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.6.2.1 09-Nov-2001  thorpej file loadfile_elf32.c was added on branch thorpej-mips-cache on 2001-11-12 21:19:05 +0000
 1.7.16.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.16.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.4.4 21-Jan-2008  yamt sync with head
 1.10.4.3 07-Dec-2007  yamt sync with head
 1.10.4.2 03-Sep-2007  yamt sync with head.
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.12.2.1 01-Feb-2006  yamt sync with head.
 1.13.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.8.1 19-Apr-2006  elad sync with head.
 1.13.6.1 11-Apr-2006  yamt sync with head
 1.13.4.1 22-Apr-2006  simonb Sync with head.
 1.13.2.1 09-Sep-2006  rpaulo sync with head
 1.16.20.1 11-Jul-2007  mjf Sync with head.
 1.16.18.1 09-Jun-2007  ad Sync with head.
 1.17.14.2 18-Feb-2008  mjf Sync with HEAD.
 1.17.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.17.8.1 09-Jan-2008  matt sync with HEAD
 1.17.6.2 03-Dec-2007  joerg Sync with HEAD.
 1.17.6.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.20.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.21.10.4 09-Oct-2010  yamt sync with head
 1.21.10.3 11-Aug-2010  yamt sync with head.
 1.21.10.2 04-May-2009  yamt sync with head.
 1.21.10.1 16-May-2008  yamt sync with head.
 1.21.8.2 04-Jun-2008  yamt sync with head
 1.21.8.1 18-May-2008  yamt sync with head.
 1.21.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.21.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.22.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.22.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.23.4.1 19-Oct-2008  haad Sync with HEAD.
 1.24.14.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.24.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.25.2.1 05-Mar-2011  rmind sync with head
 1.27.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.27.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.18.1 18-May-2014  rmind sync with head
 1.29.14.2 03-Dec-2017  jdolecek update from HEAD
 1.29.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.30.6.5 28-Aug-2017  skrll Sync with HEAD
 1.30.6.4 05-Feb-2017  skrll Sync with HEAD
 1.30.6.3 05-Dec-2016  skrll Sync with HEAD
 1.30.6.2 05-Oct-2016  skrll Sync with HEAD
 1.30.6.1 22-Sep-2015  skrll Sync with HEAD
 1.31.2.3 26-Apr-2017  pgoyette Sync with HEAD
 1.31.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.31.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.34.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.52.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.52.4.1 10-Jun-2019  christos Sync with HEAD
 1.52.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.55.2.1 23-Oct-2019  martin Pull up following revision(s) (requested by maxv in ticket #361):

sys/lib/libsa/loadfile_elf32.c: revision 1.56

Make sure we're dealing with a static binary. Otherwise we could crash if
the user mistakenly tries to boot a KASLR kernel with 'boot' instead of
'pkboot'. Now we fail cleanly. Reported by cryo@.
 1.1 31-Oct-2001  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 31-Oct-2001  thorpej file loadfile_elf64.c was added on branch kqueue on 2002-01-10 20:00:40 +0000
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 31-Oct-2001  nathanw file loadfile_elf64.c was added on branch nathanw_sa on 2001-11-14 19:16:52 +0000
 1.1.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.1 31-Oct-2001  thorpej file loadfile_elf64.c was added on branch thorpej-mips-cache on 2001-11-12 21:19:05 +0000
 1.3 11-Feb-2010  martin branches: 1.3.2; 1.3.6;
Add a prototype.
 1.2 10-Feb-2010  martin fix includes
 1.1 10-Feb-2010  martin Utility function to lookup a symbol value in an elf symbol table - allows,
for example, a bootloader to access symbols in the just loaded kernel
(or module).
 1.3.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.6.1 11-Feb-2010  uebayasi file lookup_elf32.c was added on branch uebayasi-xip on 2010-04-30 14:44:15 +0000
 1.3.2.2 11-Mar-2010  yamt sync with head
 1.3.2.1 11-Feb-2010  yamt file lookup_elf32.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:22 +0000
 1.1 10-Feb-2010  martin branches: 1.1.2; 1.1.6;
Utility function to lookup a symbol value in an elf symbol table - allows,
for example, a bootloader to access symbols in the just loaded kernel
(or module).
 1.1.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.6.1 10-Feb-2010  uebayasi file lookup_elf64.c was added on branch uebayasi-xip on 2010-04-30 14:44:15 +0000
 1.1.2.2 11-Mar-2010  yamt sync with head
 1.1.2.1 10-Feb-2010  yamt file lookup_elf64.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:22 +0000
 1.5 20-Mar-2014  christos reduce size by 1K by sharing the ls code.
 1.4 02-Mar-2012  tsutsui branches: 1.4.2; 1.4.4;
Fix a bug that libsa ls doesn't work in case of filename with directory path.
("ls /path/and/file" always returns not found) From MINIX via Evgeniy Ivanov.
 1.3 25-Dec-2011  tsutsui branches: 1.3.2;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.2 26-Jan-1994  mycroft branches: 1.2.108; 1.2.112;
Clean up deleted files.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.112.4 06-Mar-2012  mrg sync to -current
 1.2.112.3 06-Mar-2012  mrg sync to -current
 1.2.112.2 04-Mar-2012  mrg sync to latest -current.
 1.2.112.1 18-Feb-2012  mrg merge to -current.
 1.2.108.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.108.1 17-Apr-2012  yamt sync with head
 1.3.2.1 08-Mar-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #96):
sys/lib/libsa/ls.c: revision 1.4
Fix a bug that libsa ls doesn't work in case of filename with directory path.
("ls /path/and/file" always returns not found) From MINIX via Evgeniy Ivanov.
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1 20-Mar-2014  christos branches: 1.1.4; 1.1.6; 1.1.10;
new header.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 20-Mar-2014  tls file ls.h was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 20-Mar-2014  yamt file ls.h was added on branch yamt-pagecache on 2014-05-22 11:41:04 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 20-Mar-2014  rmind file ls.h was added on branch rmind-smpnet on 2014-05-18 17:46:08 +0000
 1.11 02-Dec-2007  tsutsui unsigned -> unsigned int
 1.10 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 07-Aug-2003  agc branches: 1.7.8; 1.7.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 30-Mar-2000  augustss branches: 1.6.28;
Kill some more register declarations.
 1.5 31-Mar-1999  cgd branches: 1.5.8;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.4 22-Jan-1997  cgd define these functions with an 'o' prepended to their names if
__INTERNAL_LIBSA_CREAD is defined (so that they can be used by the
compressed-read code).
 1.3 21-Jun-1996  pk Allow seeks on raw devices. A `f_offset' field is added to the file structure
which is maintained in lseek(), read() and write(), and passed along to
the device's strategy routine.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.5.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.28.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.4.1 07-Dec-2007  yamt sync with head
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.2 03-Dec-2007  joerg Sync with HEAD.
 1.9.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.12 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.11 24-Nov-2007  isaki branches: 1.11.14;
style, indent, and ANSI-fy.
 1.10 11-Dec-2005  christos branches: 1.10.44; 1.10.46; 1.10.52;
merge ktrace-lwp.
 1.9 01-Sep-2003  dsl branches: 1.9.16;
Another attempt to get libsa to contain the right things.
- put a 'standards conforming' memcmp into memcmp.c
- make bcmp be a second label on the same code
- make bcmp.c be just #include "memcmp.c"
This means that libsa.o might contain both a memcmp.o and a bcmp.o, but
both contain the same code (defining both symbols) so it doesn't matter
which ld uses.
Saves worrying about which of bcmp.c and memcmp.c the architecture specific
Makefile requests.
 1.8 29-Aug-2003  dsl The __strong_alias() seems to have to be in the file with the definition.
So make bcmp.c define bcmp and memcmp.
This should (?) fix the atari build.
(I've now no idea why the previous change defined memcpy for the alpha build.)
 1.7 27-Aug-2003  dsl An ever sneakier way of making memcmp and bcmp use the same code:
__strong_alias(memcmp,bcmp)
 1.6 13-Nov-1999  thorpej branches: 1.6.28;
Backout my libsa changes.
 1.5 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.4 05-Oct-1997  thorpej branches: 1.4.16; 1.4.18; 1.4.22;
Copyright assigned to The NetBSD Foundation.
 1.3 26-Jun-1997  drochner branches: 1.3.4;
Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.2 13-Jun-1997  drochner Bring prototypes into scope.
 1.1 16-Jan-1997  cgd branches: 1.1.2;
add memcmp, implemented as a wrapper around bcmp() (like memcpy() is
implemented as a wrapper around bcopy()).
 1.1.2.2 18-Jan-1997  thorpej Update from trunk.
 1.1.2.1 16-Jan-1997  thorpej file memcmp.c was added on branch thorpej-setroot on 1997-01-18 04:32:09 +0000
 1.3.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.22.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.18.1 15-Nov-1999  fvdl Sync with -current
 1.4.16.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.28.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 07-Dec-2007  yamt sync with head
 1.10.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.10.46.1 09-Jan-2008  matt sync with HEAD
 1.10.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.11.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.8 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.7 24-Nov-2007  isaki branches: 1.7.14;
style, indent, and ANSI-fy.
 1.6 11-Dec-2005  christos branches: 1.6.44; 1.6.46; 1.6.52;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 30-Mar-2000  augustss branches: 1.4.28;
Kill some more register declarations.
 1.3 31-Mar-1999  cgd branches: 1.3.8;
replace memcpy() implementation (which just called bcopy()) with
a small implementation of memcpy(). libsa memcpy() wouldn't
do the right thing if LIBSA_USE_MEMCPY was defined, and the whole
point of that define is to get rid of either bcopy() or memcpy().
(cloned from the bcopy() code.)
 1.2 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.1 30-Jan-1996  thorpej branches: 1.1.12;
Add a memcpy() function, just a cheezy wrapper around bcopy(). Yes,
it's really true...we didn't have one before, even though the Makefile
thought we did. (Yes, I checked the Attic...)
 1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.28.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 07-Dec-2007  yamt sync with head
 1.6.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.46.1 09-Jan-2008  matt sync with HEAD
 1.6.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.7.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.5 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.4 24-Nov-2007  isaki branches: 1.4.14;
style, indent, and ANSI-fy.
 1.3 11-Dec-2005  christos branches: 1.3.44; 1.3.46; 1.3.52;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 02-Sep-2001  tsutsui branches: 1.1.4; 1.1.6; 1.1.24;
Add a small version of memmove() for libsa.
Mostly identical with libsa/bcopy.c.
 1.1.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.24.1 03-Aug-2004  skrll Sync with HEAD
 1.1.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.6.1 02-Sep-2001  nathanw file memmove.c was added on branch nathanw_sa on 2001-09-21 22:36:31 +0000
 1.1.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.1 02-Sep-2001  thorpej file memmove.c was added on branch kqueue on 2001-09-13 01:16:19 +0000
 1.2.16.1 07-Dec-2007  yamt sync with head
 1.3.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.46.1 09-Jan-2008  matt sync with HEAD
 1.3.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.4.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.5 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.4 24-Nov-2007  isaki branches: 1.4.14;
style, indent, and ANSI-fy.
 1.3 13-Nov-1999  thorpej branches: 1.3.44; 1.3.100; 1.3.102; 1.3.108;
Backout my libsa changes.
 1.2 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.1 30-Mar-1999  cgd branches: 1.1.8; 1.1.10; 1.1.14;
add simple (small) implementations of memset and bzero. the versions
in libkern are fine for the kernel, but the versions here are smaller
and in libsa the point is size.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.10.1 15-Nov-1999  fvdl Sync with -current
 1.1.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.108.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.102.1 09-Jan-2008  matt sync with HEAD
 1.3.100.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.3.44.1 07-Dec-2007  yamt sync with head
 1.4.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.13 29-Apr-2022  rin Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.
 1.12 27-Apr-2022  rin Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name: src
> Committed By: rin
> Date: Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
> src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
 1.11 27-Apr-2022  rin Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.
 1.10 24-Apr-2022  mlelstv Ask driver about sector size to support reading superblocks from fixed
byte offsets.
 1.9 19-Apr-2022  skrll Typo in comment. avoinds -> avoids
 1.8 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.7 20-Mar-2014  christos branches: 1.7.30;
reduce size by 1K by sharing the ls code.
 1.6 03-Nov-2013  christos make a gcc unitialized variable
 1.5 23-Jun-2013  dholland branches: 1.5.2;
Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.4 23-Jun-2013  dholland fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.3 19-Jun-2013  dholland blkoff() -> mfs_blkoff()

XXX: this shouldn't be using "mfs" for its symbols as we also have
XXX: sys/ufs/mfs.
 1.2 19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.1 16-Jan-2012  christos branches: 1.1.4; 1.1.6; 1.1.10;
PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 23-Jun-2013  tls resync from head
 1.1.6.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.2 17-Apr-2012  yamt sync with head
 1.1.6.1 16-Jan-2012  yamt file minixfs3.c was added on branch yamt-pagecache on 2012-04-17 00:08:33 +0000
 1.1.4.2 18-Feb-2012  mrg merge to -current.
 1.1.4.1 16-Jan-2012  mrg file minixfs3.c was added on branch jmcneill-usbmp on 2012-02-18 07:35:35 +0000
 1.5.2.1 18-May-2014  rmind sync with head
 1.7.30.1 10-Jun-2019  christos Sync with HEAD
 1.5 23-Jun-2013  dholland Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.4 23-Jun-2013  dholland fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.3 19-Jun-2013  dholland blkoff() -> mfs_blkoff()

XXX: this shouldn't be using "mfs" for its symbols as we also have
XXX: sys/ufs/mfs.
 1.2 19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.1 16-Jan-2012  christos branches: 1.1.4; 1.1.6; 1.1.10;
PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 23-Jun-2013  tls resync from head
 1.1.6.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.2 17-Apr-2012  yamt sync with head
 1.1.6.1 16-Jan-2012  yamt file minixfs3.h was added on branch yamt-pagecache on 2012-04-17 00:08:33 +0000
 1.1.4.2 18-Feb-2012  mrg merge to -current.
 1.1.4.1 16-Jan-2012  mrg file minixfs3.h was added on branch jmcneill-usbmp on 2012-02-18 07:35:35 +0000
 1.36 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.35 11-Apr-2009  lukem branches: 1.35.64;
fix sign-compare issue
 1.34 31-Jan-2009  isaki branches: 1.34.2;
Revert previous one. It has already fixed in net.h,v 1.25.
 1.33 31-Jan-2009  isaki Fix build error. Declare getsecs() before (re-)defining it.
 1.32 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.31 24-Nov-2007  isaki branches: 1.31.14; 1.31.18; 1.31.26;
style, indent, and ANSI-fy.
 1.30 21-Jan-2006  dsl branches: 1.30.42; 1.30.44; 1.30.50;
Adjust code so that it will work when _STANDALONE isn't defined.
Allows it to be used for mount_nfs when SMALL is set - eg install floppies/
 1.29 11-Dec-2005  christos branches: 1.29.2;
merge ktrace-lwp.
 1.28 31-Aug-2003  fvdl branches: 1.28.16;
Fix signed/unsigned warnings.
 1.27 25-Oct-2000  thorpej branches: 1.27.24;
Split the UDP routines out of net.c.
 1.26 30-Mar-2000  augustss Kill some more register declarations.
 1.25 13-Nov-1999  thorpej Backout my libsa changes.
 1.24 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.23 07-May-1999  drochner branches: 1.23.2; 1.23.4; 1.23.8;
move intoa() from libsa:net.c to libkern, turn inet_ntoa() into a macro,
nuke ip_convertaddr()
 1.22 12-Apr-1999  ross libkern just got an inet_addr(), but it won't compile, no prototype. Cleanup...
* Add prototype to libkern.h.
* Remove the almost-identical-copy from libsa/net.[ch].
* Change its type back to the (wrong, but harmless) historical one. (u_long)
* Kill the XXX local prototype in nfs_bootparam.c
 1.21 11-Feb-1999  pk branches: 1.21.4;
Add missing prototypes.
 1.20 26-Dec-1997  scottr If the send routine returns an error (-1), wait and retry using the same
backoff mechanism we use for receiving the response. This is particularly
helpful when we have transient errors on transmit, e.g. a very busy
network or router.
 1.19 17-Sep-1997  drochner branches: 1.19.2;
Save some bytes by keeping the number of byteswaps minimal.
Allow to switch off UDP checksum generation and check via compile time
option (for the really desperade).
 1.18 06-Sep-1997  drochner -Wall fixes
 1.17 07-Jul-1997  drochner branches: 1.17.2;
Don't use private copy of old netinet/if_ether.h.
Use <net/if_ether.h> for ethernet specific definitions, and insert private
definitions for ARP if needed. (The new ARP macros in <net/if_arp.h> are
not used because they create larger code, and we really don't need more
than ethernet/ip support here.)
 1.16 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.15 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.14 13-Oct-1996  christos branches: 1.14.6;
backout previous kprintf changes
 1.13 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.12 13-Dec-1995  pk Make `time difference' a signed quantity explicitly.
 1.11 29-Nov-1995  thorpej Use bzero() instead of memset(..., 0, ...).
 1.10 21-Nov-1995  cgd make netinet work on systems where pointers and longs are 64 bits
(like the alpha). Biggest problem: IP headers were overlayed with
structure which included pointers, and which therefore didn't overlay
properly on 64-bit machines. Solution: instead of threading pointers
through IP header overlays, add a "queue element" structure to do
the threading, and point it at the ip headers.
 1.9 23-Sep-1995  thorpej Add an inet_addr() function; return network-order numeric representation
of an IP address from `aa.bb.cc.dd'-style text input.
 1.8 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.7 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.6 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.5 11-Sep-1995  thorpej Changes from Gordon Ross:
a) check against `my' ethernet or broadcast addresses done in
ether.c
b) changed interface to readether() to provide ethertype info
c) respond to arp requests when appropriate.
First two are clean-up. Last fixes hp300 and presumably mvme68k netboot
code.
 1.4 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 04-Aug-1994  brezak branches: 1.2.2;
Make libsa compile again by not including sys/errno.h
 1.1 08-May-1994  brezak branches: 1.1.2;
Standalone networking for network boot loaders.
 1.1.2.1 05-Aug-1994  mycroft update from trunk, per Brezak
 1.2.2.2 04-Aug-1994  brezak Make libsa compile again by not including sys/errno.h
 1.2.2.1 04-Aug-1994  brezak file net.c was added on branch netbsd-1-0 on 1994-08-04 19:39:36 +0000
 1.14.6.1 07-Mar-1997  is Use the local copy of the old-style if_ether.h for the moment, til we have
time to modernize the libsa ARP support.
 1.17.2.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.2.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19.2.1 26-Dec-1997  perry pull up from trunk (scottr)
 1.21.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.23.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.23.4.1 15-Nov-1999  fvdl Sync with -current
 1.23.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.23.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.27.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.24.1 03-Aug-2004  skrll Sync with HEAD
 1.28.16.2 07-Dec-2007  yamt sync with head
 1.28.16.1 21-Jun-2006  yamt sync with head.
 1.29.2.1 01-Feb-2006  yamt sync with head.
 1.30.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.30.44.1 09-Jan-2008  matt sync with HEAD
 1.30.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.31.26.2 28-Apr-2009  skrll Sync with HEAD.
 1.31.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.18.1 04-May-2009  yamt sync with head.
 1.31.14.1 17-Jan-2009  mjf Sync with HEAD.
 1.34.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.35.64.1 10-Jun-2019  christos Sync with HEAD
 1.28 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.27 29-Mar-2014  jakllsch branches: 1.27.30;
Obtain and/or use ETHER_ADDR_LEN.
 1.26 11-May-2011  zoltan branches: 1.26.4; 1.26.14; 1.26.18;
Separate the IP and UDP code paths inside libsa, so I can add HTTP booting
later.
 1.25 18-Jan-2009  tsutsui branches: 1.25.6; 1.25.8;
I really hate silly hacks inside #ifndef _STANDALONE in libsa sources...
 1.24 17-Jan-2009  tsutsui Remove __P().
 1.23 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.22 25-Mar-2008  christos branches: 1.22.4; 1.22.12;
fix typo
 1.21 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.20 24-Nov-2007  isaki branches: 1.20.14;
style, indent, and ANSI-fy.
 1.19 24-Jan-2006  christos branches: 1.19.42; 1.19.44; 1.19.50;
PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
on an mbuf and ip_cksum() operates on a plain buffer. We should not call
functions that operate on different arguments the same name (this is not
c++).
 1.18 22-Jan-2006  dsl If _STANDALONE is defined, #include </lib/libsa/iodesc.h> instead of requiring
that the source that #includes net.h have lib/libsa in its include path.
In the non-_STANDALONE case make it easy for the user to supply their own iodesc.h.
 1.17 21-Jan-2006  dsl Adjust code so that it will work when _STANDALONE isn't defined.
Allows it to be used for mount_nfs when SMALL is set - eg install floppies/
 1.16 11-Dec-2005  christos branches: 1.16.2;
merge ktrace-lwp.
 1.15 26-Feb-2005  perry branches: 1.15.4;
nuke trailing whitespace
 1.14 19-Mar-2003  drochner branches: 1.14.2; 1.14.10; 1.14.12;
remove stuff just moved to bootparam.c and some variables which are
never used.
 1.13 07-May-1999  drochner move intoa() from libsa:net.c to libkern, turn inet_ntoa() into a macro,
nuke ip_convertaddr()
 1.12 12-Apr-1999  ross libkern just got an inet_addr(), but it won't compile, no prototype. Cleanup...
* Add prototype to libkern.h.
* Remove the almost-identical-copy from libsa/net.[ch].
* Change its type back to the (wrong, but harmless) historical one. (u_long)
* Kill the XXX local prototype in nfs_bootparam.c
 1.11 11-Feb-1999  pk branches: 1.11.4;
Add missing prototypes.
 1.10 20-Oct-1995  cgd fix spacing in header 'room to leave' comment
 1.9 23-Sep-1995  thorpej Add an inet_addr() function; return network-order numeric representation
of an IP address from `aa.bb.cc.dd'-style text input.
 1.8 23-Sep-1995  gwr Fix/improve some comments.
 1.7 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.6 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.5 11-Sep-1995  thorpej Changes from Gordon Ross:
a) check against `my' ethernet or broadcast addresses done in
ether.c
b) changed interface to readether() to provide ethertype info
c) respond to arp requests when appropriate.
First two are clean-up. Last fixes hp300 and presumably mvme68k netboot
code.
 1.4 27-Jun-1995  gwr Pad HEADER_SIZE for alignment.
 1.3 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.14.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.10.1 29-Apr-2005  kent sync with -current
 1.14.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.4.2 07-Dec-2007  yamt sync with head
 1.15.4.1 21-Jun-2006  yamt sync with head.
 1.16.2.1 01-Feb-2006  yamt sync with head.
 1.19.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.44.1 09-Jan-2008  matt sync with HEAD
 1.19.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.20.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.20.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.22.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.4.1 04-May-2009  yamt sync with head.
 1.25.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.25.6.1 31-May-2011  rmind sync with head
 1.26.18.1 18-May-2014  rmind sync with head
 1.26.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.30.1 10-Jun-2019  christos Sync with HEAD
 1.27 14-Sep-2023  rin netif_open: Fail with ENXIO instead of panic if no netif available

Avoid undesirable freeze for efiboot/x86 when interfaces are really
unavailable, or fail to be configured by buggy UEFI firmware.
 1.26 31-Mar-2019  christos branches: 1.26.30;
fix warnings, printf formats, etc.
 1.25 20-Oct-2013  christos branches: 1.25.30;
remove unused
 1.24 17-Jan-2009  tsutsui branches: 1.24.14; 1.24.24; 1.24.28;
Remove __P().
 1.23 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.22 25-Mar-2008  christos branches: 1.22.4; 1.22.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.21 24-Nov-2007  isaki branches: 1.21.14;
style, indent, and ANSI-fy.
 1.20 11-Dec-2005  christos branches: 1.20.44; 1.20.46; 1.20.52;
merge ktrace-lwp.
 1.19 26-Feb-2005  perry branches: 1.19.4;
nuke trailing whitespace
 1.18 12-Mar-2003  drochner branches: 1.18.2; 1.18.10; 1.18.12;
separate the netif interface from the rest of the networking code,
so that it can be replaced easily in md code
 1.17 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.16 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.15 30-Mar-2000  augustss branches: 1.15.6; 1.15.8;
Kill some more register declarations.
 1.14 13-Nov-1999  thorpej Backout my libsa changes.
 1.13 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.12 31-Mar-1999  cgd branches: 1.12.8; 1.12.10; 1.12.14;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.11 11-Feb-1999  pk Add missing prototypes.
 1.10 06-Sep-1997  drochner -Wall fixes
 1.9 26-Jun-1997  drochner branches: 1.9.4;
Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.8 13-Jun-1997  drochner -Wall fixes
 1.7 13-Oct-1996  christos backout previous kprintf changes
 1.6 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.4 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.3 20-Feb-1995  mycroft Define netif_debug in here.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.9.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.10.1 15-Nov-1999  fvdl Sync with -current
 1.12.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.15.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.15.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.6.2 18-Oct-2002  nathanw Catch up to -current.
 1.15.6.1 08-Jan-2002  nathanw Catch up to -current.
 1.18.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.10.1 29-Apr-2005  kent sync with -current
 1.18.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.19.4.1 07-Dec-2007  yamt sync with head
 1.20.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.46.1 09-Jan-2008  matt sync with HEAD
 1.20.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.21.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.21.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.22.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.4.1 04-May-2009  yamt sync with head.
 1.24.28.1 18-May-2014  rmind sync with head
 1.24.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25.30.1 10-Jun-2019  christos Sync with HEAD
 1.26.30.1 21-Jun-2024  martin Pull up following revision(s) (requested by rin in ticket #716):

sys/lib/libsa/netif.c: revision 1.27

netif_open: Fail with ENXIO instead of panic if no netif available

Avoid undesirable freeze for efiboot/x86 when interfaces are really
unavailable, or fail to be configured by buggy UEFI firmware.
 1.8 27-Feb-2024  christos Put the standard NetBSD copyright on this file. Approved by John Brezak
via a message on LinkedIn.
 1.7 17-Jan-2009  tsutsui Remove __P().
 1.6 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.5 12-Mar-2003  drochner branches: 1.5.100; 1.5.104; 1.5.114;
separate the netif interface from the rest of the networking code,
so that it can be replaced easily in md code
 1.4 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.3 03-Sep-1995  pk Add a driver hook to the `netif' structure.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.5.114.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.104.1 04-May-2009  yamt sync with head.
 1.5.100.1 17-Jan-2009  mjf Sync with HEAD.
 1.53 29-Jun-2024  rin libsa/nfs.c: Add `LIBSA_NFS_IMPLICIT_MOUNT` compile-time option

by which nfs_mount() is automatically called from nfs_open(),
as done for nfs.c in i386/stand.

This is only functional difference b/w two copies of nfs.c.
Now, we can safely retire the latter.

XXX
It would be really nice to drop this option also. However,
unfortunately, it is too much for me at the very moment...
 1.52 14-Dec-2023  rin libsa: nfs: Fix NFS_NOSYMLINK option for previous

Used only by mvme68k.
 1.51 12-Dec-2023  mlelstv Add NFSv3 support. Try NFSv3 and fall back to NFSv2.
 1.50 26-Jan-2020  skrll branches: 1.50.24;
Make a debug printf compile for all platforms
 1.49 31-Mar-2019  christos branches: 1.49.6;
fix warnings, printf formats, etc.
 1.48 20-Mar-2014  christos branches: 1.48.30;
reduce size by 1K by sharing the ls code.
 1.47 25-Dec-2011  tsutsui branches: 1.47.6; 1.47.10;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.46 16-Jun-2011  joerg branches: 1.46.2; 1.46.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.45 17-Jan-2009  tsutsui branches: 1.45.12;
Remove __P().
 1.44 19-Nov-2008  ad For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.43 25-Mar-2008  christos branches: 1.43.4; 1.43.10; 1.43.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.42 24-Nov-2007  isaki branches: 1.42.14;
style, indent, and ANSI-fy.
 1.41 25-Feb-2007  uwe branches: 1.41.16; 1.41.18; 1.41.24;
Add missing newlines to debug messages.
 1.40 29-Dec-2006  yamt branches: 1.40.2;
remove nqnfs from comments. from Arnaud Lacombe.
(no functional changes.)
 1.39 25-Jan-2006  christos branches: 1.39.18;
free -> dealloc
 1.38 11-Dec-2005  christos branches: 1.38.2;
merge ktrace-lwp.
 1.37 26-Feb-2005  perry branches: 1.37.4;
nuke trailing whitespace
 1.36 04-Sep-2003  he branches: 1.36.8; 1.36.10;
Um, undo last; libsa printf doesn't do %z.
 1.35 04-Sep-2003  he Use the %zu format for size_t printing instead of cast + %lu.
 1.34 03-Sep-2003  he Cast size_t to u_long before printing, and use %lu instead of %d as format.
Fixes compilation on alpha.
 1.33 31-Aug-2003  fvdl Fix signed/unsigned warnings.
 1.32 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.31 18-Mar-2003  mycroft branches: 1.31.2;
Move some stuff into .rodata.
 1.30 12-Mar-2003  drochner no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
 1.29 30-Mar-2000  augustss Kill some more register declarations.
 1.28 23-Nov-1999  simonb Remove leading '/' from pathnames, using same logic as ufs.c. Allows new
style (but not yet committed) pmax bootblocks to open "/boot.pmax" on an
ISO image. Same problem reported for NFS by Jason Thorpe.
 1.27 13-Nov-1999  thorpej Backout my libsa changes.
 1.26 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.25 31-Mar-1999  cgd branches: 1.25.8; 1.25.10; 1.25.14;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.24 11-Feb-1999  pk Add missing prototypes.
 1.23 23-Jan-1998  thorpej Fix some debugging printf formats.
 1.22 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.21 16-Jun-1997  drochner Conditionally compile without symlink support (#ifdef NFS_NOSYMLINK).
Saves 708 bytes (i386). (close pr misc/3335)
 1.20 27-Dec-1996  pk Add missing `#ifdef NFS_DEBUG' (from Rolf Grossmann; PR#3061).
 1.19 13-Oct-1996  christos backout previous kprintf changes
 1.18 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.17 02-Oct-1996  cgd fix several endianness bugs that caused name lookup (!!) and symlink
expansion to fail on little-endian machines.
 1.16 30-Sep-1996  ws Add support for booting from cd9660 fs
Support directory traversal and symbolic links for nfs booting
Close device when file opening failed
Plug memory leak in ufs code
 1.15 14-May-1996  leo Fix gcc -Wall warnings about printf arguments.
 1.14 26-Feb-1996  gwr Make this code independent of <sys/nfs> now that we use very little
from there anyway, so we can ignore changes in the NFS code...
 1.13 26-Feb-1996  scottr Make these build again in the wake of the v3 changes
 1.12 23-Sep-1995  gwr More cleanup: change some private types to eliminate casts,
replace some "goto xxx" with return(-1). (mostly cosmetic)
 1.11 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.10 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.9 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.8 03-Jul-1995  gwr Can not use htonl() in static initializers. (Fixes PR 1188)
 1.7 27-Jun-1995  gwr Re-work for new rpc interface, and simplify a bit.
 1.6 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.5 19-Feb-1995  mycroft Adjust the attribute info size for our NFS code.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 22-Aug-1994  brezak branches: 1.3.2;
Cleanup to make more ANSI compliant; checkpoint
 1.2 20-Jun-1994  glass make it compile w/4.4-lite header file changes
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.3.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.3.2.1 22-Aug-1994  brezak file nfs.c was added on branch netbsd-1-0 on 1994-08-22 21:56:09 +0000
 1.25.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.10.1 15-Nov-1999  fvdl Sync with -current
 1.25.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.31.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.31.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.31.2.1 03-Aug-2004  skrll Sync with HEAD
 1.36.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.36.8.1 29-Apr-2005  kent sync with -current
 1.37.4.4 07-Dec-2007  yamt sync with head
 1.37.4.3 26-Feb-2007  yamt sync with head.
 1.37.4.2 30-Dec-2006  yamt sync with head.
 1.37.4.1 21-Jun-2006  yamt sync with head.
 1.38.2.1 01-Feb-2006  yamt sync with head.
 1.39.18.1 12-Jan-2007  ad Sync with head.
 1.40.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.41.24.1 08-Dec-2007  mjf Sync with HEAD.
 1.41.18.1 09-Jan-2008  matt sync with HEAD
 1.41.16.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.42.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.42.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.43.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.43.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.43.4.1 04-May-2009  yamt sync with head.
 1.45.12.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.46.6.1 18-Feb-2012  mrg merge to -current.
 1.46.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.2.1 17-Apr-2012  yamt sync with head
 1.47.10.1 18-May-2014  rmind sync with head
 1.47.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.30.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.48.30.1 10-Jun-2019  christos Sync with HEAD
 1.49.6.1 29-Feb-2020  ad Sync with head.
 1.50.24.1 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #894):

sys/arch/i386/stand/Makefile.booters: revision 1.98
sys/lib/libsa/nfsv3.h: revision 1.1
sys/lib/libsa/rpcv2.h: revision 1.4
sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.23
sys/lib/libsa/nfsv2.h: revision 1.5
sys/lib/libsa/nfs.c: revision 1.51
sys/lib/libsa/nfs.c: revision 1.52
sys/arch/i386/stand/libsa/nfs.c: file removal
sys/lib/libsa/nfs.c: revision 1.53
sys/arch/i386/stand/libsa/nfs.c: revision 1.20
sys/arch/i386/stand/libsa/nfs.c: revision 1.21
sys/arch/i386/stand/pxeboot/Makefile: revision 1.29

Add NFSv3 support. Try NFSv3 and fall back to NFSv2.

Merge with generic libsa NFS code to minimize differences and to learn NFSv3.

libsa: nfs: Fix NFS_NOSYMLINK option for previous
Used only by mvme68k.

Align again with libsa (NFS_NOSYMLINK fix).

libsa/nfs.c: Add `LIBSA_NFS_IMPLICIT_MOUNT` compile-time option
by which nfs_mount() is automatically called from nfs_open(),
as done for nfs.c in i386/stand.

This is only functional difference b/w two copies of nfs.c.
Now, we can safely retire the latter.
XXX
It would be really nice to drop this option also. However,
unfortunately, it is too much for me at the very moment...

i386: stand: Retire its own nfs.c, and switch to libsa/nfs.c. NFC
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 10-Jul-1996  cgd branches: 1.5.62;
nfs_read and nfs_write return 'int' rather than ssize_t.
 1.4 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.3 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.5.62.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.62.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.62.1 03-Aug-2004  skrll Sync with HEAD
 1.5 12-Dec-2023  mlelstv Add NFSv3 support. Try NFSv3 and fall back to NFSv2.
 1.4 11-Dec-2005  christos branches: 1.4.194;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 26-Feb-1996  gwr branches: 1.2.64;
Make this code independent of <sys/nfs> now that we use very little
from there anyway, so we can ignore changes in the NFS code...
 1.1 26-Feb-1996  scottr Needed for NFS booting; we aren't likely to use v3 here any time soon.
 1.2.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.64.1 03-Aug-2004  skrll Sync with HEAD
 1.4.194.1 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #894):

sys/arch/i386/stand/Makefile.booters: revision 1.98
sys/lib/libsa/nfsv3.h: revision 1.1
sys/lib/libsa/rpcv2.h: revision 1.4
sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.23
sys/lib/libsa/nfsv2.h: revision 1.5
sys/lib/libsa/nfs.c: revision 1.51
sys/lib/libsa/nfs.c: revision 1.52
sys/arch/i386/stand/libsa/nfs.c: file removal
sys/lib/libsa/nfs.c: revision 1.53
sys/arch/i386/stand/libsa/nfs.c: revision 1.20
sys/arch/i386/stand/libsa/nfs.c: revision 1.21
sys/arch/i386/stand/pxeboot/Makefile: revision 1.29

Add NFSv3 support. Try NFSv3 and fall back to NFSv2.

Merge with generic libsa NFS code to minimize differences and to learn NFSv3.

libsa: nfs: Fix NFS_NOSYMLINK option for previous
Used only by mvme68k.

Align again with libsa (NFS_NOSYMLINK fix).

libsa/nfs.c: Add `LIBSA_NFS_IMPLICIT_MOUNT` compile-time option
by which nfs_mount() is automatically called from nfs_open(),
as done for nfs.c in i386/stand.

This is only functional difference b/w two copies of nfs.c.
Now, we can safely retire the latter.
XXX
It would be really nice to drop this option also. However,
unfortunately, it is too much for me at the very moment...

i386: stand: Retire its own nfs.c, and switch to libsa/nfs.c. NFC
 1.1 12-Dec-2023  mlelstv branches: 1.1.4;
Add NFSv3 support. Try NFSv3 and fall back to NFSv2.
 1.1.4.2 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #894):

sys/arch/i386/stand/Makefile.booters: revision 1.98
sys/lib/libsa/nfsv3.h: revision 1.1
sys/lib/libsa/rpcv2.h: revision 1.4
sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.23
sys/lib/libsa/nfsv2.h: revision 1.5
sys/lib/libsa/nfs.c: revision 1.51
sys/lib/libsa/nfs.c: revision 1.52
sys/arch/i386/stand/libsa/nfs.c: file removal
sys/lib/libsa/nfs.c: revision 1.53
sys/arch/i386/stand/libsa/nfs.c: revision 1.20
sys/arch/i386/stand/libsa/nfs.c: revision 1.21
sys/arch/i386/stand/pxeboot/Makefile: revision 1.29

Add NFSv3 support. Try NFSv3 and fall back to NFSv2.

Merge with generic libsa NFS code to minimize differences and to learn NFSv3.

libsa: nfs: Fix NFS_NOSYMLINK option for previous
Used only by mvme68k.

Align again with libsa (NFS_NOSYMLINK fix).

libsa/nfs.c: Add `LIBSA_NFS_IMPLICIT_MOUNT` compile-time option
by which nfs_mount() is automatically called from nfs_open(),
as done for nfs.c in i386/stand.

This is only functional difference b/w two copies of nfs.c.
Now, we can safely retire the latter.
XXX
It would be really nice to drop this option also. However,
unfortunately, it is too much for me at the very moment...

i386: stand: Retire its own nfs.c, and switch to libsa/nfs.c. NFC
 1.1.4.1 12-Dec-2023  martin file nfsv3.h was added on branch netbsd-10 on 2024-09-20 11:31:31 +0000
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.12 20-Mar-2014  christos reduce size by 1K by sharing the ls code.
 1.11 25-Dec-2011  tsutsui branches: 1.11.6; 1.11.10;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.10 16-Jun-2011  joerg branches: 1.10.2; 1.10.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.9 11-Dec-2005  christos branches: 1.9.108;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry nuke trailing whitespace
 1.7 18-Aug-2003  dsl branches: 1.7.8; 1.7.10;
make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 10-Apr-2003  dsl branches: 1.5.2;
Fix prototypes of null_read and null_write, change to return errno values.
This code can't actually be used anywhere! I don't think its obvious use
would compile!
 1.4 28-May-2002  bjh21 Implement LIBSA_NO_FS_CLOSE, LIBSA_NO_FS_WRITE and LIBSA_NO_FS_SEEK.
LIBSA_NO_FS_SYMLINK and LIBSA_FS_SINGLECOMPONENT are irrelevant here.
 1.3 28-May-2002  bjh21 KNF.
 1.2 31-Mar-1999  cgd branches: 1.2.20; 1.2.22; 1.2.34;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.1 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.2.34.1 30-May-2002  gehenna Catch up with -current.
 1.2.22.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.20.1 20-Jun-2002  nathanw Catch up to -current.
 1.5.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.9.108.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.6.1 18-Feb-2012  mrg merge to -current.
 1.10.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.11.10.1 18-May-2014  rmind sync with head
 1.11.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.25 11-Dec-2005  christos branches: 1.25.44; 1.25.46; 1.25.52;
merge ktrace-lwp.
 1.24 26-Feb-2005  perry branches: 1.24.4;
nuke trailing whitespace
 1.23 07-Aug-2003  agc branches: 1.23.8; 1.23.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.22 01-Feb-2003  dsl branches: 1.22.2;
Beautify a little
 1.21 23-Feb-2002  thorpej Move files[] from open.c to globals.c, so that it's possible to
use libsa in an application where there are no file systems or
devices.
 1.20 30-Mar-2000  augustss branches: 1.20.6; 1.20.8;
Kill some more register declarations.
 1.19 31-Mar-1999  cgd branches: 1.19.8;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.18 26-Mar-1999  simonb Don't call f_dev->dv_close if it's a null pointer when an open() call
fails.
 1.17 22-Sep-1998  ross Make sure ctags(1) indexes oopen().
 1.16 28-Jan-1997  pk Initialize `f_offset'.
 1.15 25-Jan-1997  cgd Change file system file-open semantics slightly: if file system returns
EINVAL, that error code is ignored, leaving whatever other meaningful
error code that might have previously been returned intact. Stand-alone
file system implementations return EINVAL typically when the file system
is not recognized (i.e. cd9660_open on a UFS file system, ufs_open on a
cd9660 file system, etc.). This meant that if you had multiple file
systems in a file system switch, the first returned ENOENT (because
it recognized the file system type, but the file wasn't there) and
the second returned EINVAL (because it didn't recognize the file system
type), errno would be set to EINVAL. Now it'll be set to ENOENT.

It would probably make sense to have file systems return a special
error code to indicate "this file system is unrecognized," which
could then be special-cased, but that's a fair bit more invasive.
 1.14 22-Jan-1997  cgd define these functions with an 'o' prepended to their names if
__INTERNAL_LIBSA_CREAD is defined (so that they can be used by the
compressed-read code).
 1.13 17-Jan-1997  cgd only call the device close routine on a (fall-through) error if
F_NODEV isn't set in the file flags for the file being opened.
Pointed out by Matthias Drochner in PR 3122. (fix equivalent to
the one he included, but stylistically different.)
 1.12 30-Sep-1996  ws Add support for booting from cd9660 fs
Support directory traversal and symbolic links for nfs booting
Close device when file opening failed
Plug memory leak in ufs code
 1.11 21-Jun-1996  pk Return useful file descriptor when opening a raw device.
 1.10 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.9 19-Sep-1995  thorpej Assume that if devopen() points `file' at a NULL that a raw device was
opened (as opposed to only checking to see if `file' itself is NULL).
 1.8 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.7 06-Sep-1995  pk Avoid calling device-close routine when open() not completed. Otherwise you
lose if this sequence occurs: open()->devopen()->...->panic()->closeall().
 1.6 22-Apr-1995  cgd various attribute poisoning, don't be as quick to specify size of files[]
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 18-Jul-1994  pk branches: 1.4.2;
Avoid descriptor leakage.
 1.3 08-May-1994  brezak branches: 1.3.2;
Standalone networking for network boot loaders.
 1.2 01-Mar-1994  pk set errno.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.3.2.1 27-Jul-1994  cgd update from trunk.
 1.4.2.2 18-Jul-1994  pk Avoid descriptor leakage.
 1.4.2.1 18-Jul-1994  pk file open.c was added on branch netbsd-1-0 on 1994-07-18 18:41:13 +0000
 1.19.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.20.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.20.6.1 28-Feb-2002  nathanw Catch up to -current.
 1.22.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.8.1 29-Apr-2005  kent sync with -current
 1.24.4.1 07-Dec-2007  yamt sync with head
 1.25.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.25.46.1 09-Jan-2008  matt sync with HEAD
 1.25.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.7 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.6 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.5 11-Dec-2005  christos branches: 1.5.44; 1.5.46; 1.5.52;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 07-Mar-2003  dsl branches: 1.3.2; 1.3.10; 1.3.12;
LIBSA_NO_CLOSE is LIBSA_NO_FS_CLOSE everywhere else.
 1.2 28-Apr-1999  christos Nuke local prototype for closeall(). Add a new define LIBSA_NO_CLOSE so that
we don't try to close files, if we are not using any other I/O.
 1.1 12-Feb-1999  drochner branches: 1.1.4;
We can't prototype exit() publically because it might take an argument or
not, depending on the port-specific environment.
Separate panic() and exit() so that the mi/default panic() can be used
without conflicting with a local exit() definition, move exit(void)
prototype to the default exit() implementation.
Closes PR bin/6990 by Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>.
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.4.1 07-Dec-2007  yamt sync with head
 1.5.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.46.1 09-Jan-2008  matt sync with HEAD
 1.5.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.18 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.17 11-Dec-2005  christos merge ktrace-lwp.
 1.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.15 13-Feb-1999  pk branches: 1.15.42;
Split the printf variants into separate files.
 1.14 11-Feb-1999  pk sprintf() now produces a return value, like the standard counterpart does.
Also, implement vsprintf(), snprintf() and vsnprintf().
 1.13 16-Jun-1998  gwr Add support for "%p" format (easy).
 1.12 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.11 26-Jun-1997  thorpej Don't run off the end of the format string if the caller botched for
format modifier. Pointed out by Daniel G. Pouzzner in PR #2633.
 1.10 30-Nov-1996  gwr Finish the kprintf backout: kvprintf -> vprintf was missed.
 1.9 13-Oct-1996  christos backout previous kprintf changes
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 08-Feb-1996  gwr Need vprintf() for things like panic().
 1.6 03-Sep-1995  pk branches: 1.6.2;
Merge an sprintf() in.
 1.5 21-Feb-1995  mycroft Add a generic twiddler.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 22-Aug-1994  brezak branches: 1.3.2;
Cleanup to make more ANSI compliant; checkpoint
 1.2 27-Jul-1994  cgd get rid of someone else's bravery (stupidity)
 1.1 26-Jan-1994  brezak branches: 1.1.2;
CMU/4.4 stand-alone library
 1.1.2.1 27-Jul-1994  cgd update from trunk.
 1.3.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.3.2.1 22-Aug-1994  brezak file printf.c was added on branch netbsd-1-0 on 1994-08-22 21:56:11 +0000
 1.6.2.1 08-Feb-1996  gwr Need vprintf() for things like panic().
 1.15.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.42.1 03-Aug-2004  skrll Sync with HEAD
 1.5 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.4 24-Nov-2007  isaki branches: 1.4.106;
style, indent, and ANSI-fy.
 1.3 24-Dec-2005  perry branches: 1.3.44; 1.3.46; 1.3.52;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 19-May-2004  abs branches: 1.1.2; 1.1.4; 1.1.16;
Add qsort to libsa (taken from sys/dev/vinum/vinumqsort.c) and use instead of
bubblesort in acorn32 bootloader. Reduces time to sort memory on A710 equipped
RiscPC from over twenty seconds to effectively instantaneous.
Update boot version to 3.30
 1.1.16.2 07-Dec-2007  yamt sync with head
 1.1.16.1 21-Jun-2006  yamt sync with head.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 19-May-2004  skrll file qsort.c was added on branch ktrace-lwp on 2004-08-03 10:53:53 +0000
 1.1.2.2 22-May-2004  he Pull up revision 1.1 (new, requested by abs in ticket #369):
Add qsort to libsa (taken from sys/dev/vinum/vinumqsort.c)
and use instead of bubblesort in acorn32 bootloader. Reduces
time to sort memory on A710 equipped RiscPC from over twenty
seconds to effectively instantaneous. Update boot version
to 3.30
 1.1.2.1 19-May-2004  he file qsort.c was added on branch netbsd-2-0 on 2004-05-22 17:12:43 +0000
 1.3.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.46.1 09-Jan-2008  matt sync with HEAD
 1.3.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.4.106.1 10-Jun-2019  christos Sync with HEAD
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Minimal quad routines needed for libsa to be self-contained. The compiler
emits a reference to this one in the UFS code.
 1.34 05-Apr-2019  christos Go back ot using 0x%x instead of %#x because we don't always support the
format. See subr_prf.c
 1.33 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.32 29-Mar-2014  jakllsch branches: 1.32.30;
Obtain and/or use ETHER_ADDR_LEN.
 1.31 11-May-2011  zoltan branches: 1.31.4; 1.31.14; 1.31.18;
Separate the IP and UDP code paths inside libsa, so I can add HTTP booting
later.
 1.30 17-Jan-2009  tsutsui branches: 1.30.6; 1.30.8;
Remove __P().
 1.29 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.28 05-Apr-2008  tsutsui branches: 1.28.4; 1.28.12;
Fix a warning in #ifdef RARP_DEBUG. PR kern/20314
 1.27 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.26 24-Nov-2007  isaki branches: 1.26.14;
style, indent, and ANSI-fy.
 1.25 11-Dec-2005  christos branches: 1.25.44; 1.25.46; 1.25.52;
merge ktrace-lwp.
 1.24 13-Jun-2005  junyoung branches: 1.24.2;
Remove bcmp(). Use memcmp() instead.
 1.23 26-Feb-2005  perry nuke trailing whitespace
 1.22 31-Aug-2003  fvdl branches: 1.22.8; 1.22.10;
Fix signed/unsigned warnings.
 1.21 12-Mar-2003  drochner branches: 1.21.2;
no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
 1.20 30-Mar-2000  augustss Kill some more register declarations.
 1.19 13-Nov-1999  thorpej Backout my libsa changes.
 1.18 12-Nov-1999  lukem fix pointer size in debug message
 1.17 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.16 07-Jul-1997  drochner branches: 1.16.20; 1.16.22; 1.16.26;
Don't use private copy of old netinet/if_ether.h.
Use <net/if_ether.h> for ethernet specific definitions, and insert private
definitions for ARP if needed. (The new ARP macros in <net/if_arp.h> are
not used because they create larger code, and we really don't need more
than ethernet/ip support here.)
 1.15 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.14 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.13 13-Oct-1996  christos branches: 1.13.6;
backout previous kprintf changes
 1.12 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 03-Jun-1996  pk missing semicolon
 1.10 23-Sep-1995  gwr More cleanup: change some private types to eliminate casts,
replace some "goto xxx" with return(-1). (mostly cosmetic)
 1.9 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.8 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.7 11-Sep-1995  thorpej Changes from Gordon Ross:
a) check against `my' ethernet or broadcast addresses done in
ether.c
b) changed interface to readether() to provide ethertype info
c) respond to arp requests when appropriate.
First two are clean-up. Last fixes hp300 and presumably mvme68k netboot
code.
 1.6 27-Jun-1995  gwr Fix ARP opcode, add more debugging prints.
 1.5 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 04-Aug-1994  brezak branches: 1.3.2;
Make libsa compile again by not including sys/errno.h
 1.2 31-May-1994  hpeyerl branches: 1.2.2;
s/REVARP/ARPOP/
(duh; thanx Gordon)
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.2.2.1 05-Aug-1994  mycroft update from trunk, per Brezak
 1.3.2.2 04-Aug-1994  brezak Make libsa compile again by not including sys/errno.h
 1.3.2.1 04-Aug-1994  brezak file rarp.c was added on branch netbsd-1-0 on 1994-08-04 19:39:38 +0000
 1.13.6.1 07-Mar-1997  is Use the local copy of the old-style if_ether.h for the moment, til we have
time to modernize the libsa ARP support.
 1.16.26.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.22.1 15-Nov-1999  fvdl Sync with -current
 1.16.20.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.21.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.8.1 29-Apr-2005  kent sync with -current
 1.24.2.1 07-Dec-2007  yamt sync with head
 1.25.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.25.46.1 09-Jan-2008  matt sync with HEAD
 1.25.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.26.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.26.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.26.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.28.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.4.1 04-May-2009  yamt sync with head.
 1.30.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.6.1 31-May-2011  rmind sync with head
 1.31.18.1 18-May-2014  rmind sync with head
 1.31.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.32.30.1 10-Jun-2019  christos Sync with HEAD
 1.15 02-Dec-2007  tsutsui unsigned -> unsigned int
 1.14 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.13 11-Dec-2005  christos branches: 1.13.44; 1.13.46; 1.13.52;
merge ktrace-lwp.
 1.12 26-Feb-2005  perry branches: 1.12.4;
nuke trailing whitespace
 1.11 07-Aug-2003  agc branches: 1.11.8; 1.11.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.10 30-Mar-2000  augustss branches: 1.10.28;
Kill some more register declarations.
 1.9 31-Mar-1999  cgd branches: 1.9.8;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.8 22-Jan-1997  cgd define these functions with an 'o' prepended to their names if
__INTERNAL_LIBSA_CREAD is defined (so that they can be used by the
compressed-read code).
 1.7 21-Jun-1996  pk Oh, what's in a name..
 1.6 21-Jun-1996  pk Allow seeks on raw devices. A `f_offset' field is added to the file structure
which is maintained in lseek(), read() and write(), and passed along to
the device's strategy routine.
 1.5 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.4 21-Feb-1995  mycroft Add a generic twiddler.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Cleanup to make more ANSI compliant; checkpoint
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.2.2.1 22-Aug-1994  brezak file read.c was added on branch netbsd-1-0 on 1994-08-22 21:56:12 +0000
 1.9.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.10.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.28.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.12.4.1 07-Dec-2007  yamt sync with head
 1.13.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.13.46.1 09-Jan-2008  matt sync with HEAD
 1.13.44.2 03-Dec-2007  joerg Sync with HEAD.
 1.13.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.31 05-Apr-2019  christos Go back ot using 0x%x instead of %#x because we don't always support the
format. See subr_prf.c
 1.30 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.29 17-Jan-2009  tsutsui branches: 1.29.66;
Remove __P().
 1.28 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.27 25-Mar-2008  christos branches: 1.27.4; 1.27.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.26 24-Nov-2007  isaki branches: 1.26.14;
style, indent, and ANSI-fy.
 1.25 21-Jan-2006  dsl branches: 1.25.42; 1.25.44; 1.25.50;
Adjust code so that it will work when _STANDALONE isn't defined.
Allows it to be used for mount_nfs when SMALL is set - eg install floppies/
 1.24 11-Dec-2005  christos branches: 1.24.2;
merge ktrace-lwp.
 1.23 31-Aug-2003  fvdl branches: 1.23.16;
Fix signed/unsigned warnings.
 1.22 12-Mar-2003  drochner branches: 1.22.2;
no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
 1.21 30-Mar-2000  augustss Kill some more register declarations.
 1.20 13-Nov-1999  thorpej Backout my libsa changes.
 1.19 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.18 23-Jan-1998  thorpej branches: 1.18.14; 1.18.16; 1.18.20;
Fix some debugging printf formats.
 1.17 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.16 13-Oct-1996  christos backout previous kprintf changes
 1.15 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.14 26-Sep-1996  cgd enough 64-bit fixes to make network booting work on the Alpha. In general,
these are hacks (s/long/int/, etc.), but this code really needs a heavy
cleaning (including fixed-size typing) and I don't have time to give it one
now.
 1.13 10-Jul-1996  cgd remove some unnecessary and broken casts on char *'s which are being subtracted
 1.12 26-Feb-1996  gwr Make this code independent of <sys/nfs> now that we use very little
from there anyway, so we can ignore changes in the NFS code...
 1.11 26-Feb-1996  scottr Make these build again in the wake of the v3 changes
 1.10 23-Sep-1995  gwr More cleanup: change some private types to eliminate casts,
replace some "goto xxx" with return(-1). (mostly cosmetic)
 1.9 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.8 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.7 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.6 03-Jul-1995  gwr Build all RPC requests with AUTH_UNIX (thanks to Chuck Silvers)
 1.5 27-Jun-1995  gwr Modified to do less copying, and to allow determination of
the address from whence the reply has come.
 1.4 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.3 19-Feb-1995  mycroft Add some more diagnostic info. Increment the xid in a better place.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.18.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.16.1 15-Nov-1999  fvdl Sync with -current
 1.18.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.16.2 07-Dec-2007  yamt sync with head
 1.23.16.1 21-Jun-2006  yamt sync with head.
 1.24.2.1 01-Feb-2006  yamt sync with head.
 1.25.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.25.44.1 09-Jan-2008  matt sync with HEAD
 1.25.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.26.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.26.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.27.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.4.1 04-May-2009  yamt sync with head.
 1.29.66.1 10-Jun-2019  christos Sync with HEAD
 1.11 17-Jan-2009  tsutsui Remove __P().
 1.10 24-Nov-2007  isaki branches: 1.10.18; 1.10.26;
style, indent, and ANSI-fy.
 1.9 21-Jan-2006  dsl branches: 1.9.42; 1.9.44; 1.9.50;
Adjust code so that it will work when _STANDALONE isn't defined.
Allows it to be used for mount_nfs when SMALL is set - eg install floppies/
 1.8 26-Sep-1996  cgd branches: 1.8.78; 1.8.90;
enough 64-bit fixes to make network booting work on the Alpha. In general,
these are hacks (s/long/int/, etc.), but this code really needs a heavy
cleaning (including fixed-size typing) and I don't have time to give it one
now.
 1.7 23-Sep-1995  gwr More cleanup: change some private types to eliminate casts,
replace some "goto xxx" with return(-1). (mostly cosmetic)
 1.6 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.5 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.4 27-Jun-1995  gwr Modified to do less copying, and to allow determination of
the address from whence the reply has come.
 1.3 20-Feb-1995  mycroft Various:
* Fix some misused types.
* Encapsulate the protocols better.
* Rearrange the RPC stuff to work more like the kernel. (Needs more work.)
* Remove a bunch of extra hair when reading a file over NFS.
* Use RPCAUTH_UNIX when talking to the NFS server.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-May-1994  brezak Standalone networking for network boot loaders.
 1.8.90.1 01-Feb-2006  yamt sync with head.
 1.8.78.2 07-Dec-2007  yamt sync with head
 1.8.78.1 21-Jun-2006  yamt sync with head.
 1.9.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.44.1 09-Jan-2008  matt sync with HEAD
 1.9.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.18.1 04-May-2009  yamt sync with head.
 1.4 12-Dec-2023  mlelstv Add NFSv3 support. Try NFSv3 and fall back to NFSv2.
 1.3 11-Dec-2005  christos branches: 1.3.194;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 26-Feb-1996  gwr branches: 1.1.64;
Make this code independent of <sys/nfs> now that we use very little
from there anyway, so we can ignore changes in the NFS code...
 1.1.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.64.1 03-Aug-2004  skrll Sync with HEAD
 1.3.194.1 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #894):

sys/arch/i386/stand/Makefile.booters: revision 1.98
sys/lib/libsa/nfsv3.h: revision 1.1
sys/lib/libsa/rpcv2.h: revision 1.4
sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.23
sys/lib/libsa/nfsv2.h: revision 1.5
sys/lib/libsa/nfs.c: revision 1.51
sys/lib/libsa/nfs.c: revision 1.52
sys/arch/i386/stand/libsa/nfs.c: file removal
sys/lib/libsa/nfs.c: revision 1.53
sys/arch/i386/stand/libsa/nfs.c: revision 1.20
sys/arch/i386/stand/libsa/nfs.c: revision 1.21
sys/arch/i386/stand/pxeboot/Makefile: revision 1.29

Add NFSv3 support. Try NFSv3 and fall back to NFSv2.

Merge with generic libsa NFS code to minimize differences and to learn NFSv3.

libsa: nfs: Fix NFS_NOSYMLINK option for previous
Used only by mvme68k.

Align again with libsa (NFS_NOSYMLINK fix).

libsa/nfs.c: Add `LIBSA_NFS_IMPLICIT_MOUNT` compile-time option
by which nfs_mount() is automatically called from nfs_open(),
as done for nfs.c in i386/stand.

This is only functional difference b/w two copies of nfs.c.
Now, we can safely retire the latter.
XXX
It would be really nice to drop this option also. However,
unfortunately, it is too much for me at the very moment...

i386: stand: Retire its own nfs.c, and switch to libsa/nfs.c. NFC
 1.11 03-Dec-2007  isaki Use standard error code (EIO) instead of standalone error code
(ESHORT). Because loadfile_*() is used with or without
_STANDALONE, therefore, don't use error code in "saerrno.h".
Pointed out by and discussed with he@.
 1.10 23-Nov-2007  isaki loadfile_*() must set errno when it returns -1.
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.52;
merge ktrace-lwp.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 12-Jan-1999  kleink branches: 1.7.42;
Separate the userland and libsa errno declarations from <sys/errno.h> into
their canonical places.
 1.6 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.5 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.4 21-Feb-1995  mycroft Add EFTYPE.
 1.3 04-Aug-1994  brezak branches: 1.3.2;
Make libsa compile again by not including sys/errno.h
 1.2 24-Jul-1994  mycroft Add some more constants.
 1.1 26-Jan-1994  brezak branches: 1.1.2;
CMU/4.4 stand-alone library
 1.1.2.2 05-Aug-1994  mycroft update from trunk, per Brezak
 1.1.2.1 24-Jul-1994  cgd from branch.
 1.3.2.2 04-Aug-1994  brezak Make libsa compile again by not including sys/errno.h
 1.3.2.1 04-Aug-1994  brezak file saerrno.h was added on branch netbsd-1-0 on 1994-08-04 19:39:39 +0000
 1.7.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.42.1 03-Aug-2004  skrll Sync with HEAD
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.44.2 03-Dec-2007  joerg Sync with HEAD.
 1.9.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.5 24-Apr-2022  mlelstv Ask driver about sector size to support reading superblocks from fixed
byte offsets.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 26-Oct-1994  cgd branches: 1.2.66;
new RCS ID format.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.66.1 03-Aug-2004  skrll Sync with HEAD
 1.5 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.4 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.3 11-Dec-2005  christos branches: 1.3.44; 1.3.46; 1.3.52;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 13-Feb-1999  pk branches: 1.1.42;
Split the printf variants into separate files.
 1.1.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.42.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 07-Dec-2007  yamt sync with head
 1.3.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.46.1 09-Jan-2008  matt sync with HEAD
 1.3.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.6 26-Mar-2014  christos Remove {v,}sprintf
 1.5 17-Jul-2011  joerg branches: 1.5.2; 1.5.12; 1.5.16;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.4 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.3 11-Dec-2005  christos branches: 1.3.44; 1.3.46; 1.3.52;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 13-Feb-1999  pk branches: 1.1.42;
Split the printf variants into separate files.
 1.1.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.42.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 07-Dec-2007  yamt sync with head
 1.3.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.46.1 09-Jan-2008  matt sync with HEAD
 1.3.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.5.16.1 18-May-2014  rmind sync with head
 1.5.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.87 30-Apr-2022  rin Now, NULL is always defined correctly, as we include <sys/param.h> above.
 1.86 29-Apr-2022  rin Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.
 1.85 27-Apr-2022  rin Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name: src
> Committed By: rin
> Date: Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
> src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
 1.84 27-Apr-2022  rin Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.
 1.83 17-May-2021  mrg move bi-endian disklabel support from the kernel and libsa into libkern.

- dkcksum() and dkcksum_sized() move from subr_disk.c and from
libsa into libkern/dkcksum.c (which is missing _sized() version),
using the version from usr.sbin/disklabel.

- swap_disklabel() moves from subr_disk_mbr.c into libkern, now called
disklabel_swap(). (the sh3 version should be updated to use this.)

- DISKLABEL_EI becomes a first-class option with opt_disklabel.h.

- add libkern.h to libsa/disklabel.c.

this enables future work for bi-endian libsa/ufs.c (relevant for ffsv1,
ffsv2, lfsv1, and lfsv2), as well as making it possible for ports not
using subr_disk_mbr.c to include bi-endian disklabel support (which,
afaict, includes any disk on mbr-supporting platforms that do not have
an mbr as well as disklabel.)

builds successsfully on: alpha, i386, amd64, sun2, sun3, evbarm64,
evbarm64-eb, sparc, and sparc64. tested in anita on i386 and sparc,
testing in hardware on evbarm64*.
 1.82 27-Aug-2016  dholland branches: 1.82.32; 1.82.34;
Remove gets() from here too.
 1.81 11-Jun-2016  dholland gets_s -> kgets.

The exact name isn't that important; but it is important not to use
"gets_s" and thereby allow anyone to falsely get the impression we're
implementing Annex K. We aren't.

ok core.
 1.80 05-Jun-2016  maxv Use gets_s instead of gets. The x86 bootloader prompt is easy to
overflow.
 1.79 10-Aug-2014  isaki branches: 1.79.4;
Unify all arch/*/stand's atoi() to MI libsa.
lib/libsa/atoi.c was separated from lib/libsa/bootcfg.c.
PR/49084
 1.78 26-Mar-2014  christos Remove {v,}sprintf
 1.77 05-Jan-2014  jakllsch Make libsa fsmod string pointer const.
 1.76 21-May-2012  dsl branches: 1.76.2; 1.76.4;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.75 16-Jan-2012  christos branches: 1.75.2;
PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.74 25-Dec-2011  tsutsui Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.73 17-Jul-2011  joerg branches: 1.73.2; 1.73.6;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.72 16-Jun-2011  joerg Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.71 25-Feb-2011  joerg branches: 1.71.2;
Move HEXDIGIT to mvme68k's sboot. It seems to be the only user.
Save a byte by explicitly specifying the size.
 1.70 24-Dec-2010  christos branches: 1.70.2; 1.70.4;
panic takes a printf format too.
 1.69 19-Mar-2009  tsutsui branches: 1.69.4;
Revert previous. MI libsa doesn't provide bcmp().
 1.68 19-Mar-2009  he Add a prototype for the bcmp() function as well.
 1.67 18-Mar-2009  tsutsui - remove bcmp(9), bcopy(9), and bzero(9) from libkern since <sys/systm.h> has
macro which replace them with mem*() functions in #ifdef _KERNEL as noted
in man pages
- move declarations of bcopy(3) and bzero(3) into <lib/libsa/stand.h>
since they are still in libsa for some MD standalone sources
(I guess all bcmp(3) in standalone sources have been replaced with memcmp(3)
but they should be replaced with memcmp() anyway)
 1.66 17-Jan-2009  tsutsui branches: 1.66.2;
Remove __P().
 1.65 19-Nov-2008  ad For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.64 25-Mar-2008  christos branches: 1.64.4; 1.64.10; 1.64.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.63 24-Dec-2007  perry branches: 1.63.6;
Remove __attribute__((__noreturn__)) from things already marked __dead
Found by the department of redundancy department.
 1.62 24-Nov-2007  isaki branches: 1.62.2; 1.62.6;
style, indent, and ANSI-fy.
 1.61 25-Jan-2006  uwe branches: 1.61.42; 1.61.44; 1.61.50;
Sync alloc/dealloc prototypes with unsigned int -> size_t change.
 1.60 25-Jan-2006  christos - Add attributes to printf functions
- Fix attributes to noreturn functions
- free -> dealloc
- unsigned -> size_t for alloc, dealloc
 1.59 13-Jan-2006  christos constify write prototype.
 1.58 11-Dec-2005  christos branches: 1.58.2;
merge ktrace-lwp.
 1.57 13-Jun-2005  junyoung branches: 1.57.2;
Remove bcmp(). Use memcmp() instead.
 1.56 23-May-2005  jmc Provide HEXDIGITS as well (needed on mvme68k/stand)
 1.55 17-May-2005  christos Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
 1.54 26-Feb-2005  perry nuke trailing whitespace
 1.53 30-Jun-2004  christos branches: 1.53.4; 1.53.6;
- multiple inclusion protection.
- constify some prototypes.
 1.52 19-May-2004  abs Add qsort to libsa (taken from sys/dev/vinum/vinumqsort.c) and use instead of
bubblesort in acorn32 bootloader. Reduces time to sort memory on A710 equipped
RiscPC from over twenty seconds to effectively instantaneous.
Update boot version to 3.30
 1.51 30-Oct-2003  he branches: 1.51.2;
Add a prototype for memset().
 1.50 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.49 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.48 15-Apr-2003  dsl branches: 1.48.2;
Add interface to boot password checking code that takes password parameter.
 1.47 11-Apr-2003  dsl Put extern definition of bcopy in () to avoid macro expansion when
LIBSA_USE_MEMCPY is defined. Fixes breakage because the return
type of memcpy() is different to that of bcopy.
 1.46 10-Apr-2003  dsl Add FS_DEF() and FS_OPS() defines to save typing (and errors) elsewhere.
Kill __P() and argument names in prototypes.
(approved by christos)
 1.45 01-Apr-2003  mycroft constify a couple of pointers.
 1.44 01-Jun-2002  itojun use exit(int), not exit(void), consistently - even if the arg has no meaning.
 1.43 02-Sep-2001  tsutsui branches: 1.43.12;
Add a small version of memmove() for libsa.
Mostly identical with libsa/bcopy.c.
 1.42 05-Apr-2001  thorpej branches: 1.42.2;
libkern.h now has the ctype routines.
 1.41 21-Oct-2000  takemura branches: 1.41.2;
Add LIBSA_RENAME_PRINTF to solve conflict with prototype definition of
printf() and etc in header files of Windows CE native compiler.
 1.40 03-Feb-2000  cgd provide stat() and fstat() here for standalone programs' use
 1.39 13-Nov-1999  thorpej Backout my libsa changes.
 1.38 12-Nov-1999  simonb Add memset() prototype.
 1.37 12-Nov-1999  simonb Add strncpy().

Add prototypes for bcmp(), bzero() so the libsa compiles with WARNS=1
 1.36 11-Nov-1999  thorpej Small, MI strcat() and strcpy().
 1.35 11-Nov-1999  thorpej Networking routines needed for libsa to be self-contained.
 1.34 11-Nov-1999  thorpej Add small, MI strcmp(), strlen(), and strncmp() functions. Modules within
libsa depend on them, to it seems rather silly to have to build an additional
library (e.g. libkern) to get them.
 1.33 09-Sep-1999  drochner branches: 1.33.2; 1.33.4; 1.33.8;
add a function to verify a password against an in-core md5 sum
 1.32 14-Apr-1999  christos add getopt prototype, and externs
 1.31 31-Mar-1999  cgd branches: 1.31.4;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.30 22-Feb-1999  simonb Define bzero()/bcopy() in terms of memset()/memcpy() if LIBSA_USE_MEMSET
or LIBSA_USE_MEMCPY is defined. Most everything pulls in stand.h so
this should cover ports that only use memset/memcpy but still want to
pull in as much as possible from sys/lib/libsa.
 1.29 12-Feb-1999  drochner We can't prototype exit() publically because it might take an argument or
not, depending on the port-specific environment.
Separate panic() and exit() so that the mi/default panic() can be used
without conflicting with a local exit() definition, move exit(void)
prototype to the default exit() implementation.
Closes PR bin/6990 by Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>.
 1.28 11-Feb-1999  pk sprintf() now produces a return value, like the standard counterpart does.
Also, implement vsprintf(), snprintf() and vsnprintf().
 1.27 11-Feb-1999  pk Add missing prototypes.
 1.26 22-Sep-1998  ross Remove memset() prototype.
 1.25 22-Sep-1998  ross Prototype memset().
 1.24 27-Jul-1998  is back out last change
 1.23 27-Jul-1998  is write prototype: void * -> const void *.
[Else the Amiga bootblock can't be built.]
 1.22 26-Jun-1997  drochner Allow to define the location of the heap at runtime #if HEAP_VARIABLE.
That helps to test libsa code in user space.
 1.21 13-Jun-1997  drochner Add prototype for strerror().
 1.20 22-Jan-1997  cgd prototype lseek(). also, prototype oopen(), oclose(), oread(), and olseek()
if __INTERNAL_LIBSA_CREAD is defined.
 1.19 16-Jan-1997  cgd add memcmp, implemented as a wrapper around bcmp() (like memcpy() is
implemented as a wrapper around bcopy()).
 1.18 30-Nov-1996  gwr branches: 1.18.2;
Oops... get the vprintf prototype right.
 1.17 30-Nov-1996  gwr Add declaration for vprintf.
 1.16 13-Oct-1996  christos backout previous kprintf changes
 1.15 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.14 21-Jun-1996  pk Allow seeks on raw devices. A `f_offset' field is added to the file structure
which is maintained in lseek(), read() and write(), and passed along to
the device's strategy routine.
 1.13 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.12 18-Sep-1995  pk Another round of clean up, including fixes presented by Matthias Drochner
(PR#1404). Things to be noted:
- all IP addresses are now `struct in_addr's.
- the function rarp_getipaddress() no longer return `myip'; in stead
it returns -1 on failure (errno set), 0 on success. `myip' is set
as a size-effect.
 1.11 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.10 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.9 30-Apr-1995  cgd first arg to open() is a 'const char *'. pointed out by David Brownlee
in pr 1004.
 1.8 22-Apr-1995  cgd various attribute poisoning, don't be as quick to specify size of files[]
 1.7 21-Feb-1995  mycroft Update prototypes.
 1.6 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 22-Aug-1994  brezak branches: 1.4.2;
Cleanup to make more ANSI compliant; checkpoint
 1.3 04-Aug-1994  brezak Make libsa compile again by not including sys/errno.h
 1.2 08-May-1994  brezak branches: 1.2.2;
Standalone networking for network boot loaders.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.1 05-Aug-1994  mycroft update from trunk, per Brezak
 1.4.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.4.2.1 22-Aug-1994  brezak file stand.h was added on branch netbsd-1-0 on 1994-08-22 21:56:14 +0000
 1.18.2.1 18-Jan-1997  thorpej Update from trunk.
 1.31.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.33.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.33.4.1 15-Nov-1999  fvdl Sync with -current
 1.33.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.33.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.41.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.41.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.41.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.42.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.42.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.43.12.1 20-Jun-2002  gehenna catch up with -current.
 1.48.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.48.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.48.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.48.2.1 03-Aug-2004  skrll Sync with HEAD
 1.51.2.1 22-May-2004  he Pull up revision 1.52 (requested by abs in ticket #369):
Add qsort to libsa (taken from sys/dev/vinum/vinumqsort.c)
and use instead of bubblesort in acorn32 bootloader. Reduces
time to sort memory on A710 equipped RiscPC from over twenty
seconds to effectively instantaneous. Update boot version
to 3.30
 1.53.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.53.4.1 29-Apr-2005  kent sync with -current
 1.57.2.3 21-Jan-2008  yamt sync with head
 1.57.2.2 07-Dec-2007  yamt sync with head
 1.57.2.1 21-Jun-2006  yamt sync with head.
 1.58.2.2 01-Feb-2006  yamt sync with head.
 1.58.2.1 15-Jan-2006  yamt sync with head.
 1.61.50.2 27-Dec-2007  mjf Sync with HEAD.
 1.61.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.61.44.1 09-Jan-2008  matt sync with HEAD
 1.61.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.62.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.62.2.1 26-Dec-2007  ad Sync with head.
 1.63.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.63.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.64.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.64.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.64.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.64.4.1 04-May-2009  yamt sync with head.
 1.66.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.69.4.1 05-Mar-2011  rmind sync with head
 1.70.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.70.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.71.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.73.6.2 02-Jun-2012  mrg sync to latest -current.
 1.73.6.1 18-Feb-2012  mrg merge to -current.
 1.73.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.73.2.2 23-May-2012  yamt sync with head.
 1.73.2.1 17-Apr-2012  yamt sync with head
 1.75.2.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.76.4.1 18-May-2014  rmind sync with head
 1.76.2.2 03-Dec-2017  jdolecek update from HEAD
 1.76.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.4.2 05-Oct-2016  skrll Sync with HEAD
 1.79.4.1 09-Jul-2016  skrll Sync with HEAD
 1.82.34.1 31-May-2021  cjep sync with head
 1.82.32.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.7 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.6 11-Dec-2005  christos branches: 1.6.44; 1.6.46; 1.6.52;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 13-Jan-1996  leo branches: 1.4.64;
Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Cleanup to make more ANSI compliant; checkpoint
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.2.2.1 22-Aug-1994  brezak file stat.c was added on branch netbsd-1-0 on 1994-08-22 21:56:15 +0000
 1.4.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.64.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 07-Dec-2007  yamt sync with head
 1.6.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.46.1 09-Jan-2008  matt sync with HEAD
 1.6.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Small, MI strcat() and strcpy().
 1.3 25-Mar-2008  christos - use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.2 21-Mar-2008  rtr branches: 1.2.2; 1.2.4;
when the char being searched for is not found strchr() must return NULL
not a pointer to the terminating '\0'. the only time we return a pointer
to the terminating '\0' is when the char being searched for is '\0'.

fixes problem observed booting -current install
http://mail-index.netbsd.org/current-users/2008/03/20/msg001445.html
 1.1 14-Mar-2008  dsl branches: 1.1.2;
Add a strchr() - for dosfs in particular.
The i386 asm version in src/common is rather larger than this one.
 1.1.2.3 24-Mar-2008  yamt sync with head.
 1.1.2.2 17-Mar-2008  yamt sync with head.
 1.1.2.1 14-Mar-2008  yamt file strchr.c was added on branch yamt-lazymbuf on 2008-03-17 09:15:40 +0000
 1.2.4.2 24-Mar-2008  keiichi sync with head.
 1.2.4.1 21-Mar-2008  keiichi file strchr.c was added on branch keiichi-mipv6 on 2008-03-24 07:16:22 +0000
 1.2.2.2 23-Mar-2008  matt sync with HEAD
 1.2.2.1 21-Mar-2008  matt file strchr.c was added on branch matt-armv6 on 2008-03-23 02:05:02 +0000
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Add small, MI strcmp(), strlen(), and strncmp() functions. Modules within
libsa depend on them, to it seems rather silly to have to build an additional
library (e.g. libkern) to get them.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Small, MI strcat() and strcpy().
 1.20 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.19 11-Dec-2005  christos branches: 1.19.44; 1.19.46; 1.19.52;
merge ktrace-lwp.
 1.18 01-Jul-2004  christos branches: 1.18.12;
DECONST -> UNCONST
 1.17 30-Jun-2004  christos constification fixes.
 1.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.15 11-Mar-2003  drochner branches: 1.15.2;
translate EACCES (happens with NFS)
 1.14 01-Feb-2003  dsl Save some space
(agreed by christos)
 1.13 17-Feb-2002  thorpej Add EOFFSET.
 1.12 25-Jan-1997  cgd branches: 1.12.38; 1.12.40;
add EINVAL and ENOTDIR, as suggested by Matthias Drochner
 1.11 13-Oct-1996  christos backout previous kprintf changes
 1.10 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 13-Jan-1996  leo Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.8 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.7 03-Sep-1995  pk Fix bogus numerical conversion by using sprintf();
 1.6 22-Apr-1995  cgd various attribute poisoning, don't be as quick to specify size of files[]
 1.5 21-Feb-1995  mycroft Correct some error strings, and add a few more. Don't print error messages in
exec(); let the caller do it.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 04-Aug-1994  brezak branches: 1.3.2;
Make libsa compile again by not including sys/errno.h
 1.2 26-Feb-1994  pk branches: 1.2.2;
Don't use aggregate initialization;
Add memcpy().
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.1 05-Aug-1994  mycroft update from trunk, per Brezak
 1.3.2.2 04-Aug-1994  brezak Make libsa compile again by not including sys/errno.h
 1.3.2.1 04-Aug-1994  brezak file strerror.c was added on branch netbsd-1-0 on 1994-08-04 19:39:42 +0000
 1.12.40.1 16-Mar-2002  jdolecek Catch up with -current.
 1.12.38.1 28-Feb-2002  nathanw Catch up to -current.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.12.1 07-Dec-2007  yamt sync with head
 1.19.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.46.1 09-Jan-2008  matt sync with HEAD
 1.19.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Add small, MI strcmp(), strlen(), and strncmp() functions. Modules within
libsa depend on them, to it seems rather silly to have to build an additional
library (e.g. libkern) to get them.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 11-Nov-1999  thorpej Add small, MI strcmp(), strlen(), and strncmp() functions. Modules within
libsa depend on them, to it seems rather silly to have to build an additional
library (e.g. libkern) to get them.
 1.2 13-Nov-1999  thorpej Backout my libsa changes.
 1.1 12-Nov-1999  simonb Add strncpy().

Add prototypes for bcmp(), bzero() so the libsa compiles with WARNS=1
 1.31 31-Aug-2024  mlelstv Only a leading '0' in a format width marks zero-padding, otherwise
it's a regular digit.
 1.30 29-May-2023  rin branches: 1.30.6;
libsa/printf: Do not fetch long va_arg as long long.

This does real harm iff all of the following conditions are satisfied:

(1) On ILP32 architectures.
(2) Both LIBSA_PRINTF_LONGLONG_SUPPORT and LIBSA_PRINTF_WIDTH_SUPPORT
compile-time options are enabled.
(3) Width field is used with 'l' modifier.

This is an implicit-fallthrough bug, but unfortunately, GCC 10.4 cannot
find this out somehow...

XXX
Pull up to netbsd-10 and netbsd-9. netbsd-8 is not affected.
 1.29 06-Jun-2020  thorpej branches: 1.29.20;
Make libsa's vsnprintf() work as expected when passed a NULL
destinatino buffer.
 1.28 03-Feb-2019  mrg branches: 1.28.4;
- remove unreachable code
 1.27 30-Aug-2014  tsutsui branches: 1.27.20;
Revert stupid and untested changes. There was no extra copy in the macros.

Christos, you should reread our commit guideline as a Core member.
 1.26 30-Aug-2014  christos remove extra copy of the macro.
 1.25 30-Aug-2014  tsutsui Rename padding macros to reflect and clarify the original intention.

No binary changes on luna68k (which has -DLIBSA_PRINTF_WIDTH_SUPPORT).
 1.24 22-Mar-2014  hkenken for LIBSA_PRINTF_WIDTH_SUPPORT,
Fix right and left-adjusting padding.
 1.23 24-Dec-2013  jakllsch intmax_t might be long long, handle accordingly. from christos
 1.22 24-Dec-2013  jakllsch Add 'j' format modifier for intmax_t.
 1.21 17-Jul-2011  joerg branches: 1.21.2; 1.21.12; 1.21.16;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.20 20-May-2011  tsutsui KNF a bit.
 1.19 25-Feb-2011  joerg No trailing 0 byte for hexdigits.
 1.18 25-Feb-2011  joerg Move HEXDIGIT to mvme68k's sboot. It seems to be the only user.
Save a byte by explicitly specifying the size.
 1.17 19-Jan-2010  tsutsui branches: 1.17.4; 1.17.6; 1.17.8;
Add long long (%lld etc.) support and width (%02x etc.) support
in libsa printf(3). Disabled by default but enabled by
-DLIBSA_PRINTF_LONGLONG_SUPPORT and -DLIBSA_PRINTF_WIDTH_SUPPORT.
Provided by tnozaki@ for my libsa debugging. Thanks!
 1.16 24-Nov-2007  isaki branches: 1.16.18;
style, indent, and ANSI-fy.
 1.15 27-Jan-2006  uwe branches: 1.15.42; 1.15.44; 1.15.50;
/* fall through */ -> /* FALLTHROUGH */
 1.14 27-Jan-2006  uwe Support 'z' (size_t) and 't' (ptrdiff_t) specifiers.

XXX: ptrdiff_t is only ever defined in <stddef.h> and is defined
unconditionally, without the ifndef dance. Until we have an expert
opinion, abuse intptr_t for the 't' size check.
 1.13 11-Dec-2005  christos branches: 1.13.2;
merge ktrace-lwp.
 1.12 23-May-2005  jmc branches: 1.12.2;
Provide HEXDIGITS as well (needed on mvme68k/stand)
 1.11 17-May-2005  christos Yes, it was a cool trick >20 years ago to use "0123456789abcdef"[a] to
implement, xtoa(), but I think defining the samestring 50 times is a bit
too much. Defined HEXDIGITS and hexdigits in subr_prf.c and use it...
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 27-Apr-2003  tron branches: 1.9.2;
Remove two unused variable to fix a build problem.
 1.8 26-Apr-2003  bjh21 Remove %b support.
Encouraged by thorpej.
 1.7 20-Apr-2003  bjh21 If the format string ends with "%" or "%l", print those characters, just
as we would if they were part of an invalid conversion specification.
Code-size neutral on ARM; not tested elsewhere.
 1.6 20-Apr-2003  bjh21 ANSIfy, assume __STDC__, un-__P, KNF.
Generated code unchanged.
 1.5 17-Feb-2002  thorpej Add a missing "static".
 1.4 24-Sep-2001  wiz va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
 1.3 30-Mar-2000  augustss branches: 1.3.6; 1.3.8; 1.3.10;
Kill some more register declarations.
 1.2 20-Apr-1999  cgd branches: 1.2.2;
set lflag when printing pointers with %p
 1.1 13-Feb-1999  pk branches: 1.1.4;
Split the printf variants into separate files.
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.10.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.6.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.6.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.9.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.2.2 07-Dec-2007  yamt sync with head
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.13.2.1 01-Feb-2006  yamt sync with head.
 1.15.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.15.44.1 09-Jan-2008  matt sync with HEAD
 1.15.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.16.18.1 11-Mar-2010  yamt sync with head
 1.17.8.1 05-Mar-2011  bouyer Sync with HEAD
 1.17.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.4.2 31-May-2011  rmind sync with head
 1.17.4.1 05-Mar-2011  rmind sync with head
 1.21.16.1 18-May-2014  rmind sync with head
 1.21.12.2 03-Dec-2017  jdolecek update from HEAD
 1.21.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.20.1 10-Jun-2019  christos Sync with HEAD
 1.28.4.1 03-Jun-2023  martin Pull up following revision(s) (requested by rin in ticket #1636):

sys/lib/libsa/subr_prf.c: revision 1.30

libsa/printf: Do not fetch long va_arg as long long.

This does real harm iff all of the following conditions are satisfied:
(1) On ILP32 architectures.
(2) Both LIBSA_PRINTF_LONGLONG_SUPPORT and LIBSA_PRINTF_WIDTH_SUPPORT
compile-time options are enabled.
(3) Width field is used with 'l' modifier.

This is an implicit-fallthrough bug, but unfortunately, GCC 10.4 cannot
find this out somehow...
 1.29.20.1 03-Jun-2023  martin Pull up following revision(s) (requested by rin in ticket #185):

sys/lib/libsa/subr_prf.c: revision 1.30

libsa/printf: Do not fetch long va_arg as long long.

This does real harm iff all of the following conditions are satisfied:
(1) On ILP32 architectures.
(2) Both LIBSA_PRINTF_LONGLONG_SUPPORT and LIBSA_PRINTF_WIDTH_SUPPORT
compile-time options are enabled.
(3) Width field is used with 'l' modifier.

This is an implicit-fallthrough bug, but unfortunately, GCC 10.4 cannot
find this out somehow...
 1.30.6.1 02-Aug-2025  perseant Sync with HEAD
 1.2 24-Sep-1998  ross tfs -> ustarfs
 1.1 22-Sep-1998  ross Add `tfs', a USTAR-format FS, featuring fast floppy loads, 5% better
space efficiency, and (the real reason) multiple-volume files.
 1.2 24-Sep-1998  ross tfs -> ustarfs
 1.1 22-Sep-1998  ross Add `tfs', a USTAR-format FS, featuring fast floppy loads, 5% better
space efficiency, and (the real reason) multiple-volume files.
 1.38 07-Aug-2022  rin Consistently use ntohs() instead of htons() when converting from
network to host byte order.

No binary changes both for big and little endian.
 1.37 26-Mar-2021  rin Twiddle also for data transfer for seek.
 1.36 31-Mar-2019  christos branches: 1.36.12; 1.36.14;
fix warnings, printf formats, etc.
 1.35 20-Mar-2014  christos branches: 1.35.30;
reduce size by 1K by sharing the ls code.
 1.34 25-Dec-2011  tsutsui branches: 1.34.6; 1.34.10;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.33 30-Jul-2011  jakllsch branches: 1.33.2; 1.33.6;
Fix printf formating in ifdef DEBUG sections.
 1.32 16-Jun-2011  joerg Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.31 11-May-2011  zoltan branches: 1.31.2;
Separate the IP and UDP code paths inside libsa, so I can add HTTP booting
later.
 1.30 13-Jan-2010  drochner branches: 1.30.4; 1.30.6;
RFC783 says the ErrMsg sent with an ERROR packet needs to be
NUL-terminated
 1.29 17-Jan-2009  tsutsui Remove __P().
 1.28 12-Jan-2009  tsutsui Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.27 19-Nov-2008  ad For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.26 11-May-2008  chris branches: 1.26.4; 1.26.6;
Extend tftp_stat to return the size of the file, rather than -1.

It's not very efficient, as it has to read the whole file, and count the
block sizes. However, this is the only way to work out the size using the
tftp protocol.

This is needed to support loading modules from a tftp server with pxeboot.
 1.25 25-Mar-2008  christos branches: 1.25.2; 1.25.4; 1.25.6;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.24 02-Dec-2007  tsutsui branches: 1.24.14;
unsigned -> unsigned int
 1.23 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.22 05-Mar-2007  he branches: 1.22.14; 1.22.16; 1.22.22;
We need char* for pointer arithmetic.
 1.21 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 25-Jan-2006  christos branches: 1.20.24;
free -> dealloc
 1.19 11-Dec-2005  christos branches: 1.19.2;
merge ktrace-lwp.
 1.18 26-Feb-2005  perry branches: 1.18.4;
nuke trailing whitespace
 1.17 24-Mar-2004  drochner branches: 1.17.8; 1.17.10;
remove license clauses 3 and 4 from my cpoyright notices
 1.16 31-Aug-2003  fvdl Fix signed/unsigned warnings.
 1.15 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.14 18-Mar-2003  mycroft branches: 1.14.2;
Move some stuff into .rodata.
 1.13 12-Mar-2003  drochner no need to include "netif.h" anymore
(shared interface stuff is in iodesc.h, included by net.h)
 1.12 12-Jan-2003  christos PR/19607: Bernd Ernesti: libsa does not have access to arpa/tftp.h. Put a
copy of it in our tftp.h
 1.11 16-Sep-2002  thorpej Do not #include "/usr/include/arpa/tftp.h" directly. Doing so is
VERY BAD for cross-compiling.
 1.10 30-Mar-2000  augustss branches: 1.10.6; 1.10.8; 1.10.22;
Kill some more register declarations.
 1.9 13-Nov-1999  thorpej Backout my libsa changes.
 1.8 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.7 12-Jul-1999  drochner branches: 1.7.2; 1.7.4; 1.7.8;
fix damage in error handling crept in in 1.4
 1.6 31-Mar-1999  cgd branches: 1.6.4;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.5 26-Mar-1999  dbj Changes to compile the next68k bootblocks with
egcs -Wpointer-arith -Wstrict-prototypes
This closes pr 6653
 1.4 28-Feb-1999  kim Made this compile:
- fifth arg to recvtftp should be size_t (not ssize_t)
- the path is passed tftp_makereq as a part of the handle structure
 1.3 26-Feb-1999  christos Add missing prototypes for static functions.
 1.2 25-Feb-1999  ross XXX include libkern.h for strlen() XXX
 1.1 24-Feb-1999  drochner move TFTP filesystem from i386/stand/libsa here, it is mi
 1.6.4.1 02-Aug-1999  thorpej Update from trunk.
 1.7.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.4.1 15-Nov-1999  fvdl Sync with -current
 1.7.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.10.22.1 01-Dec-2002  he Pull up revision 1.11 (requested by thorpej in ticket #836):
Do not #include "/usr/incloude/arpa/tftph" directly.
Fixes problem for cross-compiling.
 1.10.8.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.6.2 15-Jan-2003  thorpej Sync with HEAD.
 1.10.6.1 17-Sep-2002  nathanw Catch up to -current.
 1.14.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.17.8.1 29-Apr-2005  kent sync with -current
 1.18.4.3 07-Dec-2007  yamt sync with head
 1.18.4.2 03-Sep-2007  yamt sync with head.
 1.18.4.1 21-Jun-2006  yamt sync with head.
 1.19.2.1 01-Feb-2006  yamt sync with head.
 1.20.24.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.16.1 09-Jan-2008  matt sync with HEAD
 1.22.14.2 03-Dec-2007  joerg Sync with HEAD.
 1.22.14.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.24.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.24.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.24.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.25.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.25.4.3 11-Mar-2010  yamt sync with head
 1.25.4.2 04-May-2009  yamt sync with head.
 1.25.4.1 16-May-2008  yamt sync with head.
 1.25.2.1 18-May-2008  yamt sync with head.
 1.26.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.26.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.30.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.4.1 31-May-2011  rmind sync with head
 1.31.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.33.6.1 18-Feb-2012  mrg merge to -current.
 1.33.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.33.2.1 17-Apr-2012  yamt sync with head
 1.34.10.1 18-May-2014  rmind sync with head
 1.34.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.30.1 10-Jun-2019  christos Sync with HEAD
 1.36.14.1 03-Apr-2021  thorpej Sync with HEAD.
 1.36.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 24-Mar-2004  drochner remove license clauses 3 and 4 from my cpoyright notices
 1.4 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 12-Jan-2003  christos branches: 1.2.2;
PR/19607: Bernd Ernesti: libsa does not have access to arpa/tftp.h. Put a
copy of it in our tftp.h
 1.1 24-Feb-1999  drochner branches: 1.1.20;
move TFTP filesystem from i386/stand/libsa here, it is mi
 1.1.20.1 15-Jan-2003  thorpej Sync with HEAD.
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9 29-Sep-2020  simonb Add a slow twiddle option. This speeds up a pmax netboot by 15% and
is only 1% slower than no twiddle.
 1.8 30-Apr-2008  ad Let twiddle() be disabled at runtime.
 1.7 24-Nov-2007  isaki branches: 1.7.14; 1.7.16; 1.7.18;
style, indent, and ANSI-fy.
 1.6 11-Dec-2005  christos branches: 1.6.44; 1.6.46; 1.6.52;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 22-Jun-1999  christos branches: 1.4.36;
Nuke obsolete printf comment.
 1.3 23-Mar-1999  simonb branches: 1.3.4;
Revert SA_NOPUTCHAR - the pmax was the only port using it and the new
pmax bootblocks provide a putchar().
 1.2 22-Feb-1999  simonb Use printf() instead of putchar() if SA_NOPUTCHAR is defined (for the
pmax).
Also don't include stdarg.h/varargs.h - we don't use them here.
 1.1 13-Feb-1999  pk Split the printf variants into separate files.
 1.3.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.4.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.36.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 07-Dec-2007  yamt sync with head
 1.6.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.46.1 09-Jan-2008  matt sync with HEAD
 1.6.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.7.18.1 16-May-2008  yamt sync with head.
 1.7.16.1 18-May-2008  yamt sync with head.
 1.7.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.13 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.12 31-Mar-2019  mlelstv correct debug message, d->myport has network byte order.
 1.11 11-May-2011  zoltan branches: 1.11.56;
Separate the IP and UDP code paths inside libsa, so I can add HTTP booting
later.
 1.10 26-Dec-2010  christos branches: 1.10.2;
fix slightly wrong format.
 1.9 26-Dec-2010  he Print size_t and ssize_t with %zd, not just %d.
(How did this build before?)
 1.8 12-Jan-2009  tsutsui branches: 1.8.6;
Replace time_t values in libsa sources with the following two types
to avoid unnecessary 64 bit ops which would make binaries larger:

satime_t (currently unsigned int):
numbers in seconds returned by the machine dependent getsecs() function
which are used to measure relative time

saseconds_t (currently int):
numbers in seconds used to specify timeout to network drivers

Per discussion on current-users.
 1.7 25-Mar-2008  christos branches: 1.7.4; 1.7.12;
- use mem* instead of b* routines, and kill the b* routines.
- use the mem* routines from libc.
XXX: There will be some lossage, but I am fixing it.
 1.6 24-Nov-2007  isaki branches: 1.6.14;
style, indent, and ANSI-fy.
 1.5 24-Jan-2006  christos branches: 1.5.42; 1.5.44; 1.5.50;
PR/32613: Yves-Emmanuel JUTARD: Incoherencies in file sys/lib/libsa/net.h
- Make prototype of ether_sprintf() match the one in sys/net.
- Rename in_cksum to ip_cksum and fix its prototype. in_cksum() operates
on an mbuf and ip_cksum() operates on a plain buffer. We should not call
functions that operate on different arguments the same name (this is not
c++).
 1.4 11-Dec-2005  christos branches: 1.4.2;
merge ktrace-lwp.
 1.3 31-Aug-2003  fvdl branches: 1.3.16;
Fix signed/unsigned warnings.
 1.2 23-Apr-2002  ragge branches: 1.2.10;
Someone had a braino here; IP_TTL != IPDEFTTL. This caused the standalone
udp traffic to only have a ttl of 4.
Found by Jens Nilsson, jens@rockstorm.se.
 1.1 25-Oct-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Split the UDP routines out of net.c.
 1.1.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 25-Oct-2000  bouyer file udp.c was added on branch thorpej_scsipi on 2000-11-22 16:05:43 +0000
 1.2.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.10.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.2 07-Dec-2007  yamt sync with head
 1.3.16.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 01-Feb-2006  yamt sync with head.
 1.5.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.44.1 09-Jan-2008  matt sync with HEAD
 1.5.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.6.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.4.1 04-May-2009  yamt sync with head.
 1.8.6.2 31-May-2011  rmind sync with head
 1.8.6.1 05-Mar-2011  rmind sync with head
 1.10.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.56.1 10-Jun-2019  christos Sync with HEAD
 1.88 01-Dec-2022  christos fix clang build
 1.87 17-Nov-2022  chs Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
 1.86 29-Apr-2022  rin Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.
 1.85 27-Apr-2022  rin Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name: src
> Committed By: rin
> Date: Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
> src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
 1.84 27-Apr-2022  rin Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.
 1.83 24-Apr-2022  mlelstv Don't load filessytem module for filesystem that was found but isn't used
for booting.
 1.82 24-Apr-2022  mlelstv Ask driver about sector size to support reading superblocks from fixed
byte offsets.
 1.81 19-Apr-2022  skrll Typo in comment. avoinds -> avoids
 1.80 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.79 12-May-2021  mrg push the FFSv1 superblock code into ffs_find_superblock() and
hide all the ugliness in this function, out of ufs_open().

NFC, objects same size if not identical.
 1.78 19-Dec-2020  rin branches: 1.78.4; 1.78.6;
Fix previous; define missing lfs_version.
 1.77 19-Dec-2020  rin ufs_open(): Check fs->lfs_version ifdef LIBSA_*L*FS, not LIBSA_*F*FS.

This was harmless for FFS variants, that define LIBSA_FFSv[12], not LIBSA_FFS.
 1.76 02-Apr-2019  christos branches: 1.76.12;
fix sign-compare and sign-passing errors.
 1.75 31-Mar-2019  christos fix warnings, printf formats, etc.
 1.74 01-Sep-2015  dholland branches: 1.74.18;
Add new accessors for the d_type and d_namlen fields of struct lfs_direct.
Napalm the old byteswap access logic for these.
 1.73 01-Sep-2015  dholland The ifile's inode number is constant. (it is always 1)

Therefore, storing the value in the superblock and reading it out
again is silly and offers the opportunity for it to become corrupted.
So, don't do that (most of the code already didn't) and use the
existing constant instead. Initialize new 32-bit superblocks with
the value for the sake of old userland programs, but don't keep the
value in the 64-bit superblock at all.

(approved by Margo Seltzer)
 1.72 12-Aug-2015  dholland Hack up dinode usage to be 64 vs. 32 as needed. Part 1.

(This part changes the native lfs code; the ufs-derived code already
has 64 vs. 32 logic, but as aspects of it are unsafe, and don't
entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be
rehashing that.)
 1.71 12-Aug-2015  dholland Add IFILE32 and IFILE64 structures for the on-disk ifile entries.
Add and use accessors. There are also a bunch of places that cast and
I hope I've found them all...
 1.70 02-Aug-2015  dholland Add a (draft) 64-bit superblock. Make things build again.

Add pieces of support for using both superblock types where
convenient, and specifically to the superblock accessors, but don't
actually enable it anywhere.

First substantive step on PR 50000.
 1.69 28-Jul-2015  dholland Move struct salfs back inside libsa now that lfs_accessors.h is separate.
 1.68 28-Jul-2015  dholland Add a new lfs header file: lfs_accessors.h.

This contains all the accessor functions and macros out of lfs.h.
Add an include of lfs_accessors.h after all uses of lfs.h... except
for code that wants to define its own struct lfs-alike that the
accessors are supposed to play along with. For these, set STRUCT_LFS
and include lfs_accessors.h after the necessary structure has been
defined, so that lfs_accessors.h can emit functions in terms of it.
 1.67 24-Jul-2015  dholland Switch to accessor functions for elements of the LFS on-disk
superblock. This will allow switching between 32/64 bit forms on the
fly; it will also allow handling LFS_EI reasonably tidily. (That
currently doesn't work on the superblock.)

It also gets rid of cpp abuse in the form of fake structure member
macros.

Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg
inside the on-disk superblock, add extra elements to the in-memory
struct lfs for this. (XXX: these should be changed to condvars, but
not right now)

XXX: this migrates a structure needed by the lfs code in libsa (struct
salfs) into lfs.h, where it doesn't belong, but for the time being
this is necessary in order to allow the accessors (and the various
lfs macros and other goop that relies on them) to compile.
 1.66 24-Jul-2015  dholland Rearrange the structures in the lfs bootbollocks slightly.
This generates the same output (at least on amd64) but will be more
robust until we're ready to deploy lfs64 bootblocks too.

XXX: I don't think these actually work right now, and the logic for
picking between v1 and v2 lfs formats (which is not related to ffsv1
vs. ffsv2) is definitely broken. But I haven't made it any worse.
 1.65 20-Mar-2014  christos branches: 1.65.6;
reduce size by 1K by sharing the ls code.
 1.64 20-Oct-2013  christos XXX: gcc initializations
 1.63 23-Jun-2013  dholland branches: 1.63.2;
Stick ffs_, ext2_, chfs_, filecore_, cd9660_, or mfs_ in front of
the following symbols so as to disambiguate fully. (Christos already
did the lfs ones.)

lblkno
lblktosize
lfragtosize
numfrags
blkroundup
fragroundup
 1.62 23-Jun-2013  dholland fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.61 19-Jun-2013  dholland Rename ambiguous macros:
MAXDIRSIZE -> UFS_MAXDIRSIZE or LFS_MAXDIRSIZE
NINDIR -> FFS_NINDIR, EXT2_NINDIR, LFS_NINDIR, or MFS_NINDIR
INOPB -> FFS_INOPB, LFS_INOPB
INOPF -> FFS_INOPF, LFS_INOPF
blksize -> ffs_blksize, ext2_blksize, or lfs_blksize
sblksize -> ffs_blksize

These are not the only ambiguously defined filesystem macros, of
course, there's a pile more. I may not have found all the ambiguous
definitions of blksize(), too, as there are a lot of other things
called 'blksize' in the system.
 1.60 09-Jun-2013  dholland Stick UFS_ in front of these symbols:
DIRBLKSIZ
DIRECTSIZ
DIRSIZ
OLDDIRFMT
NEWDIRFMT

Part of PR 47909.
 1.59 22-Jan-2013  dholland Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
ROOTINO -> UFS_ROOTINO
WINO -> UFS_WINO
NXADDR -> UFS_NXADDR
NDADDR -> UFS_NDADDR
NIADDR -> UFS_NIADDR
MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
 1.58 21-May-2012  dsl branches: 1.58.2;
Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.57 16-Jan-2012  christos branches: 1.57.2;
PR/45796: Evgeniy Ivanov minixfs3 support.
Split out fn_match since we have 3 copies now.
 1.56 25-Dec-2011  tsutsui Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.55 16-Jun-2011  joerg branches: 1.55.2; 1.55.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.54 19-Nov-2008  ad branches: 1.54.14;
For the x86 boot loader, autoload a kernel module corresponding to the
root file system type.
 1.53 02-Jan-2008  ad branches: 1.53.6; 1.53.10; 1.53.16; 1.53.18;
Merge vmlocking2 to head.
 1.52 01-Dec-2007  tsutsui branches: 1.52.2; 1.52.6;
Use "uint" rather than "unsigned" without a type.
 1.51 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.50 29-Sep-2007  martin branches: 1.50.4;
When compiled with COMPAT_SOLARIS_UFS, always calculate fs_qbmask and
fs_qfmask on the fly. This allows libsa to read newer Solaris ufs
filesystems (which have a slightly incompatible superblock).
Suggested by Antti Kantee when discussing PR kern/37000.
 1.49 11-May-2006  mrg branches: 1.49.18; 1.49.32; 1.49.34; 1.49.36;
ssize_t -> size_t to match variable and functions.
 1.48 25-Jan-2006  christos branches: 1.48.2; 1.48.4; 1.48.6; 1.48.8; 1.48.10;
free -> dealloc
 1.47 18-Jan-2006  uwe Define indp_t as signed int32_t, like ffsv1.c does.
 1.46 11-Dec-2005  christos branches: 1.46.2;
merge ktrace-lwp.
 1.45 19-Aug-2005  christos 64 bit inode changes.
 1.44 26-Feb-2005  perry branches: 1.44.4;
nuke trailing whitespace
 1.43 20-Mar-2004  dsl branches: 1.43.8; 1.43.10;
When searching for the superblock, check that the fs_sblockloc field
matches the location we read it from to ensure we don't have one of the
alternate superblocks.
Fixes part of PR kern/24809
 1.42 31-Aug-2003  fvdl Fix signed/unsigned warnings.
 1.41 27-Aug-2003  dsl Use memset not bzero to help shrink alpha bootxx_lfs
(sys/arch/alpha/stand/common/start.S also uses bzero, I don't know
any alpha opcodes so cant change that one...)
 1.40 22-Aug-2003  dsl Reduce memory footprint:
- use file buffer for all block reads
- only save a small amount of the indirect block list
Allows i386 bootxx_ufs code to load /boot from a filesystem with 32k blocks
while still fitting inside 64k of memory.
Code size reduced as well (by ~1k on i386).
It ought to be possible to use a buffer that is smaller than a filesystem
block. This might be needed in order to boot from filesystems with larger
block sizes.
 1.39 21-Aug-2003  elric Should call ufs_close() if it isn't being built in.
 1.38 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.37 18-Aug-2003  dsl KNF, fix a comment or two
 1.36 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.35 11-Apr-2003  dsl branches: 1.35.2;
Merge in lfs.c, use defines to build ffsv1, ffsv2, lfsv1 or lfsv2.
(removes the ability to build a single ufs.o that supports ffs v1 and v2,
that animal was too large for some of the boot code.)
Use shifts and masks to avoid pulling in 64bit divide.
 1.34 02-Apr-2003  he Conditionalize declaration of local variable ``i'', now that the
code which uses it is also conditionalized.
 1.33 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.32 23-Feb-2003  simonb Use the MAX() macro from <sys/param.h> instead of a local inline. Results
in same code size in ufs.c and removes an unused inline function in lfs.c.
 1.31 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.30 30-Mar-2000  augustss Kill some more register declarations.
 1.29 13-Nov-1999  thorpej Backout my libsa changes.
 1.28 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.27 18-Aug-1999  cgd branches: 1.27.2; 1.27.4; 1.27.8;
note that these files should be easily diffable (until they share common code
 1.26 17-Aug-1999  cgd set f_seekp to 0 in ufs_open() before returning. It ended up being 0
in most situations, but not always: if the terminal path name component
being opened couldn't be found in the first fs block of the directory
that contained it, f_seekp would be non-zero (and Bad Things would result).
 1.25 01-Apr-1999  simonb branches: 1.25.2;
Don't compile in sanity checks for old file systems if
LIBSA_NO_COMPAT_UFS is defined.
 1.24 31-Mar-1999  simonb G/C UFS_NOSYMLINK, UFS_NOCLOSE and UFS_NOWRITE and use new LIBSA_NO_FS_*.
 1.23 31-Mar-1999  cgd Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.22 22-Feb-1999  simonb Drop support for symlinks of UFS_NOSYMLINK is defined.
Don't compile in ufs_close/ufs_write if UFS_NOCLOSE/UFS_NOWRITE is defined.
Remove trailing whitespace.
 1.21 11-Feb-1999  pk Add missing prototypes.
 1.20 01-Mar-1998  ross Sweep up some miscellaneous leftover lite2 integration shrapnel.
 1.19 26-Jun-1997  drochner Avoid user space headers for standalone programs.
Don't use sys/lib/libkern or sys/lib/libz if not standalone
(ie, user space test programs).
 1.18 13-Jun-1997  drochner Don't #include <string.h>, needed prototypes are in libkern.h.
 1.17 17-Jan-1997  cgd fix file system buffer leak that occurs if an error occurs (e.g. file not
found) during the file system open function after having read some data
from the disk. From Matthias Drochner (PR 3120).
 1.16 30-Sep-1996  ws Add support for booting from cd9660 fs
Support directory traversal and symbolic links for nfs booting
Close device when file opening failed
Plug memory leak in ufs code
 1.15 02-Jun-1996  ragge Fix include file order to confirm to KNF in master tree also.
 1.14 13-Jan-1996  leo branches: 1.14.4;
Some files containing more than one function are split. This reduces the
size of the resulting loader. The read_inode() function now returns the
result of the strategy function instead of success in all cases (ufs.c).
Fixes pr#1817
 1.13 20-Oct-1995  cgd add prototypes for static functions. make ffs_oldfscompat static.
fix some arguments and structure members, in recognition of the fact
that (u_int == u_long == size_t) is not true on all systems.
 1.12 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.11 21-Feb-1995  mycroft Add a generic twiddler.
 1.10 07-Jan-1995  ws Better fix for the last.
Worked this out together with Darren Reed.
This one fixes several bugs, plus it's closer to the original
 1.9 06-Jan-1995  pk Update symbolic-link handling, from Darren Reed.
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 22-Aug-1994  brezak branches: 1.7.2;
Cleanup to make more ANSI compliant; checkpoint
 1.6 27-Jul-1994  cgd include libkern.h
 1.5 27-Jul-1994  cgd get rid of someone else's bravery (stupidity)
 1.4 18-Jul-1994  pk Include ffs_oldfscompat() from ffs_vfsops.c; enables booting from pre-44
filesystems (on big-endian machines).
 1.3 20-Jun-1994  pk branches: 1.3.2;
Further adaptions to 4.4-lite header files.
 1.2 20-Jun-1994  glass make it compile w/4.4-lite header file changes
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.3.2.2 27-Jul-1994  cgd update from trunk.
 1.3.2.1 19-Jul-1994  cgd update from trunk, per pk.
 1.7.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.7.2.1 22-Aug-1994  brezak file ufs.c was added on branch netbsd-1-0 on 1994-08-22 21:56:16 +0000
 1.14.4.1 02-Jun-1996  ragge Fix include file order to confirm to KNF.
 1.25.2.1 20-Aug-1999  cgd pull up rev 1.26 from trunk (cgd)
 1.27.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.4.1 15-Nov-1999  fvdl Sync with -current
 1.27.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.35.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.35.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.35.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.35.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.35.2.1 03-Aug-2004  skrll Sync with HEAD
 1.43.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.43.8.1 29-Apr-2005  kent sync with -current
 1.44.4.4 21-Jan-2008  yamt sync with head
 1.44.4.3 07-Dec-2007  yamt sync with head
 1.44.4.2 27-Oct-2007  yamt sync with head.
 1.44.4.1 21-Jun-2006  yamt sync with head.
 1.46.2.1 01-Feb-2006  yamt sync with head.
 1.48.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.48.8.1 11-May-2006  elad sync with head
 1.48.6.1 24-May-2006  yamt sync with head.
 1.48.4.1 01-Jun-2006  kardel Sync with head.
 1.48.2.1 09-Sep-2006  rpaulo sync with head
 1.49.36.1 06-Oct-2007  yamt sync with head.
 1.49.34.2 09-Jan-2008  matt sync with HEAD
 1.49.34.1 06-Nov-2007  matt sync with HEAD
 1.49.32.3 03-Dec-2007  joerg Sync with HEAD.
 1.49.32.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.49.32.1 02-Oct-2007  joerg Sync with HEAD.
 1.49.18.1 09-Oct-2007  ad Sync with head.
 1.50.4.2 18-Feb-2008  mjf Sync with HEAD.
 1.50.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.52.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.52.2.1 28-Dec-2007  ad Make it build.
 1.53.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.53.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.53.10.1 04-May-2009  yamt sync with head.
 1.53.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.54.14.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.55.6.2 02-Jun-2012  mrg sync to latest -current.
 1.55.6.1 18-Feb-2012  mrg merge to -current.
 1.55.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.2.3 23-Jan-2013  yamt sync with head
 1.55.2.2 23-May-2012  yamt sync with head.
 1.55.2.1 17-Apr-2012  yamt sync with head
 1.57.2.1 03-Jun-2012  jdc Pull up revisions:
src/sys/arch/i386/stand/lib/exec.c revision 1.50
src/sys/arch/sandpoint/stand/altboot/main.c revision 1.21 via patch
src/sys/lib/libsa/ext2fs.c revision 1.13
src/sys/lib/libsa/ffsv1.c revision 1.6
src/sys/lib/libsa/ffsv2.c revision 1.6
src/sys/lib/libsa/globals.c revision 1.9
src/sys/lib/libsa/lfsv1.c revision 1.5
src/sys/lib/libsa/lfsv2.c revision 1.5
src/sys/lib/libsa/stand.h revision 1.76
src/sys/lib/libsa/ufs.c revision 1.58
(requested by dsl in ticket #279).

Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
 1.58.2.4 03-Dec-2017  jdolecek update from HEAD
 1.58.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.58.2.2 23-Jun-2013  tls resync from head
 1.58.2.1 25-Feb-2013  tls resync with head
 1.63.2.1 18-May-2014  rmind sync with head
 1.65.6.1 22-Sep-2015  skrll Sync with HEAD
 1.74.18.1 10-Jun-2019  christos Sync with HEAD
 1.76.12.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.78.6.1 31-May-2021  cjep sync with head
 1.78.4.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.78.4.1 13-May-2021  thorpej Sync with HEAD.
 1.11 27-May-2021  mrg add bi-endian support to the libsa ufs reader and enable it in efiboot.

ffs frontends to "ufs.c" now also define ufs_dinode_swap, ufs_indp_swap,
and FS_MAGIC (moved from ufs.c #if segments.) these are used to call
the right (32/64 bit) ffsv1/v2 version.

ufs.c 'struct file' gains f_swapped member. accessors for d_magic,
d_reclen, and d_ino are introduced (they need to be swapped.) sfter
reading an inode from disk, read_inode() may call ufs_dinode_swap().
indirect block number and caches may be swapped.

error handling in ffs_find_superblock() is cleaned up. (size is slightly
reduced on some ports with this part.)

defaults for new defines added to ufs.c. (XXX: we build ufs.c but i think
all the consumers don't use it, and we can stop building it.)

LFS support is not included.

add a cut-down copy of ffs_bswap.c from the kernel.

also enable bi-endian disklabel support in efiboot.

most ports build and sizes compared for platforms that don't enable this
code and all but one saw reduced code size. booted several platforms with
new boot code.
 1.10 25-Dec-2011  tsutsui branches: 1.10.64; 1.10.66;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.9 11-Dec-2005  christos branches: 1.9.110; 1.9.114;
merge ktrace-lwp.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 11-Apr-2003  dsl branches: 1.7.2;
Add externs for ffsv1_xxx and ffsv2_xxx
 1.6 14-Apr-1999  drochner move "ls" utility from i386/stand/libsa here
 1.5 20-Oct-1995  cgd branches: 1.5.26;
oops; i forgot these u_int -> size_t conversions.
 1.4 20-Oct-1995  cgd fix prototypes here, to match u_int->size_t changes in ufs.c
 1.3 17-Sep-1995  pk Revert fs_ops read/write declarations; these return error numbers.
Get rid of some more compiler warnings.
Set errno where appropriate.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.5.26.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.114.1 18-Feb-2012  mrg merge to -current.
 1.9.110.1 17-Apr-2012  yamt sync with head
 1.10.66.1 31-May-2021  cjep sync with head
 1.10.64.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.15 25-Dec-2011  tsutsui Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.14 24-Nov-2007  isaki branches: 1.14.52; 1.14.56;
style, indent, and ANSI-fy.
 1.13 25-Jan-2006  christos branches: 1.13.42; 1.13.44; 1.13.50;
free -> dealloc
 1.12 11-Dec-2005  christos branches: 1.12.2;
merge ktrace-lwp.
 1.11 19-Aug-2005  christos 64 bit inode changes.
 1.10 09-Apr-2005  dsl branches: 1.10.2;
Use std form for a multi-line comment
 1.9 26-Feb-2005  perry nuke trailing whitespace
 1.8 24-Mar-2004  drochner branches: 1.8.8; 1.8.10;
I was told I'm just an "author", not a "regent"
 1.7 24-Mar-2004  drochner remove license clauses 3 and 4 from my copyright notice
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 18-Mar-2003  mycroft branches: 1.5.2;
Move some stuff into .rodata.
 1.4 23-Feb-2003  simonb We can't use <string.h> for standalone programs;
use <lib/libkern/libkern.h> for str*() prototypes instead.
 1.3 01-Feb-2003  dsl Support limited filename globbing
- agreed by christos
 1.2 09-May-2002  simonb Don't bother testing if a uint8_t is > 256 -- that test is always false.
 1.1 14-Apr-1999  drochner branches: 1.1.2; 1.1.16; 1.1.18;
move "ls" utility from i386/stand/libsa here
 1.1.18.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.10.2.2 07-Dec-2007  yamt sync with head
 1.10.2.1 21-Jun-2006  yamt sync with head.
 1.12.2.1 01-Feb-2006  yamt sync with head.
 1.13.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.13.44.1 09-Jan-2008  matt sync with HEAD
 1.13.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.14.56.1 18-Feb-2012  mrg merge to -current.
 1.14.52.1 17-Apr-2012  yamt sync with head
 1.37 21-Nov-2019  mrg apply the strncmp hack only to !clang. requested by tnn.
 1.36 21-Nov-2019  mrg from the new comment:

* XXX Hack alert. GCC 8.3 mis-compiles this function and calls
* strncmp() with the wrong second pointer, as seen in PR#54703.
*
* Until the real cause is located, work around it by using -O1
* for this function.

this hack is restricted to i386.
 1.35 20-Mar-2014  christos branches: 1.35.30;
reduce size by 1K by sharing the ls code.
 1.34 25-Dec-2011  tsutsui branches: 1.34.6; 1.34.10;
Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

- add 'ls' op to struct fs_ops to support ls command on each fs,
enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
in libsa
- split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
that opens the target fs and calls fs-depedent XXX_ls() functions
- add a ls op for ext2fs
(all other fs than ufs and ext2fs don't have actual ls ops yet)
- replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
 1.33 16-Jun-2011  joerg branches: 1.33.2; 1.33.6;
Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
 1.32 17-Jan-2009  tsutsui branches: 1.32.12;
Remove __P().
 1.31 24-Nov-2007  isaki branches: 1.31.18; 1.31.26;
style, indent, and ANSI-fy.
 1.30 11-Nov-2007  isaki x68k's floppy is 8*2 sect/cyl, not 18*2 sect/cyl.
 1.29 05-Mar-2007  he branches: 1.29.14; 1.29.16; 1.29.20; 1.29.22;
We need char* for pointer arithmetic.
 1.28 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 27-Jan-2006  uwe branches: 1.27.24;
Don't omit int arguments in the K&R style function definitions.
 1.26 25-Jan-2006  christos free -> dealloc
 1.25 11-Dec-2005  christos branches: 1.25.2;
merge ktrace-lwp.
 1.24 26-Feb-2005  perry branches: 1.24.4;
nuke trailing whitespace
 1.23 31-Aug-2003  fvdl branches: 1.23.8; 1.23.10;
Fix signed/unsigned warnings.
 1.22 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.21 18-Mar-2003  mycroft branches: 1.21.2;
Move some stuff into .rodata.
 1.20 11-Mar-2003  jmmv After the "insert disk <number>, and press return..." message, check only
for the return keypress.
 1.19 10-May-2002  lukem fix comment
 1.18 30-Mar-2002  matt Add a 1byte pad to make the ustar_t word aligned so the uas_1cyl after it
will also be word aligned. This makes the VAX VMB bootrom happy since it
doesn't support odd-aligned buffers.
 1.17 22-Feb-2002  lukem fix spelos
 1.16 28-Sep-2001  minoura Add changedisk_hook().
Machine-dependent code can eject the floppy to prompt the next volume in it.
(Or add another method in devsw?)
 1.15 02-Oct-2000  lukem branches: 1.15.2; 1.15.4; 1.15.6;
show "press return" instead of "type return", since it's a key name and
not the actual word...
 1.14 13-Nov-1999  thorpej branches: 1.14.4;
Backout my libsa changes.
 1.13 11-Nov-1999  thorpej Update for the improvements to libsa, and don't reference libkern.h.
 1.12 20-Sep-1999  ross branches: 1.12.2; 1.12.4; 1.12.8;
Fix error flow that was broken 10 days ago in the previous commit.
Fixes the broken i386 boot blocks and closes port-i386/8432.
 1.11 10-Sep-1999  ross * Fix the volume zero recognition bug; it was interacting with a
feature to avoid rereads (which was added to work around bugs in
old SRM versions that wouldn't rewind DATs, but would return no
error on rewind callbacks)
* Initialize the volzero signature in ustarfs_open(), rather than as a
side effect of the first read.
* Centralize error retry.
 1.10 01-Sep-1999  ross Fix read retry error case. Closes kern/8300.
While here, add automatic error retry up to 3 times.
 1.9 22-Jun-1999  christos bring back my friend the twiddle.
 1.8 31-Mar-1999  cgd branches: 1.8.4;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.7 26-Mar-1999  dbj Changes to compile the next68k bootblocks with
egcs -Wpointer-arith -Wstrict-prototypes
This closes pr 6653
 1.6 19-Dec-1998  he Retry ustarfs_cylinder_read after disk change, apparently required on i386.
 1.5 30-Oct-1998  matt Conditionalize include of <lib/libkern/libkern.h> with _STANDALONE (like
libsa/nfs.c does). Fixes VAX libsa build problem.
 1.4 15-Oct-1998  bad Work around gcc warning.
 1.3 15-Oct-1998  ross 1. Avoid snarfing label areas unless necessary; read with monotonically
increasing block numbers and don't reread cylinder 0.

2. Recognize the USTAR.... meta-info file...kind of like a super-block,
it makes the volume size and label info programmable.
 1.2 05-Oct-1998  ross Reserve an 8K label area on every disk, not just the first. Rewrite the block
addressing and disk changing code. Separate disk addressing into three layers.
(virtual: ustar format space spanning volumes, logical: format space relative
to current volume, and physical: standard meaning). Compute a checksum of the
disk 0 8k label area, and define a label for disk 2, 3.... Detect incorrect
disk changing order and attempt to recognize our disk 0 from its checksum.
 1.1 24-Sep-1998  ross tfs -> ustarfs
 1.8.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.4.1 15-Nov-1999  fvdl Sync with -current
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.4.1 03-Oct-2000  lukem pull up rev 1.15 (approved by thorpej):
fix a prompt to say `press return' instead of `type return'
 1.15.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.15.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.15.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.15.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.15.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.15.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.21.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.8.1 29-Apr-2005  kent sync with -current
 1.24.4.4 07-Dec-2007  yamt sync with head
 1.24.4.3 15-Nov-2007  yamt sync with head.
 1.24.4.2 03-Sep-2007  yamt sync with head.
 1.24.4.1 21-Jun-2006  yamt sync with head.
 1.25.2.1 01-Feb-2006  yamt sync with head.
 1.27.24.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.22.2 08-Dec-2007  mjf Sync with HEAD.
 1.29.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.29.20.1 13-Nov-2007  bouyer Sync with HEAD
 1.29.16.1 09-Jan-2008  matt sync with HEAD
 1.29.14.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.29.14.1 11-Nov-2007  joerg Sync with HEAD.
 1.31.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.18.1 04-May-2009  yamt sync with head.
 1.32.12.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.33.6.1 18-Feb-2012  mrg merge to -current.
 1.33.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.33.2.1 17-Apr-2012  yamt sync with head
 1.34.10.1 18-May-2014  rmind sync with head
 1.34.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 18-Aug-2003  dsl make 'path' argument to ufs_open 'const char *' and fix the fallout.
 1.1 24-Sep-1998  ross branches: 1.1.46;
tfs -> ustarfs
 1.1.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.46.1 03-Aug-2004  skrll Sync with HEAD
 1.6 26-Mar-2014  christos Remove {v,}sprintf
 1.5 17-Jul-2011  joerg branches: 1.5.2; 1.5.12; 1.5.16;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.4 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.3 11-Dec-2005  christos branches: 1.3.44; 1.3.46; 1.3.52;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 13-Feb-1999  pk branches: 1.1.42;
Split the printf variants into separate files.
 1.1.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.42.1 03-Aug-2004  skrll Sync with HEAD
 1.2.16.1 07-Dec-2007  yamt sync with head
 1.3.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.46.1 09-Jan-2008  matt sync with HEAD
 1.3.44.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.5.16.1 18-May-2014  rmind sync with head
 1.5.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15 02-Dec-2007  tsutsui unsigned -> unsigned int
 1.14 24-Nov-2007  isaki style, indent, and ANSI-fy.
 1.13 13-Jan-2006  christos branches: 1.13.42; 1.13.44; 1.13.50;
constify write prototype.
 1.12 11-Dec-2005  christos branches: 1.12.2;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 07-Aug-2003  agc branches: 1.10.8; 1.10.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 30-Mar-2000  augustss branches: 1.9.28;
Kill some more register declarations.
 1.8 31-Mar-1999  cgd branches: 1.8.8;
Make a bunch of backward-compatible changes to the boot blocks which allow
size to be reduced substantially. (backward compatibility verified
by compiling one of the alpha boot blocks which uses all of the code
before and after, diffing the object files, and manually verifying that
the differences were 'correct'. some differences were "unavoidable,"
it wanting to avoid a double-commit, because e.g. local variables which
were previously used were no longer used.) a README which describes
supported options (or at least the ones mentioned below) is forthcoming.

add support for the preprocessor macro LIBSA_NO_TWIDDLE, which
causes calls to twiddle() to be omitted if it's defined.
add support for the preprocessor macros:
LIBSA_NO_FS_CLOSE
LIBSA_NO_FS_WRITE
LIBSA_NO_FS_SEEK
which, if defined, cause the corresponding file system operations
in the individual file system implementations to be omitted. (note
that all of those macros are not supported by all file systems at
this point. comments were added to individual file system files
to indicate lack of support, and should be cleaned up later. Backward
compatibility options e.g. UFS_NOCLOSE, etc., are supported.)
add support for the preprocessor macro LIBSA_NO_FS_SYMLINK, which
removes support for symbolic links from the file system support
functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_FS_SINGLECOMPONENT which
removes all subdirectory and symlink support from the file system
support functions. (same notes as for the macros above apply.)
add support for the preprocessor macro LIBSA_NO_FD_CHECKING, which
causes code relating to libsa file descriptor checks (e.g. range
checking and checking that a file descriptor is valid) to be
omitted if it's defined.
add support for the preprocessor macro LIBSA_NO_RAW_ACCESS, which
causes code relating to raw device access to be omitted if it's
defined.
change some structure copies to use bcopy() instead. that way
use of bcopy vs. memcpy() can easily be selected by
LIBSA_USE_MEMCPY. (without changes like these, you could end up
having both bcopy() and memcpy() included. eventually, all
calls to bcopy should be changed to calls to memcpy() or memmove()
as appropriate -- hopefully never the latter -- with an option to
use bcopy instead.)
add support for the preprocessor macro LIBSA_NO_DISKLABEL_MSGS, which
causes disklabel() to return '1' as msg rather than a string. Can
be used if the boot blocks don't care about the string, and need to
save the space.
add support for the preprocessor macro LIBSA_SINGLE_FILESYSTEM, which
if defined causes all of the file system switch code to be removed.
Its value should be the name of the file system supported by the
boot block, e.g. "ufs" for the FFS file system. calls to the
file system functions open, close, etc., which were previously
done through a function switch are then done via direct invocation
of <fs>_open, <fs>_close, etc. (e.g. ufs_open, ...).
add support for the preprocessor macro LIBSA_SINGLE_DEVICE, which
does the equivalent of LIBSA_SINGLE_FILESYSTEM but for the device
switch table. Device entry pointes are expected to be named
<dev>foo, e.g. the 'strategy' routine used when LIBSA_SINGLE_DEVICE
is set to 'disk' is diskstrategy.
make ufs.c f_nindir array be unsigned ints. the fact that it was signed
caused ufs.c to require signed division routines (which were otherwise
unnecessary for a small boot block).
 1.7 21-Jun-1996  pk Oh, what's in a name..
 1.6 21-Jun-1996  pk Allow seeks on raw devices. A `f_offset' field is added to the file structure
which is maintained in lseek(), read() and write(), and passed along to
the device's strategy routine.
 1.5 14-Sep-1995  pk Clear up some size_t/ssize_t confusion.
 1.4 21-Feb-1995  mycroft Add a generic twiddler.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Aug-1994  brezak branches: 1.2.2;
Cleanup to make more ANSI compliant; checkpoint
 1.1 26-Jan-1994  brezak CMU/4.4 stand-alone library
 1.2.2.2 22-Aug-1994  brezak Cleanup to make more ANSI compliant; checkpoint
 1.2.2.1 22-Aug-1994  brezak file write.c was added on branch netbsd-1-0 on 1994-08-22 21:56:18 +0000
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.9.28.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.28.1 03-Aug-2004  skrll Sync with HEAD
 1.10.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.11.4.2 07-Dec-2007  yamt sync with head
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.12.2.1 15-Jan-2006  yamt sync with head.
 1.13.50.1 08-Dec-2007  mjf Sync with HEAD.
 1.13.44.1 09-Jan-2008  matt sync with HEAD
 1.13.42.2 03-Dec-2007  joerg Sync with HEAD.
 1.13.42.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.10 28-Feb-2021  joerg Defer acquiring the FDE lock until after the allocation. This can avoid
nesting issues between malloc and backtrace when using LSan.
 1.9 02-Nov-2017  christos branches: 1.9.16;
Avoid negative shift.
 1.8 29-Jan-2015  joerg Fix binary search when search value is in the last block, but not equal
to the start of the range. PR 49444.
 1.7 20-Jul-2014  joerg branches: 1.7.2; 1.7.4; 1.7.6;
Fix braino in last commit and free the node iff the insert failed.
 1.6 14-Jul-2014  joerg Use static_cast for rb_tree_insert_node void * return value.
 1.5 28-Apr-2014  joerg branches: 1.5.2; 1.5.4;
GC unwind_info_size.
 1.4 02-Apr-2014  joerg branches: 1.4.2;
SH3 uses unaligned data in the .eh_frame section, so use memcpy.
 1.3 12-Mar-2014  joerg Pass down data_base just in case something actually tries to use it.
 1.2 12-Mar-2014  joerg Add more const to make GCC happy.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.4.2.1 10-Aug-2014  tls Rebase.
 1.5.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.4.1 28-Apr-2014  yamt file AddressSpace.hpp was added on branch yamt-pagecache on 2014-05-22 11:41:04 +0000
 1.5.2.2 18-May-2014  rmind sync with head
 1.5.2.1 28-Apr-2014  rmind file AddressSpace.hpp was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.7.6.1 06-Apr-2015  skrll Sync with HEAD
 1.7.4.3 03-Dec-2017  jdolecek update from HEAD
 1.7.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.4.1 20-Jul-2014  tls file AddressSpace.hpp was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.7.2.1 04-Feb-2015  snj Pull up following revision(s) (requested by joerg in ticket #476):
sys/lib/libunwind/AddressSpace.hpp: revision 1.8
Fix binary search when search value is in the last block, but not equal
to the start of the range. PR 49444.
 1.9.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 14-Oct-2013  joerg branches: 1.1.4; 1.1.6; 1.1.10;
Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 14-Oct-2013  tls file CREDITS.TXT was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 14-Oct-2013  yamt file CREDITS.TXT was added on branch yamt-pagecache on 2014-05-22 11:41:04 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 14-Oct-2013  rmind file CREDITS.TXT was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.7 17-Jul-2018  joerg Remove redundant setIP call overwritten a few lines later.
 1.6 27-Sep-2014  joerg branches: 1.6.18; 1.6.20;
Introduce a separate bit mask for the return address. Use it on HPPA.
 1.5 26-Apr-2014  joerg branches: 1.5.2; 1.5.4; 1.5.8;
Use the return address register from the CIE. Based on patch from Nick
Kledzik.
 1.4 14-Apr-2014  joerg Some architectures like SPARC need to apply a fixed offset to the return
address. Introduce such a constant.
 1.3 11-Mar-2014  joerg branches: 1.3.2;
Rename IP_PSEUDO_REG to RETURN_REG. Fix PPC value. Sort.
 1.2 11-Mar-2014  joerg GC unused enum.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.3.2.1 10-Aug-2014  tls Rebase.
 1.5.8.3 03-Dec-2017  jdolecek update from HEAD
 1.5.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.8.1 26-Apr-2014  tls file DwarfInstructions.hpp was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.5.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.4.1 26-Apr-2014  yamt file DwarfInstructions.hpp was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.5.2.2 18-May-2014  rmind sync with head
 1.5.2.1 26-Apr-2014  rmind file DwarfInstructions.hpp was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.6.20.1 10-Jun-2019  christos Sync with HEAD
 1.6.18.1 28-Jul-2018  pgoyette Sync with HEAD
 1.7 09-Aug-2021  andvar s/aligment/alignment/ + one more typo fix in comments.
 1.6 23-Feb-2021  joerg The return address register entry is the DWARF register. On PowerPC,
this is not the same as the internal encoding, since the Link Register
is deliberately non-continous from the other general purpose register
values. To handle this, always translate the value into the internal
format.
 1.5 03-May-2014  joerg branches: 1.5.2; 1.5.4; 1.5.8; 1.5.46;
Missing register validation check.
 1.4 26-Apr-2014  joerg Use the return address register from the CIE. Based on patch from Nick
Kledzik.
 1.3 15-Apr-2014  joerg Add initial unwind support for SPARC/SPARC64.
 1.2 11-Mar-2014  joerg branches: 1.2.2;
0 is a valid LSDA encoding and can be seen in statically linked
programs. Initialize lsdaEncoding to DW_EH_PE_omit and check for that
value to decide whether a value should be decoded.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.5.46.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.8.1 03-May-2014  tls file DwarfParser.hpp was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.5.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.4.1 03-May-2014  yamt file DwarfParser.hpp was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.5.2.2 18-May-2014  rmind sync with head
 1.5.2.1 03-May-2014  rmind file DwarfParser.hpp was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.1 14-Oct-2013  joerg branches: 1.1.4; 1.1.6; 1.1.10;
Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 14-Oct-2013  tls file LICENSE.TXT was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 14-Oct-2013  yamt file LICENSE.TXT was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 14-Oct-2013  rmind file LICENSE.TXT was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.14 22-Nov-2021  thorpej Revert unintended commit.
 1.13 22-Nov-2021  thorpej Gah, fix two typos.
 1.12 17-Nov-2019  christos Explicitly compile libunwind with vfp3 because gcc-8 defaults to neon
and breaks exceptions.
 1.11 29-Jan-2015  joerg branches: 1.11.18;
Force FPU support for Clang, don't disable IAS completely.
 1.10 23-Oct-2014  christos branches: 1.10.2;
prefer our own unwind.h
 1.9 30-Jun-2014  joerg branches: 1.9.2; 1.9.4;
IAS is clang specific.
 1.8 28-Jun-2014  joerg .fpu is not handled correctly by LLVM's assembler parser, so use GAS for
now.
 1.7 13-Jun-2014  matt Split COPTS.libunwind.cxx into multiple lines.
 1.6 13-Jun-2014  mrg remove the build support for GCC 4.1, and any hacks i found for it.

there could still be more -- i only looked for lines matching
both "HAVE_GCC" and "4" as words (grep -w.)
 1.5 19-Mar-2014  joerg branches: 1.5.2; 1.5.4; 1.5.6;
Allow building with GCC 4.1 by providing <cstdint>
 1.4 13-Mar-2014  joerg Kill one colon that shouldn't be.
 1.3 13-Mar-2014  joerg libstdc++ doesn't like me using <cstdint> without requesting C++11, so
just do so.
 1.2 20-Dec-2013  joerg Fix typo.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.5.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.6.1 19-Mar-2014  yamt file Makefile.inc was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.5.4.2 18-May-2014  rmind sync with head
 1.5.4.1 19-Mar-2014  rmind file Makefile.inc was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.5.2.1 10-Aug-2014  tls Rebase.
 1.9.4.3 03-Dec-2017  jdolecek update from HEAD
 1.9.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.4.1 30-Jun-2014  tls file Makefile.inc was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.9.2.1 25-Jan-2015  martin Sync gcc with -current, requested by skrll in ticket #448:

tools/gcc/Makefile up to 1.74
tools/gcc/gcc-version.mk up to 1.3
external/gpl3/gcc/dist/config/mh-alpha-linux up to 1.1.1.1
external/gpl3/gcc/dist/gcc/config/or1k/constraints.md up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/elf.h up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/linux-elf.h up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/linux-gas.h up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/netbsd.h up to 1.2
external/gpl3/gcc/dist/gcc/config/or1k/or1k-modes.def up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/or1k-opts.h up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/or1k-protos.h up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/or1k.c up to 1.2
external/gpl3/gcc/dist/gcc/config/or1k/or1k.h up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/or1k.md up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/or1k.opt up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/predicates.md up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/t-linux up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/t-or1k up to 1.1
external/gpl3/gcc/dist/gcc/config/or1k/t-or1knd up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/constraints.md up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/crti.asm up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/crtn.asm up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/div.S up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/elf.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/generic.md up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/linux-unwind.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/linux.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/linux64.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/netbsd.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/opcode-riscv.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/peephole.md up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/predicates.md up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv-fp.c up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv-ftypes.def up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv-modes.def up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv-opc.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv-protos.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv.c up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv.h up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv.md up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/riscv.opt up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/sync.md up to 1.2
external/gpl3/gcc/dist/gcc/config/riscv/t-elf up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/t-linux64 up to 1.1
external/gpl3/gcc/dist/gcc/config/riscv/t-netbsd64 up to 1.1
external/gpl3/gcc/dist/gcc/common/config/or1k/or1k-common.c up to 1.1
external/gpl3/gcc/dist/gcc/common/config/riscv/riscv-common.c up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/or1k-asm.h up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/crti.S up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/crtn.S up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/linux-unwind.h up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/or1k.S up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/sfp-machine.h up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/t-crtstuff up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/t-linux up to 1.1
external/gpl3/gcc/dist/libgcc/config/or1k/t-or1k up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/riscv-fp.c up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/crti.S up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/crtn.S up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/t-dpbit up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/t-elf up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/t-fpbit up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/t-linux up to 1.1
external/gpl3/gcc/dist/libgcc/config/riscv/t-tpbit up to 1.1
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_netbsd.cc up to 1.3
external/gpl3/gcc/lib/libstdc++-v3/include/bits/arch/powerpc/Makefile up to 1.1
external/gpl3/gcc/lib/libstdc++-v3/include/bits/arch/powerpc64/Makefile up to 1.1
external/gpl3/gcc/lib/libstdc++-v3/include/bits/arch/riscv32/Makefile up to 1.1
external/gpl3/gcc/lib/libstdc++-v3/include/bits/arch/riscv64/Makefile up to 1.1
external/gpl3/gcc/lib/libtsan/Makefile up to 1.2
external/gpl3/gcc/lib/libtsan/shlib_version up to 1.1
external/gpl3/gcc/lib/libasan/Makefile up to 1.9
external/gpl3/gcc/lib/libasan/shlib_version up to 1.1
external/gpl3/gcc/usr.bin/lto-wrapper/Makefile up to 1.1
external/gpl3/gcc/usr.bin/lto1/Makefile up to 1.2
external/gpl3/gcc/Makefile up to 1.2
external/gpl3/gcc/README.gcc48 up to 1.6
external/gpl3/gcc/dist/ChangeLog up to 1.1.1.6
external/gpl3/gcc/dist/LAST_UPDATED up to 1.5
external/gpl3/gcc/dist/MD5SUMS up to 1.5
external/gpl3/gcc/dist/Makefile.def up to 1.1.1.4
external/gpl3/gcc/dist/Makefile.in up to 1.1.1.4
external/gpl3/gcc/dist/configure up to 1.8
external/gpl3/gcc/dist/configure.ac up to 1.7
external/gpl3/gcc/dist/config/ChangeLog up to 1.1.1.6
external/gpl3/gcc/dist/contrib/ChangeLog up to 1.1.1.6
external/gpl3/gcc/dist/contrib/reghunt/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/contrib/regression/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/fixincludes/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/fixincludes/fixincl.x up to 1.1.1.3
external/gpl3/gcc/dist/fixincludes/inclhack.def up to 1.1.1.3
external/gpl3/gcc/dist/fixincludes/tests/base/assert.h up to 1.1.1.2
external/gpl3/gcc/dist/gcc/ChangeLog up to 1.11
external/gpl3/gcc/dist/gcc/DATESTAMP up to 1.1.1.7
external/gpl3/gcc/dist/gcc/DEV-PHASE up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config.gcc up to 1.32
external/gpl3/gcc/dist/gcc/config.in up to 1.1.1.4
external/gpl3/gcc/dist/gcc/configure up to 1.11
external/gpl3/gcc/dist/gcc/configure.ac up to 1.9
external/gpl3/gcc/dist/gcc/convert.c up to 1.1.1.4
external/gpl3/gcc/dist/gcc/expr.c up to 1.7
external/gpl3/gcc/dist/gcc/fold-const.c up to 1.1.1.7
external/gpl3/gcc/dist/gcc/graphite-clast-to-gimple.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/graphite-interchange.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/graphite-optimize-isl.c up to 1.1.1.2
external/gpl3/gcc/dist/gcc/graphite-poly.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/graphite-sese-to-poly.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/ipa-pure-const.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/omp-low.c up to 1.1.1.4
external/gpl3/gcc/dist/gcc/ree.c up to 1.1.1.2
external/gpl3/gcc/dist/gcc/rtlanal.c up to 1.2
external/gpl3/gcc/dist/gcc/stor-layout.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/tree-data-ref.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/tree-data-ref.h up to 1.1.1.3
external/gpl3/gcc/dist/gcc/tree-nrv.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/tree-ssa-forwprop.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/tree-ssa-reassoc.c up to 1.1.1.4
external/gpl3/gcc/dist/gcc/tree-ssa-strlen.c up to 1.1.1.2
external/gpl3/gcc/dist/gcc/tree-ssa-tail-merge.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/tree-vect-slp.c up to 1.1.1.4
external/gpl3/gcc/dist/gcc/tree.c up to 1.1.1.4
external/gpl3/gcc/dist/gcc/tsan.c up to 1.1.1.2
external/gpl3/gcc/dist/gcc/c/ChangeLog up to 1.1.1.4
external/gpl3/gcc/dist/gcc/c-family/ChangeLog up to 1.1.1.3
external/gpl3/gcc/dist/gcc/config/darwin-c.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/config/darwin-driver.c up to 1.1.1.3
external/gpl3/gcc/dist/gcc/config/netbsd.h up to 1.14
external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-elf-raw.h up to 1.1.1.2
external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-linux.h up to 1.1.1.3
external/gpl3/gcc/dist/gcc/config/aarch64/aarch64-protos.h up to 1.1.1.2
external/gpl3/gcc/dist/gcc/config/aarch64/aarch64.c up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config/aarch64/aarch64.h up to 1.1.1.3
external/gpl3/gcc/dist/gcc/config/aarch64/aarch64.opt up to 1.1.1.2
external/gpl3/gcc/dist/gcc/config/arm/arm.h up to 1.10
external/gpl3/gcc/dist/gcc/config/arm/arm.md up to 1.8
external/gpl3/gcc/dist/gcc/config/i386/i386.c up to 1.9
external/gpl3/gcc/dist/gcc/config/pa/pa.md up to 1.1.1.4
external/gpl3/gcc/dist/gcc/config/rs6000/altivec.h up to 1.1.1.4
external/gpl3/gcc/dist/gcc/config/rs6000/altivec.md up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config/rs6000/netbsd.h up to 1.8
external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-builtin.def up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-c.c up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config/rs6000/rs6000-protos.h up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c up to 1.10
external/gpl3/gcc/dist/gcc/config/rs6000/vsx.md up to 1.1.1.6
external/gpl3/gcc/dist/gcc/config/rs6000/xcoff.h up to 1.1.1.3
external/gpl3/gcc/dist/gcc/config/sh/sh.c up to 1.7
external/gpl3/gcc/dist/gcc/config/sh/sh.md up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config/sparc/leon.md up to 1.1.1.2
external/gpl3/gcc/dist/gcc/config/sparc/sparc-opts.h up to 1.1.1.2
external/gpl3/gcc/dist/gcc/config/sparc/sparc.c up to 1.1.1.5
external/gpl3/gcc/dist/gcc/config/sparc/sparc.h up to 1.1.1.4
external/gpl3/gcc/dist/gcc/config/sparc/sparc.md up to 1.4
external/gpl3/gcc/dist/gcc/config/sparc/sparc.opt up to 1.1.1.4
external/gpl3/gcc/dist/gcc/config/sparc/t-rtems up to 1.1.1.2
external/gpl3/gcc/dist/gcc/cp/ChangeLog up to 1.1.1.7
external/gpl3/gcc/dist/gcc/cp/parser.c up to 1.1.1.6
external/gpl3/gcc/dist/gcc/cp/pt.c up to 1.1.1.5
external/gpl3/gcc/dist/gcc/cp/semantics.c up to 1.1.1.5
external/gpl3/gcc/dist/gcc/doc/extend.texi up to 1.1.1.5
external/gpl3/gcc/dist/gcc/doc/install.texi up to 1.1.1.5
external/gpl3/gcc/dist/gcc/doc/invoke.texi up to 1.7
external/gpl3/gcc/dist/gcc/doc/md.texi up to 1.1.1.6
external/gpl3/gcc/dist/gcc/doc/tm.texi up to 1.1.1.4
external/gpl3/gcc/dist/gcc/doc/tm.texi.in up to 1.1.1.3
external/gpl3/gcc/dist/gcc/lto/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/gcc/objc/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/gcc/objcp/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/gnattools/ChangeLog up to 1.1.1.3
external/gpl3/gcc/dist/include/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/intl/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libbacktrace/ChangeLog up to 1.1.1.4
external/gpl3/gcc/dist/libcpp/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libcpp/lex.c up to 1.5
external/gpl3/gcc/dist/libcpp/line-map.c up to 1.1.1.4
external/gpl3/gcc/dist/libdecnumber/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libgcc/ChangeLog up to 1.1.1.7
external/gpl3/gcc/dist/libgcc/config/libbid/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libgcc/config/pa/linux-unwind.h up to 1.1.1.2
external/gpl3/gcc/dist/libgcc/config/sh/lib1funcs.S up to 1.1.1.2
external/gpl3/gcc/dist/libgomp/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libgomp/configure.tgt up to 1.1.1.3
external/gpl3/gcc/dist/libiberty/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libitm/ChangeLog up to 1.1.1.3
external/gpl3/gcc/dist/libitm/configure.tgt up to 1.1.1.3
external/gpl3/gcc/dist/libitm/libitm.info up to 1.1.1.2
external/gpl3/gcc/dist/libmudflap/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libobjc/ChangeLog up to 1.1.1.6
external/gpl3/gcc/dist/libsanitizer/ChangeLog up to 1.1.1.3
external/gpl3/gcc/dist/libsanitizer/configure.tgt up to 1.3
external/gpl3/gcc/dist/libsanitizer/asan/asan_intercepted_functions.h up to 1.2
external/gpl3/gcc/dist/libsanitizer/asan/asan_internal.h up to 1.2
external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc up to 1.5
external/gpl3/gcc/dist/libsanitizer/asan/asan_malloc_linux.cc up to 1.2
external/gpl3/gcc/dist/libsanitizer/asan/asan_posix.cc up to 1.2
external/gpl3/gcc/dist/libsanitizer/interception/interception.h up to 1.2
external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.cc up to 1.3
external/gpl3/gcc/dist/libsanitizer/interception/interception_linux.h up to 1.2
external/gpl3/gcc/dist/libsanitizer/interception/interception_type_test.cc up to 1.2
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc up to 1.2
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_internal_defs.h up to 1.2
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_placement_new.h up to 1.2
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc up to 1.2
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_posix.cc up to 1.2
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_procmaps.h up to 1.2
external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_symbolizer_linux.cc up to 1.2
external/gpl3/gcc/dist/libsanitizer/tsan/tsan_symbolize_addr2line_linux.cc up to 1.2
external/gpl3/gcc/dist/libssp/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/libstdc++-v3/ChangeLog up to 1.1.1.7
external/gpl3/gcc/dist/libstdc++-v3/configure.host up to 1.1.1.3
external/gpl3/gcc/dist/libstdc++-v3/config/os/mingw32/os_defines.h up to 1.1.1.3
external/gpl3/gcc/dist/libstdc++-v3/config/os/mingw32-w64/os_defines.h up to 1.1.1.2
external/gpl3/gcc/dist/libstdc++-v3/doc/html/manual/status.html up to 1.1.1.3
external/gpl3/gcc/dist/libstdc++-v3/include/bits/stl_algo.h up to 1.1.1.3
external/gpl3/gcc/dist/libstdc++-v3/include/std/functional up to 1.1.1.4
external/gpl3/gcc/dist/libstdc++-v3/include/std/tuple up to 1.1.1.4
external/gpl3/gcc/dist/libstdc++-v3/include/tr1/functional up to 1.1.1.3
external/gpl3/gcc/dist/libstdc++-v3/libsupc++/dyncast.cc up to 1.1.1.3
external/gpl3/gcc/dist/libstdc++-v3/libsupc++/eh_personality.cc up to 1.1.1.3
external/gpl3/gcc/dist/lto-plugin/ChangeLog up to 1.1.1.5
external/gpl3/gcc/dist/maintainer-scripts/ChangeLog up to 1.1.1.6
external/gpl3/gcc/lib/Makefile up to 1.8
external/gpl3/gcc/lib/crtstuff/arch/coldfire.mk up to 1.3
external/gpl3/gcc/lib/crtstuff/arch/m68000.mk up to 1.6
external/gpl3/gcc/lib/libbacktrace/arch/alpha/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/alpha/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/arm/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/arm/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/armeb/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/armeb/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/coldfire/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/coldfire/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/hppa/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/hppa/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/i386/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/i386/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/m68000/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/m68000/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/m68k/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/m68k/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/mips64eb/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/mips64eb/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/mips64el/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/mips64el/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/mipseb/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/mipseb/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/mipsel/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/mipsel/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/powerpc/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/powerpc/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/powerpc64/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/powerpc64/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/sh3eb/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/sh3eb/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/sh3el/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/sh3el/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/sparc/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/sparc/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/sparc64/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/sparc64/config.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/vax/backtrace-supported.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/vax/config.h up to 1.3
external/gpl3/gcc/lib/libbacktrace/arch/x86_64/backtrace-supported.h up to 1.2
external/gpl3/gcc/lib/libbacktrace/arch/x86_64/config.h up to 1.2
external/gpl3/gcc/lib/libgcc/Makefile.inc up to 1.29
external/gpl3/gcc/lib/libgcc/arch/m68000/defs.mk up to 1.2
external/gpl3/gcc/lib/libgcc/arch/powerpc64/defs.mk up to 1.3
external/gpl3/gcc/lib/libgcc/libgcc_s/Makefile up to 1.11
external/gpl3/gcc/lib/libgcc/libgcov/arch/alpha/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/arm/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/armeb/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/coldfire/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earm/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmeb/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmhf/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmhfeb/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv4/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv4eb/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv6/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv6eb/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv6hf/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv6hfeb/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv7/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv7eb/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv7hf/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/earmv7hfeb/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/hppa/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/i386/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/m68000/gcov-iov.h up to 1.5
external/gpl3/gcc/lib/libgcc/libgcov/arch/m68k/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/mips64eb/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/mips64el/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/mipseb/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/mipsel/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/powerpc/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/powerpc64/gcov-iov.h up to 1.4
external/gpl3/gcc/lib/libgcc/libgcov/arch/sh3eb/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/sh3el/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/sparc/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/sparc64/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/vax/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgcc/libgcov/arch/x86_64/gcov-iov.h up to 1.6
external/gpl3/gcc/lib/libgomp/arch/m68000/config.h up to 1.3
external/gpl3/gcc/lib/libgomp/arch/m68000/libgomp.spec up to 1.3
external/gpl3/gcc/lib/libiberty/arch/coldfire/config.h up to 1.3
external/gpl3/gcc/lib/libiberty/arch/m68000/config.h up to 1.3
external/gpl3/gcc/lib/liblto_plugin/Makefile up to 1.3
external/gpl3/gcc/lib/libmudflap/Makefile up to 1.6
external/gpl3/gcc/lib/libobjc/arch/m68000/config.h up to 1.3
external/gpl3/gcc/lib/libstdc++-v3/Makefile up to 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/c++config.h up to 1.13
external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/arm/c++config.h up to 1.16
external/gpl3/gcc/lib/libstdc++-v3/arch/arm/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/c++config.h up to 1.15
external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earm/c++config.h up to 1.13
external/gpl3/gcc/lib/libstdc++-v3/arch/earm/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/c++config.h up to 1.11
external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/c++config.h up to 1.11
external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/c++config.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/c++config.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/gstdint.h up to 1.7
external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/c++config.h up to 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/gstdint.h up to 1.10
external/gpl3/gcc/lib/libstdc++-v3/arch/i386/c++config.h up to 1.13
external/gpl3/gcc/lib/libstdc++-v3/arch/i386/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/c++config.h up to 1.10
external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/gstdint.h up to 1.5
external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/c++config.h up to 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/c++config.h up to 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/c++config.h up to 1.13
external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/c++config.h up to 1.15
external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/c++config.h up to 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h up to 1.15
external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/c++config.h up to 1.5
external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/defs.mk up to 1.3
external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/gstdint.h up to 1.5
external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/c++config.h up to 1.13
external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/c++config.h up to 1.15
external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/c++config.h up to 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/c++config.h up to 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/vax/c++config.h up to 1.16
external/gpl3/gcc/lib/libstdc++-v3/arch/vax/gstdint.h up to 1.8
external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/c++config.h up to 1.15
external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/gstdint.h up to 1.9
external/gpl3/gcc/lib/libstdc++-v3/include/bits/arch/Makefile up to 1.3
external/gpl3/gcc/usr.bin/Makefile up to 1.7
external/gpl3/gcc/usr.bin/backend/Makefile up to 1.23
external/gpl3/gcc/usr.bin/frontend/Makefile up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/alpha/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/alpha/configargs.h up to 1.15
external/gpl3/gcc/usr.bin/gcc/arch/alpha/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/arm/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/arm/configargs.h up to 1.17
external/gpl3/gcc/usr.bin/gcc/arch/arm/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/armeb/auto-host.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/armeb/configargs.h up to 1.17
external/gpl3/gcc/usr.bin/gcc/arch/armeb/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/coldfire/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/coldfire/bversion.h up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/coldfire/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/coldfire/defs.mk up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/coldfire/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/coldfire/tm.h up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/earm/auto-host.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/earm/configargs.h up to 1.15
external/gpl3/gcc/usr.bin/gcc/arch/earm/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/earmeb/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/earmeb/configargs.h up to 1.11
external/gpl3/gcc/usr.bin/gcc/arch/earmeb/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmhf/auto-host.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmhf/configargs.h up to 1.12
external/gpl3/gcc/usr.bin/gcc/arch/earmhf/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmhfeb/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmhfeb/configargs.h up to 1.10
external/gpl3/gcc/usr.bin/gcc/arch/earmhfeb/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv4/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv4/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv4/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv4eb/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv4eb/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv4eb/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv6/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv6/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv6/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv6eb/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv6eb/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv6eb/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv6hf/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv6hf/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv6hf/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv6hfeb/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv6hfeb/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv6hfeb/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv7/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv7/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv7/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv7eb/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv7eb/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv7eb/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv7hf/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv7hf/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv7hf/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/earmv7hfeb/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/earmv7hfeb/configargs.h up to 1.9
external/gpl3/gcc/usr.bin/gcc/arch/earmv7hfeb/plugin-version.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/hppa/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/hppa/configargs.h up to 1.17
external/gpl3/gcc/usr.bin/gcc/arch/hppa/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/i386/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/i386/configargs.h up to 1.19
external/gpl3/gcc/usr.bin/gcc/arch/i386/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/m68000/auto-host.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/m68000/bversion.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/m68000/configargs.h up to 1.12
external/gpl3/gcc/usr.bin/gcc/arch/m68000/defs.mk up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/m68000/plugin-version.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/m68000/tm.h up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/m68k/auto-host.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/m68k/configargs.h up to 1.14
external/gpl3/gcc/usr.bin/gcc/arch/m68k/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/mips64eb/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/mips64eb/configargs.h up to 1.15
external/gpl3/gcc/usr.bin/gcc/arch/mips64eb/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/mips64el/auto-host.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/mips64el/configargs.h up to 1.16
external/gpl3/gcc/usr.bin/gcc/arch/mips64el/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/mipseb/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/mipseb/configargs.h up to 1.15
external/gpl3/gcc/usr.bin/gcc/arch/mipseb/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/mipsel/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/mipsel/configargs.h up to 1.16
external/gpl3/gcc/usr.bin/gcc/arch/mipsel/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/powerpc/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/powerpc/configargs.h up to 1.21
external/gpl3/gcc/usr.bin/gcc/arch/powerpc/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/auto-host.h up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/bversion.h up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/configargs.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/defs.mk up to 1.4
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/gtyp-input.list up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/multilib.h up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/plugin-version.h up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/tm.h up to 1.3
external/gpl3/gcc/usr.bin/gcc/arch/sh3eb/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/sh3eb/configargs.h up to 1.16
external/gpl3/gcc/usr.bin/gcc/arch/sh3eb/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/sh3el/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/sh3el/configargs.h up to 1.18
external/gpl3/gcc/usr.bin/gcc/arch/sh3el/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/sparc/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/sparc/configargs.h up to 1.16
external/gpl3/gcc/usr.bin/gcc/arch/sparc/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/sparc64/auto-host.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/sparc64/configargs.h up to 1.17
external/gpl3/gcc/usr.bin/gcc/arch/sparc64/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/vax/auto-host.h up to 1.6
external/gpl3/gcc/usr.bin/gcc/arch/vax/configargs.h up to 1.17
external/gpl3/gcc/usr.bin/gcc/arch/vax/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/gcc/arch/x86_64/auto-host.h up to 1.5
external/gpl3/gcc/usr.bin/gcc/arch/x86_64/configargs.h up to 1.20
external/gpl3/gcc/usr.bin/gcc/arch/x86_64/plugin-version.h up to 1.7
external/gpl3/gcc/usr.bin/libcpp/arch/alpha/config.h up to 1.3
external/gpl3/gcc/usr.bin/libcpp/arch/armeb/config.h up to 1.2
external/gpl3/gcc/usr.bin/libcpp/arch/x86_64/config.h up to 1.3
distrib/sets/lists/base/ad.arm 1.58
distrib/sets/lists/base/ad.arm 1.61
distrib/sets/lists/base/ad.mips 1.53
distrib/sets/lists/base/ad.mips 1.56
distrib/sets/lists/base/ad.powerpc 1.22
distrib/sets/lists/base/ad.powerpc 1.25
distrib/sets/lists/base/ad.powerpc 1.26
distrib/sets/lists/base/md.amd64 1.249
distrib/sets/lists/base/md.amd64 1.252
distrib/sets/lists/base/md.sparc64 1.237
distrib/sets/lists/base/md.sparc64 1.240
distrib/sets/lists/base/shl.mi 1.718
distrib/sets/lists/base/shl.mi 1.721
distrib/sets/lists/base/shl.mi 1.722
distrib/sets/lists/comp/ad.arm 1.62
distrib/sets/lists/comp/ad.mips 1.52
distrib/sets/lists/comp/ad.powerpc 1.74
distrib/sets/lists/comp/ad.powerpc 1.75
distrib/sets/lists/comp/md.amd64 1.226
distrib/sets/lists/comp/md.sparc64 1.189
distrib/sets/lists/comp/mi 1.1918
distrib/sets/lists/comp/mi 1.1919
distrib/sets/lists/comp/mi 1.1937
distrib/sets/lists/comp/mi 1.1937
distrib/sets/lists/comp/shl.mi 1.268
distrib/sets/lists/comp/shl.mi 1.268
distrib/sets/lists/comp/shl.mi 1.269
distrib/sets/lists/debug/ad.arm 1.47
distrib/sets/lists/debug/ad.arm 1.50
distrib/sets/lists/debug/ad.mips 1.43
distrib/sets/lists/debug/ad.mips 1.46
distrib/sets/lists/debug/ad.powerpc 1.23
distrib/sets/lists/debug/ad.powerpc 1.26
distrib/sets/lists/debug/md.amd64 1.67
distrib/sets/lists/debug/md.amd64 1.70
distrib/sets/lists/debug/md.evbmips 1.5
distrib/sets/lists/debug/md.sparc64 1.66
distrib/sets/lists/debug/md.sparc64 1.69
distrib/sets/lists/debug/mi 1.101
distrib/sets/lists/debug/mi 1.101
distrib/sets/lists/debug/mi 1.90
distrib/sets/lists/debug/mi 1.91
distrib/sets/lists/debug/shl.mi 1.77
distrib/sets/lists/debug/shl.mi 1.80
distrib/sets/lists/debug/shl.mi 1.81
lib/Makefile 1.216
lib/Makefile 1.217
lib/Makefile 1.218
lib/libexecinfo/Makefile 1.6
lib/libexecinfo/Makefile 1.7
lib/libexecinfo/Makefile 1.8
lib/libexecinfo/unwind.h 1.3
sys/lib/libunwind/Makefile.inc 1.10

Sync gcc and its libraries with -current, including the import
of gcc 4.8.4, fixes to the use of cpu specific string instructions
on powerpc and a branch delay slot fix for SH from upstream.
 1.10.2.1 06-Apr-2015  skrll Sync with HEAD
 1.11.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.40 23-Aug-2023  rin libunwind: Drop unused/wrong reg_t typedef for alpha
 1.39 27-Jun-2022  martin Fix editing mishap, should fix the build
 1.38 26-Jun-2022  skrll Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for HPPA to hold the return address where the signal trampoline
will resume. XXX Same treatment is needed for HPPA64, but not done as
part of this commit.

Thanks to thorpej for help with this. (ages ago)
 1.37 24-Nov-2021  thorpej Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for SuperH for GBR, MACH, MACL, and SR.
 1.36 22-Nov-2021  thorpej Gah, fix two typos.
 1.35 22-Nov-2021  thorpej Teach the LLVM-derived unwinder about the DWARF pseudo-register defined
by GCC for AArch64 to hold the return address where the signal trampoline
will resume.
 1.34 21-Nov-2021  thorpej Teach the LLVM-derived unwinder about the alternate DWARF pseudo-register
that GCC defines for the PC / return address. This is simply an alias for
the same internal PC register number.
 1.33 21-Nov-2021  thorpej Teach the LLVM-derived unwinder about the DWARF pseudo-register defined
by GCC for PPC32 to hold the return address where the signal trampoline
will resume, as well as for the CTR and XER registers.
 1.32 21-Nov-2021  skrll Add parentheses
 1.31 20-Nov-2021  thorpej Teach the LLVM-derived unwinder about the DWARF pseudo-register defined
by GCC for Alpha to hold the return address where the signal trampoline
will resume.
 1.30 20-Nov-2021  thorpej - Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for MIPS64 to hold the MDHI and MDLO registers, as well as the return
address where the signal trampoline will resume.
- In the MIPS64 validFloatVectorRegister(), compare against the internal
register numbers, not the DWARF register numbers.
 1.29 18-Nov-2021  thorpej - Teach the LLVM-derived unwinder about the DWARF pseudo-registers defined
by GCC for MIPS to hold the MDHI and MDLO registers, as well as the return
address where the signal trampoline will resume. XXX Same treatment is
needed for MIPS64, but not done as part of this commit.
- In the MIPS validFloatVectorRegister(), compare against the internal
register numbers, not the DWARF register numbers.
 1.28 31-May-2021  rin PR toolchain/55837

Stop using enum for flags, as per request from joerg.

#define constants and #undef after use.
 1.27 31-May-2021  rin PR toolchain/55837

Bump LAST_REGISTER and LAST_RESTORE_REG to REGNO_ARM32_S31 for arm.

There are two numbering schemes for VFPv2 registers: s0-s31 and d0-d15.
The former is used by GCC, and the latter is by LLVM. Since libunwind was
derived from LLVM, it has never supported the former. This results in
crashes for GCC-compiled binaries in exception handler of C++, if it
encounters VFPv2 registers when unwinding frames.

This commit adds support for s0-s31 numbering to libunwind. I choose an
implementation in which VFPv2 registers are ``double-counted'' as s0-s31
AND d0-d15. This does not cause real problems, since the former is only
used by GCC, and the later is by LLVM. That is, different numbering
schemes cannot appear in a same frame. To make sure, assertions are added
in order to check this.

I've confirmed that no regression for ATF both for GCC- and LLVM-compiled
userlands.
 1.26 31-May-2021  rin PR toolchain/55837

Fix logic error in copyFloatVectorRegister() for arm; copy s0-s31 or
d0-d31, not both.
 1.25 31-May-2021  rin PR toolchain/55837

Fix pointer arithmetic when copying s0-s31 registers for arm.
 1.24 31-May-2021  rin PR toolchain/55837

Fix DWARF/internal register numbers of s31 for arm.
 1.23 31-May-2021  rin PR toolchain/55837

copyFloatVectorRegister(): Assert register number is valid to make sure.
 1.22 31-May-2021  rin PR toolchain/55837

Misc style fixes for clarity:

- Rename lazyVFP1() and lazyVFP3() to lazyVFPv2() and lazyVFPv3(),
respectively. Note that VFPv1 was obsoleted and replaced by VFPv2.

- Introduce enum for flags.

- Add few comments.

No functional changes.
 1.21 23-Feb-2021  joerg branches: 1.21.4; 1.21.6;
Redo the aarch64 support in libunwind. This included a number of bugs
starting from returning the wrong value from the constructor to
completely bogus offset computations. Drop the ELR support for now.
 1.20 13-Jul-2017  joerg branches: 1.20.18;
GCC 5.3 likes to emit unwind data with float registers, i.e. register
halfs. Compensate.
 1.19 27-Sep-2014  joerg branches: 1.19.2; 1.19.12;
Introduce a separate bit mask for the return address. Use it on HPPA.
 1.18 03-Sep-2014  matt Add OR1K support
 1.17 10-Aug-2014  matt branches: 1.17.4;
Changes to existing files to enable building AARCH64 userland.
evbarm64-el
This is clang only. While gcc4.8 supports aarch64, no netbsd support has
been written for aarch64 with gcc4.8.
 1.16 11-May-2014  joerg branches: 1.16.2; 1.16.4;
Support DWARFish unwind for ARM.
 1.15 26-Apr-2014  joerg Use the return address register from the CIE. Based on patch from Nick
Kledzik.
 1.14 26-Apr-2014  joerg Add initial unwind support for MIPS and MIPS64.
 1.13 19-Apr-2014  joerg Basic unwind support for HPPA.
 1.12 15-Apr-2014  joerg Add basic Alpha support to libunwind.
 1.11 15-Apr-2014  joerg Add initial unwind support for SPARC/SPARC64.
 1.10 14-Apr-2014  joerg Some architectures like SPARC need to apply a fixed offset to the return
address. Introduce such a constant.
 1.9 13-Apr-2014  joerg Move definition of what the native register layout is into
Registers.hpp.
 1.8 02-Apr-2014  joerg branches: 1.8.2;
Support SH3 in our unwinder.
 1.7 25-Mar-2014  joerg Save & restore FP registers.
 1.6 24-Mar-2014  joerg Add m68k support to our unwinder.
 1.5 18-Mar-2014  joerg Add basic unwind support for VAX. PSW handling and stack pointer after
resume is still incomplete.
 1.4 12-Mar-2014  joerg Add a dummy element as explicit padding for PPC32. Fix DWARF enumeration
to match the values created by GCC. Fix DWARFish -> index conversion.
 1.3 11-Mar-2014  joerg Rename IP_PSEUDO_REG to RETURN_REG. Fix PPC value. Sort.
 1.2 29-Jan-2014  matt Add support for non-EABI (DWARF) ARM exception handling.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.8.2.1 10-Aug-2014  tls Rebase.
 1.16.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.4.1 11-May-2014  yamt file Registers.hpp was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.16.2.2 18-May-2014  rmind sync with head
 1.16.2.1 11-May-2014  rmind file Registers.hpp was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.17.4.3 03-Dec-2017  jdolecek update from HEAD
 1.17.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.4.1 10-Aug-2014  tls file Registers.hpp was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.19.12.1 25-Jul-2017  snj Pull up following revision(s) (requested by joerg in ticket #134):
sys/lib/libunwind/Registers.hpp: revision 1.20
GCC 5.3 likes to emit unwind data with float registers, i.e. register
halfs. Compensate.
 1.19.2.1 28-Aug-2017  skrll Sync with HEAD
 1.20.18.1 03-Apr-2021  thorpej Sync with HEAD.
 1.21.6.1 31-May-2021  cjep sync with head
 1.21.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.4 17-Jul-2018  joerg The semantics of DW_CFA_GNU_args_size have changed subtile over the
years. Adopt the new convention that it is call-site specific and that
it should be applied before moving the IP by personality routines, but
not during normal unwinding. Further discussion can be found in
LLVM's phabricator review D38680.
 1.3 28-Apr-2014  joerg branches: 1.3.2; 1.3.4; 1.3.8; 1.3.32; 1.3.34;
GC unwind_info_size.
 1.2 20-Mar-2014  joerg branches: 1.2.2;
Fix DW_CFA_GNU_args_size handling. The primary architecture using this
opcode is VAX. A function call pushes the number of arguments given onto
the stack and "ret" will pop it automatically. The FDE of the caller
contains the amount of stack space used for arguments (and possibly
extra padding), so unwinding has to compensate for this when "returning"
from a function. This is exactly the case when step() is done. The
existing handling in _Unwind_SetIP no longer makes sense.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.3.34.1 10-Jun-2019  christos Sync with HEAD
 1.3.32.1 28-Jul-2018  pgoyette Sync with HEAD
 1.3.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.8.1 28-Apr-2014  tls file UnwindCursor.hpp was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.3.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.4.1 28-Apr-2014  yamt file UnwindCursor.hpp was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.3.2.2 18-May-2014  rmind sync with head
 1.3.2.1 28-Apr-2014  rmind file UnwindCursor.hpp was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.1 14-Oct-2013  joerg branches: 1.1.4; 1.1.6; 1.1.10;
Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 14-Oct-2013  tls file dwarf2.h was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 14-Oct-2013  yamt file dwarf2.h was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 14-Oct-2013  rmind file dwarf2.h was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.11 04-Feb-2019  mrg use __builtin_unreachable() after calls that panic or switch context
 1.10 17-Jul-2018  joerg The semantics of DW_CFA_GNU_args_size have changed subtile over the
years. Adopt the new convention that it is call-site specific and that
it should be applied before moving the IP by personality routines, but
not during normal unwinding. Further discussion can be found in
LLVM's phabricator review D38680.
 1.9 17-Feb-2015  joerg branches: 1.9.16; 1.9.18;
Provide _Unwind_Find_FDE for libgcc_s compatibility.
 1.8 13-Apr-2014  joerg branches: 1.8.2; 1.8.4; 1.8.8; 1.8.10;
Move definition of what the native register layout is into
Registers.hpp.
 1.7 02-Apr-2014  joerg branches: 1.7.2;
Support SH3 in our unwinder.
 1.6 24-Mar-2014  joerg Add m68k support to our unwinder.
 1.5 20-Mar-2014  joerg Fix DW_CFA_GNU_args_size handling. The primary architecture using this
opcode is VAX. A function call pushes the number of arguments given onto
the stack and "ret" will pop it automatically. The FDE of the caller
contains the amount of stack space used for arguments (and possibly
extra padding), so unwinding has to compensate for this when "returning"
from a function. This is exactly the case when step() is done. The
existing handling in _Unwind_SetIP no longer makes sense.
 1.4 18-Mar-2014  joerg Add basic unwind support for VAX. PSW handling and stack pointer after
resume is still incomplete.
 1.3 13-Mar-2014  joerg Add _Unwind_GetIPInfo for libstdc++.
 1.2 29-Jan-2014  matt Add support for non-EABI (DWARF) ARM exception handling.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.7.2.1 10-Aug-2014  tls Rebase.
 1.8.10.1 06-Apr-2015  skrll Sync with HEAD
 1.8.8.3 03-Dec-2017  jdolecek update from HEAD
 1.8.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.8.1 13-Apr-2014  tls file libunwind.cxx was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.8.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8.4.1 13-Apr-2014  yamt file libunwind.cxx was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.8.2.2 18-May-2014  rmind sync with head
 1.8.2.1 13-Apr-2014  rmind file libunwind.cxx was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.9.18.1 10-Jun-2019  christos Sync with HEAD
 1.9.16.1 28-Jul-2018  pgoyette Sync with HEAD
 1.3 17-Feb-2015  joerg Provide _Unwind_Find_FDE for libgcc_s compatibility.
 1.2 13-Mar-2014  joerg branches: 1.2.4; 1.2.6; 1.2.10; 1.2.12;
Add _Unwind_GetIPInfo for libstdc++.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.2.12.1 06-Apr-2015  skrll Sync with HEAD
 1.2.10.3 03-Dec-2017  jdolecek update from HEAD
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 13-Mar-2014  tls file unwind.h was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.2.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.6.1 13-Mar-2014  yamt file unwind.h was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 13-Mar-2014  rmind file unwind.h was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.20 31-May-2021  rin PR toolchain/55837

Fix for jumpto() armeb; use word-wise load for flags, instead of byte-wise one.
 1.19 31-May-2021  rin PR toolchain/55837

Misc style fixes for clarity:

- Rename lazyVFP1() and lazyVFP3() to lazyVFPv2() and lazyVFPv3(),
respectively. Note that VFPv1 was obsoleted and replaced by VFPv2.

- Introduce enum for flags.

- Add few comments.

No functional changes.
 1.18 23-Feb-2021  joerg branches: 1.18.4; 1.18.6;
Redo the aarch64 support in libunwind. This included a number of bugs
starting from returning the wrong value from the constructor to
completely bogus offset computations. Drop the ELR support for now.
 1.17 25-May-2015  matt branches: 1.17.30;
Use ARM_ENTRY since these aren't thumb compatible.
 1.16 03-Sep-2014  matt branches: 1.16.2;
Add OR1K support
 1.15 10-Aug-2014  matt branches: 1.15.4;
Changes to existing files to enable building AARCH64 userland.
evbarm64-el
This is clang only. While gcc4.8 supports aarch64, no netbsd support has
been written for aarch64 with gcc4.8.
 1.14 14-May-2014  joerg branches: 1.14.2; 1.14.4;
Lazy VFP processing works a lot better if the functions contain a return
instruction.
 1.13 11-May-2014  joerg Support DWARFish unwind for ARM.
 1.12 26-Apr-2014  joerg Add initial unwind support for MIPS and MIPS64.
 1.11 19-Apr-2014  joerg Basic unwind support for HPPA.
 1.10 15-Apr-2014  joerg Add basic Alpha support to libunwind.
 1.9 15-Apr-2014  joerg Add initial unwind support for SPARC/SPARC64.
 1.8 02-Apr-2014  joerg branches: 1.8.2;
Support SH3 in our unwinder.
 1.7 25-Mar-2014  joerg Save & restore FP registers.
 1.6 24-Mar-2014  joerg Add m68k support to our unwinder.
 1.5 19-Mar-2014  joerg Drop XXX, spell R14 as SP.
 1.4 18-Mar-2014  joerg Add basic unwind support for VAX. PSW handling and stack pointer after
resume is still incomplete.
 1.3 12-Mar-2014  joerg Add a dummy element as explicit padding for PPC32. Fix DWARF enumeration
to match the values created by GCC. Fix DWARFish -> index conversion.
 1.2 29-Jan-2014  matt Add support for non-EABI (DWARF) ARM exception handling.
 1.1 14-Oct-2013  joerg Add a heavily modified version of Apple's libunwind as released under
MIT license in libc++abi. At the moment, only x86 support is tested.
 1.8.2.1 10-Aug-2014  tls Rebase.
 1.14.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.4.1 14-May-2014  yamt file unwind_registers.S was added on branch yamt-pagecache on 2014-05-22 11:41:05 +0000
 1.14.2.2 18-May-2014  rmind sync with head
 1.14.2.1 14-May-2014  rmind file unwind_registers.S was added on branch rmind-smpnet on 2014-05-18 17:46:09 +0000
 1.15.4.3 03-Dec-2017  jdolecek update from HEAD
 1.15.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.4.1 10-Aug-2014  tls file unwind_registers.S was added on branch tls-maxphys on 2014-08-20 00:04:30 +0000
 1.16.2.1 06-Jun-2015  skrll Sync with HEAD
 1.17.30.1 03-Apr-2021  thorpej Sync with HEAD.
 1.18.6.1 31-May-2021  cjep sync with head
 1.18.4.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.6 04-Dec-2020  thorpej Build x86emu.c with -fno-inline, otherwise all of the auto-inlining
the compiler does causes stack usage to exceed the limits we've set.
 1.5 03-Sep-2015  uebayasi branches: 1.5.30;
Set buildprefix.
 1.4 01-Sep-2015  uebayasi Use "prefix" to specify path out of $S.
 1.3 13-Mar-2009  cube branches: 1.3.22; 1.3.40;
Follow the syntax of file conditionals for makeoptions, using minor case
versions of options.
 1.2 21-Dec-2007  joerg branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.18; 1.2.26; 1.2.32;
Add virtual i8254 for x86emu.
 1.1 13-Dec-2007  joerg branches: 1.1.2;
Add glue for x86emu and build it as part of i386/ALL.
 1.1.2.3 02-Jan-2008  bouyer Sync with HEAD
 1.1.2.2 13-Dec-2007  bouyer Sync with HEAD
 1.1.2.1 13-Dec-2007  bouyer file files.x86emu was added on branch bouyer-xeni386 on 2007-12-13 22:52:38 +0000
 1.2.32.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.26.1 28-Apr-2009  skrll Sync with HEAD.
 1.2.18.1 04-May-2009  yamt sync with head.
 1.2.8.2 21-Jan-2008  yamt sync with head
 1.2.8.1 21-Dec-2007  yamt file files.x86emu was added on branch yamt-lazymbuf on 2008-01-21 09:46:38 +0000
 1.2.6.2 09-Jan-2008  matt sync with HEAD
 1.2.6.1 21-Dec-2007  matt file files.x86emu was added on branch matt-armv6 on 2008-01-09 01:56:47 +0000
 1.2.4.2 26-Dec-2007  ad Sync with head.
 1.2.4.1 21-Dec-2007  ad file files.x86emu was added on branch vmlocking2 on 2007-12-26 22:51:39 +0000
 1.2.2.2 21-Dec-2007  joerg Add virtual i8254 for x86emu.
 1.2.2.1 21-Dec-2007  joerg file files.x86emu was added on branch mjf-devfs on 2007-12-21 17:45:51 +0000
 1.3.40.1 22-Sep-2015  skrll Sync with HEAD
 1.3.22.1 03-Dec-2017  jdolecek update from HEAD
 1.5.30.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.24 07-Oct-2023  rin Drop -O[01] hacks for vax; no longer necessary for patched GCC 10

PR port-vax/57646: Import major vax toolchain fix by Kalvis Duckmanton

XXXRO: GCC 12 may require hacks for a while, but it turned out that
GCC 12 should be treated differently from older versions; a lot of new
files need -O[01] flags, while some may no longer require it.

I will take a look later.

Note that these hacks are not required if Kalvis's patches for GCC 12
are applied.

Keep doc/HACKS entries for a while (will be sync with update for GCC 12).

diff --git a/crypto/external/bsd/openssh/lib/Makefile b/crypto/external/bsd/openssh/lib/Makefile
index 96a93f5e396..4e38be1b642 100644
--- a/crypto/external/bsd/openssh/lib/Makefile
+++ b/crypto/external/bsd/openssh/lib/Makefile
@@ -117,12 +117,6 @@ COPTS.${f}.c+= -Wno-pointer-sign
# XXX
COPTS.channels.c+= -fno-strict-aliasing

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.poly1305.c+= -O0
-COPTS.umac.c+= -O0
-.endif
-
COPTS.hostfile.c+= ${CC_WNO_FORMAT_TRUNCATION}
COPTS.sshkey.c+= ${CC_WNO_FORMAT_TRUNCATION}
COPTS.cipher.c+= -Wno-error=deprecated-declarations
diff --git a/distrib/utils/x_ping/Makefile b/distrib/utils/x_ping/Makefile
index f1c452a0d60..8ee77580a3f 100644
--- a/distrib/utils/x_ping/Makefile
+++ b/distrib/utils/x_ping/Makefile
@@ -12,10 +12,6 @@ CPPFLAGS+= -I${SRCDIR} -DCRUNCHOPS
DPADD= ${LIBM}
LDADD= -lm

-.if ${MACHINE_ARCH} == "vax"
-COPTS.ping.c=-O0
-.endif
-
.include <bsd.prog.mk>

.PATH: ${SRCDIR}
diff --git a/external/apache2/argon2/lib/libargon2/Makefile.inc b/external/apache2/argon2/lib/libargon2/Makefile.inc
index d3f4470c6c7..6a1dd146d7d 100644
--- a/external/apache2/argon2/lib/libargon2/Makefile.inc
+++ b/external/apache2/argon2/lib/libargon2/Makefile.inc
@@ -16,7 +16,3 @@ CFLAGS+= -pthread
LDADD+=-lpthread
DPADD+=${LIBPTHREAD}
.endif
-
-.if ${MACHINE} == "vax"
-COPTS.blake2b.c+= -O0
-.endif
diff --git a/external/bsd/jemalloc/lib/Makefile.inc b/external/bsd/jemalloc/lib/Makefile.inc
index 2f524358f46..d5da774f293 100644
--- a/external/bsd/jemalloc/lib/Makefile.inc
+++ b/external/bsd/jemalloc/lib/Makefile.inc
@@ -53,12 +53,6 @@ COPTS.ctl.c+=-Wno-error=stack-protector
COPTS.stats.c+=-Wno-error=stack-protector
COPTS.tcache.c+=-Wno-error=stack-protector

-.if ${MACHINE_ARCH} == "vax"
-# in merge_overlapping_regs, at regrename.c
-COPTS.arena.c+=-O0
-COPTS.extent.c+=-O0
-.endif
-
SRCS+=${JEMALLOC_SRCS}

jemalloc.d jemalloc.pico jemalloc.o jemalloc.ln jemalloc.po jemalloc.go: \
diff --git a/external/bsd/mdocml/lib/libmandoc/Makefile b/external/bsd/mdocml/lib/libmandoc/Makefile
index 40d7e29ae88..dfd3077a2c7 100644
--- a/external/bsd/mdocml/lib/libmandoc/Makefile
+++ b/external/bsd/mdocml/lib/libmandoc/Makefile
@@ -39,11 +39,6 @@ tbl_opts.c

MAN= mandoc.3

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.mdoc_macro.c+=-O0
-.endif
-
COPTS.man_validate.c+=-Wno-error=array-bounds

.include <bsd.lib.mk>
diff --git a/external/gpl3/binutils.old/lib/libbfd/Makefile b/external/gpl3/binutils.old/lib/libbfd/Makefile
index 03477232b55..74a354532fa 100644
--- a/external/gpl3/binutils.old/lib/libbfd/Makefile
+++ b/external/gpl3/binutils.old/lib/libbfd/Makefile
@@ -41,10 +41,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
-DDEBUGDIR=\"${DEBUGDIR}\" -DLIBDIR=\"${LIBDIR}\" \
-DBINDIR=\"${BINDIR}\"

-.if (${BFD_MACHINE_ARCH} == "vax")
-CPPFLAGS.elf.c += -O0
-.endif
-
COPTS.pei-x86_64.c+= -Wno-stack-protector
COPTS.elfxx-mips.c+= -Wno-stack-protector
COPTS.elf.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-overflow :}
diff --git a/external/gpl3/binutils/lib/libbfd/Makefile b/external/gpl3/binutils/lib/libbfd/Makefile
index 00cb2b20081..a3f0c25fd35 100644
--- a/external/gpl3/binutils/lib/libbfd/Makefile
+++ b/external/gpl3/binutils/lib/libbfd/Makefile
@@ -41,10 +41,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
-DDEBUGDIR=\"${DEBUGDIR}\" -DLIBDIR=\"${LIBDIR}\" \
-DBINDIR=\"${BINDIR}\"

-.if (${BFD_MACHINE_ARCH} == "vax")
-CPPFLAGS.elf.c += -O0
-.endif
-
COPTS.pei-x86_64.c+= -Wno-stack-protector
COPTS.elfxx-mips.c+= -Wno-stack-protector
COPTS.elf.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-overflow :}
diff --git a/external/gpl3/gcc.old/lib/Makefile.sanitizer b/external/gpl3/gcc.old/lib/Makefile.sanitizer
index efd36ae4bee..5173a5109a0 100644
--- a/external/gpl3/gcc.old/lib/Makefile.sanitizer
+++ b/external/gpl3/gcc.old/lib/Makefile.sanitizer
@@ -88,22 +88,3 @@ COPTS+=-fno-builtin -fno-exceptions -fno-rtti -funwind-tables

# Can't profile without it`
#-fomit-frame-pointer
-
-.if ${MACHINE_ARCH} == "vax"
-COPTS.sanitizer_allocator.cc += -O1
-COPTS.sanitizer_common.cc += -O1
-COPTS.sanitizer_common_libcdep.cc += -O1
-COPTS.sanitizer_coverage_libcdep.cc += -O1
-COPTS.sanitizer_coverage_mapping_libcdep.cc += -O1
-COPTS.sanitizer_deadlock_detector1.cc += -O1
-COPTS.sanitizer_mac.cc += -O1
-COPTS.sanitizer_netbsd.cc += -O1
-COPTS.sanitizer_posix.cc += -O1
-COPTS.sanitizer_printf.cc += -O1
-COPTS.sanitizer_procmaps_common.cc += -O1
-COPTS.sanitizer_stackdepot.cc += -O1
-COPTS.sanitizer_symbolizer_libcdep.cc += -O1
-COPTS.sanitizer_symbolizer_report.cc += -O1
-COPTS.ubsan_diag.cc += -O1
-COPTS.ubsan_init.cc += -O1
-.endif
diff --git a/external/gpl3/gcc.old/lib/libasan/Makefile b/external/gpl3/gcc.old/lib/libasan/Makefile
index 1e6f9608abe..3da7bbf2f58 100644
--- a/external/gpl3/gcc.old/lib/libasan/Makefile
+++ b/external/gpl3/gcc.old/lib/libasan/Makefile
@@ -49,14 +49,6 @@ LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
LIBDPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread
CPPFLAGS+=-DCAN_SANITIZE_UB=0

-.if ${MACHINE_ARCH} == "vax"
-COPTS.asan_allocator.cc += -O1
-COPTS.asan_report.cc += -O1
-COPTS.sanitizer_file.cc += -O1
-COPTS.ubsan_diag.cc += -O1
-COPTS.ubsan_init.cc += -O1
-.endif
-
.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
COPTS.asan_interceptors.cc += -O1
.endif
diff --git a/external/gpl3/gcc.old/lib/liblsan/Makefile b/external/gpl3/gcc.old/lib/liblsan/Makefile
index 4578544a9a8..ddb7981077c 100644
--- a/external/gpl3/gcc.old/lib/liblsan/Makefile
+++ b/external/gpl3/gcc.old/lib/liblsan/Makefile
@@ -16,11 +16,6 @@ LSAN_SRCS+= \
lsan_linux.cc \
lsan_thread.cc

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lsan_allocator.cc += -O1
-COPTS.sanitizer_file.cc += -O1
-.endif
-
LIB= lsan
SRCS+= ${LSAN_SRCS}
LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
diff --git a/external/gpl3/gcc.old/lib/libubsan/Makefile b/external/gpl3/gcc.old/lib/libubsan/Makefile
index 2e2faca7b1c..9de82550d14 100644
--- a/external/gpl3/gcc.old/lib/libubsan/Makefile
+++ b/external/gpl3/gcc.old/lib/libubsan/Makefile
@@ -26,10 +26,6 @@ UBSAN_SRCS= \
COPTS.${_s}.cc+=-frtti
.endfor

-.if ${MACHINE_ARCH} == "vax"
-COPTS.sanitizer_file.cc += -O1
-.endif
-
LIB= ubsan
SRCS+= ${UBSAN_SRCS}
LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm
diff --git a/external/gpl3/gcc.old/usr.bin/cc1/Makefile b/external/gpl3/gcc.old/usr.bin/cc1/Makefile
index c55e292ee8e..ff12a5be524 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1/Makefile
@@ -46,17 +46,6 @@ CPPFLAGS.default-c.c+= -I${BACKENDOBJ}
BUILDSYMLINKS+= ${GNUHOSTDIST}/gcc/config/sh/sh-c.cc sh-c.c
.endif

-.if ${MACHINE_CPU} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1-checksum.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile b/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
index 3123ee0d60b..aab82ad3448 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1obj/Makefile
@@ -44,16 +44,8 @@ COPTS.objc-act.c+= -Wno-stack-protector
COPTS.objc-gnu-runtime-abi-01.c+= -Wno-stack-protector
COPTS.objc-next-runtime-abi-01.c+= -Wno-stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1obj-checksum.c+=-O0
-.endif
+COPTS.c-cppbuiltin.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}
+COPTS.c-typeck.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}

.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
diff --git a/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile b/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
index b9c108251c5..e04e8fc7f53 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile
@@ -69,18 +69,6 @@ COPTS.objc-act.c+= -Wno-stack-protector
COPTS.objc-gnu-runtime-abi-01.c+= -Wno-stack-protector
COPTS.objc-next-runtime-abi-01.c+= -Wno-stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.c-decl.c+=-O0
-COPTS.c-typeck.c+=-O0
-COPTS.c-array-notation.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1obj-checksum.c+=-O0
-COPTS.decl.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile b/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
index 7936efd3a5e..7c54559e21a 100644
--- a/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/cc1plus/Makefile
@@ -31,23 +31,6 @@ CHECKSUM_OBJS= ${LIBBACKTRACEOBJ}/libbacktrace.a \

CFLAGS+= -Wno-error=stack-protector

-.if ${MACHINE_ARCH} == "vax"
-COPTS.call.c+=-O0
-COPTS.decl.c+=-O0
-COPTS.typeck2.c+=-O0
-COPTS.class.c+=-O0
-COPTS.typeck.c+=-O0
-COPTS.init.c+=-O0
-COPTS.semantics.c+=-O0
-COPTS.mangle.c+=-O0
-COPTS.constexpr.c+=-O0
-COPTS.c-common.c+=-O0
-COPTS.c-ada-spec.c+=-O0
-COPTS.cilk.c+=-O0
-COPTS.c-ubsan.c+=-O0
-COPTS.cc1plus-checksum.c+=-O0
-.endif
-
.if ${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel"
COPTS.c-common.c+=-O3
.endif
diff --git a/external/gpl3/gcc.old/usr.bin/gcc/Makefile b/external/gpl3/gcc.old/usr.bin/gcc/Makefile
index 7a66d77ffc7..a5a4b1c3adf 100644
--- a/external/gpl3/gcc.old/usr.bin/gcc/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/gcc/Makefile
@@ -25,9 +25,6 @@ ${SRCS}: ${GCCARCH}/defs.mk
.include <bsd.info.mk>

COPTS.gcc.c= -Wno-stack-protector
-.if ${MACHINE_ARCH} == "vax"
-COPTS.dse.c= -O1
-.endif

.PATH: ${DIST}/gcc ${DIST}/gcc/doc ${DIST}/gcc/c

diff --git a/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile b/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
index 751d1513eec..33aeb1c9898 100644
--- a/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile
@@ -14,10 +14,6 @@ SRCS= decNumber.c decContext.c decimal32.c decimal64.c decimal128.c
CPPFLAGS+= -I${.CURDIR}/arch/${GCC_MACHINE_ARCH} -I${DIST}/libdecnumber
CPPFLAGS+= -I${DIST}/libgcc

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.include <bsd.lib.mk>

# Force using C++ for this
diff --git a/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile b/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
index 90f44a9fcf6..fd251464fb7 100644
--- a/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/lto-dump/Makefile
@@ -24,11 +24,6 @@ COPTS.lto-common.c+= -Wno-stack-protector
.include "../Makefile.backtrace"
.include "../Makefile.libdecnumber"

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lto-lang.c+=-O0
-COPTS.lto-symtab.c+=-O0
-.endif
-
LDADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} -lintl -lz -lm
DPADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} ${LIBINTL} ${LIBZ} ${LIBM}

diff --git a/external/gpl3/gcc.old/usr.bin/lto1/Makefile b/external/gpl3/gcc.old/usr.bin/lto1/Makefile
index 4c49161a64c..340d3c6124f 100644
--- a/external/gpl3/gcc.old/usr.bin/lto1/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/lto1/Makefile
@@ -21,11 +21,6 @@ COPTS.lto-common.c+= -Wno-stack-protector
.include "../Makefile.libcpp"
.include "../Makefile.libdecnumber"

-.if ${MACHINE_ARCH} == "vax"
-COPTS.lto-lang.c+=-O0
-COPTS.lto-symtab.c+=-O0
-.endif
-
LDADD+= ${LIBIBERTYOBJ}/libiberty.a
DPADD+= ${LIBIBERTYOBJ}/libiberty.a
LDADD+= ${LIBIBERTY} ${LIBMPC} ${LIBMPFR} ${LIBGMP} -lintl -lz -lm
diff --git a/external/gpl3/gdb.old/lib/libdecnumber/Makefile b/external/gpl3/gdb.old/lib/libdecnumber/Makefile
index bcd4ae5b222..ce28811526b 100644
--- a/external/gpl3/gdb.old/lib/libdecnumber/Makefile
+++ b/external/gpl3/gdb.old/lib/libdecnumber/Makefile
@@ -18,10 +18,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${GDB_MACHINE_ARCH} \

SRCS= ${G_OBJS:.o=.c} ${G_SOURCES}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.PATH: ${DIST}/libdecnumber ${DIST}/libdecnumber/dpd

.include <bsd.lib.mk>
diff --git a/external/gpl3/gdb/lib/libdecnumber/Makefile b/external/gpl3/gdb/lib/libdecnumber/Makefile
index c95d36e3dfa..e3169865304 100644
--- a/external/gpl3/gdb/lib/libdecnumber/Makefile
+++ b/external/gpl3/gdb/lib/libdecnumber/Makefile
@@ -18,10 +18,6 @@ CPPFLAGS+= -I${.CURDIR}/arch/${GDB_MACHINE_ARCH} \

SRCS= ${G_OBJS:.o=.c} ${G_SOURCES}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.decNumber.c=-O0
-.endif
-
.PATH: ${DIST}/libdecnumber ${DIST}/libdecnumber/dpd ${DIST}/libdecnumber/bid

.include <bsd.lib.mk>
diff --git a/external/gpl3/gdb/lib/libgdb/Makefile b/external/gpl3/gdb/lib/libgdb/Makefile
index b87a515d13a..c118c363975 100644
--- a/external/gpl3/gdb/lib/libgdb/Makefile
+++ b/external/gpl3/gdb/lib/libgdb/Makefile
@@ -66,12 +66,6 @@ CFLAGS:= ${CXXFLAGS} -std=gnu++17 -Wno-error=stack-protector

ada-exp.c: ada-lex.c

-.if ${MACHINE} == "vax"
-. if ${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 8
-COPTS.read.c+= -O0
-. endif
-.endif
-
# These are generated by implicit rules and are not easy to generate
CLEANDIRFILES+= \
ada-exp.c ada-lex.c \
diff --git a/external/mit/xorg/lib/gallium.old/Makefile b/external/mit/xorg/lib/gallium.old/Makefile
index 55b2fe3d1c1..bfa40c8974f 100644
--- a/external/mit/xorg/lib/gallium.old/Makefile
+++ b/external/mit/xorg/lib/gallium.old/Makefile
@@ -1211,10 +1211,6 @@ SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHL
COPTS+= ${${ACTIVE_CC} == "clang":? -Wa,-Av8plus :}
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.nir.c += -O1
-.endif
-
# XXXGCC12
.if ${MACHINE_ARCH} == "m68k"
COPTS.st_glsl_to_tgsi.cpp += -O1
diff --git a/external/mit/xorg/lib/gallium/Makefile b/external/mit/xorg/lib/gallium/Makefile
index 6778a8c11c8..9f1422080fe 100644
--- a/external/mit/xorg/lib/gallium/Makefile
+++ b/external/mit/xorg/lib/gallium/Makefile
@@ -1428,10 +1428,6 @@ SYMLINKS+= gallium_dri.so.${SHLIB_MAJOR}.debug ${DRIDEBUGDIR}/${_d}_dri.so.${SHL
COPTS+= ${${ACTIVE_CC} == "clang":? -Wa,-Av8plus :}
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.nir.c += -O1
-.endif
-
COPTS.u_atomic.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-builtin-declaration-mismatch :}

.include <bsd.lib.mk>
diff --git a/external/mit/xorg/lib/libX11/Makefile.libx11 b/external/mit/xorg/lib/libX11/Makefile.libx11
index e103d9ace12..0e55c2a4732 100644
--- a/external/mit/xorg/lib/libX11/Makefile.libx11
+++ b/external/mit/xorg/lib/libX11/Makefile.libx11
@@ -471,11 +471,6 @@ COPTS.OpenDis.c+= -Wno-error # XXX xf86bigfstr.h
COPTS.XlibInt.c+= -Wno-error # XXX xcmiscstr.h
COPTS.XKBBind.c+= -Wno-deprecated-declarations # uses XKeycodeToKeysym

-# XXX
-.if ${MACHINE} == "vax"
-COPTS.lcWrap.c+= -O0
-.endif
-
CWARNFLAGS.clang+= -Wno-string-plus-int

.include "${NETBSDSRCDIR}/external/mit/xorg/tools/makekeys/Makefile.makekeys"
diff --git a/games/gomoku/Makefile b/games/gomoku/Makefile
index e86a63aaea7..678537066ed 100644
--- a/games/gomoku/Makefile
+++ b/games/gomoku/Makefile
@@ -9,10 +9,6 @@ LDADD= -lcurses -lterminfo
HIDEGAME=hidegame
CPPFLAGS+= ${DEBUG:D-DDEBUG}

-.if ${MACHINE} == "vax"
-COPTS.pickmove.c += -O0
-.endif
-
#WARNS= 6 # would produce warnings about small integer types
LINTFLAGS+= -w # treat warnings as errors
LINTFLAGS+= -T # strict bool mode
diff --git a/games/phantasia/Makefile b/games/phantasia/Makefile
index e9c53f23ae5..b919dac17c6 100644
--- a/games/phantasia/Makefile
+++ b/games/phantasia/Makefile
@@ -52,7 +52,3 @@ map: map.c
./map | plot > /dev/tty

.include <bsd.prog.mk>
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.misc.c+= -O0
-.endif
diff --git a/lib/i18n_module/UTF7/Makefile b/lib/i18n_module/UTF7/Makefile
index 712c1515d42..7136f7f0cc3 100644
--- a/lib/i18n_module/UTF7/Makefile
+++ b/lib/i18n_module/UTF7/Makefile
@@ -3,6 +3,3 @@
SRCPRE=citrus_
.include <bsd.lib.mk>

-.if ${MACHINE_ARCH} == "vax" && defined(HAVE_GCC)
-COPTS.citrus_utf7.c+= -O0
-.endif
diff --git a/lib/libbz2/Makefile b/lib/libbz2/Makefile
index b2aea1e04b0..e60a2862d48 100644
--- a/lib/libbz2/Makefile
+++ b/lib/libbz2/Makefile
@@ -15,11 +15,6 @@ SRCS= blocksort.c huffman.c crctable.c randtable.c compress.c \
INCS= bzlib.h
INCSDIR= /usr/include

-# XXX huffman.c gets mis-compiled with 2.95.3
-.if ${MACHINE_ARCH} == "vax"
-COPTS+= -O0
-.endif
-
COPTS+= ${CC_WNO_IMPLICIT_FALLTHROUGH}

# XXX blocksort.c gets mis-compiled with 4.1
diff --git a/lib/libc/gdtoa/Makefile.inc b/lib/libc/gdtoa/Makefile.inc
index 132686fc33d..609da919803 100644
--- a/lib/libc/gdtoa/Makefile.inc
+++ b/lib/libc/gdtoa/Makefile.inc
@@ -44,10 +44,3 @@ SRCS+= dmisc.c \
.if ${MACHINE_ARCH} != "vax"
SRCS+= strtord.c
.endif
-
-# XXX revisit with newer GCC.
-# Ensure numbers like 0xffff319f5fa95963 print correctly
-# ("999999999999999.98", not garbage like "?A>C>@>C:BA;A><.:<")
-.if ${MACHINE_ARCH} == "vax" && defined(HAVE_GCC)
-COPTS.misc.c+= -O0
-.endif
diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile
index cb3f89d6d09..e9c8be820da 100644
--- a/lib/libcrypt/Makefile
+++ b/lib/libcrypt/Makefile
@@ -30,9 +30,6 @@ SRCS+= crypt-argon2.c
SRCS+= ${src}
COPTS.${src}+= -fvisibility=hidden
. endfor
-. if ${MACHINE} == "vax"
-COPTS.blake2b.c+= -O0
-. endif
.endif

WARNS?= 5
diff --git a/libexec/ld.elf_so/Makefile b/libexec/ld.elf_so/Makefile
index f5baae1e883..24f7e1121e5 100644
--- a/libexec/ld.elf_so/Makefile
+++ b/libexec/ld.elf_so/Makefile
@@ -141,10 +141,6 @@ CPPFLAGS+= -DRTLD_DEFAULT_LIBRARY_PATH=\"${SHLIBDIR}:${LIBDIR}\"
COPTS.rtld.c+= -Wno-stack-protector
COPTS.symbol.c+=-Wno-stack-protector

-.if ${MACHINE_CPU} == "vax"
-COPTS.rtld.c+= -O0
-.endif
-
LDADD+= -Wl,--version-script=${.CURDIR}/symbols.map
LDADD+= -L${CLIBOBJ} -L${DESTDIR}${LIBDIR}
.if ${MKPICLIB} != "no"
diff --git a/sbin/fsck_ffs/Makefile.common b/sbin/fsck_ffs/Makefile.common
index 765638b2801..824e3bf2628 100644
--- a/sbin/fsck_ffs/Makefile.common
+++ b/sbin/fsck_ffs/Makefile.common
@@ -36,7 +36,3 @@ COPTS.ffs_appleufs.c+= -Wno-pointer-sign
.if ${MACHINE_ARCH} == "m68000"
COPTS.pass1.c+= -fno-tree-fre -fno-tree-lrs
.endif
-.if ${MACHINE_ARCH} == "vax"
-COPTS.pass1.c+= -O0
-COPTS.inode.c+= -O0
-.endif
diff --git a/sbin/fsdb/Makefile b/sbin/fsdb/Makefile
index c039f73a1eb..3b0331e5880 100644
--- a/sbin/fsdb/Makefile
+++ b/sbin/fsdb/Makefile
@@ -39,12 +39,6 @@ COPTS.${f}.c+= -Wno-pointer-sign
COPTS.pass1.c+= -fno-tree-fre -fno-tree-lrs
.endif

-.if ${MACHINE_ARCH} == "vax"
-COPTS.pass1.c+= -O0
-COPTS.inode.c+= -O0
-COPTS.fsdb.c+= -O0
-.endif
-
CWARNFLAGS.gcc+= ${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

.include <bsd.prog.mk>
diff --git a/sbin/newfs_ext2fs/Makefile b/sbin/newfs_ext2fs/Makefile
index 40a44b9a038..ecfdbff4d3a 100644
--- a/sbin/newfs_ext2fs/Makefile
+++ b/sbin/newfs_ext2fs/Makefile
@@ -20,8 +20,4 @@ DPADD+=${LIBPROP}

.PATH: ${NETBSDSRCDIR}/sys/ufs/ext2fs ${FSCK}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.mke2fs.c=-O0
-.endif
-
.include <bsd.prog.mk>
diff --git a/sbin/ping/Makefile b/sbin/ping/Makefile
index 4f33501ea7a..1f7f56e3ea5 100644
--- a/sbin/ping/Makefile
+++ b/sbin/ping/Makefile
@@ -12,8 +12,4 @@ CPPFLAGS+= -DIPSEC
LDADD+= -lipsec
DPADD+= ${LIBIPSEC}

-.if ${MACHINE_ARCH} == "vax"
-COPTS.ping.c=-O0
-.endif
-
.include <bsd.prog.mk>
diff --git a/sys/arch/vax/conf/Makefile.vax b/sys/arch/vax/conf/Makefile.vax
index cf095d54a86..c483eaa644a 100644
--- a/sys/arch/vax/conf/Makefile.vax
+++ b/sys/arch/vax/conf/Makefile.vax
@@ -34,7 +34,6 @@ GENASSYM_CONF= ${VAX}/vax/genassym.cf
CPPFLAGS+= -D_VAX_INLINE_
AFLAGS+= -x assembler-with-cpp -fno-pic
CFLAGS+= -fno-pic
-COPTS.wsmux.c+= ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 9:? -O1 :}


##
diff --git a/sys/lib/libsa/Makefile b/sys/lib/libsa/Makefile
index 718c97ce857..4ef3840c753 100644
--- a/sys/lib/libsa/Makefile
+++ b/sys/lib/libsa/Makefile
@@ -96,7 +96,3 @@ SRCS+= ufs.c
lib${LIB}.o:: ${OBJS:O} __buildstdlib

CPPFLAGS+= -Wno-pointer-sign
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.bootp.c+= -O0
-.endif
diff --git a/sys/lib/libz/Makefile b/sys/lib/libz/Makefile
index 6945c0da6c6..61fb7d4f652 100644
--- a/sys/lib/libz/Makefile
+++ b/sys/lib/libz/Makefile
@@ -25,7 +25,3 @@ CLEANFILES+= lib${LIB}.o
.include <bsd.lib.mk>

lib${LIB}.o:: ${OBJS:O} __buildstdlib
-
-.if defined(HAVE_GCC) && ${MACHINE_ARCH} == "vax"
-COPTS.inftrees.c+= -O0
-.endif
diff --git a/sys/modules/lfs/Makefile b/sys/modules/lfs/Makefile
index 962538821a5..ea8f187e160 100644
--- a/sys/modules/lfs/Makefile
+++ b/sys/modules/lfs/Makefile
@@ -18,9 +18,4 @@ SRCS+= ulfs_bmap.c ulfs_dirhash.c ulfs_inode.c ulfs_lookup.c \

WARNS= 3

-.if ${MACHINE} == "vax"
-# GCC 6.5 and 7.4 cannot compile this with -DDIAGNOSTIC and -O2/-O1
-COPTS.lfs_inode.c+= -O0
-.endif
-
.include <bsd.kmodule.mk>
diff --git a/sys/rump/fs/lib/liblfs/Makefile b/sys/rump/fs/lib/liblfs/Makefile
index abade3767d9..68b74c62502 100644
--- a/sys/rump/fs/lib/liblfs/Makefile
+++ b/sys/rump/fs/lib/liblfs/Makefile
@@ -17,9 +17,6 @@ SRCS+= ulfs_bmap.c ulfs_dirhash.c ulfs_extattr.c \


CFLAGS+= -DLFS_KERNEL_RFW
-.if ${MACHINE_ARCH} == "vax"
-COPTS.lfs_inode.c+=-O0
-.endif

.include <bsd.lib.mk>
.include <bsd.klinks.mk>
diff --git a/usr.sbin/mtrace/Makefile b/usr.sbin/mtrace/Makefile
index aef09db6198..9c125c15265 100644
--- a/usr.sbin/mtrace/Makefile
+++ b/usr.sbin/mtrace/Makefile
@@ -12,10 +12,6 @@ PROG= mtrace
SRCS= igmp.c inet.c kern.c mtrace.c
MAN= mtrace.8

-.if ${MACHINE_ARCH} == "vax"
-COPTS.mtrace.c=-O0
-.endif
-
BINMODE=4555
BINOWN= root

diff --git a/external/gpl3/gcc.old/usr.bin/backend/Makefile b/external/gpl3/gcc.old/usr.bin/backend/Makefile
index d69a26fe619..99e881c783d 100644
--- a/external/gpl3/gcc.old/usr.bin/backend/Makefile
+++ b/external/gpl3/gcc.old/usr.bin/backend/Makefile
@@ -533,68 +533,9 @@ COPTS.insn-recog.c+=-Wno-error

.if ${GCC_MACHINE_ARCH} == "vax"
CPPFLAGS+=-I${.CURDIR}/../../lib/libgcc/libgcov/arch/${GCC_MACHINE_ARCH}
-COPTS.builtins.c+=-O0
-COPTS.calls.c+=-O0
-COPTS.convert.c+=-O0
-COPTS.data-streamer-out.c+=-O0
-COPTS.dse.c+=-O0 # XXX port-vax/51967
-COPTS.dwarf2out.c+=-O0
-COPTS.expmed.c+=-O0
-COPTS.expr.c+=-O0 -Wno-error=tautological-compare
-COPTS.fixed-value.c+=-O0
-COPTS.fold-const.c+=-O0
-COPTS.generic-match.c+=-O0
-COPTS.gimple-fold.c+=-O0
-COPTS.gimple-match.c+=-O0
-COPTS.gimple-ssa-strength-reduction.c+=-O0
-COPTS.gimple-ssa-warn-restrict.c+=-O0
-COPTS.gimple.c+=-O0
-COPTS.internal-fn.c+=-O0
-COPTS.lto-streamer-out.c+=-O0
-COPTS.omp-low.c+=-O0
-COPTS.predict.c+=-O0
-COPTS.range-op.cc+=-O0
-COPTS.recog.c+=-O0
-COPTS.sanopt.c+=-O0
-COPTS.stmt.c+=-O0
-COPTS.stor-layout.c+=-O0
-COPTS.targhooks.c+=-O0
-COPTS.tree-affine.c+=-O0
-COPTS.tree-cfg.c+=-O0
-COPTS.tree-data-ref.c+=-O0
-COPTS.tree-eh.c+=-O0
-COPTS.tree-if-conv.c+=-O0
-COPTS.tree-object-size.c+=-O0
-COPTS.tree-parloops.c+=-O0
-COPTS.tree-predcom.c+=-O0
-COPTS.tree-pretty-print.c+=-O0
-COPTS.tree-ssa-alias.c+=-O0
-COPTS.tree-ssa-ccp.c+=-O0
-COPTS.tree-ssa-forwprop.c+=-O0
-COPTS.tree-ssa-loop-ivopts.c+=-O0
-COPTS.tree-ssa-loop-manip.c+=-O0
-COPTS.tree-ssa-loop-niter.c+=-O0
-COPTS.tree-ssa-math-opts.c+=-O0
-COPTS.tree-ssa-phiopt.c+= -O0
-COPTS.tree-ssa-pre.c+=-O0
-COPTS.tree-ssa-reassoc.c+=-O0
-COPTS.tree-ssa-strlen.c+=-O0
-COPTS.tree-ssa-uninit.c+=-O0
-COPTS.tree-ssa.c+=-O0
-COPTS.tree-switch-conversion.c+=-O0
-COPTS.tree-vect-data-refs.c+=-O0
-COPTS.tree-vect-loop-manip.c+=-O0
-COPTS.tree-vect-loop.c+=-O0
-COPTS.tree-vect-patterns.c+=-O0
-COPTS.tree-vect-stmts.c+=-O0
-COPTS.tree-vrp.c+=-O0
-COPTS.tree.c+=-O0
-COPTS.ubsan.c+=-O0
-COPTS.varasm.c+=-O0
-COPTS.vr-values.c+=-O0
-COPTS.web.c+=-O0
-COPTS.wide-int-range.cc+=-O0
-COPTS.wide-int.cc+=-O0
+
+COPTS.expmed.c+=-Wno-error=tautological-compare
+COPTS.expr.c+=-Wno-error=tautological-compare
.else
COPTS.tree.c= ${${ACTIVE_CC} == "clang" :? -O0 :}
.endif
 1.23 05-Jun-2018  christos branches: 1.23.32;
Use the standard build rules.
 1.22 22-Mar-2016  mrg branches: 1.22.16;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.21 07-Sep-2015  uebayasi Order library object build.
 1.20 07-Sep-2015  uebayasi Sprinkle more done messages.
 1.19 14-Jun-2014  mrg branches: 1.19.4;
remove remaining makefile support for GCC < 45 that i found.
 1.18 30-Oct-2011  mrg branches: 1.18.12; 1.18.26;
use LIBISPRIVATE instead of home-grown.
 1.17 03-Jul-2011  mrg apply some -O0 with gcc 4.5 and vax.
 1.16 25-Mar-2009  tls Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.15 23-Jun-2007  isaki branches: 1.15.32; 1.15.42; 1.15.44; 1.15.48; 1.15.52;
Remove _ZLIB_PRIVATE that should have been removed 10 years ago.
 1.14 14-Jan-2006  christos branches: 1.14.28; 1.14.30;
use zlib-1.2.3
 1.13 25-Mar-2003  mycroft branches: 1.13.18; 1.13.30;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.12 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.11 14-Nov-2001  tv Undefine DESTDIR; we don't want the special DESTDIR <bsd.lib.mk>
handling for kernel libraries.

XXX this build method should be replaced by something more sane
 1.10 07-May-1999  drochner branches: 1.10.14; 1.10.16;
Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.9 15-Apr-1999  simonb For the "update-sources" target, don't copy any src/lib/libz sources
that differ only in the first line (the NetBSD RCS header).
 1.8 15-Apr-1999  simonb Add uncompr.c to LIBZSRCS and zalloc.c to SRCS.
 1.7 13-Feb-1999  lukem branches: 1.7.4;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.6 31-May-1997  cjs Back out BUILDDIR and NOINSTALL changes.
 1.5 30-May-1997  cjs Use new NOINSTALL option for libraries that are used only during the build
of a program, and not installed into the final system.
 1.4 07-May-1997  mycroft Use libinstall::, not install:, to prevent instaling LIB.
 1.3 16-Feb-1997  cgd allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.2 22-Jan-1997  cgd branches: 1.2.4;
fix a typo (ZPPFLAGS should have been ZCPPFLAGS)
 1.1 16-Jan-1997  cgd add Makefiles to build kernel 'libz' library, expected to be used by
boot blocks to load compressed images. Sources and headers are copied
from src/lib (src/lib/libz, in particular) by making the 'update-sources'
target in this directory. This library builds in a manner similar to
libkern; much of the Makefile hackery was taken from there.
 1.2.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.14.2 08-Jan-2002  nathanw Catch up to -current.
 1.10.14.1 14-Nov-2001  thorpej Merge from -current, required to cross-build kernels properly.
 1.13.30.1 15-Jan-2006  yamt sync with head.
 1.13.18.2 03-Sep-2007  yamt sync with head.
 1.13.18.1 21-Jun-2006  yamt sync with head.
 1.14.30.1 11-Jul-2007  mjf Sync with head.
 1.14.28.1 15-Jul-2007  ad Sync with head.
 1.15.52.1 21-Apr-2010  matt sync to netbsd-5
 1.15.48.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.44.1 03-May-2009  snj Pull up following revision(s) (requested by tls in ticket #611):
common/dist/zlib/zlib.h: revision 1.3
sys/lib/libkern/crc32.c: revision 1.2
sys/lib/libkern/libkern.h: revision 1.90 via patch
sys/lib/libsa/cread.c: revision 1.23
sys/lib/libz/Makefile: revision 1.16
Fix build problems caused by crc32 addition to libkern. Also, this makes
the i386 bootblocks about 2K smaller than they were before we monkeyed
with crc32 at all.
 1.15.42.1 28-Apr-2009  skrll Sync with HEAD.
 1.15.32.1 04-May-2009  yamt sync with head.
 1.18.26.1 10-Aug-2014  tls Rebase.
 1.18.12.2 03-Dec-2017  jdolecek update from HEAD
 1.18.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.4.2 22-Apr-2016  skrll Sync with HEAD
 1.19.4.1 22-Sep-2015  skrll Sync with HEAD
 1.22.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.23.32.1 08-Oct-2023  martin Pull up following revision(s) (requested by rin in ticket #394):

external/gpl3/binutils/dist/gas/config/tc-vax.h: revision 1.10
tools/gcc/Makefile: revision 1.109
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.16
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.17
external/gpl3/binutils/dist/gas/config/tc-vax.c: revision 1.18
external/gpl3/gcc.old/dist/gcc/recog.c: revision 1.12
external/gpl3/gcc.old/dist/gcc/function.c: revision 1.16
external/gpl3/gcc.old/dist/gcc/dse.c: revision 1.14 - 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.13
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.14
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.15
external/gpl3/gcc.old/dist/gcc/doc/tm.texi.in: revision 1.10
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.17
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.18
external/gpl3/gcc.old/dist/gcc/config/vax/vax.c: revision 1.19
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.13
external/gpl3/gcc.old/usr.bin/backend/Makefile: revision 1.20
external/gpl3/gcc.old/dist/gcc/targhooks.c: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.14
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.15
external/gpl3/gcc.old/dist/gcc/config/vax/builtins.md: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.16
external/gpl3/gcc.old/dist/gcc/config/vax/builtins.md: revision 1.13
external/gpl3/gcc.old/dist/gcc/doc/tm.texi: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.17
external/gpl3/gcc.old/dist/gcc/config/vax/vax.md: revision 1.18
external/gpl3/gcc.old/dist/gcc/config/vax/elf.h: revision 1.12
external/gpl3/gcc.old/dist/gcc/config/vax/elf.h: revision 1.13
external/gpl3/gcc.old/dist/gcc/targhooks.h: revision 1.12
external/gpl3/gcc.old/dist/gcc/target.def: revision 1.10
external/gpl3/gcc.old/dist/gcc/rtlanal.c: revision 1.14
external/gpl3/gcc.old/dist/gcc/reload.c: revision 1.12
external/gpl3/gcc.old/usr.bin/gcc/Makefile: revision 1.11
external/gpl3/gcc.old/usr.bin/lto-dump/Makefile: revision 1.3
external/gpl3/gcc.old/lib/Makefile.sanitizer: revision 1.7
external/gpl3/binutils.old/lib/libbfd/Makefile: revision 1.10
distrib/utils/x_ping/Makefile: revision 1.9
games/phantasia/Makefile: revision 1.38
external/apache2/argon2/lib/libargon2/Makefile.inc: revision 1.2
external/gpl3/gcc.old/lib/libubsan/Makefile: revision 1.8
external/bsd/mdocml/lib/libmandoc/Makefile: revision 1.13
sbin/ping/Makefile: revision 1.18
sbin/newfs_ext2fs/Makefile: revision 1.7
sys/lib/libz/Makefile: revision 1.24
sys/lib/libsa/Makefile: revision 1.97
external/gpl3/gcc.old/usr.bin/cc1objplus/Makefile: revision 1.3
external/gpl3/gdb/lib/libgdb/Makefile: revision 1.36
sys/modules/lfs/Makefile: revision 1.11
external/mit/xorg/lib/gallium/Makefile: revision 1.51
external/gpl3/gdb.old/lib/libdecnumber/Makefile: revision 1.10
external/mit/xorg/lib/libX11/Makefile.libx11: revision 1.26
libexec/ld.elf_so/Makefile: revision 1.148
external/bsd/jemalloc/lib/Makefile.inc: revision 1.16
external/gpl3/gcc.old/usr.bin/libdecnumber/Makefile: revision 1.14
crypto/external/bsd/openssh/lib/Makefile: revision 1.38
external/gpl3/gcc.old/usr.bin/backend/Makefile: revision 1.21
external/gpl3/gcc.old/usr.bin/cc1/Makefile: revision 1.12
external/gpl3/gcc.old/lib/libasan/Makefile: revision 1.11
external/gpl3/gcc.old/usr.bin/cc1plus/Makefile: revision 1.13
lib/libcrypt/Makefile: revision 1.36
external/gpl3/gdb/lib/libdecnumber/Makefile: revision 1.5
lib/libc/gdtoa/Makefile.inc: revision 1.13
games/gomoku/Makefile: revision 1.13
sbin/fsdb/Makefile: revision 1.43
external/gpl3/gcc.old/usr.bin/lto1/Makefile: revision 1.9
external/mit/xorg/lib/gallium.old/Makefile: revision 1.8
lib/libbz2/Makefile: revision 1.22
external/gpl3/gcc.old/usr.bin/cc1obj/Makefile: revision 1.12
usr.sbin/mtrace/Makefile: revision 1.14
external/gpl3/gcc.old/usr.bin/cc1obj/Makefile: revision 1.13
sys/arch/vax/conf/Makefile.vax: revision 1.86
sys/rump/fs/lib/liblfs/Makefile: revision 1.18
sbin/fsck_ffs/Makefile.common: revision 1.3
external/gpl3/binutils/lib/libbfd/Makefile: revision 1.27
lib/i18n_module/UTF7/Makefile: revision 1.5
external/gpl3/gcc.old/lib/liblsan/Makefile: revision 1.7
doc/CHANGES (apply patch)
(all external/gpl3/gcc.old/ changes applied to external/gpl3/gcc/)

PR 57646: Import major vax toolchain fix.
 1.18 28-Sep-2020  simonb Whitespace alignment nit.
 1.17 27-May-2018  christos - Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Revert :Q to work as before.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@
XXX: pullup 8
 1.16 22-Mar-2016  mrg branches: 1.16.10; 1.16.16;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.15 06-Sep-2015  uebayasi In kernel lib build, print message when things not only start bug also end.
 1.14 12-Dec-2012  matt branches: 1.14.14;
Pass down an empty CPUFLAGS since CPUFLAGS is contained in CFLAGS.
 1.13 11-Dec-2005  christos branches: 1.13.110; 1.13.120;
merge ktrace-lwp.
 1.12 07-Nov-2003  dsl Make 'dependall' generate dependencies in these libraries.
 1.11 15-Jun-2002  matt branches: 1.11.6;
Fix make breakage. $ZDST != ${ZDST} in make. make clean/cleandir now works.
 1.10 21-Nov-2001  jmc branches: 1.10.8; 1.10.10;
Don't make clean and cleandir depend on the lib subdir. Just check for it's
existance before running the submake. This makes it possible to run a
make build (which runs cleandir before make obj) in a r/o source tree
 1.9 05-Dec-2000  sommerfeld branches: 1.9.2; 1.9.4;
Have recursive make invocations depend on the .MAKE pseudo-target so
make knows to handle them specially.
 1.8 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.7 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.6 07-May-1999  drochner branches: 1.6.2;
Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.5 05-Sep-1998  lukem branches: 1.5.8;
distclean is a synonym for cleandir
 1.4 07-Feb-1998  cgd make sure that LORDER, TSORT, AR, NM, RANLIB, and SIZE are correctly
and consistently set when doing kernel library builds.
 1.3 16-Feb-1997  cgd allow includers to specify library-specific CPP flags via ${LIB}MISCCPPFLAGS
 1.2 23-Jan-1997  cgd branches: 1.2.4;
clean up substantially. Transform clean, depend, cleandir targets from ::
to :, so they can be used e.g. with <bsd.prog.mk>. Standardize variable
names used to configure kernel libraries.

Variables used by these Makefile.inc's are:

S must be set to the top of the 'sys' tree.
${LIB}DST may be set to the location of the directory where library
objects are to be built. Defaults to ${.OBJDIR}/lib/${lib}.
${LIB}_AS may be set to 'obj' to build a object from the library's
object files. (Otherwise, a library will be built.)
Defaults to 'library'.
${LIB}MISCMAKEFLAGS
Miscellaneous flags to be passed to the library's Makefile when
building. See library's Makefile for more details about
supported flags and their default values.

(where LIB is KERN, SA, or Z, and lib is kern, sa, or z, depending on which
library's Makefile.inc is being discussed.)
 1.1 16-Jan-1997  cgd add Makefiles to build kernel 'libz' library, expected to be used by
boot blocks to load compressed images. Sources and headers are copied
from src/lib (src/lib/libz, in particular) by making the 'update-sources'
target in this directory. This library builds in a manner similar to
libkern; much of the Makefile hackery was taken from there.
 1.2.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.5.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.9.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.9.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.10.10.1 18-Jun-2002  lukem Pull up revision 1.11 (requested by matt in ticket #288):
Fix make breakage. $ZDST != ${ZDST} in make. make clean/cleandir now works.
 1.10.8.1 20-Jun-2002  gehenna catch up with -current.
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.13.120.1 25-Feb-2013  tls resync with head
 1.13.110.1 16-Jan-2013  yamt sync with (a bit old) head
 1.14.14.2 22-Apr-2016  skrll Sync with HEAD
 1.14.14.1 22-Sep-2015  skrll Sync with HEAD
 1.16.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.16.10.1 09-Jun-2018  martin Pull up following revision(s) (requested by christos in ticket #870):

sys/lib/libgnuefi/Makefile.inc: revision 1.5
external/mit/xorg/xorg-pkg-ver.mk: revision 1.9
sys/arch/i386/stand/lib/Makefile.inc: revision 1.17
sys/compat/common/Makefile.inc: revision 1.25
usr.bin/make/unit-tests/varquote.exp: revision 1.1, 1.2
sys/lib/libsa/Makefile.inc: revision 1.24
usr.bin/make/var.c: revision 1.220
sys/arch/ia64/stand/efi/libefi/Makefile.inc: revision 1.5
sys/arch/hppa/spmath/Makefile.inc: revision 1.10
usr.bin/make/unit-tests/varquote.mk: revision 1.1, 1.2
usr.bin/make/unit-tests/Makefile: revision 1.53
sys/lib/libkern/Makefile.inc: revision 1.45
sys/arch/acorn32/stand/lib/Makefile.inc: revision 1.4
sys/arch/m68k/fpsp/Makefile.inc: revision 1.21
usr.bin/make/make.1: revision 1.273
sys/lib/libz/Makefile.inc: revision 1.17

- Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@

XXX: pullup 8
 1.5 25-Mar-2003  mycroft *** empty log message ***
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.9 14-Jan-2006  christos use zlib-1.2.3
 1.8 11-Dec-2005  christos branches: 1.8.2;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 29-Mar-2003  thorpej branches: 1.6.2; 1.6.10; 1.6.12;
Garbage-collect the DYNAMIC_CRC_TABLE stuff. The table it computed
was incompatible with the new CRC code, and it is largely unnecessary
now, since the static table is so much smaller.

Fixes PR kern/20935.
 1.5 25-Mar-2003  mycroft Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.6.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.10.1 29-Apr-2005  kent sync with -current
 1.6.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.8.2.1 15-Jan-2006  yamt sync with head.
 1.10 14-Jan-2006  christos use zlib-1.2.3
 1.9 11-Dec-2005  christos branches: 1.9.2;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 30-Jun-2004  christos branches: 1.7.4; 1.7.6;
Introduce a zerror() function that can be conditionally compiled out to
save space. share all error strings in a single array.
 1.6 25-Mar-2003  mycroft branches: 1.6.2;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.5 18-Mar-2003  mycroft Finish const poisoning.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.6.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 15-Jan-2006  yamt sync with head.
 1.8 14-Jan-2006  christos use zlib-1.2.3
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 25-Mar-2003  mycroft branches: 1.5.2; 1.5.10; 1.5.12;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.9 14-Jan-2006  christos use zlib-1.2.3
 1.8 11-Dec-2005  christos branches: 1.8.2;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 30-Jun-2004  christos branches: 1.6.4; 1.6.6;
Introduce a zerror() function that can be conditionally compiled out to
save space. share all error strings in a single array.
 1.5 18-Mar-2003  mycroft branches: 1.5.2;
Finish const poisoning.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 03-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.8.2.1 15-Jan-2006  yamt sync with head.
 1.8 14-Jan-2006  christos use zlib-1.2.3
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 18-Mar-2003  mycroft branches: 1.5.2; 1.5.10; 1.5.12;
Finish const poisoning.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 03-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.9 14-Jan-2006  christos use zlib-1.2.3
 1.8 11-Dec-2005  christos branches: 1.8.2;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 30-Jun-2004  christos branches: 1.6.4; 1.6.6;
Introduce a zerror() function that can be conditionally compiled out to
save space. share all error strings in a single array.
 1.5 18-Mar-2003  mycroft branches: 1.5.2;
Finish const poisoning.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.8.2.1 15-Jan-2006  yamt sync with head.
 1.8 14-Jan-2006  christos use zlib-1.2.3
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 18-Mar-2003  mycroft branches: 1.5.2; 1.5.10; 1.5.12;
Finish const poisoning.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 03-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.4 14-Jan-2006  christos use zlib-1.2.3
 1.3 18-Mar-2003  mycroft branches: 1.3.18; 1.3.30;
Move more stuff into .rodata.
 1.2 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.1 03-Nov-1998  tron branches: 1.1.22; 1.1.24; 1.1.26;
Make "src/sys/arch/i386/stand" compile again.
 1.1.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.1.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.22.1 11-Apr-2002  he Pull up revision 1.2 (via patch, requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
(This was accidentally left out when the rest was pulled up.)
 1.3.30.1 15-Jan-2006  yamt sync with head.
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.8 14-Jan-2006  christos use zlib-1.2.3
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 25-Mar-2003  mycroft branches: 1.5.2; 1.5.10; 1.5.12;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.12 14-Jan-2006  christos use zlib-1.2.3
 1.11 11-Dec-2005  christos branches: 1.11.2;
merge ktrace-lwp.
 1.10 04-Aug-2005  tron Return correct error on all zero length codes. Fix from Gentoo bug 94584.
 1.9 26-Feb-2005  perry branches: 1.9.2; 1.9.4;
nuke trailing whitespace
 1.8 30-Jun-2004  christos branches: 1.8.4; 1.8.6;
Introduce a zerror() function that can be conditionally compiled out to
save space. share all error strings in a single array.
 1.7 31-Aug-2003  fvdl branches: 1.7.2; 1.7.4;
Fix signed/unsigned warnings.
 1.6 18-Mar-2003  mycroft branches: 1.6.2;
Move more stuff into .rodata.
 1.5 12-Mar-2002  fvdl branches: 1.5.6;
Sync with userland (1.1.4)
 1.4 30-Mar-2000  augustss branches: 1.4.4; 1.4.6; 1.4.8;
Kill some more register declarations.
 1.3 01-Nov-1998  tron branches: 1.3.12;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.6.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.1 20-Mar-2002  he Pull up revision 1.5 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.6.1 05-Aug-2005  snj Pull up revision 1.10 (requested by tron in ticket #5835):
Return correct error on all zero length codes. Fix from Gentoo bug 94584.
 1.6.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.4.1 05-Aug-2005  snj Pull up revision 1.10 (requested by tron in ticket #5550):
Return correct error on all zero length codes. Fix from Gentoo bug 94584.
 1.7.2.1 05-Aug-2005  snj Pull up revision 1.10 (requested by tron in ticket #5550):
Return correct error on all zero length codes. Fix from Gentoo bug 94584.
 1.8.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 05-Aug-2005  snj Pull up revision 1.10 (requested by tron in ticket #649):
Return correct error on all zero length codes. Fix from Gentoo bug 94584.
 1.11.2.1 15-Jan-2006  yamt sync with head.
 1.8 14-Jan-2006  christos use zlib-1.2.3
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 18-Mar-2003  mycroft branches: 1.5.2; 1.5.10; 1.5.12;
Move more stuff into .rodata.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.11 14-Jan-2006  christos use zlib-1.2.3
 1.10 11-Dec-2005  christos branches: 1.10.2;
merge ktrace-lwp.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 01-Jul-2004  christos branches: 1.8.4; 1.8.6;
DECONST->UNCONST
 1.7 30-Jun-2004  christos Introduce a zerror() function that can be conditionally compiled out to
save space. share all error strings in a single array.
 1.6 25-Mar-2003  mycroft branches: 1.6.2;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.5 18-Mar-2003  mycroft Move more stuff into .rodata.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.6.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.10.2.1 15-Jan-2006  yamt sync with head.
 1.9 14-Jan-2006  christos use zlib-1.2.3
 1.8 11-Dec-2005  christos branches: 1.8.2;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 25-Mar-2003  mycroft branches: 1.6.2; 1.6.10; 1.6.12;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.5 18-Mar-2003  mycroft Move more stuff into .rodata.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.6.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.10.1 29-Apr-2005  kent sync with -current
 1.6.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.4.1 21-Jun-2006  yamt sync with head.
 1.8.2.1 15-Jan-2006  yamt sync with head.
 1.1 14-Jan-2006  christos branches: 1.1.2; 1.1.18;
use zlib-1.2.3
 1.1.18.2 21-Jun-2006  yamt sync with head.
 1.1.18.1 14-Jan-2006  yamt file libz.h was added on branch yamt-lazymbuf on 2006-06-21 15:10:23 +0000
 1.1.2.2 15-Jan-2006  yamt sync with head.
 1.1.2.1 14-Jan-2006  yamt file libz.h was added on branch yamt-uio_vmspace on 2006-01-15 10:02:57 +0000
 1.6 14-Jan-2006  christos use zlib-1.2.3
 1.5 11-Dec-2005  christos branches: 1.5.2;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 30-Jun-2004  christos branches: 1.3.4; 1.3.6;
cast help.
 1.2 12-Mar-2002  fvdl branches: 1.2.12;
Sync with userland (1.1.4)
 1.1 15-Apr-1999  simonb branches: 1.1.2; 1.1.14; 1.1.16; 1.1.18;
Add source file, copied from lib/libz/uncompr.c.
 1.1.18.1 16-Mar-2002  jdolecek Catch up with -current.
 1.1.16.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.14.1 11-Apr-2002  he Pull up revision 1.2 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
(This was accidentally left out when the rest was pulled up.)
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.12.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.12.1 03-Aug-2004  skrll Sync with HEAD
 1.3.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.4.1 29-Apr-2005  kent sync with -current
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.5.2.1 15-Jan-2006  yamt sync with head.
 1.7 18-Mar-2009  cegger bzero -> memset
 1.6 28-Apr-2008  martin branches: 1.6.8; 1.6.14;
Remove clause 3 and 4 from TNF licenses
 1.5 29-Dec-2007  tsutsui branches: 1.5.6; 1.5.8; 1.5.10;
ANSIfy and some KNF.
 1.4 25-Jan-2006  christos branches: 1.4.44; 1.4.50; 1.4.58;
free -> dealloc
 1.3 13-Nov-1999  thorpej branches: 1.3.44; 1.3.56;
Backout my libsa changes.
 1.2 12-Nov-1999  simonb "zutil.h" includes <lib/libsa/stand.h> now.
 1.1 15-Apr-1999  simonb branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10;
A simple implementation of zcalloc and zcfree in terms of the libsa
alloc and free.
 1.1.10.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.6.1 15-Nov-1999  fvdl Sync with -current
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.56.1 01-Feb-2006  yamt sync with head.
 1.3.44.2 21-Jan-2008  yamt sync with head
 1.3.44.1 21-Jun-2006  yamt sync with head.
 1.4.58.1 02-Jan-2008  bouyer Sync with HEAD
 1.4.50.1 18-Feb-2008  mjf Sync with HEAD.
 1.4.44.1 09-Jan-2008  matt sync with HEAD
 1.5.10.2 04-May-2009  yamt sync with head.
 1.5.10.1 16-May-2008  yamt sync with head.
 1.5.8.1 18-May-2008  yamt sync with head.
 1.5.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.8 14-Jan-2006  christos use zlib-1.2.3
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 25-Mar-2003  mycroft branches: 1.5.2; 1.5.10; 1.5.12;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.8 14-Jan-2006  christos use zlib-1.2.3
 1.7 11-Dec-2005  christos branches: 1.7.2;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 25-Mar-2003  mycroft branches: 1.5.2; 1.5.10; 1.5.12;
Remove a whole bunch of crap -- including the entirely adler32 stuff that's
only used in gzip headers/footers -- that's not actually used here. Also use
a smaller CRC table. Saves >4k of code in boot images.
 1.4 12-Mar-2002  fvdl Sync with userland (1.1.4)
 1.3 01-Nov-1998  tron branches: 1.3.22; 1.3.24; 1.3.26;
Sync with files in "src/lib/libz".
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.3.26.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.24.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.1 20-Mar-2002  he Pull up revision 1.4 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 15-Jan-2006  yamt sync with head.
 1.13 14-Jan-2006  christos use zlib-1.2.3
 1.12 11-Dec-2005  christos branches: 1.12.2;
merge ktrace-lwp.
 1.11 30-Jun-2004  christos branches: 1.11.12;
Introduce a zerror() function that can be conditionally compiled out to
save space. share all error strings in a single array.
 1.10 12-Mar-2002  fvdl branches: 1.10.12;
Sync with userland (1.1.4)
 1.9 13-Nov-1999  thorpej branches: 1.9.4; 1.9.6; 1.9.8;
Backout my libsa changes.
 1.8 12-Nov-1999  simonb Include <lib/libsa/stand.h> so that this builds with WARNS=1
 1.7 11-Nov-1999  thorpej Don't reference libkern.h in standalone programs.
 1.6 22-Apr-1999  christos branches: 1.6.2; 1.6.4; 1.6.8;
Don't try to use <stdio.h> (when -DDEBUG) if we are -D_STANDALONE or -D_KERNEL
Now the boot blocks compile with -DDEBUG
 1.5 03-Nov-1998  tron branches: 1.5.8;
Make "src/sys/arch/i386/stand" compile again.
 1.4 01-Nov-1998  tron Sync with files in "src/lib/libz".
 1.3 27-Mar-1998  cgd copy from src/lib/libz:
if _STANDALONE or _KERNEL, don't include standard headers and pull
in libkern.h instead. (That doesn't even appear to be necessary,
but it's the 'standard' thing to do.)
 1.2 20-May-1997  gwr Sync with src/lib/libz
 1.1 16-Jan-1997  cgd add sources, all copied verbatim from src/lib/libz
 1.5.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.4.1 15-Nov-1999  fvdl Sync with -current
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.9.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.9.6.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.9.4.1 20-Mar-2002  he Pull up revision 1.10 (requested by fvdl):
Upgrade libz to 1.1.4 due to a possible security bug.
 1.10.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.12.1 03-Aug-2004  skrll Sync with HEAD
 1.11.12.1 21-Jun-2006  yamt sync with head.
 1.12.2.1 15-Jan-2006  yamt sync with head.

RSS XML Feed