Home | History | Annotate | only in /src/sys/arch/sparc/include
History log of /src/sys/arch/sparc/include
RevisionDateAuthorComments
 1.39 30-Nov-2024  christos Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.38 04-Nov-2024  christos Undo previous lwp.h change.
 1.37 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.36 17-May-2020  ad branches: 1.36.26;
Install sparc/intr.h
 1.35 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.34 29-Mar-2018  joerg branches: 1.34.2;
Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.
 1.33 23-Jul-2014  alnsn branches: 1.33.26;
Rename sljitarch.h to sljit_machdep.h.
 1.32 05-Nov-2012  alnsn branches: 1.32.10;
Add sljitarch.h on sparc.
 1.31 17-Jul-2011  joerg branches: 1.31.2; 1.31.12;
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.30 20-May-2011  nakayama Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.29 09-Feb-2007  ad branches: 1.29.70; 1.29.76;
Merge newlock2 to head.
 1.28 11-Dec-2005  christos branches: 1.28.20;
merge ktrace-lwp.
 1.27 08-May-2004  kleink branches: 1.27.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.26 11-Apr-2003  jdc branches: 1.26.2;
Install (new) cpuconf.h.

From Christopher SEKIYA in PR port-sparc/21093.
 1.25 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.24 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.22 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.21 07-Aug-2002  briggs Implement pmc(9) -- An interface to hardware performance monitoring
counters. These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.20 19-Sep-2001  thorpej branches: 1.20.4; 1.20.8; 1.20.12;
Don't do the symlink hack for fbio.h. Just use <dev/sun/fbio.h>.
 1.19 15-Apr-2001  kleink branches: 1.19.2; 1.19.4;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.18 15-Apr-2001  kleink Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.17 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.16 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.15 20-Aug-2000  pk branches: 1.15.2;
fbio.h moded to sys/dev/sun.
Retain symlink from /usr/include/machine.
 1.14 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.13 29-Apr-2000  thorpej Oops, install <machine/lock.h> on these systems, too.
 1.12 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.11 10-Jan-2000  pk Cleanup the list of exported headers a bit.
 1.10 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.9 20-Dec-1999  jdc Added tctrl.h
 1.8 11-Aug-1999  matt branches: 1.8.2; 1.8.8;
Add <machine/apmvar.h> for sparc so that apmd can be built. Eventually
this allow it work on Tadpole SPARCbook 3 laptops (and/or other sparc
with power management).
 1.7 02-May-1999  christos Add bootinfo.h
 1.6 28-Apr-1999  christos Support for installboot
 1.5 15-Jan-1999  bouyer branches: 1.5.4;
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.4 22-Aug-1998  mrg bsd_audioio.h is not used.
 1.3 28-Jul-1998  pk Remove mbppio.h from the list.
Also stop installing db_machdep.h, fbvar.h, z8530.h.
 1.2 20-Jun-1998  mrg moved <machine/sun_disklabel.h> to <dev/sun/disklabel.h>
 1.1 12-Jun-1998  cgd Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.19.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.19.2.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.19.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.12.2 31-Aug-2002  gehenna catch up with -current.
 1.20.12.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.20.8.1 18-Mar-2002  thorpej Install mutex_impl.h and rwlock_impl.h
 1.20.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.20.4.4 21-Nov-2002  martin Install mcontext.h, userland needs it.
 1.20.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.20.4.2 13-Aug-2002  nathanw Catch up to -current.
 1.20.4.1 19-Sep-2001  nathanw file Makefile was added on branch nathanw_sa on 2002-08-13 02:18:53 +0000
 1.26.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.27.12.1 26-Feb-2007  yamt sync with head.
 1.28.20.1 01-Feb-2007  ad Header file cleanup.
 1.29.76.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.70.1 31-May-2011  rmind sync with head
 1.31.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.31.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.32.10.1 10-Aug-2014  tls Rebase.
 1.33.26.2 28-Jul-2018  pgoyette Sync with HEAD
 1.33.26.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.34.2.1 10-Jun-2019  christos Sync with HEAD
 1.36.26.1 02-Aug-2025  perseant Sync with HEAD
 1.2 12-Sep-2020  isaki Improve am7930 family drivers to share more code.
audioamd(4) on sparc, vsaudio(4) on vax, and bba(4) are.
- Remove complex and useless callbacks: onopen, onclose, and
indirect_{read,write}. This makes audioamd and vsaudio almost the same.
- Remove (already disabled) assembly fast interrupt path from audioamd(4).
cf. http://mail-index.netbsd.org/source-changes/2009/12/19/msg004585.html
- Use trigger_* method rather than start_* method. It's more suitable.
vsaudio(4) was tested by naru@, bba(4) was tested by tsutsui@.
 1.1 14-Mar-1999  jonathan Use bus_space tags and handles, embedded in MD hooks AM7930_{READ_WRITE}_REG
to handle MD delay and bus padding. Tested on sparc2 by David Brownlee.

Should use regmaps, but that breaks sparc pDMA assembly code.
 1.25 07-May-2019  kamil Switch all users (except ia64) of custom machine/ansi.h to common_ansi.h

Deduplicate the code among ports and poll definitions of types
directly from a compiler.

This fixes miscompilation of certain programs that instruct compilers
to generate code for different types. This bug has been detected with
-fshort-wchar in EFI firmware.

Proposed and discussed on a mailing list (twice).

Itanium uses custom !ELF fallback switch, temporarily leave it as it is.
 1.24 17-Jun-2015  martin branches: 1.24.18;
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.23 17-Jul-2011  joerg branches: 1.23.12; 1.23.28; 1.23.30;
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.22 27-Mar-2010  tnozaki 1. {wctype,wctrans,mbstate}_t: switch MD to MI like other
libc implementation (such as *BSD and glibc2).

2. don't typedef void * wc{type,trans}_t, suggested by soda@-san.
it may pass through compiler type check, it's harmful.
so i introduce dummy struct __tag_wc{type,trans}_t(iconv_t already does).

no ABI change was made.
 1.21 11-Jan-2009  christos branches: 1.21.4; 1.21.6;
merge christos-time_t
 1.20 17-Oct-2007  garbled branches: 1.20.16; 1.20.18; 1.20.22; 1.20.30;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.19 03-Sep-2007  drochner clean up some definitions around rune_t which are not needed anymore
 1.18 04-Oct-2006  tnozaki branches: 1.18.8; 1.18.16; 1.18.22; 1.18.26; 1.18.28;
fix gcc -Werror -Wmissing-braces problem
mbstate_t(this is opaque object)'s initializer should be ``{ 0 }'',
so changed 1st field of union from character array to integer.
 1.17 11-Dec-2005  christos branches: 1.17.20; 1.17.22;
merge ktrace-lwp.
 1.16 20-Apr-2005  matt branches: 1.16.2;
For GCC3 and later, use the __builtin_va* constructs.
 1.15 07-Aug-2003  agc branches: 1.15.8; 1.15.14; 1.15.18;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.14 02-Mar-2003  tshiozak branches: 1.14.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.13 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.12 26-Dec-2000  itojun make mbstate_t bigger (32 -> 128 bytes).
XXX if you have libc after citrus locale import, please recompile libc,
and your applications that use mbstate_t (rather rare). really sorry
for the mess.
 1.11 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.10 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.9 05-Jun-1999  pk branches: 1.9.2; 1.9.10;
64-bit safety to help sharing compilation tools with sparc64.
 1.8 27-Apr-1998  kleink branches: 1.8.10;
Provide definitions for intptr_t and uintptr_t, signed resp. unsigned integral
types large enough to hold any pointer.
 1.7 23-Nov-1997  kleink Add _BSD_SUSECONDS_T_ and _BSD_USECONDS_T_; do some space vs. tab formatting
cleanup
 1.6 15-Nov-1996  jtc Define _BSD_CLOCKID_T_ and _BSD_TIMER_T_
 1.5 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.4 16-Mar-1996  jtc Add _BSD_WINT_T_ definition so we can handle wint_t type added in NA1.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 24-May-1994  deraadt liten
 1.1 10-Oct-1993  deraadt need these
 1.8.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.10.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.9.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.18.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.15.14.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.15.8.1 29-Apr-2005  kent sync with -current
 1.16.2.2 27-Oct-2007  yamt sync with head.
 1.16.2.1 30-Dec-2006  yamt sync with head.
 1.17.22.1 22-Oct-2006  yamt sync with head
 1.17.20.1 18-Nov-2006  ad Sync with head.
 1.18.28.1 06-Nov-2007  matt sync with HEAD
 1.18.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.18.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.18.16.1 03-Oct-2007  garbled Sync with HEAD
 1.18.8.1 09-Oct-2007  ad Sync with head.
 1.20.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.22.2 11-Aug-2010  yamt sync with head.
 1.20.22.1 04-May-2009  yamt sync with head.
 1.20.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.20.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.20.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.21.6.1 30-May-2010  rmind sync with head
 1.21.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.23.30.1 22-Sep-2015  skrll Sync with HEAD
 1.23.28.1 16-Jul-2015  riz Pull up following revision(s) (requested by martin in ticket #846):
sys/arch/mips/include/ansi.h: revision 1.29
sys/arch/sh3/include/ansi.h: revision 1.16
sys/arch/sparc64/include/ansi.h: revision 1.18
sys/arch/m68k/include/ansi.h: revision 1.24
sys/arch/powerpc/include/ansi.h: revision 1.30
sys/arch/hppa/include/ansi.h: revision 1.14
sys/arch/i386/include/ansi.h: revision 1.27
sys/arch/alpha/include/ansi.h: revision 1.25
sys/arch/usermode/include/ansi.h: revision 1.5
sys/arch/sparc/include/ansi.h: revision 1.24
Make _BSD_CLOCK_T_ unsigned int so it's the same for IPL32 and LP64
environments. We don't really have a powerpc64 native userland
and the mips64 native userland is IPL32 so this shouldn't affect anything.
Make clock_t unsigned
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.23.12.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.1 10-Jun-2019  christos Sync with HEAD
 1.10 17-Mar-2012  martin mark reloc bitfield linted
 1.9 10-Dec-2002  thorpej branches: 1.9.146; 1.9.150;
Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.8 15-Mar-1997  pk branches: 1.8.40;
Remove trailing comma in enum definition.
 1.7 20-Nov-1994  deraadt copyright/Id cleanup
 1.6 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.5 18-Oct-1993  deraadt fix a typo
 1.4 18-Oct-1993  pk Put definition of __LDPGSZ and `struct relocation_info' where they belong:
in <machine/exec.h>.
 1.3 15-Oct-1993  deraadt actually put something in a previously empty file.
__LDPGSZ should now be defined here!
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.40.1 11-Dec-2002  thorpej Sync with HEAD.
 1.9.150.1 05-Apr-2012  mrg sync to latest -current.
 1.9.146.1 17-Apr-2012  yamt sync with head
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 14-Oct-2002  takemura branches: 1.2.108; 1.2.110; 1.2.112;
Moved MI APM definitions into dev/apm.
 1.1 11-Aug-1999  matt branches: 1.1.20;
Add <machine/apmvar.h> for sparc so that apmd can be built. Eventually
this allow it work on Tadpole SPARCbook 3 laptops (and/or other sparc
with power management).
 1.1.20.1 18-Oct-2002  nathanw Catch up to -current.
 1.2.112.1 16-May-2008  yamt sync with head.
 1.2.110.1 18-May-2008  yamt sync with head.
 1.2.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.25 06-Jan-2025  martin PR 58960: fix misunderstanding in semantic and provide both the original
id string as well as _NETBSD_REVISIONID.
Do not rely on string concatenation in the inline assembler, use .ascii
and .asciz for individual string parts instead.
 1.24 04-Jan-2025  martin PR 58960: sparc/asm.h: Respect NETBSD_REVISIONID.
 1.23 17-Apr-2020  joerg branches: 1.23.26;
Mark the .ident section as mergable string section to avoid redundant
entries.
 1.22 23-Aug-2015  joerg branches: 1.22.18; 1.22.28;
Use .word for data that is known to be aligned.
 1.21 23-Aug-2015  joerg Remove .proc 1, it has been ignored by gas for ages.
 1.20 12-Apr-2014  joerg branches: 1.20.4;
Add END() macro like most other archs have.
 1.19 12-Sep-2013  joerg branches: 1.19.2;
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.18 20-Dec-2010  joerg branches: 1.18.8; 1.18.18; 1.18.22;
Consistently use .gnu.warning with .pushsectio and .popsection on all
architectures instead of obsolete STABS frames for linker warnings.
 1.17 20-Dec-2010  matt Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.16 20-Jan-2006  christos branches: 1.16.98;
Add a STRONG_ALIAS macro
 1.15 17-Sep-2002  uwe branches: 1.15.22; 1.15.34;
RCSID should go to .ident section.
While here add __KERNEL_RCSID.
 1.14 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.13 24-Jun-2002  thorpej Add ENTRY_NOPROFILE().
 1.12 03-Nov-2001  thorpej branches: 1.12.8;
Changes from Martin Husemann and myself:
- Make the 32-bit SPARC profile support work with the GCC 2.95.3
SPARC ELF compiler, which uses a different name for mcount.
- Make the 64-bit SPARC profile support header look more like the 32-bit
SPARC header (no functional change -- 64-bit SPARC already used the
correct mcount name).
 1.11 23-Jun-2000  kleink branches: 1.11.4; 1.11.6; 1.11.8;
Add a WEAK_ALIAS() macro.
 1.10 24-Feb-1999  chs branches: 1.10.8; 1.10.18;
add RODATA(), which is like ENTRY() but without the _PROF_PROLOGUE.
 1.9 02-Dec-1998  thorpej Argh, fix the ANSI CPP version of the a.out WARN_REFERENCES().
 1.8 02-Dec-1998  thorpej Implement WARN_REFERENCES().
 1.7 01-Jul-1998  tv branches: 1.7.4;
_GLOBAL_OFFSET_TABLE_ needs a _C_LABEL() wrapper, too.
 1.6 01-Jul-1998  tv Change _C_LABEL() to use proper underscoring depending on __ELF__ or not.
 1.5 16-Jul-1997  christos Add RCSID() macro.
 1.4 30-Nov-1996  jtc PROF -> GPROF
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 03-Jun-1994  pk Profile asm entries also.
 1.1 10-Feb-1994  pk Define a few things here, in line with other ports.
 1.7.4.1 25-Feb-1999  chs sync with HEAD - profiling fixes.
 1.10.18.1 25-Jul-2000  kleink Pull up rev. 1.11 (approved by thorpej):
For ELF, add a WEAK_ALIAS() macro.
 1.10.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.11.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.11.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.11.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.11.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.11.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.8.2 31-Aug-2002  gehenna catch up with -current.
 1.12.8.1 17-Jul-2002  gehenna catch up with -current.
 1.15.34.1 01-Feb-2006  yamt sync with head.
 1.15.22.1 21-Jun-2006  yamt sync with head.
 1.16.98.1 05-Mar-2011  rmind sync with head
 1.18.22.1 18-May-2014  rmind sync with head
 1.18.18.2 03-Dec-2017  jdolecek update from HEAD
 1.18.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.8.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.19.2.1 10-Aug-2014  tls Rebase.
 1.20.4.1 22-Sep-2015  skrll Sync with HEAD
 1.22.28.1 20-Apr-2020  bouyer Sync with HEAD
 1.22.18.1 21-Apr-2020  martin Sync with HEAD
 1.23.26.1 02-Aug-2025  perseant Sync with HEAD
 1.51 22-May-2022  andvar fix various small typos, mainly in comments.
 1.50 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.49 17-Jan-2021  mrg set machine_model[] earlier, so that bootstrap can use it.

also, avoid "extern <variable>" in .c files, and add
idempotency to autoconf.h.
 1.48 27-Oct-2012  chs branches: 1.48.50;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.47 01-Jul-2011  dyoung branches: 1.47.2; 1.47.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.46 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.45 12-Feb-2008  joerg branches: 1.45.6; 1.45.8; 1.45.10;
Introduce device_find_by_xname and device_find_by_driver_unit to replace
alldevs iterations all over src.

Patch discussed with and improved on suggestioned from cube@.
 1.44 04-Mar-2006  uwe branches: 1.44.44; 1.44.50;
De-__P.
 1.43 04-Mar-2006  uwe s/u_intN_t/uintN_t/
 1.42 11-Dec-2005  christos branches: 1.42.4; 1.42.6;
merge ktrace-lwp.
 1.41 03-Jun-2005  martin branches: 1.41.2;
Sprinkle some const
 1.40 31-May-2005  christos - sprinkle const
- remove parameter names from function declarations
 1.39 28-Jun-2004  pk Rename bus_translate_address_generic => bus_space_translate_address_generic()
and move prototype to <machine/bus.h>.
 1.38 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.37 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.36 18-Feb-2003  pk branches: 1.36.2;
Move makememarr() into promlib.c.
 1.35 25-Aug-2002  thorpej Add a generic function to translate a device address using a
parent's "ranges" property, and use it.
 1.34 11-Mar-2002  pk branches: 1.34.4;
`bus_type_t' is gone. Retain bus_space_map2() for MD drivers that need
to map registers to a fixed virtual address.
 1.33 21-Mar-2000  pk branches: 1.33.8; 1.33.12;
findzs() is now used only by the kgbd initialision code.
 1.32 11-Jan-2000  pk Remove old-style boot device recognition.
 1.31 14-Feb-1999  pk branches: 1.31.8;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.30 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.29 26-Sep-1998  pk Move PROM interface prototypes into openprom.h
Use the `openprom_addr' structure for passing around physical addresses.
 1.28 30-Aug-1998  pk Nuke old getprop() function and put its successor in place.
 1.27 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.26 29-Jul-1998  pk <sparc/dev/sbusvar.h> => <dev/sbus/sbusvar.h>
 1.25 07-Apr-1998  pk Remove old mapdev() function prototype.
 1.24 30-Mar-1998  pk Make mainbus attach phys addr field a bus_addr_t.
 1.23 29-Mar-1998  pk Enter `obio_find_rom_map()' prototype.
Make `oba_paddr' field a `bus_addr_t'.
Define temporary compat `obio_bus_map()'.
 1.22 21-Mar-1998  pk Remove old `confargs' structure which is no longer used; extract the
structures representing the ROM properties.
Also, define the `mainbus' and `obio' attach arguments here.
 1.21 25-Jan-1998  pk bus_map() & bus_untmp() are only used for sun4/obio devices.
 1.20 24-May-1997  pk Always use `rr_iospace' to track the MMU page type bits.
This obsoletes the `bustype' argument in map[io]dev().
 1.19 18-May-1997  pk Remove bus_tmp().
 1.18 08-Apr-1997  pk Move "range" property description out of generic `romaux'.
 1.17 10-Dec-1996  pk Comply with recent autoconfiguration changes. Diffs graciously supplied
by Chris Demetriou.
 1.16 10-Apr-1996  pk Make room for another `value' in struct bootpath. Drop the global `bootdv'
in favour of storing the device pointer in the bootpath[] element corresponding
to the boot device. This also allows the opportunity to get to "intermediate"
devices (e.g. busses) should the need for this ever arise.
 1.15 31-Mar-1996  pk Add some v3 PROM glue.
Move autoconf subroutine prototypes here (from cpu.h).
 1.14 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.13 15-Jan-1996  thorpej Add a "mountroot hook" mechanism so that devices can take care of
special needs before being used in (*mountroot)().
 1.12 11-Jan-1996  pk Move bus_map() prototype here.
 1.11 11-Dec-1995  pk Change mapdev() and mapiodev() to take a `struct rom_reg', enabling the use
of IO spaces to construct device mappings.
 1.10 18-Aug-1995  pk declarations
 1.9 08-Mar-1995  pk Allow for multiple virtual PROM addresses.
 1.8 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.7 23-Nov-1994  deraadt XXmatch change (and a few __P() as well)
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 15-Oct-1994  deraadt mapiodev takes a bustype argument now
 1.4 17-Sep-1994  deraadt "struct confargs" is used for all device match/attach functions. It
tells you what bus (sbus, vme, ...) you are on.
 1.3 19-May-1994  deraadt liten
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.31.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.33.12.2 27-Aug-2002  nathanw Catch up to -current.
 1.33.12.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.33.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.33.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.34.4.1 31-Aug-2002  gehenna catch up with -current.
 1.36.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.36.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.36.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.36.2.1 03-Aug-2004  skrll Sync with HEAD
 1.41.2.2 27-Feb-2008  yamt sync with head.
 1.41.2.1 21-Jun-2006  yamt sync with head.
 1.42.6.1 22-Apr-2006  simonb Sync with head.
 1.42.4.1 09-Sep-2006  rpaulo sync with head
 1.44.50.1 18-Feb-2008  mjf Sync with HEAD.
 1.44.44.1 23-Mar-2008  matt sync with HEAD
 1.45.10.1 16-May-2008  yamt sync with head.
 1.45.8.1 18-May-2008  yamt sync with head.
 1.45.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.47.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.47.2.1 30-Oct-2012  yamt sync with head
 1.48.50.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 28-May-2012  martin Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.
 1.5 04-Mar-2006  uwe branches: 1.5.106; 1.5.110; 1.5.112;
De-__P.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6;
merge ktrace-lwp.
 1.3 24-Mar-2004  drochner branches: 1.3.16;
remove license clauses 3 and 4 from my cpoyright notices
 1.2 28-Mar-2002  pk branches: 1.2.10;
Define bootinfo record to pass the kernel file path from the boot program.
 1.1 02-May-1999  christos branches: 1.1.2; 1.1.18; 1.1.22;
Add bootinfo.h
 1.1.22.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.18.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 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.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.5.112.1 05-Jun-2012  jdc Pull up revisions:
src/sys/arch/sparc/include/bootinfo.h revision 1.6
src/sys/arch/sparc/sparc/autoconf.c revision 1.243
src/sys/arch/sparc/stand/boot/boot.c revision 1.28
src/sys/arch/sparc/stand/ofwboot/boot.c revision 1.29
src/sys/arch/sparc64/include/bootinfo.h revision 1.6-1.7
src/sys/arch/sparc64/sparc64/autoconf.c revision 1.186
(requested by martin in ticket #289).

Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.

Ooops, remove definitions duplicated in <sparc/bootinfo.h>
 1.5.110.1 02-Jun-2012  mrg sync to latest -current.
 1.5.106.1 30-Oct-2012  yamt sync with head
 1.4 22-Aug-1998  mrg bsd_audioio.h is not used.
 1.3 04-Mar-1995  pk Sync with sys/audioio.h for now, so SunOS compat works.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.25 24-Dec-2007  perry Remove __attribute__((__noreturn__)) from things already marked __dead
Found by the department of redundancy department.
 1.24 04-Mar-2007  christos branches: 1.24.20; 1.24.28; 1.24.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 11-Dec-2005  christos branches: 1.23.26;
merge ktrace-lwp.
 1.22 31-May-2005  christos branches: 1.22.2;
- sprinkle const
- remove parameter names from function declarations
 1.21 16-Mar-2004  pk Encapsulate retrieval of properties from the global `options' prom node.
 1.20 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.19 16-Jan-2003  pk branches: 1.19.2;
Definitions of some OBP generated CPU mailbox messages.
 1.18 23-Aug-2002  thorpej * Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.17 15-Nov-2000  pk branches: 1.17.4; 1.17.8; 1.17.16; 1.17.18;
Adjust setprop() prototype to match that in dev/ofw/openfirm.h
 1.16 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.15 14-Feb-1999  pk branches: 1.15.8;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.14 26-Sep-1998  pk Add wrappers for PROM's CPU start/stop functions.
 1.13 26-Sep-1998  pk Move PROM interface prototypes into openprom.h
Use the `openprom_addr' structure for passing around physical addresses.
 1.12 12-Sep-1998  pk Expose `v3' routines to everyone.
 1.11 18-May-1996  mrg put promdev definition into <machine/bsd_openprom.h>.
 1.10 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.9 15-May-1996  mrg remove some RCS id's we don't need.
 1.8 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.7 16-Mar-1996  christos add rom routines declarations
 1.6 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.5 22-Feb-1996  pk Correct some prototypes.
 1.4 13-Feb-1996  pk Change some caddr_t's to void *'s.
 1.3 04-Sep-1995  pk Rename a `xxx' function.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 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
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.18.1 22-Nov-2002  tron Pull up revision 1.18 (requested by martin in ticket #948):
* Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.17.16.1 31-Aug-2002  gehenna catch up with -current.
 1.17.8.2 17-Jan-2003  thorpej Sync with HEAD.
 1.17.8.1 27-Aug-2002  nathanw Catch up to -current.
 1.17.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.2.2 21-Jan-2008  yamt sync with head
 1.22.2.1 03-Sep-2007  yamt sync with head.
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.24.28.1 26-Dec-2007  ad Sync with head.
 1.24.20.1 09-Jan-2008  matt sync with HEAD
 1.2 21-Aug-1999  simonb Include <sys/bswap.h> for function prototypes. i386, pc532 and vax
still include <machine/byte_swap.h> and define macros for some of
the bswap*() functions.
 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.57 17-Jul-2011  dyoung Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.56 26-May-2009  macallan do as phone suggested - remove sparc_bus_map_large() again and use a flag
instead ( BUS_SPACE_MAP_LARGE )
 1.55 16-Apr-2009  macallan Add sparc_bus_map_large() to map large bus ranges like framebuffers and
apertures outside the IODEV range. ZX for example needs 8MB for the framebuffer
alone while the IODEV range provides only 16MB.
 1.54 28-Apr-2008  martin branches: 1.54.8; 1.54.10; 1.54.14; 1.54.18;
Remove clause 3 and 4 from TNF licenses
 1.53 04-Mar-2007  christos branches: 1.53.40; 1.53.42; 1.53.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 21-Feb-2007  mrg add a pair of new bus_dma(9) functions:
int _bus_dmatag_subregion(bus_dma_tag_t tag,
bus_addr_t min_addr,
bus_addr_t max_addr,
bus_dma_tag_t *newtag,
int flags)
void _bus_dmatag_destroy(bus_dma_tag_t tag)

that allow a (normally broken/limited) device to restrict the bus address
range it can talk to. this is used by bce(4) to limit DMA addresses to
1GB range, the maximum the chip can address.

all this is from Yorick Hardy <yhardy@uj.ac.za> with input from several
people on tech-kern.

XXX: bus_dma(9) needs an update still.
 1.51 04-Mar-2006  uwe branches: 1.51.20;
De-__P.
 1.50 04-Mar-2006  uwe s/u_intN_t/uintN_t/
 1.49 16-Feb-2006  perry 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.48 24-Dec-2005  perry branches: 1.48.2; 1.48.4; 1.48.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.47 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.46 11-Dec-2005  christos merge ktrace-lwp.
 1.45 09-Mar-2005  matt branches: 1.45.4;
Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.
 1.44 15-Nov-2004  martin branches: 1.44.4; 1.44.6;
Add bus_space_region_stream* functions (verbatim copy from sparc64).
Fixes PR port-sparc/28302. OK'd by pk.
 1.43 30-Jun-2004  pk Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.42 28-Jun-2004  pk Rename bus_translate_address_generic => bus_space_translate_address_generic()
and move prototype to <machine/bus.h>.
 1.41 27-Jun-2004  pk Always use `full bus space'. In order to implement this more efficiently,
require that all bus tags have pointers to bus_space_read/write functions,
i.e. no run-time hunting for the first "upstream" implementation.
Since this changes the way bus tags should be constructed it makes sense
to do the same thing for the rest of the bus space methods.
So, now bus space tags are generally constructed by copying the parent's bus
tag and then overriding the methods that the bus driver needs to handle,
instead of starting with an empty bus tag and fiiling in only the fields needed.
 1.40 16-Nov-2003  pk Use __insn_barrier() in all bus_space read/write operations.
 1.39 15-Jun-2003  fvdl branches: 1.39.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
 1.38 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.37 03-Jan-2003  martin Make the *_stream_* methods always use the *_real accessors.
Define __BUS_SPACE_HAS_STREAM_METHODS.
 1.36 03-Jan-2003  mrg part one of bus_space(9) fixes to enable bus spaces to override the
bus_space_{read,write}_[1248]() functions, which will allow 16-bit
PCMCIA support to work without additional hacks in MI drivers.
this option is not enabled yet.
 1.35 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.34 10-Dec-2002  pk bus_intr_establish() now takes an optional `fast trap' handler argument.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.33 25-Aug-2002  thorpej Put a bus's ranges in the bus space tag, and make sparc_bus_map()
perform the translation and recursion if t->ranges != NULL. Make
sbus, cpuunit, and bootbus inherit the parent's map/mmap routines,
and delete the now-unused mapping functions. Update all places where
bus space tags are statically allocated.
 1.32 07-May-2002  uwe branches: 1.32.2;
Delint a bit.
 1.31 07-May-2002  uwe bus space methods should be "static __inline__", not "extern __inline__".
Otherwise an unoptimized kernel cannot be linked. Reviewed by pk.
 1.30 23-Apr-2002  pk BUS_ADDR(): avoid signed conversions.
 1.29 21-Mar-2002  eeh Add bus_space_vaddr().
 1.28 11-Mar-2002  pk `bus_type_t' is gone. Retain bus_space_map2() for MD drivers that need
to map registers to a fixed virtual address.
 1.27 15-Dec-2001  soren Use regular read/writes for stream variant calls.
 1.26 24-Sep-2001  eeh branches: 1.26.4;
Change bus_space_mmap() signature to the official one.
 1.25 19-Jul-2001  thorpej branches: 1.25.2;
Add BUS_DMA_READ and BUS_DMA_WRITE flags, that hint the back-end
at dmamap load time that the mapping will be used for a unidirectional
transfer of the specified direction.
 1.24 07-Mar-2001  thorpej branches: 1.24.2;
Add the BUS_DMA_STREAMING flag.
 1.23 09-Jul-2000  pk branches: 1.23.2;
Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.22 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.21 24-Jun-2000  pk Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.
 1.20 21-Jun-2000  pk Fix pastos in bus_space_read_region_*() functions.
 1.19 23-May-2000  pk branches: 1.19.4;
Simplify the bus_dma(9) implementation:

- the `alignment' and `boundary' arguments in bus_dmamem_alloc() only
serve as hints on how to break up a DMA transaction into chunks
when necessary; it is not necessary on sparc DVMA hardware.

- exclusively use the VM page size (i.e. PAGE_SIZE et.al.) when computing
resource allocations.

- remember the size of DVMA resource allocations in the private `_ds_sgsize'
field in a dma segment descriptor.
 1.18 09-May-2000  pk The bus_dma(9) implementation now allocates DVMA addresses in
bus_dmamap_load_*() routines only. Note that DMA memory buffers
allocated with bus_dmamem_alloc() _must_ be loaded by bus_dmamap_load_raw().
 1.17 25-Jan-2000  drochner define a "BUS_SPACE_MAP_PREFETCHABLE" flag which basically means that
device accesses are idempotent (but should not be cached by the CPU)
 1.16 23-Mar-1999  drochner branches: 1.16.8;
Add a macro to check for sufficient pointer alignment in bus.h context,
"BUS_SPACE_ALIGNED_POINTER()".
Equal to the param.h "ALIGNED_POINTER()" normally, but obeys additional
requirements of the bus_space_xxx_n() macros. (BUS_SPACE_DEBUG)
 1.15 29-Jan-1999  drochner fix address incrementing in the read_region_N, write_region_N,
set_region_N and copy_region_N methods
 1.14 26-Nov-1998  pk Turn a bunch of bus_space_*() macros into in-line functions mostly to avoid
variable aliasing.
 1.13 22-Nov-1998  pk Turn the passed tag into "used" arguments.
 1.12 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.11 30-Jul-1998  pk Define a BUS_DMA flag for devices that have a 24-bit address space.
Update _bus_dma* prototypes.
 1.10 07-Apr-1998  pk branches: 1.10.2;
* Pass the bus tag instead of just the cookie to all bus space methods.
* In the bus tag structure, keep a reference to the parent bus.
* Express all bus space methods as inline functions in stead of macros
and use the parent bus tag reference to find the nearest "upstream"
bus that implements the method.
 1.9 29-Mar-1998  pk `sparc_bus_mmap()' declaration moved to machdep.c
 1.8 28-Mar-1998  pk bus_space_probe() prototype.
 1.7 21-Mar-1998  pk Add `interrupt establish' and ` device mmap' methods and macros to
match to the bus tag structure.
 1.6 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.5 04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.4 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.3 13-Jan-1998  pk Fix parenthesis inbalance.
 1.2 23-Nov-1997  pk Re-do the `busdma' interface.
 1.1 02-Nov-1997  pk The sparc's bus.h.
 1.10.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.16.8.2 12-Mar-2001  bouyer Sync with HEAD.
 1.16.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.4.4 22-Jul-2000  pk Pull up revision 1.21.

Maintain the DVMA map extent subregion boundaries in the bus_dma map
structure.
 1.19.4.3 19-Jul-2000  mrg pull up sparc/sparc64 bus_intr_establish() changes, necessary for sparc64
(originally done by pk, approved by thorpej):

>Add a `device class' interrupt level argument (from machine/intr.h)
>to bus_interrupt_establish().
>
>It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
>level to devices in PCI slots.
 1.19.4.2 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.19.4.1 27-Jun-2000  pk Pullup rev. 1.20:
Fix pastos in bus_space_read_region_*() functions.
 1.23.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.24.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.24.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.24.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.24.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.2.1 03-Aug-2001  lukem update to -current
 1.25.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.26.4.7 03-Jan-2003  thorpej Sync with HEAD (again).
 1.26.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.26.4.5 27-Aug-2002  nathanw Catch up to -current.
 1.26.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.26.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.26.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.26.4.1 24-Sep-2001  nathanw file bus.h was added on branch nathanw_sa on 2002-01-08 00:27:37 +0000
 1.32.2.1 31-Aug-2002  gehenna catch up with -current.
 1.39.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.39.2.4 29-Nov-2004  skrll Sync with HEAD.
 1.39.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.39.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.39.2.1 03-Aug-2004  skrll Sync with HEAD
 1.44.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.44.4.1 29-Apr-2005  kent sync with -current
 1.45.4.3 03-Sep-2007  yamt sync with head.
 1.45.4.2 26-Feb-2007  yamt sync with head.
 1.45.4.1 21-Jun-2006  yamt sync with head.
 1.48.6.1 22-Apr-2006  simonb Sync with head.
 1.48.4.1 09-Sep-2006  rpaulo sync with head
 1.48.2.1 18-Feb-2006  yamt sync with head.
 1.51.20.2 12-Mar-2007  rmind Sync with HEAD.
 1.51.20.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.53.44.3 20-Jun-2009  yamt sync with head
 1.53.44.2 04-May-2009  yamt sync with head.
 1.53.44.1 16-May-2008  yamt sync with head.
 1.53.42.1 18-May-2008  yamt sync with head.
 1.53.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.54.18.1 21-Apr-2010  matt sync to netbsd-5
 1.54.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.54.10.2 18-Oct-2009  bouyer Back out ticket 969
 1.54.10.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #969):
sys/arch/sparc/include/bus.h: revision 1.56
sys/arch/sparc/sparc/machdep.c: revision 1.294
do as phone suggested - remove sparc_bus_map_large() again and use a =20=
flag
instead ( BUS_SPACE_MAP_LARGE )
 1.54.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.2 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.1 01-Jul-2011  dyoung branches: 1.1.54;
Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

Note that some bus_space(9) routines' implementation will move to .c
files from inline subroutines or macros in .h files.

I've only made the split for machine architectures where there is PCI.
All of the non-PCI-having architectures will require a similar split.

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.1.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 01-Jul-2011  dyoung Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

Note that some bus_space(9) routines' implementation will move to .c
files from inline subroutines or macros in .h files.

I've only made the split for machine architectures where there is PCI.
All of the non-PCI-having architectures will require a similar split.

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.13 18-Mar-2014  christos Make all __ALIGNBYTES macros return the same type (size_t)
 1.12 20-Jan-2012  joerg branches: 1.12.6; 1.12.10;
Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.11 11-Dec-2005  christos branches: 1.11.112; 1.11.116;
merge ktrace-lwp.
 1.10 07-Jan-2004  martin A __insn_barrier() is now available for all archs, remove the MD version
here. Suggested by Jason Thorpe.
 1.9 16-Nov-2003  pk Introduce __insn_barrier(), designed to prevent instruction re-ordering
with minimal side-effects across its location in the source code.
 1.8 20-Mar-1999  thorpej branches: 1.8.42;
Garbage-collect.
 1.7 01-Jul-1998  tv On ELF, make __indr_reference undefined and __warn_references do nothing,
as on Alpha. This should be fixed to do something in both cases.
 1.6 01-Jul-1998  tv Change _C_LABEL() to use proper underscoring depending on __ELF__ or not.
 1.5 04-Nov-1997  thorpej Bug fixes and cleanup from Chris Demetriou <cgd@pa.dec.com>:
- fix _C_LABEL so that it actually works.
- make __RENAME use _C_LABEL.
- fix __RENAME so that it expects an unquoted argument.
- fix __indr_reference and __warn_references so that they
supply their own final semicolon.
- define __warn_references to nothing if not GNU C (required
by the way it's used).

The __warn_references semicolon change has to be made
so that __warn_references can be defined into nothing.
(A ; all by itself isn't a great idea.) The __indr_reference
change was made for consistency.
 1.4 22-Oct-1997  thorpej Implement __RENAME() in <machine/cdefs.h>
 1.3 27-Dec-1996  pk branches: 1.3.14;
For now, define `__indr_reference' and `__warn_references' as empty
macros if __GNUC__ not defined.
 1.2 23-Mar-1995  jtc Changed name of __weak_reference() to __indr_reference(). They really
are indirect references, and I want to add a real __weak_reference()
macro to <machine/cdefs.h> soon.
 1.1 19-Jan-1995  jtc This file, which will be included by <sys/cdefs.h>, will contain macros
such as __warn_references() and __weak_reference() which are actually
machine dependant. This will make it easier for ports that are being
bootstraped with ELF and ECOFF based toolchains.

This change also introduces a new macro, _C_LABEL(x). _C_LABEL expands
its argument, an identifier, to a character string of the identifier
name as it is represented in an object file.

For most ports, _C_LABEL(x) will expand to "_x", for ELF based ports
_C_LABEL(x) will expand to "x".
 1.3.14.2 04-Nov-1997  thorpej Pull up from trunk: bug fixes and cleaups.
 1.3.14.1 22-Oct-1997  thorpej Pull up from trunk: Implement __RENAME() in <machine/cdefs.h>
 1.8.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.42.1 03-Aug-2004  skrll Sync with HEAD
 1.11.116.1 18-Feb-2012  mrg merge to -current.
 1.11.112.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.11.112.1 17-Apr-2012  yamt sync with head
 1.12.10.1 18-May-2014  rmind sync with head
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6 28-Mar-2023  andvar s/interrput/interrupt/ and s/accesss/access/ in comments.
 1.5 20-May-2003  nakayama Correct invalid type.
 1.4 03-May-2003  wiz DMA, not dma nor Dma.
 1.3 04-Oct-1995  pk Add a few constants used for mapping bit and pieces in the kernel driver.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 14-Aug-1994  deraadt branches: 1.1.2;
needed for X
 1.1.2.2 14-Aug-1994  deraadt needed for X
 1.1.2.1 14-Aug-1994  deraadt file cgtworeg.h was added on branch netbsd-1-0 on 1994-08-14 00:13:21 +0000
 1.20 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.19 27-Feb-2002  christos branches: 1.19.8;
- define other DEV_ constants that the local port uses.
- delete cdev_decl(mm) since <sys/conf.h> does it.
 1.18 26-Mar-2001  lukem branches: 1.18.2; 1.18.8;
- add dev_noimpl(xxx,yyy) macro to replace "(dev_type_xxx((*))) yyy",
and use appropriately

- create more helper macros:
. cdev__xyz_init(c,n), such as cdev__ocri_init() for
/* open, close, read, ioctl */, etc.
. cdev__xRy_init(c,n), where nullop is used instead of enodev to dummy out
method `R' and the comments now read /* xxx (read) yyy */ instead
. cdev__xyz_t_init(c,n,t) - as per cdev__xyz_init, but sets d_type = t
as well

- use seltrue instead of dev_noimpl(poll,*), as (IIRC) cdevsw.d_poll should
always DTRT WRT returning a valid result. (a few devices previously
incorrectly returned ENODEV)

- use dev_noimpl(stop,enodev) instead of dev_noimpl(stop,nullop) if tty
== 0, because it doesn't matter if dev_type_stop isn't implemented in that
case, and it allows the use of the cdev__xyz_init macros. certain ports
(sparc,sparc64,x68k) used the nullop method for dev_type_stop in a few
drivers, whereas everything else uses enodev

- ensure that the comments are accurate WRT the behaviour of a given entry
 1.17 15-Dec-1999  garbled branches: 1.17.6;
Add new spl level for tadpole devices splts102.
Device entrypoints for tctrl device (tadpole micro controller)
add header for direct-access ioctl to the tadpole microcontroller.
 1.16 01-Aug-1999  matt branches: 1.16.2; 1.16.8;
Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.15 30-Jul-1999  matt Add preliminary support for the built-in modem on Tadpole 3GX/S
laptops. There is currently something wrong with the interrupt
code but it does attach and sense a 16550a. (anyways the built
in modem is only a 14.4Kb and you'd really want to use a PCMCIA
modem to get faster dialup rates).
 1.14 13-Nov-1998  oster branches: 1.14.6;
Updating of bdev's and cdev's to support RAIDframe.
 1.13 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.12 21-Sep-1998  pk Fill the `bpp' slot.
 1.11 05-Sep-1998  christos Assign copyright to TNF.
 1.10 20-May-1998  pk Add `mtty' and `mbpp' entries for the magma driver by Iain Hibbert.
 1.9 18-Oct-1997  gwr Use common zs code.
 1.8 31-Dec-1996  mrg oops; rd -> md paul left behind...
 1.7 11-Nov-1996  pk Declare `cgtwo' and `rd' character devices.
 1.6 30-Sep-1996  abrown Add cgfourteen to conf.h.
Add new framebuffer types for recent-model graphics devices to fbio.h.
 1.5 07-Sep-1996  mycroft Implement poll(2).
 1.4 20-Jun-1996  pk ramdisk stuff
 1.3 19-Jun-1996  pk Remove a "notyet" in last commit.
 1.2 19-Jun-1996  pk tcx declaration
 1.1 30-Mar-1996  christos New md conf.h per Jason's plan.
 1.14.6.1 02-Aug-1999  thorpej Update from trunk.
 1.16.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.2.2 27-Mar-2001  bouyer Sync with HEAD.
 1.16.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.6.1 09-Apr-2001  nathanw Catch up with -current.
 1.18.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.18.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.18.8.1 26-Mar-2001  nathanw file conf.h was added on branch nathanw_sa on 2002-02-28 04:12:03 +0000
 1.18.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.18.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.19.8.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.111 13-Jul-2023  riastradh Break cycle by using `struct kmutex *' instead of `kmutex_t *'.

sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.
 1.110 14-Aug-2021  ryo branches: 1.110.4;
Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU.

In the current implementation, locks are acquired at the entrance of the mcount
internal function, so the higher the number of cores, the more lock conflict
occurs, making profiling performance in a MULTIPROCESSOR environment unusable
and slow. Profiling buffers has been changed to be reserved for each CPU,
improving profiling performance in MP by several to several dozen times.

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
For compatibility, if the -c option is not specified, the entire system can be
operated as before, and the -p option will get the total profiling data for
all CPUs.
 1.109 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.108 16-May-2020  ad branches: 1.108.2;
PR port-sparc/55261: sparc still panics running ATF tests

Reinstate the cpu_info change and remove __HAVE_CPU_DATA_FIRST to fix
build failure.
 1.107 16-May-2020  ad Back out previous - it doesn't work.
 1.106 15-May-2020  ad PR port-sparc/55261: sparc still panics running ATF tests

Put cpu_data at the end of cpu_info to see how that modifies the symptom.
 1.105 10-Mar-2020  christos tuck curproc/curlwp under _KERNEL only (no _KMEMUSER)
 1.104 30-Dec-2019  ad PR port-sparc/54789: Sparc boot fails with "Trap 0x21 while interrupts disabled"

Remove assumption that cpu_info is smaller than 1kB.
 1.103 01-Dec-2019  ad Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.
 1.102 23-Nov-2019  ad cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().
 1.101 22-Aug-2018  msaitoh - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.
 1.100 16-Jan-2018  mrg branches: 1.100.2; 1.100.4;
implement cpuctl identify for sparc and sparc64.

sparc:
- move enum vactype and struct cacheinfo into cpu.h
- move the cache flags from cpuinfo.flags into CACHEINFO.c_flags
(this allows the new cache_printf_backend() to see them.)
remove unused CPUFLG_CACHEIOMMUTABLES and CPUFLG_CACHEDVMA.
- align xmpsg to 64 bytes
- move cache_print() into cache_print.h so it can be shared with
cpuctl. it only depends upon a working printf().
- if found, store the CPU node's "name" into cpu_longname. this
changes the default output to show the local CPU not the
generic CPU family. eg:
cpu0 at mainbus0: mid 8: Ross,RT625 @ 90 MHz, on-chip FPU
vs the generic "RT620/625" previously shown.
- for each CPU export these things:
- name
- fpuname
- mid
- cloc
- freq
- psr impl and version
- mmu impl, version, and number of contexts
- cacheinfo structure (which changed for the first time ever
with this commit.)

sparc64:
- add a minimal "cacheinfo" structure to export the i/d/e-cache
size and linesize.
- store %ver, cpu node "name" and cacheinfo in cpu_info.
- set cpu_info ver, name and cacheinfo in cpu_attach(), and
export them via sysctl, as well as CPU ID and clock freq

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.99 02-Dec-2017  macallan - return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.98 16-Jun-2017  jdolecek dumpconf(void) long doesn't exist, remove the prototype

PR kern/39714 by Henning Petersen
 1.97 10-Dec-2016  mrg branches: 1.97.8;
rearrange slightly to enable crash(8) to build.
 1.96 10-Dec-2016  mrg move struct cpu_info and xpmsg into <machine/cpu.h> from
<sparc/sparc/cpuvar.h>. this enables them for crash(8)
and this seems more natural to me anyway.
 1.95 19-Oct-2013  christos branches: 1.95.6; 1.95.10;
make cpu_need_resched() macros consistent; __USE flags
 1.94 01-May-2012  martin branches: 1.94.2; 1.94.4;
On unaligned access, provide the data address to the signal handler, instead
of the faulting instructions address.
 1.93 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.92 30-Jul-2011  martin branches: 1.92.2; 1.92.6;
Get rid of #ifdef __sparc__ in uvm code - as noted by cgd back 1996,
now that we have __HAVE_CPU_VMSPACE_EXEC/cpu_vmspace_exec().
 1.91 24-Jan-2011  martin Provide LWP_PC
 1.90 13-Jan-2011  mrg branches: 1.90.2; 1.90.4;
introduce a hack to workaround the savefpstate IPI get's NULL
struct fpstate *.

add a new entry point ipi_savefpstate() that is used for this IPI
instead of the plain ipi_savefpstate(). check for %o0 being NULL,
and if so, just return.

add event counters for the savefpstate IPI, and another one for
when it detects the NULL problem.

make the cpu_info struct xmpsg be aligned to a single cache line.

with this change applied (and another minor change in testing) my
SS20 with dual SM75's has survived for 17 hours on build.sh -j5,
and has reported 7 NULL savefps. (the minor change seems to have
a significant effect at reducing this number, but more testing is
needed for it.)


XXX: this is horrible and we really need to find the real problem
XXX: but this should let people use sparc smp again, and fixes
XXX: for the real problem can be tested by seeing if any of the
XXX: savefp IPI null counter becomes non-zero.
 1.89 03-Jan-2010  mrg branches: 1.89.4;
add an explicit "bool mpsafe" to intr_establish(). only set it to true
for the sun4m timer/counter interrupts. this gets lev10/14 working again
on SMP systems, where those interrupts started taking the kernel lock and
hanging...
 1.88 03-Jan-2010  mrg add two new members to struct intrhand: ih_realfun and ih_realarg, and
use them to take the kernel lock around non-IPL_VM interrupts, using
a intr_biglock_wrapper() function ike x86 does.
 1.87 21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.86 29-May-2009  mrg fix up cpu_setfunc() as noted by uwe:

- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.85 27-May-2009  mrg avoid a local variable in a do {} while (0) macro.
 1.84 27-Feb-2008  xtraeme branches: 1.84.4; 1.84.14; 1.84.22;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.83 03-Dec-2007  ad branches: 1.83.10; 1.83.14;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.82 17-Oct-2007  garbled branches: 1.82.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.81 17-May-2007  yamt branches: 1.81.8; 1.81.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.80 04-Mar-2007  christos branches: 1.80.2; 1.80.4; 1.80.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.79 16-Feb-2007  ad branches: 1.79.2;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.78 09-Feb-2007  ad Merge newlock2 to head.
 1.77 11-Dec-2005  christos branches: 1.77.20;
merge ktrace-lwp.
 1.76 27-Oct-2005  uwe We need to init p_md.md_flags on fork, so implement cpu_proc_fork().
 1.75 26-Oct-2005  uwe Add missing extern to make the definition of softnet_cookie into a declaration.
 1.74 26-Oct-2005  uwe Cosmetic. Kill __P. Remove few remaining paramter names in
prototypes. CONSTCOND in while (0). Move wcopy/wzero declarations
with the rest of machdep.c. Add some blank lines for readability.
 1.73 25-Sep-2005  uwe branches: 1.73.2;
G/c msiiep_swap_endian, it's no longer used now that we run without
byteswapping in the PCIC.
 1.72 16-Jun-2005  briggs branches: 1.72.2;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.71 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.69 03-Jun-2005  martin Rename ncpu to ncpus (as other ports call it), to avoid shadow warnings.
Sprinkle some const.
 1.68 02-May-2004  pk The cpu_exit() detour is no longer necessary.
 1.67 17-Apr-2004  pk Remove the cache_flush() trampoline; it's no longer directly cross-called.
Instead, implement the MP parts in terms of cross-callable vcache_flush_range()
function.
 1.66 04-Jan-2004  jdolecek branches: 1.66.2;
Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread
 1.65 08-Nov-2003  tsutsui #if defined(_KERNEL_OPT) is enough, #if !defined(_LKM) isn't needed
in that case. Pointed out by mrg.
 1.64 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.63 22-Jan-2003  pk branches: 1.63.2;
Add functions to set & get the interrupt target CPU.
 1.62 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.61 16-Jan-2003  pk Rename the current mp_{pause,resume}_cpus() => mp_{pause,resume}_cpus_ddb().
Implement mp_pause_cpus/mp_resume_cpus on top of the PROM services.
 1.60 14-Jan-2003  pk Add CLKF_LOPRI() macro that allows a (timer) interrupt handler to determine
whether it is interrupting code running at a given IPL level.
 1.59 12-Jan-2003  pk schedcpu() has been fixed; now we can notify another CPU about a pending
reschedule request.
 1.58 12-Jan-2003  pk Remove needless indirection from the curproc() macro.
 1.57 10-Jan-2003  pk Replace `want_resched' and `want_ast' globals by per-CPU variables.
 1.56 06-Jan-2003  pk Move schedintr() to clock.c and initialise schedhz in initclocks(), so
these are available to all timer implementations.
 1.55 03-Jan-2003  mrg remove dead extern fpproc/foundfpu declarations.
 1.54 10-Dec-2002  pk * intr_establish() now takes an optional `fast trap' routine argument.
* also remove __P().
 1.53 09-Dec-2002  pk setsoftint() is no longer used.
 1.52 06-Dec-2002  pk Pass the `device class interrupt level' on to intr_establish() and use to
raise the ipl in the interrupt handlers to the appropriate level. This avoids
interrupt handler interference if one of the devices actually interrupts at
a lower hardware level than the maximum level assined to a device class.

Based on code from Art Grabowski in openbsd.
 1.51 28-Nov-2002  pk Not all sun4m platforms have version 8 sparc CPUs. So go out to the PROM
and get the CPU architecture version from the PROM cpu node `sparc-version'
property.
 1.50 26-Nov-2002  pk Add `machdep.cpu_arch' sysctl to determine the CPU architecture version.
Currrently, cpu types `sun4' and `sun4c' produce version 7, all others
version 8.
 1.49 03-Feb-2002  darrenr * add machdep.booted_device and machdep.boot_args (both fetched from
appropriate PROM variables).
* return "netbsd" for machdep.booted_kernel if the PROM doesn't return us a
kernel name.
 1.48 11-Dec-2001  uwe Export msiiep_swap_endian(onoff) from msiiep.c to turn on/off
automagic endian swapping performed by PCI controller. Need it in
several places where we want to enter PROM repl.
 1.47 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.46 12-Nov-2001  pk Remove redundant declarations.
 1.45 27-Sep-2001  mrg branches: 1.45.2; 1.45.4;
implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.44 14-Jun-2001  thorpej branches: 1.44.2; 1.44.4;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.43 15-Mar-2001  mrg sprinkle KERNEL_LOCK() and KERNEL_PROC_LOCK() where they're missing. add
SYSCALL_DEBUG support to trap.c.
 1.42 21-Jan-2001  christos branches: 1.42.2;
fix bit rot so that MP kernel compiles s/cpu_no/ci_cpuid/
 1.41 25-Aug-2000  thorpej Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.
 1.40 05-Jun-2000  thorpej Fix typo. kern/10291.
 1.39 03-Jun-2000  thorpej Provide a CPU_IS_PRIMARY() macro in the MULTIPROCESSOR case.
 1.38 31-May-2000  pk Move switchexit() declaration in here.
 1.37 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Fix a bug where all cpu_info structures except for the boot CPUs
would exist at both a CPU-local VA (CPUINFO_VA) and a gloal VA;
The boot CPU's existed only a CPUINFO_VA.
- Add a self-reference pointer to the cpu_info that references the
global address in the MULTIPROCESSOR case. Just allow it to reference
the `local' VA in the single-processor case, as CPUINFO_VA is global
enough when there's only one processor to care about. Change curcpu()
to return the global address.
 1.36 26-May-2000  thorpej branches: 1.36.2;
First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.35 16-Dec-1999  thorpej Provide cpu_boot_secondary_cpus().
 1.34 04-Oct-1999  pk branches: 1.34.2; 1.34.8;
Implement sysctl `machdep.booted_kernel'.
 1.33 10-Aug-1999  thorpej Define cpu_number() as discussed on tech-smp.
 1.32 19-Jan-1999  pk Add SIR_SERIAL soft interrupt source.
 1.31 11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.30 13-Oct-1998  pk CLKF_INTR() needs to have a MULTIPROCESSOR version.
 1.29 05-Oct-1998  thorpej cpu_set_kpc() prototype is already in <sys/systm.h>.
 1.28 26-Sep-1998  pk mp_{pause,resume,halt}_cpu() prototypes.
 1.27 23-Aug-1998  pk Nuke obsolete prototype.
 1.26 21-Aug-1998  pk iommu_{enter,remove} moved to iommuvar.h
 1.25 22-Nov-1997  tv eliminate declarations of global data in <sparc/cpu.h> and declare in
source files, reducing global symblol replication in .o kernel files
 1.24 15-Mar-1997  pk Add fix_align() and emulinstr() prototypes.
 1.23 06-Nov-1996  cgd Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().
 1.22 05-Sep-1996  thorpej Make the SPARC kernel compile again after recent tty cdevsw changes.
 1.21 31-Mar-1996  pk Move autoconf subroutine prototypes to autoconf.h
Deal with sun4m `software interrupts'.
 1.20 15-Mar-1996  christos Fix prototypes for the latest kpc changes.
 1.19 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.18 14-Mar-1996  pk Remove cpu_set_init_frame().
 1.17 28-Jun-1995  cgd remove unused cpu_exec() definitions. moved "broken swap" markers, for
ports that still need it, to types.h.
 1.16 19-May-1995  pk cpu_swapout() not needed after all.
 1.15 08-May-1995  pk Start swapping.
 1.14 05-May-1995  cgd define BROKEN_SWAP and/or cpu_swapout as appropriate.
 1.13 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.12 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.11 25-Nov-1994  deraadt prototype wcopy/wzero
 1.10 20-Nov-1994  deraadt copyright/Id cleanup
 1.9 26-Oct-1994  deraadt vme interrupt support
 1.8 27-Sep-1994  deraadt USPAGE
 1.7 19-May-1994  deraadt liten
 1.6 05-May-1994  deraadt profiling and clock stuff
 1.5 05-May-1994  deraadt flags foo
 1.4 22-Mar-1994  deraadt move defn of trapvec to cpu.h
 1.3 01-Feb-1994  deraadt sparc runs in current today
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.34.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.34.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.34.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.34.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.36.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.42.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.42.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.44.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.44.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.44.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.45.4.12 17-Jan-2003  thorpej Sync with HEAD.
 1.45.4.11 15-Jan-2003  thorpej Sync with HEAD.
 1.45.4.10 06-Jan-2003  martin Catch up to -current.
 1.45.4.9 03-Jan-2003  thorpej Pass exit2 or lwp_exit2 to switchexit(), as is suggested in comments,
and eliminate switchlwpexit().
 1.45.4.8 03-Jan-2003  thorpej Sync with HEAD (again).
 1.45.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.45.4.6 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.45.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.45.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.45.4.3 08-Dec-2001  thorpej Add a cpu_proc_fork(), called from uvm_proc_fork(), which takes care
of machine-dependent handling a fork() time (this is different from
forking the actual context in an LWP world). #define it away on
platforms which do not need it.

Problem noted by Gregory McGarry.
 1.45.4.2 20-Nov-2001  pk Adjust prototypes for SA support.
 1.45.4.1 27-Sep-2001  pk file cpu.h was added on branch nathanw_sa on 2001-11-20 16:20:50 +0000
 1.45.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.63.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.63.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.63.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.63.2.1 03-Aug-2004  skrll Sync with HEAD
 1.66.2.1 24-Apr-2004  jdc Pull up revision 1.67 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.72.2.5 17-Mar-2008  yamt sync with head.
 1.72.2.4 07-Dec-2007  yamt sync with head
 1.72.2.3 03-Sep-2007  yamt sync with head.
 1.72.2.2 26-Feb-2007  yamt sync with head.
 1.72.2.1 21-Jun-2006  yamt sync with head.
 1.73.2.1 02-Nov-2005  yamt sync with head.
 1.77.20.2 12-Jan-2007  ad sparc MD changes.
 1.77.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.79.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.79.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.80.10.1 22-May-2007  matt Update to HEAD.
 1.80.4.1 11-Jul-2007  mjf Sync with head.
 1.80.2.2 03-Dec-2007  ad Sync with HEAD.
 1.80.2.1 27-May-2007  ad Sync with head.
 1.81.10.3 23-Mar-2008  matt sync with HEAD
 1.81.10.2 09-Jan-2008  matt sync with HEAD
 1.81.10.1 06-Nov-2007  matt sync with HEAD
 1.81.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.82.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.83.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.83.10.1 24-Mar-2008  keiichi sync with head.
 1.84.22.1 21-Apr-2010  matt sync to netbsd-5
 1.84.14.2 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.84.14.1 09-Jan-2010  snj Pull up following revision(s) (requested by mrg in ticket #1223):
sys/arch/sparc/include/cpu.h: revision 1.86
sys/arch/sparc/sparc/locore.s: revision 1.246
sys/arch/sparc/sparc/vm_machdep.c: revision 1.100
fix up cpu_setfunc() as noted by uwe:
- don't call lwp_startup for cpu_setfunc() users
- introduce lwp_setfunc_trampoline instead
- no need to set the "new" lwp for setfunc
 1.84.4.2 11-Mar-2010  yamt sync with head
 1.84.4.1 20-Jun-2009  yamt sync with head
 1.89.4.1 05-Mar-2011  rmind sync with head
 1.90.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.90.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.92.6.2 02-Jun-2012  mrg sync to latest -current.
 1.92.6.1 24-Feb-2012  mrg sync to -current.
 1.92.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.92.2.2 23-May-2012  yamt sync with head.
 1.92.2.1 17-Apr-2012  yamt sync with head
 1.94.4.1 18-May-2014  rmind sync with head
 1.94.2.2 03-Dec-2017  jdolecek update from HEAD
 1.94.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.95.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.95.6.2 28-Aug-2017  skrll Sync with HEAD
 1.95.6.1 05-Feb-2017  skrll Sync with HEAD
 1.97.8.1 08-Dec-2017  msaitoh Pull up following revision(s) (requested by macallan in ticket #429):
sys/arch/sparc/sparc/cpu.c: revision 1.250
sys/arch/sparc/include/cpu.h: revision 1.99
sys/arch/sparc/sparc/intr.c: revision 1.119
- return early in xcall() if the function is sparc_noop() instead of triggering
the IPI and then ignoring responses ( or lack thereof )
- write the .tag field last to avoid a race when polling for an incoming
IPI
- add event counters for IPIs being caught with the mutex not held, and for
messages that are already marked as completed
With this my SS20 made it through 48 hours of pkgsrc with MAKE_JOBS=3 and a
pair of SM81s.
Hypersparcs still crash but instead of craziness we get actual error messages,
apparently one CPU will occasionally do a watchdog reset, which according to
the manual is caused by catching a trap with traps disabled. Now to figure
out how that can even happen...
 1.100.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.100.4.1 10-Jun-2019  christos Sync with HEAD
 1.100.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.108.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.110.4.1 09-Aug-2023  martin Pull up following revision(s) (requested by maya in ticket #316):

sys/arch/m68k/include/mutex.h: revision 1.13
sys/arch/arm/include/cpu.h: revision 1.125
sys/arch/sun68k/include/intr.h: revision 1.21
sys/arch/arm/include/mutex.h: revision 1.28
sys/sys/rwlock.h: revision 1.18
sys/arch/powerpc/include/mutex.h: revision 1.7
sys/arch/arm/include/mutex.h: revision 1.29
sys/arch/powerpc/include/mutex.h: revision 1.8
sys/uvm/uvm_param.h: revision 1.42
sys/sys/ksem.h: revision 1.16
sys/arch/x86/include/mutex.h: revision 1.10
sys/sys/proc.h: revision 1.372
sys/sys/ksem.h: revision 1.17
sys/arch/ia64/include/mutex.h: revision 1.8
sys/arch/evbarm/include/intr.h: revision 1.29
sys/sys/lua.h: revision 1.9
sys/arch/next68k/include/intr.h: revision 1.23
sys/arch/ia64/include/mutex.h: revision 1.9
sys/arch/hp300/include/intr.h: revision 1.35
sys/arch/hp300/include/intr.h: revision 1.36
sys/arch/sparc/include/cpu.h: revision 1.111
sys/arch/hppa/include/mutex.h: revision 1.16
sys/arch/vax/include/intr.h: revision 1.31
sys/arch/hppa/include/mutex.h: revision 1.17
sys/arch/news68k/include/intr.h: revision 1.28
sys/arch/hppa/include/mutex.h: revision 1.18
sys/arch/hppa/include/intr.h: revision 1.3
sys/arch/hppa/include/mutex.h: revision 1.19
sys/arch/hppa/include/intr.h: revision 1.4
sys/sys/sched.h: revision 1.92
sys/opencrypto/cryptodev.h: revision 1.51
sys/arch/vax/include/mutex.h: revision 1.20
sys/arch/sparc64/include/mutex.h: revision 1.10
sys/arch/ia64/include/sapicvar.h: revision 1.2
sys/arch/riscv/include/mutex.h: revision 1.5
sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
sys/arch/riscv/include/mutex.h: revision 1.6
sys/ddb/files.ddb: revision 1.16
sys/arch/mac68k/include/intr.h: revision 1.32
share/man/man4/ddb.4: revision 1.203
sys/ddb/db_command.c: revision 1.183
sys/arch/mips/include/mutex.h: revision 1.10
sys/ddb/db_command.c: revision 1.184
sys/arch/x68k/include/intr.h: revision 1.22
sys/arch/sparc/include/psl.h: revision 1.51
sys/arch/or1k/include/mutex.h: revision 1.4
sys/arch/mips/include/mutex.h: revision 1.11
sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
sys/arch/sparc64/include/cpu.h: revision 1.134
sys/arch/sparc/include/psl.h: revision 1.52
sys/arch/or1k/include/mutex.h: revision 1.5
sys/arch/mvme68k/include/intr.h: revision 1.22
sys/arch/luna68k/include/intr.h: revision 1.16
external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
sys/arch/sparc/include/mutex.h: revision 1.12
sys/arch/sparc/include/mutex.h: revision 1.13
sys/arch/usermode/include/mutex.h: revision 1.5
sys/arch/usermode/include/mutex.h: revision 1.6
sys/kern/kern_core.c: revision 1.38
usr.sbin/crash/Makefile: revision 1.49
sys/arch/amiga/include/intr.h: revision 1.23
sys/arch/alpha/include/mutex.h: revision 1.12
sys/arch/alpha/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
sys/ddb/ddb.h: revision 1.6
sys/arch/sparc64/include/mutex.h: revision 1.8
sys/arch/sh3/include/mutex.h: revision 1.12
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
sys/ddb/db_syncobj.c: revision 1.1
sys/arch/vax/include/mutex.h: revision 1.18
sys/arch/sparc64/include/psl.h: revision 1.63
sys/arch/sparc64/include/mutex.h: revision 1.9
sys/arch/sh3/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/obio.c: revision 1.13
sys/arch/atari/include/intr.h: revision 1.23
sys/ddb/db_syncobj.c: revision 1.2
sys/arch/vax/include/mutex.h: revision 1.19
sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
sys/arch/cesfic/include/intr.h: revision 1.14
sys/ddb/db_syncobj.h: revision 1.1
sys/arch/x86/include/cpu.h: revision 1.134
sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
sys/arch/cesfic/include/intr.h: revision 1.15
sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
sys/sys/cpu_data.h: revision 1.54
sys/arch/m68k/include/mutex.h: revision 1.12
sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes. Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h. avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h. And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.
 1.5 08-Oct-2016  joerg Macros expanding to defined() expression is not actually correct ISO C
behavior. Since it is not clear whether someone might decide to define
the macros to random non-1 values, introduce a level of indirection and
count the same of the helper macros.
 1.4 11-Dec-2005  christos branches: 1.4.122; 1.4.142; 1.4.146;
merge ktrace-lwp.
 1.3 16-Jan-2005  chs implement pmap_wired_count(). use more macros for determining MMU type.
 1.2 07-Aug-2003  agc branches: 1.2.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 09-Apr-2003  thorpej branches: 1.1.2;
Move CPU configuration predicates to <machine/cpuconf.h>.
 1.1.2.4 17-Jan-2005  skrll Sync with HEAD.
 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.2.8.1 29-Apr-2005  kent sync with -current
 1.4.146.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4.142.1 05-Dec-2016  skrll Sync with HEAD
 1.4.122.1 03-Dec-2017  jdolecek update from HEAD
 1.32 10-Mar-2024  rillig sparc: fix snprintb formats for SFSR_BITS
 1.31 06-Sep-2021  andvar fix various typos in comments.
 1.30 29-Aug-2019  msaitoh Add missing NUL to prevent buffer overrun.
 1.29 04-Dec-2013  jdc branches: 1.29.22; 1.29.30; 1.29.34;
Clarify comment about SER_SZERR.
 1.28 11-Dec-2005  christos branches: 1.28.112; 1.28.122; 1.28.128;
merge ktrace-lwp.
 1.27 10-Sep-2005  uwe Add definitions for microSPARC-IIep memory fault registers.
 1.26 27-Apr-2004  pk branches: 1.26.12;
Bits 0 (MMU Enable) and 1 (Fault inhibit) are common among the implementations
of the SRMMU control register. Reflect that fact in the definitions here.

Also add the swift `store allocate' bit.
 1.25 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.24 31-Dec-2002  pk branches: 1.24.2;
Add some more definitions: SRMMU and MXCC reset register.
 1.23 24-Aug-2002  thorpej Add Sun4d cpu-unit ASIs.
 1.22 05-May-2000  pk branches: 1.22.8; 1.22.12; 1.22.20;
Define some more bits in the MXCC control register.
 1.21 01-May-2000  pk Add definitions of HyperSPARC block fill/copy ASIs.
 1.20 30-Apr-2000  pk Rename MXCC control register.
Add MXCC stream register definitions.
 1.19 19-Jan-1999  pk branches: 1.19.8;
Define Hypersparc ICCR bits.
 1.18 20-Sep-1998  pk Name fault registers more like they're referred to in various docs.
 1.17 06-Sep-1998  pk Use the new "%b" format.
 1.16 26-Jul-1998  pk Define hypersparc instruction-cache flush ASI.
 1.15 20-Jul-1997  pk Remove a couple of "ms2 only" from cache-flush ASIs.
 1.14 06-Jul-1997  pk Define the turbosparc's processor configuration register.
 1.13 22-Mar-1997  pk For each major "module", define a separate set of MMU control register bits.
 1.12 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.11 15-May-1996  mrg remove some RCS id's we don't need.
 1.10 31-Mar-1996  pk Add SRMMU/sun4m definitions.
Cleanup (i.e. mostly delete) `#if defined (SUN4*)' in here.
 1.9 23-Oct-1995  pk Define VIDEO enable bit (per Jason Thorpe; PR#1672).
 1.8 25-Jun-1995  pk add a couple more sun4m bits.
 1.7 13-Apr-1995  pk Add `region' ASI.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 26-Oct-1994  deraadt vme, and cleanup some messy #ifdef stuff
 1.4 20-Aug-1994  deraadt add sun4 control space areas
 1.3 04-Jul-1994  deraadt add srmmu flush/prope ASI sub-codes
 1.2 05-May-1994  deraadt add sun4m ASI definitions
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.19.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.22.20.1 31-Aug-2002  gehenna catch up with -current.
 1.22.12.2 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.22.12.1 27-Aug-2002  nathanw Catch up to -current.
 1.22.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.24.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.26.12.1 21-Jun-2006  yamt sync with head.
 1.28.128.1 18-May-2014  rmind sync with head
 1.28.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.112.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.34.1 01-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #145):

sys/arch/sparc/include/ctlreg.h: revision 1.30
sys/dev/pci/if_xgereg.h: revision 1.3

Add missing NUL to prevent buffer overrun.
 1.29.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.29.22.1 26-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1387):

sys/arch/sparc/include/ctlreg.h: revision 1.30
sys/dev/pci/if_xgereg.h: revision 1.3

Add missing NUL to prevent buffer overrun.
 1.30 26-Oct-2023  andvar Build db_machdep.c when KGDB option is enabled.
Do not cast (regs)->db_tf.tf_pc to db_addr_t (thus ifdef block is redundant).
Adjust ifdef conditions in db_interface.c to make it build with KGDB option.
While here, add #endif comments for longer blocks.

These changes should make sparc build with KGDB option, once ddb/db_access.c
code will be fixed to build with it.
 1.29 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.28 06-Nov-2017  christos branches: 1.28.16;
Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.
 1.27 10-Dec-2016  mrg rearrange slightly to enable crash(8) to build.
 1.26 26-May-2011  joerg branches: 1.26.14; 1.26.32; 1.26.36;
Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.25 11-Apr-2011  mrg obsolete DB_AOUT_SYMBOLS. however, we need to leave most of the code
in db_sym.[ch] as it is used by the elf version of crash(8).

i will be cleaning up the db_sym.c code in a follow up commit to avoid
having dead code compiled.
 1.24 14-Jan-2011  rmind branches: 1.24.2;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.23 21-Feb-2007  thorpej branches: 1.23.68;
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.22 01-Apr-2006  cherry branches: 1.22.14;
closes: PR kern/32359

modifies machine/db_machdep.h: BKPT_SET(inst) to BKPT_SET(inst, addr) for all archs ie; passess the
breakpoint address as well.

Patch from cherry@mahiti.org
 1.21 04-Mar-2006  uwe branches: 1.21.2; 1.21.4; 1.21.6;
De-__P.
 1.20 29-Apr-2003  scw branches: 1.20.18; 1.20.32; 1.20.34;
Add a BKPT_ADDR() macro which gives MD code a chance to munge a
breakpoint address before it's used. Currently a no-op on all but sh5.

This is useful on sh5, for example, to mask off the instruction
type encoding in the bottom two address bits, and makes it possible
to do "db> break $rXX" instead of manually munging the address.
 1.19 07-Jan-2003  pk Simplify ddb register storage setup: remove MULTIPROCESSOR special cases
and keep the ddb register copies on the current stack always.
 1.18 07-Jan-2003  pk * Maintain a pointer to the cpu_info structure of the CPU being examined.
* Force cpu_Debugger() to have a stack frame, so tracing can at least
start off matching arguments and function calls correctly.
 1.17 09-Nov-2001  thorpej Remove unneeded declarations of the db_machine_init() function. The
ARM ports are the only ones that actually have one, and it is about
to change.
 1.16 30-Jun-2001  mrg branches: 1.16.2; 1.16.6; 1.16.8;
for now, KGDB kernels do not have access to multiple cpu's trapframe.
 1.15 08-Jun-2001  mrg if MULTIPROCESSOR, make the registers virtual, so that we can access other
processors registers. rework enter/exit ddb code to look more like the i386
code. make "mach cpu" and "mach cpu N" work.
 1.14 29-Jun-2000  mrg branches: 1.14.2;
remove include of <vm/vm.h> and <machine/pmap.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 30-Apr-1999  christos branches: 1.13.2;
Compile in support for ELF symbols.
 1.12 21-Aug-1998  pk branches: 1.12.8;
Convert to [pv]addr_t & [pv]size_t.
 1.11 10-Dec-1997  pk Code for software-assisted DDB single-stepping from Chuck Silvers.
 1.10 31-Aug-1997  pk Switch to MI kgdb code.
 1.9 26-Jun-1997  thorpej branches: 1.9.4;
#define DB_AOUT_SYMBOLS
 1.8 05-Feb-1997  pk db_expr_t is now a long.
 1.7 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.6 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.5 09-Feb-1996  christos A few prototype fixes
 1.4 10-Dec-1995  mycroft Include vm.h, rather than guessing which files we need.
 1.3 09-Feb-1995  pk We have more registers.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 24-Mar-1994  pk DDB support
 1.9.4.1 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.8.3 07-Jan-2003  thorpej Sync with HEAD.
 1.16.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.16.8.1 30-Jun-2001  nathanw file db_machdep.h was added on branch nathanw_sa on 2002-01-08 00:27:37 +0000
 1.16.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.16.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.34.1 22-Apr-2006  simonb Sync with head.
 1.20.32.1 09-Sep-2006  rpaulo sync with head
 1.20.18.2 26-Feb-2007  yamt sync with head.
 1.20.18.1 21-Jun-2006  yamt sync with head.
 1.21.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.21.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.21.2.1 11-Apr-2006  yamt sync with head
 1.22.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.23.68.3 31-May-2011  rmind sync with head
 1.23.68.2 21-Apr-2011  rmind sync with head
 1.23.68.1 05-Mar-2011  rmind sync with head
 1.24.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.36.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.26.32.1 05-Feb-2017  skrll Sync with HEAD
 1.26.14.1 03-Dec-2017  jdolecek update from HEAD
 1.28.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 30-Aug-2011  bouyer Add getlabelusesmbr(), as proposed in
http://mail-index.netbsd.org/tech-userlevel/2011/08/25/msg005404.html
This is used by disk tools such as disklabel(8) to dynamically decide is
the undelyling platform uses a disklabel-in-mbr-partition or not
(instead of using a compile-time list of ports).
getlabelusesmbr() reads the sysctl kern.labelusesmbr, takes its value from the
machdep #define LABELUSESMBR.
For evbmips, make LABELUSESMBR 1 if the platform uses pmon
as bootloader, and 0 (the previous value) otherwise.
 1.5 29-Jun-1996  pk Put native NetBSD disk label in a piece of wasteland within a SunOS label.
 1.4 01-Sep-1995  pk Enable writing of disklabels (Many thanks to Jason Thorpe, Gordon Ross
and Matthew Green).
 1.3 12-Jul-1995  thorpej Zap duplicate RCS id.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 14-Oct-1994  cgd move arch dependence to archs. clean up a bit. deal with weird MAXPARTITONS.
 1.10 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.9 28-Apr-2008  martin branches: 1.9.44;
Remove clause 3 and 4 from TNF licenses
 1.8 04-Mar-2006  uwe branches: 1.8.68; 1.8.70; 1.8.72;
De-__P.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6;
merge ktrace-lwp.
 1.6 19-Jun-2005  thorpej branches: 1.6.2;
Move common Sun3/Sun4 EEPROM definitions in to <dev/sun/eeprom.h>
 1.5 19-Jun-2005  thorpej Fix some whitespace.
 1.4 20-Jul-2002  mrg branches: 1.4.6;
sync these with the sparc64 versions.
 1.3 03-Mar-2002  jmc branches: 1.3.6;
Provide a definition for DEV_EEPROM so mem.c will compile if SUN4 is defined.
 1.2 29-Aug-1995  pk branches: 1.2.46; 1.2.50;
Export `eeprom_va' so drivers can peek at the configuration (from Jason Thorpe).
 1.1 29-May-1995  pk eeprom device for Sun4 from Jason Thorpe.
 1.2.50.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.50.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.46.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.46.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.6.1 31-Aug-2002  gehenna catch up with -current.
 1.4.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.1 21-Jun-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.8.72.1 16-May-2008  yamt sync with head.
 1.8.70.1 18-May-2008  yamt sync with head.
 1.8.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.44.1 03-Dec-2017  jdolecek update from HEAD
 1.10 06-Nov-2017  christos Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.
 1.9 12-Aug-2017  joerg Add sparc/sparc64 support for irelative relocations.
 1.8 02-Feb-2017  martin PR port-sparc64/51925: cosmetic cleanup, no functional change
 1.7 30-May-2009  skrll branches: 1.7.22; 1.7.40; 1.7.44; 1.7.48;
Add TLS relocation definitions.
 1.6 09-Dec-2001  thorpej branches: 1.6.122;
Add support for dumping ELF-cormat core files.
 1.5 02-Apr-2000  minoura branches: 1.5.8; 1.5.12;
Move dl* function definitions to libc on ELF.
Based on the patch supplied by Takuya Shiozaki <tshiozak@astec.co.jp>.
See http://mail-index.netbsd.org/tech-userlevel/2000/02/23/0000.html.
 1.4 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.3 14-May-1999  eeh branches: 1.3.2; 1.3.4; 1.3.6;
Let NetBSD/sparc know about 64-bit formats even if it can't execute them.
 1.2 01-Jul-1998  tv branches: 1.2.10;
Add relocation definitions used by ld.elf_so.
 1.1 26-Sep-1996  cgd add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.
 1.2.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.6.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
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.5.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.122.1 20-Jun-2009  yamt sync with head
 1.7.48.1 21-Apr-2017  bouyer Sync with HEAD
 1.7.44.1 20-Mar-2017  pgoyette Sync with HEAD
 1.7.40.2 28-Aug-2017  skrll Sync with HEAD
 1.7.40.1 05-Feb-2017  skrll Sync with HEAD
 1.7.22.1 03-Dec-2017  jdolecek update from HEAD
 1.1 29-Mar-2018  joerg branches: 1.1.2;
Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.
 1.1.2.2 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.1.2.1 29-Mar-2018  pgoyette file elf_support.h was added on branch pgoyette-compat on 2018-03-30 06:20:12 +0000
 1.13 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.12 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.11 21-Aug-1999  simonb branches: 1.11.2;
Include <sys/endian.h> after defining whether where are little- or
big-endian. i386, pc532 and vax still include <machine/byte_swap.h>
and define macros for the {n,h}to{h,n}*() functions. mips also
defines some endian-independent assembly-code aliases for unaligned
memory accesses.
 1.10 24-Jan-1999  mycroft Mark [hn]to[nh][ls]() with __const__, so they are subject to CSE.
 1.9 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.8 31-Jul-1998  mycroft (Always) (practice) (safe) (macro expansion).
 1.7 09-Oct-1997  bouyer branches: 1.7.4;
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 11-Oct-1996  christos branches: 1.6.10;
add in_addr_t and in_port_t
 1.5 14-Aug-1996  thorpej Back out previous; this is a bigger problem than I expected.
 1.4 14-Aug-1996  thorpej The htonl(), htons(), etc. functions return u_long and u_short. Add
casts to the big-endian versions of these calls so that the compiler
won't complain when they're passed as arguments to printf().
 1.3 13-Feb-1996  christos - Fix setcxsegmap prototype.
- Cast ?TO? macros to NULL to avoid compiler warnings
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 10-Oct-1993  deraadt need these
 1.6.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.4.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 17-Mar-2000  mycroft branches: 1.1.6;
In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 17-Mar-2000  bouyer file endian_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:25:39 +0000
 1.8 08-Oct-1996  cgd moved to aout_machdep.h (via repository copy)
 1.7 20-Nov-1994  deraadt copyright/Id cleanup
 1.6 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.5 18-Oct-1993  deraadt fix a typo
 1.4 18-Oct-1993  pk Put definition of __LDPGSZ and `struct relocation_info' where they belong:
in <machine/exec.h>.
 1.3 15-Oct-1993  deraadt actually put something in a previously empty file.
__LDPGSZ should now be defined here!
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7 20-Aug-2000  pk fbio.h moded to sys/dev/sun.
Retain symlink from /usr/include/machine.
 1.6 01-Aug-1999  matt branches: 1.6.2; 1.6.12;
Initial stab at a P9100 console FB driver for the Tadpole 3GX.
It supports RASTERCONSOLE only and the colormap support is
broken (the hardware doesn't seem to be doing what the tech.
docs. say it should be doing). But it is usable as a console
(but with blue on white as the only color choice). I figured
I'd check it in since it is somewhat usable and someone else
might figure what I screwed up in the color map support.
 1.5 30-Sep-1996  abrown branches: 1.5.24;
Add cgfourteen to conf.h.
Add new framebuffer types for recent-model graphics devices to fbio.h.
 1.4 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 27-Feb-1994  deraadt add things needed by the cgsix
 1.1 16-Oct-1993  deraadt fbio.h, mailed from Torek. This file is from Sprite, and clearly an
extensively modified SunOS file. *sigh*.
(ie. Feel free to rewrite it from scratch...)
 1.5.24.1 02-Aug-1999  thorpej Update from trunk.
 1.6.12.1 16-Aug-2001  tv Pullup [jdolecek]:

sys/arch/amiga/dev/grf_cl.c 1.26
sys/arch/amiga/dev/grfioctl.h 1.14
sys/arch/hpcmips/dev/plumvideo.c 1.20
sys/arch/macppc/dev/ofb.c 1.25
sys/arch/sparc/dev/cgtwo.c 1.35
sys/arch/sparc/include/fbio.h patch
sys/arch/sparc64/include/fbio.h patch
sys/arch/sun3/dev/cg2.c 1.14
sys/arch/sun3/include/fbio.h patch
sys/dev/pci/tga.c 1.35
sys/dev/tc/cfb.c 1.28
sys/dev/tc/mfb.c 1.27
sys/dev/tc/sfb.c 1.46
sys/dev/tc/sfbplus.c 1.10 via patch
sys/dev/tc/tfb.c 1.30
sys/dev/tc/xcfb.c 1.23
sys/net/if_ppp.c 1.71

Use unsigned variable types to make bounds checking more correct.
 1.6.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.15 25-Aug-2003  uwe Framebuffer code common to sparc and sparc64 was merged and moved to
dev/sun 3 years ago. Remove these redundant and out-of-date copies.
All code now uses dev/sun/fbvar.h
 1.14 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.13 26-Jun-2000  simonb branches: 1.13.24;
Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.12 19-Mar-2000  pk branches: 1.12.4;
Add `fb_is_console()', which is a helper function for frame buffer
device drivers used to decide whether or not to act as console output.
 1.11 13-Apr-1999  ad branches: 1.11.2;
Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.10 21-Mar-1998  pk branches: 1.10.10;
Split the fb_setsize() utility in two separate functions: one to be
used by OBP machines and another one for sun4/eeprom machines.
 1.9 07-Jul-1997  pk fbrcons_{rows,cols} helper functions.
 1.8 04-Oct-1996  thorpej Returning ENODEV is not correct in a poll entry point. Instead, since
read/write returns an error, use seltrue().
 1.7 27-Feb-1996  thorpej First-cut support for P4 framebuffers. Currently supports P4 variants
of bwtwo, cgfour, cgsix, and cgeight. Includes support for attaching
the overlay plane of the cgfour and cgeight as a bwtwo instance (a'la
SunOS).

P4 register descriptions, cgfour driver, and cgeight driver partially
derived from OpenBSD.

This code may still need polishing.
 1.6 29-Nov-1995  pk Code from Jason to better configure /dev/fb.
 1.5 08-Oct-1995  pk branches: 1.5.2;
Patch from Jason to factor out a common framebuffer size determination
routine from the individual drivers.
 1.4 05-Oct-1995  pk RCONSOLE => RASTERCONSOLE.
 1.3 17-Sep-1995  pk Remove all rcons related stuff from `fbdevice'; this is now defined in
dev/rcons/rcons.h.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.1 16-Feb-1996  thorpej Pull in improved framebuffer autoconfiguration code from -current.
Prevents panics when multiple framebuffers are found on sun4 systems.
 1.10.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.12.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.13.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2 14-Jan-2017  martin Make the copies of the FE_* macros match verbatim to avoid a gcc warning
when both ieeefp.h and fenv.h are included.
 1.1 20-May-2011  nakayama branches: 1.1.2; 1.1.6; 1.1.18; 1.1.36; 1.1.40;
Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.1.40.1 20-Mar-2017  pgoyette Sync with HEAD
 1.1.36.1 05-Feb-2017  skrll Sync with HEAD
 1.1.18.1 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.6.1 20-May-2011  jruoho file fenv.h was added on branch jruoho-x86intr on 2011-06-06 09:06:45 +0000
 1.1.2.2 31-May-2011  rmind sync with head
 1.1.2.1 20-May-2011  rmind file fenv.h was added on branch rmind-uvmplock on 2011-05-31 03:04:17 +0000
 1.13 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

Otherwise, the feature tests might come out wrong. For example,
header files that check for _NETBSD_SOURCE won't get the default when
no other _*_SOURCE macros are defined; header files that check for
_POSIX_C_SOURCE might miss _XOPEN_SOURCE, which is supposed to imply
a corresponding _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.12 25-Nov-2009  martin branches: 1.12.100;
Remove double include that prevented the right machdep LDBL_* constants
to be used.

Noticed by Masao Uebayashi.
 1.11 25-Oct-2008  mrg move the float definitions all into <sparc/float.h> and make that
version work in either 32 or 64 bit mode.
 1.10 12-May-2003  kleink branches: 1.10.104; 1.10.108; 1.10.114;
Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.9 19-Apr-2003  christos PR/3012: Greg A. Woods: Write all float.h files [except the vax of course]
in terms of float_ieee.h
 1.8 18-Feb-1998  mycroft Minor changes to make all the float.h files match.
 1.7 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.6 18-Jul-1997  thorpej branches: 1.6.6;
Change the extern declaration of __flt_rounds() into a proper prototype.
 1.5 20-Jun-1995  jtc Wrap with #ifndef _XXX_FLOAT_H_/#define _XXX_FLOAT_H_/ ... /#endif.
 1.4 20-Jun-1995  jtc #include <sys/cdefs.h>.
Wrap __flt_rounds() declaration with __BEGIN_DECLS/__END_DECLS.
 1.3 10-Apr-1995  jtc Changed FLT_ROUNDS from constant to a call to __flt_rounds(), so that the
current rounding mode is accurately reported.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.6.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.10.114.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.108.2 11-Mar-2010  yamt sync with head
 1.10.108.1 04-May-2009  yamt sync with head.
 1.10.104.1 17-Jan-2009  mjf Sync with HEAD.
 1.12.100.1 02-Aug-2025  perseant Sync with HEAD
 1.11 15-Feb-2022  palle Document the calculation of CC64FSZ
 1.10 11-Apr-2018  palle Fix typo in comment
 1.9 06-Oct-2015  martin branches: 1.9.16;
Do not use #ifdef SUN4U when testing for cpu features of post-v8 CPUs,
it is not good for SUN4V-only kernels. Instead use __sparc_v9__ (which
is also defined by the sparc compiler when called with cpu=ultrasparc).
ok: mrg@
 1.8 12-Apr-2011  mrg branches: 1.8.14; 1.8.32;
make sparc/frame.h idempotent.
 1.7 04-Mar-2006  uwe branches: 1.7.94; 1.7.100;
s/u_intN_t/uintN_t/
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6;
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 04-Dec-2001  darrenr branches: 1.4.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.3 22-Mar-2001  mrg branches: 1.3.2; 1.3.8;
sync with sparc64.
 1.2 20-Nov-1994  deraadt branches: 1.2.32; 1.2.44;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.44.1 09-Apr-2001  nathanw Catch up with -current.
 1.2.32.1 27-Mar-2001  bouyer Sync with HEAD.
 1.3.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.8.1 22-Mar-2001  nathanw file frame.h was added on branch nathanw_sa on 2002-01-08 00:27:38 +0000
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.1 03-Aug-2004  skrll Sync with HEAD
 1.5.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.7.100.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.94.1 21-Apr-2011  rmind sync with head
 1.8.32.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.8.14.1 03-Dec-2017  jdolecek update from HEAD
 1.9.16.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.5 08-Aug-2010  chs merge sparc and sparc64 fsr.h into one file.
add the missing FSR_TT_* definitions.
fix FSR_FTT_MASK. fix the V9 FCC fields.
 1.4 11-Dec-2005  christos branches: 1.4.78; 1.4.98; 1.4.100;
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 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 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.4.100.1 05-Mar-2011  rmind sync with head
 1.4.98.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.78.1 11-Aug-2010  yamt sync with head.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 19-Jun-2005  thorpej Move common Sun ID PROM definitions into <dev/sun/idprom.h>.
 1.7 04-Dec-2001  darrenr branches: 1.7.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.6 27-Nov-1999  mrg branches: 1.6.8; 1.6.12;
s/long/int/ to make this identical the sparc64 version.
 1.5 10-Mar-1997  pk branches: 1.5.22; 1.5.28;
Move some constants from param.h in here
 1.4 01-Feb-1995  pk branches: 1.4.10;
Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 20-Aug-1994  deraadt the sun4c "fake idprom inside the nvram" looks exactly like a sun4 idprom.
 1.1 08-Aug-1994  deraadt first cuts
 1.4.10.1 12-Mar-1997  is Merge in changes from The Trunk
 1.5.28.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.6.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18 31-Jan-2014  matt Consolidate the 128-bit long double defintions to <sys/ieee754.h>
Each arch that uses it now defines __HAVE_LONG_DOUBLE to 128.
<machine/ieee.h> is now just include the machine's math.h followed
by <sys/ieee754.h>
 1.17 15-Dec-2013  christos Add linted comments.
 1.16 20-Nov-2013  martin PR 48384: reorganize struct ieee_ext for sparc64 to only use a high/low
part for the mantissa.
Adjust arch specific code accordingly.
 1.15 14-Feb-2013  martin branches: 1.15.2;
We have an implicit 1 MSB bit in the mantissa. Pointed out by Matt Thomas.
Fixes PR port-sparc64/47536.
 1.14 10-Jul-2011  matt branches: 1.14.2; 1.14.8; 1.14.12;
Add defines for extu_frac[ln]m
 1.13 20-Sep-2010  christos cargo cult the x86 changes.
 1.12 04-Feb-2007  christos branches: 1.12.48; 1.12.68; 1.12.70;
remove dup definition
 1.11 03-Feb-2007  christos make extended precision gdtoa friendly.
 1.10 11-Dec-2005  christos branches: 1.10.20; 1.10.24;
merge ktrace-lwp.
 1.9 15-Apr-2005  kleink branches: 1.9.2;
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.8 28-Oct-2003  kleink branches: 1.8.8; 1.8.14;
Make the extended-precision definitions available for _KERNEL (i.e. the
FPU support package), too; reported by Chuck Silvers.
 1.7 27-Oct-2003  kleink Err, rename some members added in previous to make them reflect their
semantics better.
 1.6 26-Oct-2003  kleink For convenient use in libc, add unions of the C floating types and their
corresponding structure definitions.
 1.5 26-Oct-2003  kleink Use <sys/ieee754.h> where applicable.
 1.4 26-Oct-2003  kleink Rip out E80 format definitions which are neither "notyet", nor going to
happen.
 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 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.66.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.8.14.1 19-Apr-2005  tron Pull up revision 1.9 (requested by kleink in ticket #163):
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.
IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.8.8.1 29-Apr-2005  kent sync with -current
 1.9.2.1 26-Feb-2007  yamt sync with head.
 1.10.24.1 07-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.10.20.1 09-Feb-2007  ad Sync with HEAD.
 1.12.70.1 05-Mar-2011  rmind sync with head
 1.12.68.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.12.48.1 09-Oct-2010  yamt sync with head
 1.14.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.12.1 25-Feb-2013  tls resync with head
 1.14.8.1 14-Feb-2013  jdc Pull up revision 1.15 (requested by martin in ticket #821).

We have an implicit 1 MSB bit in the mantissa. Pointed out by Matt Thomas.
Fixes PR port-sparc64/47536.
 1.14.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.2.1 18-May-2014  rmind sync with head
 1.10 14-Jan-2017  christos remove dup definitions
 1.9 03-Jan-2015  martin branches: 1.9.2;
Avoid defining macros from the <fenv.h> namespace here (especially with
different values).
 1.8 20-Mar-2012  christos branches: 1.8.2; 1.8.16;
make fp_except unsigned
 1.7 20-May-2011  nakayama branches: 1.7.4; 1.7.8;
Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.6 24-Apr-2011  tron Don't define "fenv_t" and "fexcept_t" for NetBSD/sparc64 because the
definitions clash with "/usr/include/sparc64/fenv.h".

This fixes the build of e.g. "pkgsrc/databases/mysql51-client" under
NetBSD/sparc64 current.
 1.5 05-Aug-2008  matt branches: 1.5.16; 1.5.22;
Update <machine/ieeefp.h> to use the C99 FE_* definitions instead of the
NetBSD defined ones. Redefine the NetBSD ones in terms of the C99 ones.
Step 1 to having <fenv.h>
 1.4 21-Sep-2001  eeh branches: 1.4.4; 1.4.122; 1.4.126; 1.4.128; 1.4.132;
Correct values for different rounding modes.
 1.3 05-Jan-1998  perry branches: 1.3.26; 1.3.28;
RCSID Police.
 1.2 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.1 10-Apr-1995  jtc Sparc specific portions of ieeefp.h (fp_rnd, fp_except, constants, etc.).
 1.3.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.26.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.132.1 19-Oct-2008  haad Sync with HEAD.
 1.4.128.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.126.1 04-May-2009  yamt sync with head.
 1.4.122.1 28-Sep-2008  mjf Sync with HEAD.
 1.4.4.2 21-Sep-2001  eeh Correct values for different rounding modes.
 1.4.4.1 21-Sep-2001  eeh file ieeefp.h was added on branch nathanw_sa on 2001-09-21 20:32:34 +0000
 1.5.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.16.1 31-May-2011  rmind sync with head
 1.7.8.1 05-Apr-2012  mrg sync to latest -current.
 1.7.4.1 17-Apr-2012  yamt sync with head
 1.8.16.2 05-Feb-2017  skrll Sync with HEAD
 1.8.16.1 06-Apr-2015  skrll Sync with HEAD
 1.8.2.1 03-Dec-2017  jdolecek update from HEAD
 1.9.2.1 20-Mar-2017  pgoyette Sync with HEAD
 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 14-Jul-2003  pk The source register field was missing from the `i_loadstore' format.
From Jason Wright (openbsd) in private communication.
 1.5 16-Aug-2000  pk branches: 1.5.24;
Sync with sparc64.
 1.4 10-Dec-1997  pk branches: 1.4.14;
Code for software-assisted DDB single-stepping from Chuck Silvers.
 1.3 14-Mar-1997  christos Asi instruction struct was missing the immediate bit!
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.4 13-Aug-2014  matt Include <sys/common_int_const.h> if __INTMAX_C_SUFFIX__ is defined.
 1.3 29-May-2010  tnozaki branches: 1.3.18;
fix wrong integer promotion rule(removed U suffix from UINT{8,16}_C).
see ISO/IEC 9899:1999 7.18.4.3.
 1.2 28-Apr-2008  martin branches: 1.2.20; 1.2.22;
Remove clause 3 and 4 from TNF licenses
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12; 1.1.130; 1.1.132; 1.1.134;
Add definitions of C99 integer constant macros.
 1.1.134.2 11-Aug-2010  yamt sync with head.
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
 1.1.12.1 14-Apr-2001  kleink file int_const.h was added on branch nathanw_sa on 2001-04-14 22:38:44 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_const.h was added on branch thorpej_scsipi on 2001-04-21 17:54:37 +0000
 1.2.22.1 30-May-2010  rmind sync with head
 1.2.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.18.1 03-Dec-2017  jdolecek update from HEAD
 1.7 21-Aug-2014  martin Revert previous, we have restores ABI for {u,}int_fast_*_t.
 1.6 15-Aug-2014  martin All FAST datatypes are int (32 bit) on both sparc and sparc64, only FAST64
variants are long (sparc64) or long long (sparc).
 1.5 13-Aug-2014  matt include <sys/common_int_fmtio.h> if __INTPTR_FMTd__ is defined
 1.4 28-Apr-2008  martin branches: 1.4.44;
Remove clause 3 and 4 from TNF licenses
 1.3 15-Oct-2001  kleink branches: 1.3.4; 1.3.122; 1.3.124; 1.3.126;
Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_fmtio.h was added on branch thorpej_scsipi on 2001-04-21 17:54:37 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.126.1 16-May-2008  yamt sync with head.
 1.3.124.1 18-May-2008  yamt sync with head.
 1.3.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.4.2 15-Oct-2001  kleink Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.3.4.1 15-Oct-2001  kleink file int_fmtio.h was added on branch nathanw_sa on 2001-10-15 21:32:26 +0000
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.8 13-Aug-2014  matt Include <sys/common_init_limits.h> if __SIG_ATOMIC_MAX__ is defined.
 1.7 28-Apr-2008  martin branches: 1.7.44;
Remove clause 3 and 4 from TNF licenses
 1.6 17-Oct-2007  garbled branches: 1.6.16; 1.6.18; 1.6.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.5 31-Aug-2007  drochner Fix definitions of UCHAR_MAX/USHRT_MAX and related
types. C99 requires that these definitions promote to (signed/unsigned)
integer the same way as the types the definition is for. And since
unsigned char/short fit into an "int" on all our archs and thus promote
to signed int, the definitions must not be unsigned.
Fixes PR lib/31306 by Neil Booth.
 1.4 11-Dec-2005  christos branches: 1.4.30; 1.4.38; 1.4.44; 1.4.48; 1.4.50;
merge ktrace-lwp.
 1.3 08-May-2004  kleink branches: 1.3.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.10; 1.2.26;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_limits.h was added on branch thorpej_scsipi on 2001-04-21 17:54:38 +0000
 1.2.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.10.2 26-Apr-2001  kleink Add definitions for C99 fastest minimum-width integer types.
 1.2.10.1 26-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-26 16:25:27 +0000
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.12.1 03-Sep-2007  yamt sync with head.
 1.4.50.1 06-Nov-2007  matt sync with HEAD
 1.4.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.4.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.4.38.1 03-Oct-2007  garbled Sync with HEAD
 1.4.30.1 09-Oct-2007  ad Sync with head.
 1.6.20.1 16-May-2008  yamt sync with head.
 1.6.18.1 18-May-2008  yamt sync with head.
 1.6.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.44.1 03-Dec-2017  jdolecek update from HEAD
 1.7 13-Aug-2014  matt include <sys/common_int_mwgwtypes.h> if __UINT_FAST64_TYPE__ is defined.
 1.6 28-Apr-2008  martin branches: 1.6.44;
Remove clause 3 and 4 from TNF licenses
 1.5 24-Dec-2005  perry branches: 1.5.74; 1.5.76; 1.5.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 15-Oct-2001  kleink branches: 1.4.4; 1.4.36;
Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.3 14-Oct-2001  kleink Fix a pasto in the __COMPILER_INT64__-based definition of {u,}intmax_t.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4;
Add definitions for C99 fastest minimum-width integer types.
 1.1 14-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_mwgwtypes.h was added on branch thorpej_scsipi on 2001-04-21 17:54:38 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.36.1 21-Jun-2006  yamt sync with head.
 1.4.4.2 15-Oct-2001  kleink Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.4.4.1 15-Oct-2001  kleink file int_mwgwtypes.h was added on branch nathanw_sa on 2001-10-15 19:49:17 +0000
 1.5.78.1 16-May-2008  yamt sync with head.
 1.5.76.1 18-May-2008  yamt sync with head.
 1.5.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.44.1 03-Dec-2017  jdolecek update from HEAD
 1.11 13-Aug-2014  matt Include <sys/common_int_types.h> if __UINTPTR_TYPE__ is defined.
 1.10 24-Dec-2005  perry branches: 1.10.122;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 25-May-2005  kleink branches: 1.8.2;
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.7 07-Aug-2003  agc branches: 1.7.6; 1.7.14;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 28-Apr-2001  kleink branches: 1.6.8; 1.6.24;
* Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.5 17-Apr-2001  kleink Oops, intptrs are always long integers.
 1.4 12-Apr-2001  kleink Replace the 'unsigned __COMPILER_INT64__' construct with a new name,
__COMPILER_UINT64__, to be supplied - if such a case is made, it shouldn't
be assumed that the unsigned type-specifier may be applied to it.
 1.3 03-Jan-2001  takemura branches: 1.3.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.2 27-Jun-2000  kleink branches: 1.2.2;
Resolve some formatting nits; add __intptr_t and __uintptr_t.
 1.1 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.2.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 27-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:25:39 +0000
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 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.6.8.2 28-Apr-2001  kleink * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.6.8.1 28-Apr-2001  kleink file int_types.h was added on branch nathanw_sa on 2001-04-28 15:41:33 +0000
 1.7.14.1 28-May-2005  tron Pull up revision 1.8 (requested by klein in ticket #346):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.7.6.1 29-May-2005  riz Pull up revision 1.8 (requested by kleink in ticket #1555):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.10.122.1 03-Dec-2017  jdolecek update from HEAD
 1.14 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.13 21-Aug-2019  msaitoh branches: 1.13.8;
Fix typo (s/contoller/controller/).
 1.12 27-Jul-2012  matt branches: 1.12.40;
Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).
 1.11 28-Apr-2008  martin branches: 1.11.34;
Remove clause 3 and 4 from TNF licenses
 1.10 03-Dec-2007  ad branches: 1.10.14; 1.10.16; 1.10.18;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.9 04-May-2006  yamt branches: 1.9.18; 1.9.36; 1.9.38; 1.9.44;
implement splraiseipl() for sparc.
reviewed by Martin Husemann.

while i'm here, use macros for some MD constants (eg. IPL_ZS)
as suggested by Havard Eidnes.
 1.8 04-Mar-2006  uwe branches: 1.8.2; 1.8.4; 1.8.6;
De-__P.
 1.7 16-Jun-2003  thorpej branches: 1.7.18; 1.7.32; 1.7.34;
Rename IPL_IMP -> IPL_VM.
 1.6 31-Dec-2002  pk Define IPL_SCHED at level 11 and make splsched() use it.
 1.5 09-Dec-2002  pk Finish the switch to the softintr(9) framework.

To make this work, we now have to use separate handler lists for hardware
and software interrupts as the soft interrupt handlers do not return
an `interrupt handled' status.

Thanks to Matt Fredette for providing an initial set of patches on port-sparc.
 1.4 06-Dec-2002  pk Start using IPL_* constants from intr.h; phase out PIL_* in psl.h
 1.3 27-Sep-2001  mrg branches: 1.3.4; 1.3.8;
implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.2 25-Nov-1998  pk branches: 1.2.22; 1.2.24;
Add IPL_SERIAL
 1.1 22-Nov-1998  pk Define `interrupt priority levels'.
XXX - for now, these arbitrary identifiers; NO INTERPRETATION IS DEFINED YET
 1.2.24.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.22.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.8.1 17-Mar-2002  thorpej IPL_IMP -> IPL_VM
 1.3.4.3 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.3.4.2 11-Dec-2002  thorpej Sync with HEAD.
 1.3.4.1 27-Sep-2001  thorpej file intr.h was added on branch nathanw_sa on 2002-12-11 06:12:08 +0000
 1.7.34.2 01-Jun-2006  kardel Sync with head.
 1.7.34.1 22-Apr-2006  simonb Sync with head.
 1.7.32.1 09-Sep-2006  rpaulo sync with head
 1.7.18.2 07-Dec-2007  yamt sync with head
 1.7.18.1 21-Jun-2006  yamt sync with head.
 1.8.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.4.1 11-May-2006  elad sync with head
 1.8.2.1 24-May-2006  yamt sync with head.
 1.9.44.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.38.1 09-Jan-2008  matt sync with HEAD
 1.9.36.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.9.18.1 03-Dec-2007  ad Sync with HEAD.
 1.10.18.1 16-May-2008  yamt sync with head.
 1.10.16.1 18-May-2008  yamt sync with head.
 1.10.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.34.1 30-Oct-2012  yamt sync with head
 1.12.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.9 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.8 04-Dec-2001  darrenr branches: 1.8.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.7 18-Oct-1997  gwr branches: 1.7.30; 1.7.34;
Use common zs code.
 1.6 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.5 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.4 06-Jul-1995  pk Support KIOC_GETLAYOUT, so other than US keyboards can be dealt with better.
 1.3 26-Apr-1995  pk define LED controls
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 21-Jul-1994  deraadt branches: 1.1.2;
make X11R5 compile easier
 1.1.2.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1.2.1 21-Jul-1994  deraadt file kbd.h was added on branch netbsd-1-0 on 1994-07-21 22:06:14 +0000
 1.7.34.2 27-Aug-2002  nathanw Catch up to -current.
 1.7.34.1 08-Jan-2002  nathanw Catch up to -current.
 1.7.30.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7.30.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.8.1 31-Aug-2002  gehenna catch up with -current.
 1.6 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.5 18-Oct-1997  gwr branches: 1.5.30; 1.5.34; 1.5.42;
Use common zs code.
 1.4 10-May-1995  pk Minimalist implementation of KIOC[SG]KEY.
 1.3 26-Apr-1995  pk define LED controls
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 21-Jul-1994  deraadt branches: 1.1.2;
make X11R5 compile easier
 1.1.2.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1.2.1 21-Jul-1994  deraadt file kbio.h was added on branch netbsd-1-0 on 1994-07-21 22:06:18 +0000
 1.5.42.1 31-Aug-2002  gehenna catch up with -current.
 1.5.34.1 27-Aug-2002  nathanw Catch up to -current.
 1.5.30.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 09-Oct-1997  jtc branches: 1.3.152; 1.3.154; 1.3.156;
Fix tipo inherited from old version of TNF copyright template.
 1.2 20-Sep-1997  pk Remove the `segmap' array from the header. Insert an offset and count
field to get to it instead.

Add field `kernbase' so libkvm can be independent of the kernel's link address.
 1.1 09-Nov-1996  pk branches: 1.1.10;
Define new-style kernel crash dump format.
 1.1.10.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.10.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.156.1 16-May-2008  yamt sync with head.
 1.3.154.1 18-May-2008  yamt sync with head.
 1.3.152.1 02-Jun-2008  mjf Sync with HEAD.
 1.25 16-Mar-2024  christos make all QUAD constants look the same.
 1.24 14-Mar-2024  christos Sync with x86_64 the quad constants. No reason to be different
 1.23 21-Jan-2019  dholland Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
PR 53298 from Roberto E. Vargas Caballero.
 1.22 21-Apr-2014  matt branches: 1.22.26; 1.22.28;
Since all our compilers support __DBL_* and __FLT_*, use them to define
{DBL,FLT}_{DIG,MIN,MAX}
 1.21 11-Apr-2013  christos branches: 1.21.4; 1.21.8;
add missing SSIZE_MIN
 1.20 28-Mar-2012  christos branches: 1.20.2;
- Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.19 07-Jun-2010  tnozaki branches: 1.19.8; 1.19.12;
1. MB_LEN_MAX switch MD to MI.
2. unfortunately hppa's MB_LEN_MAX is defined incorrectly 6 instead of 32
so we have to add more setlocale(3) __RENAME func, __setlocale50.
3. move setlocale1.c and setlocale32.c to lib/libc/compat/locale/*
prepareing for next libc major crunk.
4. bump libc minor version.
 1.18 17-Oct-2007  garbled branches: 1.18.20; 1.18.40; 1.18.42;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.17 31-Aug-2007  drochner Fix definitions of UCHAR_MAX/USHRT_MAX and related
types. C99 requires that these definitions promote to (signed/unsigned)
integer the same way as the types the definition is for. And since
unsigned char/short fit into an "int" on all our archs and thus promote
to signed int, the definitions must not be unsigned.
Fixes PR lib/31306 by Neil Booth.
 1.16 11-Dec-2005  christos branches: 1.16.30; 1.16.38; 1.16.44; 1.16.48; 1.16.50;
merge ktrace-lwp.
 1.15 07-Aug-2003  agc branches: 1.15.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.14 28-Apr-2003  bjh21 branches: 1.14.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.13 03-May-2002  thorpej Don't define _LP64 here.
 1.12 08-Aug-2000  tshiozak branches: 1.12.4; 1.12.8;
Preparation for the future introduction of multibyte locale.
- MB_LEN_MAX is increased to 32.
- To ensure binary compatibility for old executables
under multibyte locale, versioned setlocale is added.
- __mb_len_cur definision is added in setlocale.c
and enable it in stdlib.h .
It is also important for multibyte locale stuffs,
but I just forgot.
 1.11 07-Mar-2000  kleink branches: 1.11.2; 1.11.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.10 27-Nov-1999  mrg merge sparc64 limits.h; these files are now identical. this includes
a `fix' for when s?size_t was changed from int to long but the
definitions of S?SIZE_MAX were left as U?INT_MAX. these are now
U?LONG_MAX.
 1.9 06-Aug-1998  kleink branches: 1.9.12; 1.9.18;
_POSIX_SOURCE -> _POSIX_C_SOURCE
 1.8 09-Jan-1998  perry multiple include protect machine/limits.h, fixes pr 4473 (from Mika Nystrom)
 1.7 05-Jan-1996  pk Use {U,L} suffices per Charles' recommendation.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 05-Oct-1994  jtc Add constants required by XPG3
 1.4 13-May-1994  deraadt sync with 4.4-lite
 1.3 27-Jan-1994  pk BLAST!
 1.2 19-Oct-1993  deraadt Define the {QUAD,UQUAD}_{MIN,MAX} things here.
 1.1 10-Oct-1993  deraadt need these
 1.9.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.4.1 09-Aug-2000  tshiozak pull up the following changes (approved by thorpej):
> cvs rdiff -r1.9 -r1.10 basesrc/include/locale.h
> cvs rdiff -r1.45 -r1.46 basesrc/include/stdlib.h
> cvs rdiff -r1.16 -r1.17 basesrc/lib/libc/locale/Makefile.inc
> cvs rdiff -r1.17 -r1.18 basesrc/lib/libc/locale/setlocale.c
> cvs rdiff -r0 -r1.2 basesrc/lib/libc/locale/setlocale_sb.c
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/alpha/include/limits.h
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/arm26/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/arm32/include/limits.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/limits.h
> cvs rdiff -r1.12 -r1.13 syssrc/sys/arch/m68k/include/limits.h
> cvs rdiff -r1.13 -r1.14 syssrc/sys/arch/mips/include/limits.h
> cvs rdiff -r1.10 -r1.11 syssrc/sys/arch/pc532/include/limits.h
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/powerpc/include/limits.h
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/sh3/include/limits.h
> cvs rdiff -r1.11 -r1.12 syssrc/sys/arch/sparc/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/sparc64/include/limits.h
> cvs rdiff -r1.9 -r1.10 syssrc/sys/arch/vax/include/limits.h
>
> Outline:
>
> Preparation for the future introduction of multibyte locale.
> - MB_LEN_MAX is increased to 32.
> - To ensure binary compatibility for old executables
> under multibyte locale, versioned setlocale is added.
> - __mb_len_cur definision is added in setlocale.c
> and enable it in stdlib.h .
> It is also important for multibyte locale stuffs,
> but I just forgot.
 1.11.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.12.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.12.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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.1 03-Sep-2007  yamt sync with head.
 1.16.50.1 06-Nov-2007  matt sync with HEAD
 1.16.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.16.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.16.38.1 03-Oct-2007  garbled Sync with HEAD
 1.16.30.1 09-Oct-2007  ad Sync with head.
 1.18.42.1 03-Jul-2010  rmind sync with head
 1.18.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.18.20.1 11-Aug-2010  yamt sync with head.
 1.19.12.1 05-Apr-2012  mrg sync to latest -current.
 1.19.8.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.19.8.1 17-Apr-2012  yamt sync with head
 1.20.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.2.1 23-Jun-2013  tls resync from head
 1.21.8.1 10-Aug-2014  tls Rebase.
 1.21.4.1 18-May-2014  rmind sync with head
 1.22.28.1 10-Jun-2019  christos Sync with HEAD
 1.22.26.1 26-Jan-2019  pgoyette Sync with HEAD
 1.11 06-Aug-2014  joerg Consistently define WARN in a way that passes format string checks, i.e.
always uses the same number of arguments as given in the format string.
 1.10 28-Apr-2008  martin branches: 1.10.44; 1.10.60;
Remove clause 3 and 4 from TNF licenses
 1.9 25-Jan-2006  christos branches: 1.9.72; 1.9.74; 1.9.76;
free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.8 01-Mar-2003  pk branches: 1.8.18; 1.8.30;
Add support for large kernels by searching for a physical memory segment
to fit it in. As a bonus, the kernel is now also mapped to the virtual
address (i.e. KERNBASE) it is linked at.
 1.7 08-Dec-2002  uwe Use 0x07ffffff for LOADADDR mask. This still provides for 128MB (and
given that PROM maps just 4 or 16 this is not going to be a bottle
neck). Doesn't really affect normal kernels, need it for the changed
kernel base address (uncommitted) hack for broken javastation OFW.
Ok by pk.
 1.6 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.5 04-Dec-2001  thorpej branches: 1.5.8;
Don't declare which exec formats to support in loadfile_machdep.h.
Instead, give each user of loadfile() control over which exec formats
it wants to support.
 1.4 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.3 16-Aug-2000  mrg branches: 1.3.4; 1.3.6; 1.3.8;
deal with 64 bit ELF
 1.2 30-Apr-1999  christos branches: 1.2.2; 1.2.4; 1.2.14;
Load the header too.
 1.1 28-Apr-1999  christos MD version of loadfile.h
 1.2.14.1 26-Aug-2000  mrg pull up 1.3. approved by thorpej:
>deal with 64 bit ELF
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.8.3 11-Dec-2002  thorpej Sync with HEAD.
 1.3.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.3.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.8.1 31-Aug-2002  gehenna catch up with -current.
 1.8.30.1 01-Feb-2006  yamt sync with head.
 1.8.18.1 21-Jun-2006  yamt sync with head.
 1.9.76.1 16-May-2008  yamt sync with head.
 1.9.74.1 18-May-2008  yamt sync with head.
 1.9.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.60.1 10-Aug-2014  tls Rebase.
 1.10.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34 13-Feb-2022  riastradh sparc: __cpu_simple_lock membar audit.

No functional change -- comments only, to justify the absence of
barriers with reference to chapter & verse.
 1.33 29-Nov-2019  riastradh Nix mb_* on sparc and sparc64.
 1.32 17-Sep-2017  christos branches: 1.32.4;
more const.
 1.31 28-Apr-2008  martin branches: 1.31.44;
Remove clause 3 and 4 from TNF licenses
 1.30 17-Oct-2007  garbled branches: 1.30.16; 1.30.18; 1.30.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.29 10-Sep-2007  skrll Merge nick-csl-alignment.
 1.28 17-Feb-2007  ad branches: 1.28.4; 1.28.12; 1.28.16; 1.28.20; 1.28.22;
Put a sock in it..
 1.27 16-Feb-2007  ad branches: 1.27.2;
Pacify lint.
 1.26 15-Feb-2007  ad Pacify lint/gcc.
 1.25 11-Feb-2007  ad inline -> __inline
 1.24 09-Feb-2007  ad Merge newlock2 to head.
 1.23 04-Mar-2006  uwe branches: 1.23.14;
De-__P.
 1.22 28-Dec-2005  perry branches: 1.22.4; 1.22.6;
inline -> __inline
 1.21 24-Dec-2005  perry __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.20 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.19 11-Dec-2005  christos merge ktrace-lwp.
 1.18 03-Feb-2005  chs branches: 1.18.6;
add the early-clobber modifier on the destination reg of ldstub.
in some implementations (eg. sun4c), the hardware modifies the destination
reg before checking for write permission on the memory location. without
this change, gcc was using the same register for the address and the
destination, so if the store part of the instruction faulted, the address
was already gone when the instruction was retried after resolving the fault.
part of PR 25633, PR 25896.
 1.17 20-Apr-2004  pk branches: 1.17.4; 1.17.6;
Turn __CPU_SIMPLE_LOCK_INLINE into !__CPU_SIMPLE_LOCK_NOINLINE, so we don't
screw up user land.
 1.16 19-Apr-2004  pk __cpu_simple_lock() isn't a pure function.
 1.15 18-Apr-2004  pk Make inlining __cpu_simple_lock() optional. Add a version with a built-in
spin out counter that panics with a diagnostic.
 1.14 26-Dec-2003  mrg branches: 1.14.2;
convert __ldstub() from a ({}) macro into a properly static inline function.
the latter is not valid for C++ so says GCC3.
 1.13 16-Nov-2003  pk __cpu_simple_unlock: use __insn_barrier() instead of a "memory" clobber.
 1.12 09-Nov-2003  pk __cpu_simple_unlock: avoid instruction re-ordering by the compiler.
 1.11 26-Sep-2003  nathanw Move __cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED to machine/types.h
so that they can be used in a namespace-friendly way.
 1.10 05-May-2000  hannken branches: 1.10.16; 1.10.28;
Fix for lint during build of libc.
 1.9 02-May-2000  thorpej Let each platform typedef the new __cpu_simple_lock_t, which should
be the most efficient type used for the atomic operations in the
simplelock structure, and should also be __volatile.
 1.8 30-Apr-2000  pk FIx declaration in __ldstub.
 1.7 29-Apr-2000  thorpej Require that each each MACHINE/MACHINE_ARCH supply a lock.h. This file
contains the values __SIMPLELOCK_LOCKED and __SIMPLELOCK_UNLOCKED, which
replace the old SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED. These files
are also required to supply inline functions __cpu_simple_lock(),
__cpu_simple_lock_try(), and __cpu_simple_unlock() if locking is to be
supported on that platform (i.e. if MULTIPROCESSOR is defined in the
_KERNEL case). Change these functions to take an int * (&alp->lock_data)
rather than the struct simplelock * itself.

These changes make it possible for userland to use the locking primitives
by including <machine/lock.h>.
 1.6 27-Jul-1999  thorpej branches: 1.6.2;
Make a slight rearrangement in how <machine/lock.h> is included.
 1.5 27-Jul-1999  thorpej Define apporpriate an value for SIMPLELOCK_LOCKED, based on the
semantics of ldstub.
 1.4 27-Jul-1999  thorpej Prepend `cpu_' to the machine-dependent atomic locking primitivies.
 1.3 04-Nov-1998  chs branches: 1.3.8;
LOCKDEBUG enhancements for non-MP:
keep a list of locked locks.
use this to print where the lock was locked
when we either go to sleep with a lock held
or try to free a locked lock.
 1.2 05-Oct-1998  pk If a lock is held do not spin in a read/write loop but just read the lock
until it is released. This is easier on the bus cache coherency logic.
 1.1 27-Sep-1998  pk sparc spin lock functions.
 1.3.8.1 02-Aug-1999  thorpej Update from trunk.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.28.4 04-Feb-2005  skrll Sync with HEAD.
 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.10.16.1 19-Mar-2002  thorpej Change __cpu_simple_lock_t to a single byte.
 1.14.2.2 16-Mar-2005  tron Pull up revision 1.18 (requested by chs in ticket #1159):
add the early-clobber modifier on the destination reg of ldstub.
in some implementations (eg. sun4c), the hardware modifies the destination
reg before checking for write permission on the memory location. without
this change, gcc was using the same register for the address and the
destination, so if the store part of the instruction faulted, the address
was already gone when the instruction was retried after resolving the fault.
part of PR 25633, PR 25896.
 1.14.2.1 24-Apr-2004  jdc branches: 1.14.2.1.2;
Pull up revisions 1.15-1.17 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.14.2.1.2.1 16-Mar-2005  tron Pull up revision 1.18 (requested by chs in ticket #1159):
add the early-clobber modifier on the destination reg of ldstub.
in some implementations (eg. sun4c), the hardware modifies the destination
reg before checking for write permission on the memory location. without
this change, gcc was using the same register for the address and the
destination, so if the store part of the instruction faulted, the address
was already gone when the instruction was retried after resolving the fault.
part of PR 25633, PR 25896.
 1.17.6.1 12-Feb-2005  yamt sync with head.
 1.17.4.1 29-Apr-2005  kent sync with -current
 1.18.6.3 27-Oct-2007  yamt sync with head.
 1.18.6.2 26-Feb-2007  yamt sync with head.
 1.18.6.1 21-Jun-2006  yamt sync with head.
 1.22.6.1 22-Apr-2006  simonb Sync with head.
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.23.14.3 06-Feb-2007  ad Test for the presence of 'membar' by checking for __sparc_v9__.
 1.23.14.2 12-Jan-2007  ad Make sparc64 build again.
 1.23.14.1 12-Jan-2007  ad sparc MD changes.
 1.27.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.28.22.1 06-Nov-2007  matt sync with HEAD
 1.28.20.1 02-Oct-2007  joerg Sync with HEAD.
 1.28.16.1 15-Aug-2007  skrll Provide __SIMPLELOCK_{UN,}LOCKED_P and __cpu_simple_lock_{set,clear}
for all architectures.
 1.28.12.1 03-Oct-2007  garbled Sync with HEAD
 1.28.4.1 09-Oct-2007  ad Sync with head.
 1.30.20.1 16-May-2008  yamt sync with head.
 1.30.18.1 18-May-2008  yamt sync with head.
 1.30.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.44.1 03-Dec-2017  jdolecek update from HEAD
 1.32.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 11-Dec-2021  mrg remove clause 3 from all my licenses that aren't conflicting with
another copyright claim line. again. (i did this in 2008 and then
did not update all of my personal templates.)
 1.1 24-Jan-2021  mrg branches: 1.1.4;
avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.1.4.2 03-Apr-2021  thorpej Sync with HEAD.
 1.1.4.1 24-Jan-2021  thorpej file locore.h was added on branch thorpej-futex on 2021-04-03 22:28:38 +0000
 1.2 04-Nov-2024  christos Undo previous lwp.h change.
 1.1 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.1 30-Nov-2024  christos branches: 1.1.4;
Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 30-Nov-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:56:08 +0000
 1.7 01-Feb-2014  matt Export __HAVE_LONG_DOUBLE 128 to kernel for emulation
 1.6 31-Jan-2014  matt Consolidate the 128-bit long double defintions to <sys/ieee754.h>
Each arch that uses it now defines __HAVE_LONG_DOUBLE to 128.
<machine/ieee.h> is now just include the machine's math.h followed
by <sys/ieee754.h>
 1.5 15-Dec-2008  mrg branches: 1.5.14; 1.5.24; 1.5.28;
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.4 19-Feb-2002  simonb branches: 1.4.118; 1.4.122; 1.4.130; 1.4.132; 1.4.136;
Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.3 05-Feb-2000  kleink branches: 1.3.6; 1.3.10; 1.3.14;
Improve namespace test macros a bit.
 1.2 04-Jan-2000  kleink const -> __const and include <sys/cdefs.h> earlier; fixes PR lib/9052
by Takahiro Kambe.
 1.1 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.3.14.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.10.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.6.1 05-Feb-2000  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:25:40 +0000
 1.4.136.1 11-May-2009  bouyer branches: 1.4.136.1.2;
Pull up following revision(s) (requested by mrg in ticket #750):
sys/arch/sparc64/include/math.h: revision 1.7
sys/arch/sparc/include/math.h: revision 1.5
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.4.136.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.4.132.1 11-May-2009  bouyer Pull up following revision(s) (requested by mrg in ticket #750):
sys/arch/sparc64/include/math.h: revision 1.7
sys/arch/sparc/include/math.h: revision 1.5
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.4.130.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.122.1 04-May-2009  yamt sync with head.
 1.4.118.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.28.1 18-May-2014  rmind sync with head
 1.5.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.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.2 28-Jul-1998  pk This file is now in <dev/sbus>
 1.1 03-Jun-1998  pk Magma parallel port ioctls per Iain Hibbert.
 1.22 30-Nov-2024  christos Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.21 04-Nov-2024  christos Undo previous lwp.h change.
 1.20 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.19 18-May-2024  thorpej branches: 1.19.2;
Clean up the <sys/ucontext.h> <-> <machine/mcontext.h> interface up
a little:
- Define _UC_MD_BIT* constants for the available machine-dependent bits,
and use those constants to define the machine-dependent bits as well
as the machine-independent bits that have machine-dependent values.
- Explicitly generate an error if _UC_TLSBASE, _UC_SETSTACK, or
_UC_CLRSTACK are not defined by <machine/mcontext.h>.
 1.18 27-Dec-2019  kamil Harmonize the namespace of fast TLS base pointer getter functions

Protect __lwp_getprivate_fast() with _RTLD_SOURCE, _LIBC_SOURCE and
__LIBPTHREAD_SOURCE__.

Include in this namespace <sys/tcl.h> and use __BEGIN_DECLS/__END_DECLS
for the sake of consistency.
 1.17 19-Feb-2018  mrg branches: 1.17.4;
fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is
the right offset. do this by using __greg32_t, which is only in
the sparc64 version, and these are only useful there, so move them.
 1.16 18-Feb-2018  christos Make _UC_MACHINE_FP() compile again and fix it so that it does not add
the offset twice.
 1.15 17-Feb-2018  kamil Improve _UC_MACHINE_FP() for SPARC/SPARC64

Introduce a static inline function _uc_machine_fp() that contains improved
caluclation of a frame pointer.

Algorithm:

uptr *stk_ptr;
# if defined (__arch64__)
stk_ptr = (uptr *) (*sp + 2047);
# else
stk_ptr = (uptr *) *sp;
# endif
*bp = stk_ptr[15];

Noted by <mrg>
 1.14 15-Feb-2018  kamil Introduce _UC_MACHINE_FP() as a macro

_UC_MACHINE_FP() is a helper macro to extract from mcontext a frame pointer.

Don't rely on this interface as a compiler might strip frame pointer or
optimize it making this interface unreliable.


For hppa assume a small frame context, for larger frames FP might be located
in a different register (4 instead of 3).

For ia64 there is no strict frame pointer, and registers might rotate.
Reuse 79 following:

./gcc/config/ia64/ia64.h:#define HARD_FRAME_POINTER_REGNUM LOC_REG (79)

Once ia64 will mature, this should be revisited.

A macro can encapsulate a real function for extracting Frame Pointer on
more complex CPUs / ABIs.


For the remaining CPUs, reuse standard register as defined in appropriate ABI.

The direct users of this macro are LLVM and GCC with Sanitizers.

Proposed on tech-userlevel@.

Sponsored by <The NetBSD Foundation>
 1.13 12-Sep-2012  manu branches: 1.13.32;
setcontext() used to be incompatible with -lpthread since it affected
the TLS pointer, therefore wrecking the pthread environement.

Some ports had _UC_TLSBASE flag or equivalent (_UC_UNIQUE on alpha)
that controlled whether setcontext() would change the TLS pointer.
This change let libpthread override setcontext() with its own version
that unsets _UC_TLSBASE, enabling safe usage of setcontext() with
-lpthread.

We also have the following required changes here:
- rename alpha's _UC_UNIQUE into _UC_TLSBASE
- add _UC_TLSBASE definition in header file for all ports
(powerpc, sh3, sparc and sparc64 lack the implementation for now)
- introduce a libc stub that can be overriden for setcontext()
- modify MD libcs swapcontext() implementations so that they use the
setcontext() libc stub instead of doing a plain system call.

While we are there:
- document various MD _UC_* flags in header file
- add libc and libpthread tests for swapcontext() behavior
(hopefully helpful to spot MD problems introduced with this change)

Future work:
- Deciding whether kernel support or _UC_TLSBASE should be added for
powerpc, sh3, sparc and sparc64 is left to portmasters
sparc64

Approved by core@
 1.12 25-Feb-2011  joerg branches: 1.12.4;
Be nicer to software that insists on -ansi and use __inline.
 1.11 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.10 26-Oct-2008  mrg branches: 1.10.16; 1.10.22; 1.10.24;
expose both sparc and sparc64 context bits.
 1.9 28-Apr-2008  martin branches: 1.9.6;
Remove clause 3 and 4 from TNF licenses
 1.8 29-Mar-2006  cube branches: 1.8.62; 1.8.64; 1.8.66;
Add the netbsd32 MD bits for sparc64 and amd64 to support SA.

Many thanks to all who helped for that little project, notably Martin
Husemann for teaching me a bit about the very special sparc64 world.
 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 10-Jul-2005  martin Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 1.5 01-Jan-2004  pk branches: 1.5.14; 1.5.16;
Enable reset of a process's alternative signal stack flag.
 1.4 12-Oct-2003  pk There's no point in having two separate sets of padding; add the local
__filler bytes to _UC_MACHINE_PAD.
 1.3 08-Oct-2003  thorpej Add some accessor macros for the ucontext:
* _UC_MACHINE_PC() - access the program counter
* _UC_MACHINE_INTRV() - access the integer return value register
* _UC_MACHINE_SET_PC() - set the program counter (this requires
special handling on some platforms).
 1.2 18-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 20-Nov-2001  pk branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.3 17-Dec-2002  thorpej Reconcile the sparc/sparc64 mcontexts by using the sparc64 header
for sparc, as well (it is #ifdef __arch64__'d already).
 1.1.2.2 21-Jun-2002  gmcgarry Provide _UC_MACHINE_SP()
 1.1.2.1 20-Nov-2001  pk SPARC mcontext definitions.
 1.2.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.5.16.1 21-Jun-2006  yamt sync with head.
 1.5.14.1 11-Jul-2005  tron Pull up revision 1.6 (requested by martin in ticket #570):
Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 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 - hopefully this will work
 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.8.66.2 04-May-2009  yamt sync with head.
 1.8.66.1 16-May-2008  yamt sync with head.
 1.8.64.1 18-May-2008  yamt sync with head.
 1.8.62.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.62.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.24.1 05-Mar-2011  bouyer Sync with HEAD
 1.10.22.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.16.1 05-Mar-2011  rmind sync with head
 1.12.4.1 30-Oct-2012  yamt sync with head
 1.13.32.3 21-Mar-2018  martin Pull up the following, requested by kamil in ticket #552:

external/gpl3/gcc{.old}/dist/libsanitizer/asan/asan_linux.cc 1.4
sys/arch/aarch64/include/mcontext.h 1.2
sys/arch/alpha/include/mcontext.h 1.9
sys/arch/amd64/include/mcontext.h 1.19
sys/arch/arm/include/mcontext.h 1.19
sys/arch/hppa/include/mcontext.h 1.9
sys/arch/i386/include/mcontext.h 1.14
sys/arch/ia64/include/mcontext.h 1.6
sys/arch/m68k/include/mcontext.h 1.10
sys/arch/mips/include/mcontext.h 1.22
sys/arch/or1k/include/mcontext.h 1.2
sys/arch/powerpc/include/mcontext.h 1.18
sys/arch/riscv/include/mcontext.h 1.5
sys/arch/sh3/include/mcontext.h 1.11
sys/arch/sparc/include/mcontext.h 1.14-1.17
sys/arch/sparc64/include/mcontext.h 1.10
sys/arch/vax/include/mcontext.h 1.9
tests/lib/libc/sys/Makefile 1.50
tests/lib/libc/sys/t_ucontext.c 1.2-1.5
sys/arch/hppa/include/mcontext.h 1.10
sys/arch/ia64/include/mcontext.h 1.7

- Introduce _UC_MACHINE_FP(). _UC_MACHINE_FP() is a helper
macro to extract from mcontext a frame pointer.
- Add new tests in lib/libc/sys/t_ucontext:
* ucontext_sp (testing _UC_MACHINE_SP)
* ucontext_fp (testing _UC_MACHINE_FP)
* ucontext_pc (testing _UC_MACHINE_PC)
* ucontext_intrv (testing _UC_MACHINE_INTRV)

Add a dummy implementation of _UC_MACHINE_INTRV() for ia64.

Implement _UC_MACHINE_INTRV() for hppa.

Make the t_ucontext.c test more portable.

We now have _UC_MACHINE_FP.
 1.13.32.2 26-Feb-2018  snj revert ticket 552, which broke the build
 1.13.32.1 25-Feb-2018  snj Pull up following revision(s) (requested by kamil in ticket #552):
sys/arch/aarch64/include/mcontext.h: 1.2
sys/arch/alpha/include/mcontext.h: 1.9
sys/arch/amd64/include/mcontext.h: 1.19
sys/arch/arm/include/mcontext.h: 1.19
sys/arch/hppa/include/mcontext.h: 1.9
sys/arch/i386/include/mcontext.h: 1.14
sys/arch/ia64/include/mcontext.h: 1.6
sys/arch/m68k/include/mcontext.h: 1.10
sys/arch/mips/include/mcontext.h: 1.22
sys/arch/or1k/include/mcontext.h: 1.2
sys/arch/powerpc/include/mcontext.h: 1.18
sys/arch/riscv/include/mcontext.h: 1.5
sys/arch/sh3/include/mcontext.h: 1.11
sys/arch/sparc/include/mcontext.h: 1.14-1.17
sys/arch/sparc64/include/mcontext.h: 1.10
sys/arch/vax/include/mcontext.h: 1.9
tests/lib/libc/sys/Makefile: 1.50
tests/lib/libc/sys/t_ucontext.c: 1.2
Introduce _UC_MACHINE_FP() as a macro
_UC_MACHINE_FP() is a helper macro to extract from mcontext a frame pointer.
Don't rely on this interface as a compiler might strip frame pointer or
optimize it making this interface unreliable.
For hppa assume a small frame context, for larger frames FP might be located
in a different register (4 instead of 3).
For ia64 there is no strict frame pointer, and registers might rotate.
Reuse 79 following:
./gcc/config/ia64/ia64.h:#define HARD_FRAME_POINTER_REGNUM LOC_REG (79)
Once ia64 will mature, this should be revisited.
A macro can encapsulate a real function for extracting Frame Pointer on
more complex CPUs / ABIs.
For the remaining CPUs, reuse standard register as defined in appropriate ABI.
The direct users of this macro are LLVM and GCC with Sanitizers.
Proposed on tech-userlevel@.
Sponsored by <The NetBSD Foundation>
--
Improve _UC_MACHINE_FP() for SPARC/SPARC64
Introduce a static inline function _uc_machine_fp() that contains improved
caluclation of a frame pointer.
Algorithm:
uptr *stk_ptr;
# if defined (__arch64__)
stk_ptr = (uptr *) (*sp + 2047);
# else
stk_ptr = (uptr *) *sp;
# endif
*bp = stk_ptr[15];
Noted by <mrg>
--
Make _UC_MACHINE_FP() compile again and fix it so that it does not add
the offset twice.
--
fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is
the right offset. do this by using __greg32_t, which is only in
the sparc64 version, and these are only useful there, so move them.
--
Add new tests in lib/libc/sys/t_ucontext
New tests:
- ucontext_sp
- ucontext_fp
- ucontext_pc
- ucontext_intrv
They test respectively:
- _UC_MACHINE_SP
- _UC_MACHINE_FP
- _UC_MACHINE_PC
- _UC_MACHINE_INTRV
These tests attempt to access and print the values from ucontext, without
interpreting the values.
This is a follow up of the _UC_MACHINE_FP() introduction.
These tests use PRIxREGISTER, and require to be built with -D_KERNTYPES.
Sponsored by <The NetBSD Foundation>
 1.17.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.19.2.1 02-Aug-2025  perseant Sync with HEAD
 1.13 12-Jul-2023  riastradh machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h. And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.
 1.12 09-Jul-2023  riastradh machine/mutex.h: Sprinkle includes so this can be used by crash(8).

XXX pullup-10
 1.11 29-Nov-2019  riastradh branches: 1.11.26;
Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.10 28-Apr-2008  martin branches: 1.10.88;
Remove clause 3 and 4 from TNF licenses
 1.9 23-Apr-2008  martin branches: 1.9.2;
Include psl.h to provide the details of ipl_cookie_t
 1.8 14-Feb-2008  ad branches: 1.8.6; 1.8.8;
Make sparc use atomic_cas_ulong() for mutex and rwlock operations, and
disable the custom mutex/rwlock code. PR port-sparc/37930. ok martin@
 1.7 02-Jan-2008  ad Merge vmlocking2 to head.
 1.6 21-Nov-2007  yamt branches: 1.6.2; 1.6.6;
make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.5 17-Oct-2007  garbled branches: 1.5.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.4 28-May-2007  mrg branches: 1.4.8; 1.4.10; 1.4.14;
disable mutex_spin_enter() & mutex_spin_exit() as they are currently
broken and cause MULTIPROCESSOR kernels to hang while entering
userland boot up.
 1.3 15-Feb-2007  ad branches: 1.3.4; 1.3.8; 1.3.10; 1.3.16;
Add MUTEX_CLEAR_WAITERS().
 1.2 09-Feb-2007  ad Merge newlock2 to head.
 1.1 12-Jan-2007  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.7 02-Feb-2007  ad Fix declarations. Spotted by uebayasi.
 1.1.2.6 01-Feb-2007  ad Fix broken declaration in previous.
 1.1.2.5 01-Feb-2007  ad Handle hppa weirdness.
 1.1.2.4 01-Feb-2007  ad Header file cleanup.
 1.1.2.3 28-Jan-2007  ad - Fix sequence error between saving/raising the SPL.
- Changes for JavaStation.
- Fix bugs with mips & sparc support routines.
 1.1.2.2 17-Jan-2007  ad Fix detection of deadlock against the big lock.
 1.1.2.1 12-Jan-2007  ad sparc MD changes.
 1.3.16.1 26-Jun-2007  garbled Sync with HEAD.
 1.3.10.1 11-Jul-2007  mjf Sync with head.
 1.3.8.2 03-Dec-2007  ad Sync with HEAD.
 1.3.8.1 09-Jun-2007  ad Sync with head.
 1.3.4.6 27-Feb-2008  yamt sync with head.
 1.3.4.5 21-Jan-2008  yamt sync with head
 1.3.4.4 07-Dec-2007  yamt sync with head
 1.3.4.3 03-Sep-2007  yamt sync with head.
 1.3.4.2 26-Feb-2007  yamt sync with head.
 1.3.4.1 15-Feb-2007  yamt file mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:17 +0000
 1.4.14.1 21-Nov-2007  bouyer Sync with HEAD
 1.4.10.3 23-Mar-2008  matt sync with HEAD
 1.4.10.2 09-Jan-2008  matt sync with HEAD
 1.4.10.1 06-Nov-2007  matt sync with HEAD
 1.4.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.5.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.5.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.2.1 01-Jan-2008  ad Locking changes for sparc.
 1.8.8.1 18-May-2008  yamt sync with head.
 1.8.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.2.1 16-May-2008  yamt sync with head.
 1.10.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.26.1 09-Aug-2023  martin Pull up following revision(s) (requested by maya in ticket #316):

sys/arch/m68k/include/mutex.h: revision 1.13
sys/arch/arm/include/cpu.h: revision 1.125
sys/arch/sun68k/include/intr.h: revision 1.21
sys/arch/arm/include/mutex.h: revision 1.28
sys/sys/rwlock.h: revision 1.18
sys/arch/powerpc/include/mutex.h: revision 1.7
sys/arch/arm/include/mutex.h: revision 1.29
sys/arch/powerpc/include/mutex.h: revision 1.8
sys/uvm/uvm_param.h: revision 1.42
sys/sys/ksem.h: revision 1.16
sys/arch/x86/include/mutex.h: revision 1.10
sys/sys/proc.h: revision 1.372
sys/sys/ksem.h: revision 1.17
sys/arch/ia64/include/mutex.h: revision 1.8
sys/arch/evbarm/include/intr.h: revision 1.29
sys/sys/lua.h: revision 1.9
sys/arch/next68k/include/intr.h: revision 1.23
sys/arch/ia64/include/mutex.h: revision 1.9
sys/arch/hp300/include/intr.h: revision 1.35
sys/arch/hp300/include/intr.h: revision 1.36
sys/arch/sparc/include/cpu.h: revision 1.111
sys/arch/hppa/include/mutex.h: revision 1.16
sys/arch/vax/include/intr.h: revision 1.31
sys/arch/hppa/include/mutex.h: revision 1.17
sys/arch/news68k/include/intr.h: revision 1.28
sys/arch/hppa/include/mutex.h: revision 1.18
sys/arch/hppa/include/intr.h: revision 1.3
sys/arch/hppa/include/mutex.h: revision 1.19
sys/arch/hppa/include/intr.h: revision 1.4
sys/sys/sched.h: revision 1.92
sys/opencrypto/cryptodev.h: revision 1.51
sys/arch/vax/include/mutex.h: revision 1.20
sys/arch/sparc64/include/mutex.h: revision 1.10
sys/arch/ia64/include/sapicvar.h: revision 1.2
sys/arch/riscv/include/mutex.h: revision 1.5
sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
sys/arch/riscv/include/mutex.h: revision 1.6
sys/ddb/files.ddb: revision 1.16
sys/arch/mac68k/include/intr.h: revision 1.32
share/man/man4/ddb.4: revision 1.203
sys/ddb/db_command.c: revision 1.183
sys/arch/mips/include/mutex.h: revision 1.10
sys/ddb/db_command.c: revision 1.184
sys/arch/x68k/include/intr.h: revision 1.22
sys/arch/sparc/include/psl.h: revision 1.51
sys/arch/or1k/include/mutex.h: revision 1.4
sys/arch/mips/include/mutex.h: revision 1.11
sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
sys/arch/sparc64/include/cpu.h: revision 1.134
sys/arch/sparc/include/psl.h: revision 1.52
sys/arch/or1k/include/mutex.h: revision 1.5
sys/arch/mvme68k/include/intr.h: revision 1.22
sys/arch/luna68k/include/intr.h: revision 1.16
external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
sys/arch/sparc/include/mutex.h: revision 1.12
sys/arch/sparc/include/mutex.h: revision 1.13
sys/arch/usermode/include/mutex.h: revision 1.5
sys/arch/usermode/include/mutex.h: revision 1.6
sys/kern/kern_core.c: revision 1.38
usr.sbin/crash/Makefile: revision 1.49
sys/arch/amiga/include/intr.h: revision 1.23
sys/arch/alpha/include/mutex.h: revision 1.12
sys/arch/alpha/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
sys/ddb/ddb.h: revision 1.6
sys/arch/sparc64/include/mutex.h: revision 1.8
sys/arch/sh3/include/mutex.h: revision 1.12
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
sys/ddb/db_syncobj.c: revision 1.1
sys/arch/vax/include/mutex.h: revision 1.18
sys/arch/sparc64/include/psl.h: revision 1.63
sys/arch/sparc64/include/mutex.h: revision 1.9
sys/arch/sh3/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/obio.c: revision 1.13
sys/arch/atari/include/intr.h: revision 1.23
sys/ddb/db_syncobj.c: revision 1.2
sys/arch/vax/include/mutex.h: revision 1.19
sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
sys/arch/cesfic/include/intr.h: revision 1.14
sys/ddb/db_syncobj.h: revision 1.1
sys/arch/x86/include/cpu.h: revision 1.134
sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
sys/arch/cesfic/include/intr.h: revision 1.15
sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
sys/sys/cpu_data.h: revision 1.54
sys/arch/m68k/include/mutex.h: revision 1.12
sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes. Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h. avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h. And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.
 1.1 18-Mar-2002  thorpej branches: 1.1.2;
file mutex_impl.h was initially added on branch newlock.
 1.1.2.4 22-Mar-2002  thorpej Wrap the stuff that manipulates the guts of a mutex in __MUTEX_PRIVATE.
 1.1.2.3 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.2 19-Mar-2002  thorpej Shuffle the mutex structure and change types such that the mutex
is now 8 bytes rather than 16.
 1.1.2.1 18-Mar-2002  thorpej First cut at mutex and rwlock implementation for SPARC.
 1.17 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 04-Mar-2006  uwe branches: 1.16.20;
De-__P.
 1.15 11-Dec-2005  christos branches: 1.15.4; 1.15.6;
merge ktrace-lwp.
 1.14 31-May-2005  christos branches: 1.14.2;
- sprinkle const
- remove parameter names from function declarations
 1.13 04-Dec-2001  darrenr branches: 1.13.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.12 14-Feb-1999  pk branches: 1.12.22; 1.12.26;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.11 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.10 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.9 22-Feb-1996  pk Correct some prototypes.
 1.8 13-Feb-1996  christos caddt_t -> caddr_t
 1.7 13-Feb-1996  christos - Fix setcxsegmap prototype.
- Cast ?TO? macros to NULL to avoid compiler warnings
 1.6 09-Feb-1996  christos A few prototype fixes
 1.5 03-Sep-1995  pk Add data structures used to interface to the monitor-resident drivers.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 02-Oct-1994  deraadt MONxx -> OLDMON_xx
 1.2 20-Aug-1994  deraadt repair a few rom call return values
 1.1 08-Aug-1994  deraadt first cuts
 1.12.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.12.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.2 03-Sep-2007  yamt sync with head.
 1.14.2.1 21-Jun-2006  yamt sync with head.
 1.15.6.1 22-Apr-2006  simonb Sync with head.
 1.15.4.1 09-Sep-2006  rpaulo sync with head
 1.16.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.10 01-Apr-2016  palle sun4v: Workaround for OpenBoot feature where a 64-bit address is truncated to a 32-bit address. This happends when a write to the console (/virtual-devices@100/console@1) is done. Avoid this by using a static buffer that is mapped below 4GB. Thanks to Tarl Neustaedter for explaining how OpenBoot works. ok martin@
 1.9 06-Oct-2015  martin Do not use #ifdef SUN4U when testing for cpu features of post-v8 CPUs,
it is not good for SUN4V-only kernels. Instead use __sparc_v9__ (which
is also defined by the sparc compiler when called with cpu=ultrasparc).
ok: mrg@
 1.8 27-Mar-2015  nakayama Sync sparc64 kernel's OF_seek with ofwboot's one, but sparc version
is not changed.
 1.7 18-May-2009  nakayama branches: 1.7.22; 1.7.38; 1.7.40;
Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6 04-Mar-2006  uwe branches: 1.6.72; 1.6.82; 1.6.92; 1.6.96;
s/u_intN_t/uintN_t/
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6;
merge ktrace-lwp.
 1.4 31-May-2005  christos branches: 1.4.2;
- sprinkle const
- remove parameter names from function declarations
 1.3 21-Mar-2004  pk Add sparc64 cell_t definitions.
Change OF_interpret() prototype to the unabridged version.
 1.2 15-Nov-2000  pk branches: 1.2.24;
OF_getproplen(), OF_nextprop() and OF_setprop() prototypes are now in
dev/ofw/openfirm.h
 1.1 14-Feb-1999  pk branches: 1.1.8;
Provide a uniform interface to most of the PROM functions.
Include an Openfirmware back-end (mostly copied from sparc64).
 1.1.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.2.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.4.2.1 21-Jun-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.6.96.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.92.1 26-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.82.1 19-Apr-2015  msaitoh Pullup another commit for ticket #1958 requested by martin:

sys/arch/sparc/include/openfirm.h 1.7
sys/arch/sparc/stand/ofwboot/Locore.c 1.11
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c 1.7
sys/arch/sparc/stand/ofwboot/openfirm.h 1.4

Make ofwboot can handle over 4GB physical memory by using OpenFirmware
calls properly, and some cosmetic changes. Idea from OpenBSD.
 1.6.72.1 20-Jun-2009  yamt sync with head
 1.7.40.3 22-Apr-2016  skrll Sync with HEAD
 1.7.40.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.7.40.1 06-Apr-2015  skrll Sync with HEAD
 1.7.38.1 29-Mar-2015  martin Pull up following revision(s) (requested by nakayama in ticket #649):
sys/arch/sparc/sparc/openfirm.c: revision 1.20
sys/arch/sparc/include/openfirm.h: revision 1.8
sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14
Fix kernel loading failures from partitions started from over first
4GB of disks on sparc64.
Sync sparc64 kernel's OF_seek with ofwboot's one, but sparc version
is not changed.
 1.7.22.1 03-Dec-2017  jdolecek update from HEAD
 1.7 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.6 11-Dec-2005  christos branches: 1.6.122; 1.6.142;
merge ktrace-lwp.
 1.5 23-Apr-2004  hannken Protect against multiple inclusion.
 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 20-Jul-2002  mrg branches: 1.3.6;
sync these with the sparc64 versions.
 1.2 20-Nov-1994  deraadt branches: 1.2.46; 1.2.50; 1.2.58;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.58.1 31-Aug-2002  gehenna catch up with -current.
 1.2.50.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.46.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 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.142.1 22-Sep-2015  skrll Sync with HEAD
 1.6.122.1 03-Dec-2017  jdolecek update from HEAD
 1.76 20-Apr-2025  riastradh t_signal_and_sp: Add sparc support.

Seems fine! Would be nice if we had a well-known macro to abstract
PIC vs non-PIC `sethi/ori/(ld)' like I invented here, to reduce
needless #ifdef __PIC__ conditionals.

PR kern/59327: user stack pointer is not aligned properly
 1.75 02-Jun-2023  andvar branches: 1.75.6;
follow the steps of Andrew Doran (ad) commit and fix more s/loose/lose/ typos.
also s/beyound/beyond/ and few others along the way, mainly in comments.
 1.74 01-May-2020  isaki Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.
Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).
But please don't be eager to make the default value shorter.

<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
 1.73 15-May-2019  christos branches: 1.73.2;
From: Tobias Ulmer. Unbreak zfs module build on sparc{,64} by hiding DELAY.
ZFS has a conflicting definition of delay() and tries to hide it by
defining __HIDE_DELAY.
 1.72 07-Jan-2019  jdolecek move DEV_BSIZE, DEV_BSHIFT out of MD param.h, they are same on all ports

also move BLKDEV_IOSIZE, MAXPHYS, but allow override since some ports
have different value (powerpc uses NBPG for BLKDEV_IOSIZE, sun2/sun3
have lower MAXPHYS)
 1.71 13-Feb-2017  skrll branches: 1.71.12; 1.71.14;
G/C VM_MAX_KERNEL_BUF
 1.70 10-Feb-2012  para branches: 1.70.6; 1.70.24; 1.70.28; 1.70.32;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.69 24-Jan-2012  christos Use and define ALIGN() ALIGN_POINTER() and STACK_ALIGN() consistently,
and avoid definining them in 10 different places if not needed.
 1.68 20-Jan-2012  joerg Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.67 08-Feb-2010  joerg branches: 1.67.10; 1.67.14;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.66 28-Aug-2006  yamt branches: 1.66.60; 1.66.80;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.65 04-Mar-2006  uwe branches: 1.65.2;
De-__P.
 1.64 13-Jan-2006  chs branches: 1.64.2; 1.64.4;
increase NKMEMPAGES_MAX_DEFAULT to 32 MB. this is needed on sun4m machines
with 512 MB of RAM, and it doesn't seem to cause any problems on sun4c.
 1.63 11-Dec-2005  christos branches: 1.63.2;
merge ktrace-lwp.
 1.62 12-Dec-2003  martin branches: 1.62.14; 1.62.16;
If compiling for JavaStations, modify kernal VA layout to not conflict
with the PROM. From Valeriy E. Ushakov. This is a hack, but as long as
we don't have a way to arrange for a proper VA layout on this machines
(i.e. beyound the PROM) it is needed.
 1.61 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.60 11-Apr-2003  jdc branches: 1.60.2;
Always include (new) cpuconf.h.

From Christopher SEKIYA in PR port-sparc/21093.
 1.59 09-Apr-2003  thorpej Move CPU configuration predicates to <machine/cpuconf.h>.
 1.58 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.57 17-Jul-2002  thorpej Add a macro to test if the system uses the SRMMU (Sun4M || Sun4D).
 1.56 17-Jul-2002  thorpej Handle the CPU_NTYPES == 0 case (as we would see in bootblocks)
in the CPU types predicates.
 1.55 17-Jul-2002  thorpej Add a CPU_ISSUN4D predicate.
 1.54 17-Jul-2002  thorpej Instead of using a matrix of configured CPU types, first count
how many CPU types are configured into the kernel. Then, use this
information to define the CPU predicate macros according to the
following rules:

1. If support for a CPU type is not configured into the kernel,
then the test is always false.

2. Otherwise, if only one CPU type is configured into the kernel,
then the test is always true.

3. Otherwise, we have to reference the cputyp variable.

Use a similar strategy for short-cutting the page size related
definitions.
 1.53 17-Jul-2002  thorpej Remote CPU_ISSUN4OR4C and CPU_ISSUN4COR4M, and instead express them
as (CPU_ISSUN4 || CPU_ISSUN4C) and (CPU_ISSUN4C || CPU_ISSUN4M),
respectively. The compiler can still optimize as desired by expressing
them this way, and it simplifies adding new tests.

While here, just remove CPU_ISSUN4MOR4U; it's not used by anything.
 1.52 17-Jul-2002  thorpej Add CPU_SUN4D.
 1.51 26-Feb-2002  simonb branches: 1.51.8;
Purge CLSIZE, CLSIZELOG2 and MCLOFSET.
Be consistant in the way that MSIZE, MCLSHIFT, MCLBYTES and NMBCLUSTERS
are defined.
Remove old VM constants from cesfic port.
Bump MSIZE to 256 on mipsco (the only one that wasn't already 256).
 1.50 11-Dec-2001  uwe microSPARC-IIep is a sun4m but with an integrated PCI controller.
In a lot of places (like pmap &c) we want it to be treated as SUN4M.
But since various low-level things are done very differently from
normal sparcs (and since for now it requires a relocated kernel
anyway), the MSIIEP kernels are not supposed to support any other
system. So when MSIIEP is defined - insist on SUN4M defined and SUN4
and SUN4C not defined.
 1.49 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.48 30-May-2001  mrg branches: 1.48.2; 1.48.8;
use _KERNEL_OPT
 1.47 10-May-2001  pk * reserve NBPG et.al. for kernel usage only.
* remove obsoleted comment on `physmap'.
 1.46 01-Mar-2001  pk branches: 1.46.2;
Drop MSGBUFSIZE; we don't use it and it can't currently be configured
to a different value anyway.
 1.45 30-Jun-2000  itojun raise MSIZE from 128 to 256.
- for sizeof(void *) == 8 arch, this is mandatory. MHLEN is too small
already (less than 80) and there are chances for unwanted packet loss due
to m_pullup restriction.
- for other cases, the change should avoid allocating clusters in most cases
(even when you have IPv4 IPsec tunnel, or IPv6 with moderate amount of
extension header)

portmasters: if your arch chokes with the change (high memory usage or
whatever), please backout the change for your arch.
 1.44 22-May-2000  mrg branches: 1.44.4;
add two new CPU_ISXXX versions: CPU_ISSUN4U, CPU_ISSUN4MOR4U
 1.43 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.42 26-Jan-2000  cjs Don't explode when we've got a lot of RAM. Limit our space for buffers
to 1/4 of the kernel VM map.
 1.41 04-Dec-1999  ragge CL* discarding.
 1.40 27-Nov-1999  mrg minor cosmetic merges; long way to go here.
 1.39 03-May-1999  christos branches: 1.39.2; 1.39.8;
move PROM_LOADADDR from promlib.h to param.h and remove its cast.
 1.38 14-Feb-1999  pk branches: 1.38.4;
Adjust to functionality and changes introduced with <machine/promlib.h>
 1.37 01-Feb-1999  mrg add CPU_SUN4U, to make libkvm compile.
 1.36 23-Aug-1998  pk Nuke phys_map & old dvmamap.
 1.35 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.34 29-Apr-1998  thorpej Pull in opt_gateway.h as appropriate.
 1.33 23-Sep-1997  pk Move KERNBASE to 0xf0000000.
 1.32 23-Sep-1997  pk MSGBUFSIZE needs no obscure adjustment; initmsgbuf() takes care of that.
 1.31 20-Sep-1997  leo Correct for the extra member in 'struct kern_msgbuf' when calculating
the number of bytes we want to allocate.
 1.30 19-Sep-1997  leo Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
 1.29 10-Mar-1997  pk branches: 1.29.4;
Remove `cpumod' and `mmumod' and several related constants.
This functionality is now taken over by cpuvar.h
 1.28 24-Feb-1997  fvdl Define ALIGNED_POINTER
 1.27 22-Oct-1996  pk branches: 1.27.6;
If no specific kernel architecture is requested, define the CPU_* and
NBPG et.al. as in the generic case. This would be the expected thing to do
when compiling LKMs and such.
 1.26 20-Oct-1996  pk Regroup the definitions of NBPG, PGOFSET and PGSHIFT into the section that
enumerates the possible SUN? combinations.
 1.25 28-Aug-1996  mrg re-order to allow NBPG/PGSHIFT/PGOFSET to work always.
 1.24 15-May-1996  mrg remove some RCS id's we don't need.
 1.23 31-Mar-1996  pk Add sun4m CPU/MMU identifications.
 1.22 04-Mar-1996  cgd add _MACHINE and _MACHINE_ARCH, which are like MACHINE and MACHINE_ARCH,
execpt without quotes. meant to be __CONCAT()ted for easy #includes
of machine-dependent headers for MI code (e.g. for the MI ISA/EISA/PCI/TC
bus code).
 1.21 22-Feb-1996  pk An #ifndef _LOCORE to make this file safe to include in locore.s.
Introduce a couple of `CPU-type' helper macros to reduce the preprocessor
tangos in many a source file.
 1.20 16-Feb-1996  pk delay() prototype.
 1.19 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.18 11-Dec-1995  pk Prototype dvma helper functions `dvma_malloc()/dvma_free()'
 1.17 06-Dec-1995  pk DVMA space is described by the variables `dvma_start' and `dvma_end'.
Prototype dvma_map*() routines.
 1.16 28-Jun-1995  cgd kill user-land DELAY macro, as suggested by gwr.
 1.15 26-Jun-1995  pk Define variables and macros for DVMA allocation using rmaps.
 1.14 26-Jun-1995  cgd clean up definitions of ctod(), dtoc(), ctob(), btoc(), btodb(), and
dbtob(). remove unused definitions of ctos(), stoc(), and dtob().
 1.13 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.12 18-Mar-1995  cgd don't be so quick to cast macro arguments to unsigned; if the
arguments are really off_t's (e.g. to btodb), then you can lose
information. This was the "> 4G file systems don't work" bug; physio
uses btodb, which was broken.
 1.11 01-Feb-1995  pk Integrate changes from Chuck Cranor for the Sun 4/100.
Support for multiple register banks on SBUS devices (based on patches
from Francis Dupont).
Highlights:
romaux defines an array of register spaces.
pay attention to `vactype'.
quirks handling 4/100 idiosyncracies.
 1.10 20-Nov-1994  deraadt copyright/Id cleanup
 1.9 02-Nov-1994  deraadt do not have UPAGES definition
 1.8 26-Oct-1994  deraadt vme interrupt support
 1.7 20-Aug-1994  deraadt regarding NBPG, PGOFSET, PGSHIFT, NPTESG, VA_VPG:
these are simple macros unless you build a combined sun4+(sun4c,sun4m)
kernel -- then they point to variables which are initialized early on.
 1.6 04-Jul-1994  deraadt goodbye BTOPKERNBASE
 1.5 19-May-1994  deraadt liten
 1.4 04-Dec-1993  cgd add MACHINE_ARCH
 1.3 03-Dec-1993  deraadt monster kludge! struct kinfo is very large, cause the pmap struct is
very large. this has to fit into struct user.. kern_kinfo.c should get
fixed (for the core dump case)
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.27.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.29.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.29.4.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.38.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.39.8.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.39.8.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.39.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.39.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.44.4.1 23-Jul-2000  itojun pullup from main trunc (approved by releng-1-5)

raise MSIZE from 128 to 256.
- for sizeof(void *) == 8 arch, this is mandatory. MHLEN is too small
already (less than 80) and there are chances for unwanted packet loss due
to m_pullup restriction.
- for other cases, the change should avoid allocating clusters in most cases
(even when you have IPv4 IPsec tunnel, or IPv6 with moderate amount of
extension header)

portmasters: if your arch chokes with the change (high memory usage or
whatever), please backout the change for your arch.

1.1 -> 1.2 syssrc/sys/arch/amigappc/include/param.h
1.13 -> 1.14 syssrc/sys/arch/arc/include/param.h
1.1 -> 1.2 syssrc/sys/arch/arm26/include/param.h
1.17 -> 1.18 syssrc/sys/arch/arm32/include/param.h
1.6 -> 1.7 syssrc/sys/arch/bebox/include/param.h
1.4 -> 1.5 syssrc/sys/arch/cobalt/include/param.h
1.4 -> 1.5 syssrc/sys/arch/evbsh3/include/param.h
1.2 -> 1.3 syssrc/sys/arch/hpcmips/include/param.h
1.40 -> 1.41 syssrc/sys/arch/i386/include/param.h
1.7 -> 1.8 syssrc/sys/arch/m68k/include/param.h
1.9 -> 1.10 syssrc/sys/arch/macppc/include/param.h
1.4 -> 1.5 syssrc/sys/arch/mmeye/include/param.h
1.6 -> 1.7 syssrc/sys/arch/newsmips/include/param.h
1.7 -> 1.8 syssrc/sys/arch/ofppc/include/param.h
1.23 -> 1.24 syssrc/sys/arch/pc532/include/param.h
1.32 -> 1.33 syssrc/sys/arch/pmax/include/param.h
1.7 -> 1.8 syssrc/sys/arch/powerpc/include/param.h
1.1 -> 1.2 syssrc/sys/arch/prep/include/param.h
1.1 -> 1.2 syssrc/sys/arch/sgimips/include/param.h
1.3 -> 1.4 syssrc/sys/arch/sh3/include/param.h
1.44 -> 1.45 syssrc/sys/arch/sparc/include/param.h
1.21 -> 1.22 syssrc/sys/arch/sparc64/include/param.h
1.43 -> 1.44 syssrc/sys/arch/vax/include/param.h
 1.46.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.48.8.6 16-Jan-2003  martin Backout previous - didn't mean to commit this file.
 1.48.8.5 16-Jan-2003  martin Fix typo.
 1.48.8.4 01-Aug-2002  nathanw Catch up to -current.
 1.48.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.48.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.48.8.1 30-May-2001  nathanw file param.h was added on branch nathanw_sa on 2002-01-08 00:27:39 +0000
 1.48.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.48.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.48.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.51.8.1 21-Jul-2002  gehenna catch up with -current.
 1.60.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1 03-Aug-2004  skrll Sync with HEAD
 1.62.16.2 30-Dec-2006  yamt sync with head.
 1.62.16.1 21-Jun-2006  yamt sync with head.
 1.62.14.1 30-Jan-2006  tron Pull up following revision(s) (requested by chs in ticket #1147):
sys/arch/sparc/include/param.h: revision 1.64
increase NKMEMPAGES_MAX_DEFAULT to 32 MB. this is needed on sun4m machines
with 512 MB of RAM, and it doesn't seem to cause any problems on sun4c.
 1.63.2.1 15-Jan-2006  yamt sync with head.
 1.64.4.1 22-Apr-2006  simonb Sync with head.
 1.64.2.1 09-Sep-2006  rpaulo sync with head
 1.65.2.1 03-Sep-2006  yamt sync with head.
 1.66.80.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.66.60.1 11-Mar-2010  yamt sync with head
 1.67.14.1 18-Feb-2012  mrg merge to -current.
 1.67.10.1 17-Apr-2012  yamt sync with head
 1.70.32.1 21-Apr-2017  bouyer Sync with HEAD
 1.70.28.1 20-Mar-2017  pgoyette Sync with HEAD
 1.70.24.1 28-Aug-2017  skrll Sync with HEAD
 1.70.6.1 03-Dec-2017  jdolecek update from HEAD
 1.71.14.1 10-Jun-2019  christos Sync with HEAD
 1.71.12.1 18-Jan-2019  pgoyette Synch with HEAD
 1.73.2.1 18-May-2020  martin Pull up following revision(s) (requested by isaki in ticket #911):

sys/dev/audio/audiodef.h: revision 1.13
sys/dev/audio/audiodef.h: revision 1.14
sys/arch/sparc/include/param.h: revision 1.74
sys/arch/evbarm/conf/GENERIC64: revision 1.148
sys/arch/sh3/include/param.h: revision 1.25
sys/arch/evbarm/conf/GENERIC: revision 1.75
sys/arch/m68k/include/param.h: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.564
sys/arch/hppa/include/param.h: revision 1.27
sys/dev/audio/audio.c: revision 1.68
sys/arch/vax/include/param.h: revision 1.63
sys/dev/audio/audio.c: revision 1.69

Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before). And remove the option from GENERIC.

- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.

Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.

Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.


Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.

Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).

But please don't be eager to make the default value shorter.
<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
 1.75.6.1 02-Aug-2025  perseant Sync with HEAD
 1.9 13-Oct-2009  pooka protect against multi-inclusion
 1.8 04-Mar-2007  christos branches: 1.8.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 11-Dec-2005  christos branches: 1.7.26;
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 03-Mar-2001  pk branches: 1.5.24;
Remove unused declaration of `cpcb', which is no longer a global variable.
 1.4 28-Mar-1995  jtc branches: 1.4.32;
KERNEL -> _KERNEL
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 19-May-1994  deraadt liten
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.32.1 12-Mar-2001  bouyer Sync with HEAD.
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.44.1 11-Mar-2010  yamt sync with head
 1.12 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.11 29-Mar-2014  christos branches: 1.11.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.10 16-Apr-2013  jdc branches: 1.10.4;
Add PCI fixup for MicroSPARC-IIep.
Unconfigured PCI-PCI bridges and devices behind them are configured.
 1.9 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.8 04-Apr-2011  dyoung branches: 1.8.4; 1.8.14;
Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

For the most part, these changes add a 'const' where there was no
'const' before, however, some drivers and MD code used to modify
pci_attach_args. Now those drivers either copy their pci_attach_args
and modify the copy, or refrain from modifying pci_attach_args:

Xen: according to Manuel Bouyer, writing to pci_attach_args in
pci_intr_map() was a leftover from Xen 2. Probably a bug. I
stopped writing it. I have not tested this change.

siside(4): sis_hostbr_match() needlessly wrote to pci_attach_args.
Probably a bug. I use a temporary variable. I have not tested this
change.

slide(4): sl82c105_chip_map() overwrote the caller's pci_attach_args.
Probably a bug. Use a local pci_attach_args. I have not tested
this change.

viaide(4): via_sata_chip_map() and via_sata_chip_map_new() overwrote the
caller's pci_attach_args. Probably a bug. Make a local copy of the
caller's pci_attach_args and modify the copy. I have not tested
this change.

While I'm here, make pci_mapreg_submap() static.

With these changes in place, I have tested the compilation of these
kernels:

alpha GENERIC
amd64 GENERIC XEN3_DOM0
arc GENERIC
atari HADES MILAN-PCIIDE
bebox GENERIC
cats GENERIC
cobalt GENERIC
evbarm-eb NSLU2
evbarm-el ADI_BRH ARMADILLO9 CP3100 GEMINI GEMINI_MASTER GEMINI_SLAVE GUMSTIX
HDL_G IMX31LITE INTEGRATOR IQ31244 IQ80310 IQ80321 IXDP425 IXM1200
KUROBOX_PRO LUBBOCK MARVELL_NAS NAPPI SHEEVAPLUG SMDK2800 TEAMASA_NPWR
TEAMASA_NPWR_FC TS7200 TWINTAIL ZAO425
evbmips-el AP30 DBAU1500 DBAU1550 MALTA MERAKI MTX-1 OMSAL400 RB153 WGT624V3
evbmips64-el XLSATX
evbppc EV64260 MPC8536DS MPC8548CDS OPENBLOCKS200 OPENBLOCKS266
OPENBLOCKS266_OPT P2020RDB PMPPC RB800 WALNUT
hp700 GENERIC
i386 ALL XEN3_DOM0 XEN3_DOMU
ibmnws GENERIC
macppc GENERIC
mvmeppc GENERIC
netwinder GENERIC
ofppc GENERIC
prep GENERIC
sandpoint GENERIC
sgimips GENERIC32_IP2x
sparc GENERIC_SUN4U KRUPS
sparc64 GENERIC

As of Sun Apr 3 15:26:26 CDT 2011, I could not compile these kernels
with or without my patches in place:

### evbmips-el GDIUM

nbmake: nbmake: don't know how to make /home/dyoung/pristine-nbsd/src/sys/arch/mips/mips/softintr.c. Stop

### evbarm-el MPCSA_GENERIC
src/sys/arch/evbarm/conf/MPCSA_GENERIC:318: ds1672rtc*: unknown device `ds1672rtc'

### ia64 GENERIC

/tmp/genassym.28085/assym.c: In function 'f111':
/tmp/genassym.28085/assym.c:67: error: invalid application of 'sizeof' to incomplete type 'struct pcb'
/tmp/genassym.28085/assym.c:76: error: dereferencing pointer to incomplete type

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
 1.7 29-May-2008  mrg branches: 1.7.20; 1.7.26;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.6 04-Mar-2006  uwe branches: 1.6.68; 1.6.70; 1.6.72; 1.6.74;
s/u_intN_t/uintN_t/
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6;
merge ktrace-lwp.
 1.4 29-Jul-2004  drochner branches: 1.4.12;
remove now unnecessary "pci_enumerate_bus" definitions
 1.3 15-May-2002  thorpej branches: 1.3.10;
Let machine-dependent code specify how to enumerate the bus.
Currently, everyone uses pci_enumerate_bus_generic().
 1.2 15-May-2002  thorpej Garbage-collect __PCI_DEV_FUNCORDER.
 1.1 11-Dec-2001  uwe branches: 1.1.2; 1.1.4;
microSPARC-IIep support.
 1.1.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 11-Dec-2001  thorpej file pci_machdep.h was added on branch kqueue on 2002-01-10 19:48:53 +0000
 1.1.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 11-Dec-2001  nathanw file pci_machdep.h was added on branch nathanw_sa on 2002-01-08 00:27:39 +0000
 1.3.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.10.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.1 21-Jun-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.6.74.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.72.1 04-May-2009  yamt sync with head.
 1.6.70.1 04-Jun-2008  yamt sync with head
 1.6.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.26.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.20.1 21-Apr-2011  rmind sync with head
 1.8.14.4 03-Dec-2017  jdolecek update from HEAD
 1.8.14.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.14.2 23-Jun-2013  tls resync from head
 1.8.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 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 30-Oct-2012  yamt sync with head
 1.10.4.1 18-May-2014  rmind sync with head
 1.11.6.1 09-Jul-2016  skrll Sync with HEAD
 1.98 23-Mar-2024  andvar s/ignorning/ignoring/ in comment.
 1.97 25-Jan-2021  mrg avoid needing <machine/promlib.h>. fixes sparc64 build.
 1.96 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.95 18-Dec-2020  mrg remove unused and #if 0'd since introduced in 1996 struct kvm_cpustate.
sparc kvm was handled differently for the sun4m port.
 1.94 06-Sep-2020  mrg branches: 1.94.2;
forward declare struct vm_page, and include uvm_prot.h and uvm_pmap.h.

fixes build, presumeably after uvm.h external rototill.
 1.93 14-Mar-2020  ad pmap_remove_all(): Return a boolean value to indicate the behaviour. If
true, all mappings have been removed, the pmap is totally cleared out, and
UVM can then avoid doing the work to call pmap_remove() for each map entry.
If false, either nothing has been done, or some helpful arch-specific voodoo
has taken place.
 1.92 19-Oct-2013  mrg branches: 1.92.30;
- remove unused but set variables.
- use __USE() where necessary.
- remove useless 'volatile' markers

kd.c:consinit() might be wrong for old proms, but i've not
changed it really.
 1.91 07-Jan-2013  chs branches: 1.91.2;
switch to __USE_TOPDOWN_VM.
 1.90 14-Feb-2011  he branches: 1.90.4; 1.90.14;
Provide a macro for pmap_mmap_flags() since we define PMAP_EXCLUDE_DECLS
here.
 1.89 14-Nov-2010  uebayasi branches: 1.89.2; 1.89.4;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.88 21-Nov-2009  rmind branches: 1.88.2; 1.88.4;
Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.
 1.87 07-Nov-2009  cegger Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.86 21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.85 16-Aug-2009  skrll s/int/u_int/ for flags in pmap_enter and deal with this in rump.

Hi cegger.
 1.84 09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

Bonus cosmetics round: move all the pmap_t pointer typedefs into
uvm_pmap.h.

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.83 25-Oct-2008  mrg branches: 1.83.2;
include <sparc/pte.h> not <machine/pte.h> so this gets the right
version in 32 bit mode.
 1.82 02-Jan-2008  ad branches: 1.82.6; 1.82.10; 1.82.16;
Merge vmlocking2 to head.
 1.81 17-Oct-2007  garbled branches: 1.81.2; 1.81.4; 1.81.8;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.80 16-Jul-2007  macallan branches: 1.80.10;
turn pmap_phys_address() into a macro since all the function ever did was
to cast its parameter to paddr_t and return it
approved by mrg
 1.79 04-Mar-2007  mrg branches: 1.79.2; 1.79.10;
fix fall out from caddr_t changes.
 1.78 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.77 21-Feb-2007  thorpej 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.76 11-Dec-2005  christos branches: 1.76.26;
merge ktrace-lwp.
 1.75 17-Jan-2005  atatat branches: 1.75.8;
Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
 1.74 16-Jan-2005  chs implement pmap_wired_count(). use more macros for determining MMU type.
 1.73 10-Apr-2004  pk branches: 1.73.4;
De-__P().
 1.72 10-Apr-2004  pk Do not maintain the number of valid pages per segment (`sg_npte') anymore
for the kernel map on SRMMU machines. This allows pmap_kenter() and
pmap_kremove() to update mappings without needing to lock the pmap
or raising the interrupt level.
 1.71 03-Apr-2004  pk Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.
 1.70 16-Aug-2003  pk branches: 1.70.2;
sun4/sun4c MMU: keep `wired' status per page, implemented by defining a bit
in the PTE word that is not used by the hardware. Use it to unlock a `pmeg'
if the wired count in a segment drops to zero.
 1.69 12-Aug-2003  pk Use pmap_remove_all() to flush the cache by context and set a flag to
avoid subsequent user space cache flushes by page or segment in pmap_remove().
 1.68 10-May-2003  thorpej branches: 1.68.2;
Back out the following chagne:
http://mail-index.netbsd.org/source-changes/2003/05/08/0068.html

There were some side-effects that I didn't anticipate, and fixing them
is proving to be more difficult than I thought, do just eject for now.
Maybe one day we can look at this again.

Fixes PR kern/21517.
 1.67 08-May-2003  thorpej Simplify the way the bounds of the managed kernel virtual address
space is advertised to UVM by making virtual_avail and virtual_end
first-class exported variables by UVM. Machine-dependent code is
responsible for initializing them before main() is called. Anything
that steals KVA must adjust these variables accordingly.

This reduces the number of instances of this info from 3 to 1, and
simplifies the pmap(9) interface by removing the pmap_virtual_space()
function call, and removing two arguments from pmap_steal_memory().

This also eliminates some kludges such as having to burn kernel_map
entries on space used by the kernel and stolen KVA.

This also eliminates use of VM_{MIN,MAX}_KERNEL_ADDRESS from MI code,
this giving MD code greater flexibility over the bounds of the managed
kernel virtual address space if a given port's specific platforms can
vary in this regard (this is especially true of the evb* ports).
 1.66 02-Mar-2003  pk pmap_changeprot() is not a UVM <-> PMAP interface function; make it internal.
Provide pmap_kprotect() for MD code to change protection on a range of
kernel addresses (cuurent users: intr.c and mkclock.c).
 1.65 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.64 11-Jan-2003  mrg keep track of which cpu's have run a pmap and only broadcast tlb flushes to
cpu's who have done so. implement pmap_deactivate() for MULTIPROCESSOR and
call it from cpu_switch() when we are about to switch proces and when we
enter idle().

with this change, i see significantly reduced tlb IPI traffic and fork/exec
bound processes -- such as "configure" -- run significantly faster, upto
15%. i also obvserved a small (0-2%) benefit to CPU bound tasks as well.
 1.63 21-Dec-2002  pk tlb_flush_segment() and tlb_flush_region() now take a virtual address
argument instead of segment and region numbers.
 1.62 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.61 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.60 17-Jul-2002  thorpej Add SUN4D ifdef cases. Use CPU_HAS_SRMMU where appropriate.
 1.59 04-Dec-2001  darrenr branches: 1.59.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.58 10-Sep-2001  chris branches: 1.58.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.57 18-Jun-2001  mrg branches: 1.57.2; 1.57.4;
copy tlb_flush*() #defines here, but rename them tlb_flush*_real(). this
allows for tlb_flush*() to be defined differently if MULTIPROCESSOR.
 1.56 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.55 23-Apr-2001  thorpej Don't need a prototype for pmap_bootstrap_alloc(); the function
does not exist in the pmap API anymore.
 1.54 22-Apr-2001  thorpej Remove pmap_kenter_pgs(). It was never really adopted by
anything, and the interface itself wasn't as flexible as
callers would have probably liked.
 1.53 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.52 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.51 21-Apr-2001  thorpej #define away pmap_update() in <machine/pmap.h> so that no function
call overhead is incurred as we start sprinkling pmap_update() calls
throughout the source tree (no pmaps currently defer operations, but
we are adding the infrastructure to allow them to do so).
 1.50 26-Mar-2001  pk pmap_release(), pmap_pinit() and the `pm_regstore' field are obsolete.
 1.49 01-Mar-2001  pk branches: 1.49.2;
Drop the managed() macro; it is no longer used.
State the intended use of the vm_{first,last,num}_phys variables that are
still exported from pmap.c.
 1.48 31-May-2000  pk Remove obsolete function declarations.
Move switchexit() to cpu.h
 1.47 31-May-2000  pk Fix a couple of typos.
 1.46 01-May-2000  pk branches: 1.46.2;
Implement HyperSPARC specific pmap_{zero,copy}_page functions.
 1.45 30-Apr-2000  pk Allow for CPU specific page clear and page copy functions.
 1.44 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.43 14-Nov-1999  thorpej Update for pmap API change.
 1.42 04-Oct-1999  pk branches: 1.42.2; 1.42.4; 1.42.8;
Each process (i.e. each `pmap') needs a region table for each CPU.
Implement this by making the fields `pm_reg_ptp' and `pm_reg_ptp_pa'
pointers to an array of `ncpu' region table pointers and corresponding
physical addresses.

This is a somewhat unfortunate side effect of having the per-CPU data
addressable by the same virtual address on each CPU.
 1.41 12-Sep-1999  chs eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.40 08-Jul-1999  thorpej Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.39 28-Jun-1999  pk mmu_pagein() prototype: change address argument to `vaddr_t'.
 1.38 17-Jun-1999  thorpej pmap_change_wiring() -> pmap_unwire().
 1.37 17-Jun-1999  thorpej Remove pmap_pageable(); no pmap implements it, and it is not really useful,
because pmap_enter()/pmap_change_wiring() (soon to be pmap_unwire())
communicate the information in greater detail.
 1.36 26-Mar-1999  mycroft branches: 1.36.2; 1.36.4; 1.36.6;
Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.35 09-Sep-1998  thorpej Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule
the reaper to free them for us, once it is safe to do so (i.e. we are
no longer running on the dead proc's vmspace and stack).
 1.34 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.33 02-Mar-1998  fvdl Make this compile again.
 1.32 08-Jan-1998  thorpej Update a comment relative to the vm_bootstrap_steal_memory() change, and
don't include pmap_free_pages() or pmap_next_page() in the new non-contig
case.
 1.31 02-Jan-1998  thorpej Implement pmap_activate().
 1.30 04-Aug-1997  pk Prototype pmap_writetext().
 1.29 06-Jul-1997  pk branches: 1.29.2;
Follow lock changes (DEBUG => LOCKDEBUG).
 1.28 06-Jul-1997  pk Adjust for generic lock changes.
 1.27 28-Jun-1997  pk Remove __VM_PMAP_HACK.
 1.26 24-May-1997  pk Define macros for encoding I/O space bits into the physical address
passed to pmap_enter().
 1.25 16-May-1997  gwr Add #define __VM_PMAP_HACK as a temporary measure.
 1.24 27-May-1996  pk prototype mmu_pagein4m() #if DEBUG is on.
 1.23 27-May-1996  pk No longer need to call mmu_pagein() through a pointer.
 1.22 20-May-1996  thorpej branches: 1.22.4;
RCS Id police.
 1.21 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.20 31-Mar-1996  pk Add SRMMU/sun4m support. Size and layout of `struct pmap' has changed.
 1.19 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.18 28-Feb-1996  gwr update PMAP_PREFER
 1.17 05-Jul-1995  pk Prototype pmap_dumpsize() and pmap_dumpmmu().
 1.16 13-Apr-1995  pk Make size of `struct pmap' independent of `MMU3_L', so libkvm is
usable on all machines.
 1.15 13-Apr-1995  pk 3-level MMU changes: software MMU data structures now display a VM model
consisting of `regions', `segments' and `page maps'.
 1.14 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.13 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.12 10-Mar-1995  pk Prototype for pmap_pa_exists().
 1.11 10-Jan-1995  pk pmap_init() already declared elsewhere.
 1.10 09-Jan-1995  mycroft Validate /dev/mem addresses again.
 1.9 10-Dec-1994  pk Introduce pmap_prefer() which is used to obtain a cache-friendly virtual
address.
 1.8 20-Nov-1994  deraadt copyright/Id cleanup
 1.7 14-Nov-1994  deraadt fixed rss code by charles
 1.6 06-Aug-1994  deraadt maintain resident_count and wired_count
 1.5 10-Jun-1994  pk branches: 1.5.2;
Allocate pmap's segmap separately.
Keep some tags on segment boundaries to optimise ctx_alloc().
 1.4 24-May-1994  deraadt for newish vm
 1.3 01-Feb-1994  pk pmap_t typedef outside `#ifdef KERNEL', as it is brought into user
scope by <vm/vm_map.h>
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.1 17-Aug-1994  deraadt update from trunk
 1.22.4.1 12-Jun-1996  pk Pull down from trunk:
> No longer need to call mmu_pagein() through a pointer.
 1.29.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.36.4.3 02-Aug-1999  thorpej Update from trunk.
 1.36.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.36.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.36.2.1 02-Jul-1999  perry pullup 1.38->1.39 (pk)
 1.42.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.42.4.1 15-Nov-1999  fvdl Sync with -current
 1.42.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.42.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.42.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.42.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.46.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.49.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.49.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.57.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.57.2.4 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.57.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.57.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.57.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.58.4.7 15-Jan-2003  thorpej Sync with HEAD.
 1.58.4.6 29-Dec-2002  thorpej Sync with HEAD.
 1.58.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.58.4.4 01-Aug-2002  nathanw Catch up to -current.
 1.58.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.58.4.2 20-Nov-2001  pk Adjust prototypes for SA support.
 1.58.4.1 10-Sep-2001  pk file pmap.h was added on branch nathanw_sa on 2001-11-20 16:20:50 +0000
 1.59.8.1 21-Jul-2002  gehenna catch up with -current.
 1.68.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.68.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.68.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.68.2.1 03-Aug-2004  skrll Sync with HEAD
 1.70.2.2 24-Apr-2004  jdc Pull up revisions 1.72-1.73 (requested by pk in ticket #179)

Many fixes for issues with sparc multi-processor support (includes
fixes to make HyperSPARC MP work).
 1.70.2.1 08-Apr-2004  jdc Pull up revisions 1.71 (requested by pk in ticket #96)

Maintain pmap resident count as pages are mapped and unmapped instead
of traversing the page tables each time it's needed.
 1.73.4.1 29-Apr-2005  kent sync with -current
 1.75.8.3 21-Jan-2008  yamt sync with head
 1.75.8.2 03-Sep-2007  yamt sync with head.
 1.75.8.1 26-Feb-2007  yamt sync with head.
 1.76.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.76.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.79.10.1 03-Oct-2007  garbled Sync with HEAD
 1.79.2.1 20-Aug-2007  ad Sync with HEAD.
 1.80.10.2 09-Jan-2008  matt sync with HEAD
 1.80.10.1 06-Nov-2007  matt sync with HEAD
 1.81.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.81.4.1 01-Jan-2008  ad Locking changes for sparc.
 1.81.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.82.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.82.10.3 11-Mar-2010  yamt sync with head
 1.82.10.2 19-Aug-2009  yamt sync with head.
 1.82.10.1 04-May-2009  yamt sync with head.
 1.82.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.83.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.88.4.1 05-Mar-2011  rmind sync with head
 1.88.2.1 16-Nov-2010  uebayasi Sync with HEAD.
 1.89.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.89.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.90.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.90.14.1 25-Feb-2013  tls resync with head
 1.90.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.90.4.1 23-Jan-2013  yamt sync with head
 1.91.2.1 18-May-2014  rmind sync with head
 1.92.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.94.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.94.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.2 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.1 07-Aug-2002  briggs branches: 1.1.2; 1.1.4; 1.1.6; 1.1.202; 1.1.204;
Implement pmc(9) -- An interface to hardware performance monitoring
counters. These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.1.204.1 10-Jun-2019  christos Sync with HEAD
 1.1.202.1 28-Jul-2018  pgoyette Sync with HEAD
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 07-Aug-2002  jdolecek file pmc.h was added on branch kqueue on 2002-09-06 08:41:00 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 07-Aug-2002  gehenna file pmc.h was added on branch gehenna-devsw on 2002-08-31 14:52:18 +0000
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 07-Aug-2002  nathanw file pmc.h was added on branch nathanw_sa on 2002-08-13 02:18:54 +0000
 1.20 06-Dec-2020  christos don't expose register_t
 1.19 14-Jan-2011  rmind branches: 1.19.72;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.18 29-Jan-2010  mrg branches: 1.18.4;
make fpu_mtx visible only ifdef _KERNEL.
 1.17 26-Jan-2010  mrg convert fpulock into fpu_mtx.
 1.16 21-Nov-2009  rmind Include sys/proc.h for sparc/sparc64, which is required for now.
 1.15 11-Dec-2005  christos branches: 1.15.78;
merge ktrace-lwp.
 1.14 26-Oct-2005  uwe Move md_flags back to mdproc. MDP_FIXALIGN, the only flag we have, is
per-process, not per-lwp. We don't have per-lwp flags currently.
 1.13 10-Jul-2005  christos branches: 1.13.2;
- add syscall_{plain,fancy}
- make it use mi_userret
 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 18-Jan-2003  thorpej branches: 1.11.2;
Merge the nathanw_sa branch.
 1.10 12-Jan-2003  pk fpulock: encapsulate required IPL raise in the FPU LOCK/UNLOCK macros.
 1.9 06-Jan-2003  pk Protect FPU context switching with its own lock.
 1.8 03-Jan-2003  pk Finish FPU context switching on SMP systems.
 1.7 26-May-2000  thorpej branches: 1.7.12;
First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.6 26-Oct-1998  pk branches: 1.6.12;
Must protect user-land from cpuvar.h; noticed by Juergen Hannken-Illjes.
 1.5 21-Oct-1998  pk Pull in cpuvar.h to get definition of `curproc'.
 1.4 30-Sep-1998  pk Add a field to identify the processor that has a process' FPU context.
 1.3 26-Sep-1996  christos Add md_flags so that we can have a fix-misalign-accesses flag.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.6.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.12.4 15-Jan-2003  thorpej Sync with HEAD.
 1.7.12.3 06-Jan-2003  martin Catch up to -current.
 1.7.12.2 03-Jan-2003  thorpej Sync with HEAD (again).
 1.7.12.1 20-Nov-2001  pk Adjust prototypes for SA support.
 1.11.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.13.2.1 02-Nov-2005  yamt sync with head.
 1.15.78.1 11-Mar-2010  yamt sync with head
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.19.72.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.17 31-May-2017  martin Fix __PIC__ profiled binaries
 1.16 12-Sep-2013  joerg branches: 1.16.6;
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.15 24-Dec-2005  perry branches: 1.15.112; 1.15.122; 1.15.128;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 07-Aug-2003  agc branches: 1.13.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.12 20-Jul-2002  mrg branches: 1.12.6;
sync these with the sparc64 versions.
 1.11 03-Nov-2001  thorpej branches: 1.11.8;
Changes from Martin Husemann and myself:
- Make the 32-bit SPARC profile support work with the GCC 2.95.3
SPARC ELF compiler, which uses a different name for mcount.
- Make the 64-bit SPARC profile support header look more like the 32-bit
SPARC header (no functional change -- 64-bit SPARC already used the
correct mcount name).
 1.10 07-Feb-1999  christos branches: 1.10.22; 1.10.24; 1.10.26;
s/ELF/__ELF__/
 1.9 01-Jul-1998  tv Strip extra underscore on _mcount on ELF.
 1.8 01-Feb-1997  mrg no need to delcare mcount here; fixes warnings(errors) when compiling a kernel with profiling.
 1.7 27-Dec-1996  pk asm => __asm__
 1.6 08-Apr-1996  pk Undo unintended change in previous commit: _mcount is static.
 1.5 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.4 14-Aug-1995  pk Make MCOUNT() PIC-safe.
 1.3 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.26.2 01-Aug-2002  nathanw Catch up to -current.
 1.10.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.10.24.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.10.22.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.8.1 31-Aug-2002  gehenna catch up with -current.
 1.12.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.6.1 03-Aug-2004  skrll Sync with HEAD
 1.13.16.1 21-Jun-2006  yamt sync with head.
 1.15.128.1 18-May-2014  rmind sync with head
 1.15.122.2 03-Dec-2017  jdolecek update from HEAD
 1.15.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.112.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.16.6.1 28-Aug-2017  skrll Sync with HEAD
 1.27 22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.26 10-May-2021  thorpej sparc{,64} promlib -> devhandle_t glue
 1.25 11-Sep-2017  palle branches: 1.25.20; 1.25.22;
sun4v: Update code to retrieve CPU clock frequency so it can handle (future?) CPU clock frequencies above the 32-bit limit. ok mrg@
 1.24 21-Jan-2010  martin branches: 1.24.22;
Split the part out of prom_getether() that deals with the local
firmware device node into a new function.
 1.23 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.22 04-Mar-2007  christos branches: 1.22.40; 1.22.42; 1.22.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 11-Dec-2005  christos branches: 1.21.26;
merge ktrace-lwp.
 1.20 31-May-2005  christos branches: 1.20.2;
- sprinkle const
- remove parameter names from function declarations
 1.19 22-Mar-2004  pk Leverage the PROM's ability to identify the on-board location of a
physical memory address.
 1.18 21-Mar-2004  pk Turn members of `struct memarr' into long ints, to help sparc64 integration.
 1.17 18-Mar-2004  pk Remove unused `search_prom()' macro.
 1.16 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.15 17-Mar-2004  pk De-__P();
 1.14 17-Mar-2004  pk prom_getprop(): Make the `element size' argument a size_t (like sparc64).
 1.13 16-Mar-2004  pk Encapsulate retrieval of properties from the global `options' prom node.
 1.12 15-Mar-2004  pk prom_getether() now takes a `node' argument in order to support the
"local-mac-address" property.
 1.11 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.10 25-Jun-2003  martin branches: 1.10.2;
#ifdef _KERNEL_OPT police
 1.9 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.8 26-Feb-2003  pk Move all `ID prom' stuff into the prom library.
 1.7 26-Feb-2003  pk Re-define `struct memarr' to have the same layout as the V2 ROM memory
property to avoid gratuitous copying in prom_makememarr().

Have prom_makememarr() accept a NULL pointer, in which case it will return
the size of the array needed to store the memory descriptors.
 1.6 18-Feb-2003  pk Move makememarr() into promlib.c.
 1.5 16-Jan-2003  pk Define a MP version of callrom().
 1.4 26-Sep-2001  eeh branches: 1.4.4;
getprop* -> PROM_getprop*
 1.3 15-Nov-2000  pk branches: 1.3.2; 1.3.4;
Adjust setprop() prototype to match the one in dev/ofw/openfirm.h
 1.2 03-May-1999  christos branches: 1.2.2;
move PROM_LOADADDR from promlib.h to param.h and remove its cast.
 1.1 14-Feb-1999  pk branches: 1.1.4;
Provide a uniform interface to most of the PROM functions.
Include an Openfirmware back-end (mostly copied from sparc64).
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 22-Nov-2000  bouyer Sync with HEAD.
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.4.2 17-Jan-2003  thorpej Sync with HEAD.
 1.4.4.1 26-Sep-2001  thorpej file promlib.h was added on branch nathanw_sa on 2003-01-17 16:23:26 +0000
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.2.1 03-Sep-2007  yamt sync with head.
 1.21.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.44.2 11-Mar-2010  yamt sync with head
 1.22.44.1 16-May-2008  yamt sync with head.
 1.22.42.1 18-May-2008  yamt sync with head.
 1.22.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.24.22.1 03-Dec-2017  jdolecek update from HEAD
 1.25.22.1 31-May-2021  cjep sync with head
 1.25.20.1 13-May-2021  thorpej Sync with HEAD.
 1.53 07-Apr-2024  rillig sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.
 1.52 11-Jul-2023  martin fix editor mishap in previous
 1.51 11-Jul-2023  martin Make ipl_cookie_t visible for _KMEMUSER userland applications.
 1.50 02-Nov-2021  ryo branches: 1.50.4;
In order to prevent _mcount() from being recursively called when built with COPTS=-O0,
sprinkle `__always_inline' to make _mcount() be generated as a single function.
 1.49 18-May-2016  nakayama Fix (unused) pstate mask bits in tstate and comment.
 1.48 28-Aug-2011  mrg branches: 1.48.12; 1.48.30;
apply some always_inline attribute to setpsr and spl*. while i am
not yet sure exactly why this is necessary, but does avoid crashes
seen on sparc INSTALL with gcc 4.5.
 1.47 16-Jul-2011  nakayama Bring some fixes and minor differences from sparc64 version.
 1.46 15-Jul-2011  riz BLOCK_SIZE->SPARC64_BLOCK_SIZE
BLOCK_ALIGN->SPARC64_BLOCK_ALIGN

XXX these values are unused in sparc; this is merely to keep the sparc
and sparc64 versions of psl.h in sync, and to allow sparc to build again.
 1.45 16-May-2009  martin Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.44 19-Feb-2007  mrg branches: 1.44.46; 1.44.56; 1.44.62;
remove a redundant variable from spl0().
 1.43 16-Feb-2007  ad branches: 1.43.2;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.42 26-Dec-2006  ad Define ipl_t as uint8_t so that it can be packed into a word with a lock
byte. Ok yamt@.
 1.41 21-Dec-2006  yamt merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.
 1.40 04-May-2006  yamt branches: 1.40.8; 1.40.10; 1.40.12; 1.40.18;
implement splraiseipl() for sparc.
reviewed by Martin Husemann.

while i'm here, use macros for some MD constants (eg. IPL_ZS)
as suggested by Havard Eidnes.
 1.39 16-Feb-2006  perry branches: 1.39.2; 1.39.4; 1.39.6;
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.38 24-Dec-2005  perry branches: 1.38.2; 1.38.4; 1.38.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.37 11-Dec-2005  christos merge ktrace-lwp.
 1.36 19-Jun-2005  thorpej branches: 1.36.2;
Remove some unused definitions.
 1.35 19-Jun-2005  thorpej - Do away with the old _SPLRAISE() template macro. Instead, provide an
splraise() inline function, and define the various spl routines in terms
of splraise().
- Use ANSI function decls.
 1.34 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.33 16-Jun-2003  thorpej branches: 1.33.2;
Rename IPL_IMP -> IPL_VM.
 1.32 14-Jan-2003  pk Define spllowerschedclock().
To be used in the same spirit as spllowersoftclock().
 1.31 31-Dec-2002  pk Define IPL_SCHED at level 11 and make splsched() use it.
 1.30 06-Dec-2002  pk Start using IPL_* constants from intr.h; phase out PIL_* in psl.h
 1.29 08-Jun-2001  uwe branches: 1.29.8; 1.29.12;
Oops, missed in the previous commit: bump PIL_SER to 13 as well.
It seems to be unused...
 1.28 06-Jun-2001  uwe Bump splserial to 13 to support com port on Tadpole and JavaStations.
While I'm here - remove redefinition of PIL_TTY, move splnet
definition to keep the list sorted and sync its comment with reality.
 1.27 23-Apr-2001  pk Bump PIL_NET to 7; some sbus network boards use this interrupt level.
Nuke PIL_IMP.
 1.26 13-Apr-2001  thorpej Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.25 22-Mar-2001  mrg sync with sparc64.
 1.24 14-Jan-2001  thorpej branches: 1.24.2;
Make sure everybody has an splvm() and equate it with splimp() (splimp()
is the historical name for this interrupt level, and the historical name
is going to go away in the near future).
 1.23 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.22 21-Aug-2000  thorpej Make sure we provide splsched() as described in spl(9).
 1.21 09-Jun-2000  pk spl0() and spllowersoftclock() return void.
 1.20 21-Jan-2000  pk branches: 1.20.2;
Move several PIL_* definitions into the scope of LOCORE stuff.
 1.19 15-Dec-1999  garbled Add new spl level for tadpole devices splts102.
Device entrypoints for tctrl device (tadpole micro controller)
add header for direct-access ioctl to the tadpole microcontroller.
 1.18 05-Aug-1999  thorpej branches: 1.18.2; 1.18.8;
Change spl calls to always raise priority, except for the ones which are
specifically supposed to lower it.
 1.17 05-Aug-1999  thorpej Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

This fixes a problem with using the "rnd" pseudo-device from within
interrupt context to extract random data (e.g. from within the softnet
interrupt) where doing so would incorrectly unblock interrupts (causing
all sorts of lossage).

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.16 26-Nov-1998  pk Add splserial().
 1.15 06-Feb-1998  mrg backout previous change.
 1.14 06-Feb-1998  mrg put PIL_CLOCK and splclock together, like the rest..
 1.13 19-Nov-1997  pk splpmap() is again equivalent to splimp().
 1.12 10-Mar-1997  pk branches: 1.12.8;
Add getmid
 1.11 31-Mar-1996  pk branches: 1.11.8;
Add a non-interrupt-priority-lowering version of SPL(). Used by splpmap()
at the moment.
 1.10 09-Feb-1996  christos A few prototype fixes
 1.9 03-Feb-1996  pk Move splbio to level 5.
 1.8 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.7 13-Aug-1995  mycroft Replace splnet() with splsoftnet(). Add splnet().
 1.6 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.5 23-Feb-1995  pk floppy levels.
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 22-Mar-1994  deraadt splimp >= (splnet or spltty)
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11.8.1 12-Mar-1997  is Merge in changes from The Trunk
 1.12.8.1 20-Nov-1997  mellon Pull rev 1.13 up from trunk (pk)
 1.18.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.18.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.18.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.18.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.20.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.24.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.24.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.29.12.1 18-Mar-2002  thorpej Add splraiseipl() for use by kern_mutex.c
 1.29.8.4 15-Jan-2003  thorpej Sync with HEAD.
 1.29.8.3 03-Jan-2003  thorpej Sync with HEAD.

XXX ALT_SWITCH_CODE is not yet LWP'ified.
 1.29.8.2 11-Dec-2002  thorpej Sync with HEAD.
 1.29.8.1 08-Jun-2001  thorpej file psl.h was added on branch nathanw_sa on 2002-12-11 06:12:08 +0000
 1.33.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.33.2.1 03-Aug-2004  skrll Sync with HEAD
 1.36.2.3 26-Feb-2007  yamt sync with head.
 1.36.2.2 30-Dec-2006  yamt sync with head.
 1.36.2.1 21-Jun-2006  yamt sync with head.
 1.38.6.2 01-Jun-2006  kardel Sync with head.
 1.38.6.1 22-Apr-2006  simonb Sync with head.
 1.38.4.1 09-Sep-2006  rpaulo sync with head
 1.38.2.1 18-Feb-2006  yamt sync with head.
 1.39.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.39.4.1 11-May-2006  elad sync with head
 1.39.2.1 24-May-2006  yamt sync with head.
 1.40.18.1 18-May-2009  bouyer Pull up following revision(s) (requested by martin in ticket #1317):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.40.12.1 18-May-2009  bouyer Pull up following revision(s) (requested by martin in ticket #1317):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.40.10.1 19-Sep-2006  yamt implement new api for sparc.
 1.40.8.1 12-Jan-2007  ad Sync with head.
 1.43.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.44.62.1 18-May-2009  bouyer branches: 1.44.62.1.2;
Pull up following revision(s) (requested by martin in ticket #764):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.44.62.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.44.56.1 18-May-2009  bouyer Pull up following revision(s) (requested by martin in ticket #764):
sys/arch/sparc/include/psl.h: revision 1.45
Add memory clobbers to the inline assembler modifying/testing the %psr
register, to avoid the compiler reordering instructions out of critical
sections. Should fix PR port-sparc/41372.
 1.44.46.1 20-Jun-2009  yamt sync with head
 1.48.30.1 29-May-2016  skrll Sync with HEAD
 1.48.12.1 03-Dec-2017  jdolecek update from HEAD
 1.50.4.1 09-Aug-2023  martin Pull up following revision(s) (requested by maya in ticket #316):

sys/arch/m68k/include/mutex.h: revision 1.13
sys/arch/arm/include/cpu.h: revision 1.125
sys/arch/sun68k/include/intr.h: revision 1.21
sys/arch/arm/include/mutex.h: revision 1.28
sys/sys/rwlock.h: revision 1.18
sys/arch/powerpc/include/mutex.h: revision 1.7
sys/arch/arm/include/mutex.h: revision 1.29
sys/arch/powerpc/include/mutex.h: revision 1.8
sys/uvm/uvm_param.h: revision 1.42
sys/sys/ksem.h: revision 1.16
sys/arch/x86/include/mutex.h: revision 1.10
sys/sys/proc.h: revision 1.372
sys/sys/ksem.h: revision 1.17
sys/arch/ia64/include/mutex.h: revision 1.8
sys/arch/evbarm/include/intr.h: revision 1.29
sys/sys/lua.h: revision 1.9
sys/arch/next68k/include/intr.h: revision 1.23
sys/arch/ia64/include/mutex.h: revision 1.9
sys/arch/hp300/include/intr.h: revision 1.35
sys/arch/hp300/include/intr.h: revision 1.36
sys/arch/sparc/include/cpu.h: revision 1.111
sys/arch/hppa/include/mutex.h: revision 1.16
sys/arch/vax/include/intr.h: revision 1.31
sys/arch/hppa/include/mutex.h: revision 1.17
sys/arch/news68k/include/intr.h: revision 1.28
sys/arch/hppa/include/mutex.h: revision 1.18
sys/arch/hppa/include/intr.h: revision 1.3
sys/arch/hppa/include/mutex.h: revision 1.19
sys/arch/hppa/include/intr.h: revision 1.4
sys/sys/sched.h: revision 1.92
sys/opencrypto/cryptodev.h: revision 1.51
sys/arch/vax/include/mutex.h: revision 1.20
sys/arch/sparc64/include/mutex.h: revision 1.10
sys/arch/ia64/include/sapicvar.h: revision 1.2
sys/arch/riscv/include/mutex.h: revision 1.5
sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
sys/arch/riscv/include/mutex.h: revision 1.6
sys/ddb/files.ddb: revision 1.16
sys/arch/mac68k/include/intr.h: revision 1.32
share/man/man4/ddb.4: revision 1.203
sys/ddb/db_command.c: revision 1.183
sys/arch/mips/include/mutex.h: revision 1.10
sys/ddb/db_command.c: revision 1.184
sys/arch/x68k/include/intr.h: revision 1.22
sys/arch/sparc/include/psl.h: revision 1.51
sys/arch/or1k/include/mutex.h: revision 1.4
sys/arch/mips/include/mutex.h: revision 1.11
sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
sys/arch/sparc64/include/cpu.h: revision 1.134
sys/arch/sparc/include/psl.h: revision 1.52
sys/arch/or1k/include/mutex.h: revision 1.5
sys/arch/mvme68k/include/intr.h: revision 1.22
sys/arch/luna68k/include/intr.h: revision 1.16
external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
sys/arch/sparc/include/mutex.h: revision 1.12
sys/arch/sparc/include/mutex.h: revision 1.13
sys/arch/usermode/include/mutex.h: revision 1.5
sys/arch/usermode/include/mutex.h: revision 1.6
sys/kern/kern_core.c: revision 1.38
usr.sbin/crash/Makefile: revision 1.49
sys/arch/amiga/include/intr.h: revision 1.23
sys/arch/alpha/include/mutex.h: revision 1.12
sys/arch/alpha/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
sys/ddb/ddb.h: revision 1.6
sys/arch/sparc64/include/mutex.h: revision 1.8
sys/arch/sh3/include/mutex.h: revision 1.12
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
sys/ddb/db_syncobj.c: revision 1.1
sys/arch/vax/include/mutex.h: revision 1.18
sys/arch/sparc64/include/psl.h: revision 1.63
sys/arch/sparc64/include/mutex.h: revision 1.9
sys/arch/sh3/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/obio.c: revision 1.13
sys/arch/atari/include/intr.h: revision 1.23
sys/ddb/db_syncobj.c: revision 1.2
sys/arch/vax/include/mutex.h: revision 1.19
sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
sys/arch/cesfic/include/intr.h: revision 1.14
sys/ddb/db_syncobj.h: revision 1.1
sys/arch/x86/include/cpu.h: revision 1.134
sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
sys/arch/cesfic/include/intr.h: revision 1.15
sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
sys/sys/cpu_data.h: revision 1.54
sys/arch/m68k/include/mutex.h: revision 1.12
sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes. Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h. avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h. And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.
 1.33 29-May-2022  andvar fix various typos in comments and log messages.
 1.32 01-Dec-2017  mrg - normalise some tab/space issues.
- fix (debugger-only useful) struct srmmu_pte::pg_pfnum to be the
right size.
- add SRMMU_TEPTERBO as a PTE type -- supersparc-II only feature
of mapping pages in reverse-byte-order (eg little endian by
default, but there's also a global RBO flag, that makes this
flag big-endian.) we don't use it (yet?)
 1.31 16-Feb-2006  perry branches: 1.31.116;
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.30 24-Dec-2005  perry branches: 1.30.2; 1.30.4; 1.30.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.29 11-Dec-2005  christos merge ktrace-lwp.
 1.28 17-Aug-2003  pk sun4/sun4c MMU: keep `wired' status per page, implemented by defining a bit
in the PTE word that is not used by the hardware. Use it to unlock a `pmeg'
if the wired count in a segment drops to zero.
 1.27 09-Aug-2003  pk Simplify the definitions of VA_VPG() and VA_OFF().
 1.26 16-Dec-2002  pk branches: 1.26.6;
Multiple inclusion protection.
 1.25 18-Jul-2002  thorpej Add checks for Sun4d. Use CPU_HAS_SRMMU as appropriate.
 1.24 04-Dec-2001  darrenr branches: 1.24.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.23 01-May-2001  kleink branches: 1.23.2; 1.23.8;
Re-add accidently removed line continuation in previous; noted by
"Valeriy E. Ushakow" <uwe@ptc.spbu.ru>.
 1.22 30-Apr-2001  kleink Don't let [gs]etcontext() and friends clash with userland.
 1.21 08-Oct-1998  pk branches: 1.21.24;
Move [gs]etcontext() and [gs]etpte() to pte.h
 1.20 12-Sep-1998  pk Define some bit-format strings.
 1.19 05-Aug-1997  pk Correct typo that has been lurking undetected for some time.
 1.18 15-May-1997  pk branches: 1.18.4;
Nuke old `mmu3l' references.
 1.17 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.16 15-May-1996  mrg remove some RCS id's we don't need.
 1.15 31-Mar-1996  pk Add SRMMU/sun4m definitions.
Cleanup (i.e. mostly delete) `#if defined (SUN4*)' in here.
 1.14 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.13 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.12 05-Jul-1995  pk typos.
 1.11 25-Jun-1995  pk Define IO-cache bit for sun 4/400 machines.
 1.10 25-Jun-1995  pk add a couple more sun4m bits.
 1.9 08-May-1995  pk #define VA_INHOLE() - to test a VA for being in an MMU hole
(and PG_VSHIFT should 29).
 1.8 13-Apr-1995  pk 3-level MMU changes: software MMU data structures now display a VM model
consisting of `regions', `segments' and `page maps'.
 1.7 20-Nov-1994  deraadt copyright/Id cleanup
 1.6 03-Nov-1994  deraadt bzzzttt wrong wrong wrong
 1.5 02-Nov-1994  deraadt VA_VSEG() should use NBPG
 1.4 26-Oct-1994  deraadt rearrangement
 1.3 25-Sep-1994  deraadt make pmeg_t always a u_short
 1.2 20-Aug-1994  deraadt regarding NBPG, PGOFSET, PGSHIFT, NPTESG, VA_VPG:
these are simple macros unless you build a combined sun4+(sun4c,sun4m)
kernel -- then they point to variables which are initialized early on.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.18.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.24.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.8.4 19-Dec-2002  thorpej Sync with HEAD.
 1.23.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.23.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.8.1 01-May-2001  nathanw file pte.h was added on branch nathanw_sa on 2002-01-08 00:27:40 +0000
 1.23.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.8.1 21-Jul-2002  gehenna catch up with -current.
 1.26.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.6.1 03-Aug-2004  skrll Sync with HEAD
 1.30.6.1 22-Apr-2006  simonb Sync with head.
 1.30.4.1 09-Sep-2006  rpaulo sync with head
 1.30.2.1 18-Feb-2006  yamt sync with head.
 1.31.116.1 03-Dec-2017  jdolecek update from HEAD
 1.16 14-Sep-2020  kamil Switch from register_t to unsigned long int

Removes dependency on _KERNTYPES.
 1.15 24-Dec-2019  kamil Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.
 1.14 18-Jun-2019  kamil Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer

The macro is dummy for ia64 (the FP register is unknown and can change
freely) and sparc/sparc64 (not stored in struct reg).
 1.13 17-Apr-2019  martin Make the illegal instruction macro safe, so the compiler does not fear it
would be an illegal instruction when compiling with certain cpu options.
 1.12 16-Apr-2019  martin Add PTRACE_ILLEGAL_ASM
 1.11 12-Apr-2017  kamil branches: 1.11.12;
Add new macro PTRACE_BREAKPOINT_ASM in <sys/ptrace.h> MD part

This macro ships with a MD-specific assembly instruction triggering
a software breakpoint.

Missing instruction for powerpc targets.

This code is used in ATF tests (lib/libc/sys/t_ptrace_wait).

Original patch by Nick Hudson, thanks!
 1.10 25-Nov-2016  christos branches: 1.10.2;
cast to register_t because not all 'struct reg' members are the right type.
 1.9 25-Sep-2015  christos branches: 1.9.2;
For processors that have memory breakpoints, add macros for them to help
libproc
 1.8 15-Sep-2015  christos Provide access to pc/sp/syscall-return registers like we have for mcontext
 1.7 25-Jan-2008  skrll branches: 1.7.54; 1.7.74;
Define PT_MACHDEP_STRINGS
 1.6 11-Dec-2005  christos branches: 1.6.50; 1.6.56;
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 20-Nov-1994  deraadt branches: 1.4.66;
copyright/Id cleanup
 1.3 11-Feb-1994  pk [GS]ETREG definitions for ptrace
 1.2 01-Feb-1994  deraadt sparc runs in current today
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.66.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.1 04-Feb-2008  yamt sync with head.
 1.6.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.50.1 23-Mar-2008  matt sync with HEAD
 1.7.74.4 28-Aug-2017  skrll Sync with HEAD
 1.7.74.3 05-Dec-2016  skrll Sync with HEAD
 1.7.74.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.7.74.1 22-Sep-2015  skrll Sync with HEAD
 1.7.54.1 03-Dec-2017  jdolecek update from HEAD
 1.9.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.9.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.10.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.11.12.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.11.12.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.12.1 10-Jun-2019  christos Sync with HEAD
 1.11 15-Jan-2018  martin Redo previous: apply the alignement to the whole struct fpstate - everything
in there is properly aligned, and we need to have fs_queue double aligned
as well.
 1.10 14-Jan-2018  martin Force explicit alignment for fpstate in the kernel, to match what our
asm code assumes.
We use a stack variable at least once (in fpu_init).
 1.9 30-Dec-2016  christos - allocate state if we did not have any in fpregs
- make fpstate explicitly start with fpregs for better type checking
- use c11 initializers
 1.8 11-Dec-2005  christos branches: 1.8.122; 1.8.142; 1.8.146;
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 19-Jun-2001  wiz branches: 1.6.8; 1.6.24;
`accessible' only has one `a'.
 1.5 30-Dec-1999  pk branches: 1.5.6;
Remove private kernel members from `struct fpreg'; update accompanying comment.
 1.4 20-Nov-1994  deraadt branches: 1.4.32;
copyright/Id cleanup
 1.3 11-Feb-1994  pk [GS]ETREG definitions for ptrace
 1.2 01-Feb-1994  deraadt sparc runs in current today
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.32.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 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.6.8.2 19-Jun-2001  wiz `accessible' only has one `a'.
 1.6.8.1 19-Jun-2001  wiz file reg.h was added on branch nathanw_sa on 2001-06-19 12:59:16 +0000
 1.8.146.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.8.142.1 05-Feb-2017  skrll Sync with HEAD
 1.8.122.1 03-Dec-2017  jdolecek update from HEAD
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 05-Jan-2005  skrll Correct two reloc numbers/names
 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 25-Aug-2001  mrg branches: 1.4.6; 1.4.22;
update a comment about R_UA_32 relocs.
 1.3 04-Dec-2000  mrg branches: 1.3.4;
sync relocs with sparc64.
 1.2 20-Nov-1994  deraadt branches: 1.2.32;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.32.1 08-Dec-2000  bouyer Sync with HEAD.
 1.3.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.4.22.4 17-Jan-2005  skrll Sync with HEAD.
 1.4.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.22.1 03-Aug-2004  skrll Sync with HEAD
 1.4.6.2 25-Aug-2001  mrg update a comment about R_UA_32 relocs.
 1.4.6.1 25-Aug-2001  mrg file reloc.h was added on branch nathanw_sa on 2001-08-25 15:03:20 +0000
 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 20-Nov-1994  deraadt branches: 1.2.66;
copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 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.6 29-Nov-2019  riastradh Largely eliminate the MD rwlock.h header file.

This was full of definitions that have been obsolete for over a
decade. The file still remains for __HAVE_RW_STUBS but that's all.
Used only internally in kern_rwlock.c now, not by <sys/rwlock.h>.
 1.5 28-Apr-2008  martin branches: 1.5.88;
Remove clause 3 and 4 from TNF licenses
 1.4 14-Feb-2008  ad branches: 1.4.6; 1.4.8; 1.4.10;
Make sparc use atomic_cas_ulong() for mutex and rwlock operations, and
disable the custom mutex/rwlock code. PR port-sparc/37930. ok martin@
 1.3 21-Nov-2007  yamt make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.2 09-Feb-2007  ad branches: 1.2.4; 1.2.8; 1.2.24; 1.2.26; 1.2.30; 1.2.32;
Merge newlock2 to head.
 1.1 11-Jan-2007  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 11-Jan-2007  ad Checkpoint work in progress.
 1.2.32.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.32.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.30.1 21-Nov-2007  bouyer Sync with HEAD
 1.2.26.2 23-Mar-2008  matt sync with HEAD
 1.2.26.1 09-Jan-2008  matt sync with HEAD
 1.2.24.1 21-Nov-2007  joerg Sync with HEAD.
 1.2.8.1 03-Dec-2007  ad Sync with HEAD.
 1.2.4.4 27-Feb-2008  yamt sync with head.
 1.2.4.3 07-Dec-2007  yamt sync with head
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file rwlock.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:17 +0000
 1.4.10.1 16-May-2008  yamt sync with head.
 1.4.8.1 18-May-2008  yamt sync with head.
 1.4.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 18-Mar-2002  thorpej branches: 1.1.2;
file rwlock_impl.h was initially added on branch newlock.
 1.1.2.2 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.1 18-Mar-2002  thorpej First cut at mutex and rwlock implementation for SPARC.
 1.3 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.2 01-Oct-1998  thorpej branches: 1.2.26; 1.2.30; 1.2.38;
Need 14 longs for jmp_buf now (sigcontext has 128-bit signal mask at the
end).
 1.1 20-Dec-1994  cgd make the definition of _JBLEN mach. dep. header-dependent.
 1.2.38.1 31-Aug-2002  gehenna catch up with -current.
 1.2.30.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.26.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.26 28-Oct-2021  thorpej Making "struct sigcontext" visible only to _LIBC || _KERNEL is too
restrictive for sparc (it's accessed by libasan).
 1.25 27-Oct-2021  thorpej Make sigcontext13 visible only to _KERNEL. Make sigcontext visible only
to _LIBC and _KERNEL.
 1.24 26-Oct-2021  christos Merge all MD __sigaction14_sigtramp.c copies into one:
- sparc and sparc64 were not using version 0 sigcontext when there were
no arguments in the signal version. This was probably a bug.
- vax is using +1 the version numbers of the other archs.
- Only hppa was defining __LIBC12_SOURCE__ so it was getting a working
sigcontext before. all the other ports that supported sigcontext had
the compat code disabled.
[pointed out by thorpej, thanks!]
If we want to remove sigcontext support from userland at least now there
is less work to do so.
 1.23 29-Nov-2017  christos include <sys/sigtypes.h> for sigset_t
 1.22 19-Nov-2008  ad branches: 1.22.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.21 11-Dec-2005  christos branches: 1.21.74; 1.21.78; 1.21.84; 1.21.86;
merge ktrace-lwp.
 1.20 10-May-2004  drochner SIGTRAMP_VALID() should not pollute the user namespace
 1.19 26-Mar-2004  drochner nothing cares about __HAVE_SIGINFO anymore, so nuke it
 1.18 19-Jan-2004  martin How stupid can you borke a commit? I could *swear* I had tested the last
revision before commiting - but you ain't going to believe me anyway.
 1.17 18-Jan-2004  martin Only compare the trampoline version in SIGTRAMP_VALID as an unsigned value.
From Christos Zoulas.
 1.16 25-Nov-2003  christos bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
 1.15 26-Oct-2003  christos Sparc64 builds with __HAVE_SIGINFO
 1.14 11-Oct-2003  pk Define SIGTRAMP_VALID.
 1.13 05-Oct-2003  pk sparc kernel support for SA_SIGINFO.
 1.12 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.11 28-Apr-2003  bjh21 branches: 1.11.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.10 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9 09-Jan-2003  thorpej Merge sparc and sparc64 <machine/signal.h>.
 1.8 27-Nov-1999  mrg branches: 1.8.12;
more sparc64 merging; these files are (basically) identical.
 1.7 17-Sep-1998  thorpej branches: 1.7.12; 1.7.18;
Minor cosmetic change.
 1.6 13-Sep-1998  pk New sigcontext.
 1.5 25-May-1998  kleink If any of _ANSI_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE are defined, don't
provide any identifiers other than sig_atomic_t.
 1.4 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.3 10-Jan-1995  jtc Only define sig_atomic_t when _ANSI_SOURCE is defined.
 1.2 20-Nov-1994  deraadt copyright/Id cleanup
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.7.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.12.3 16-Jan-2003  martin Fix typo.
 1.8.12.2 16-Jan-2003  thorpej * Include <sys/sigtypes.h> rather than <sys/signal.h> in <sys/ucontext.h>.
* Define _UCONTEXT_TO_SIGCONTEXT() and _SIGCONTEXT_TO_UCONTEXT()
macros for converting a ucontext -> sigcontext and back again.
These macros in turn use machine-dependent macros _MCONTEXT_TO_SIGCONTEXT()
and _SIGCONTEXT_TO_MCONTEXT() provided by <machine/signal.h>.

The conversion process is not 100% accurate, but should be close enough.

Also note that the mcontext conversion may not be enough for all platforms
(m68k is a good example of this). These macros should be used only if
you really know what you're doing.
 1.8.12.1 09-Jan-2003  thorpej Sync with HEAD.
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.21.78.1 04-May-2009  yamt sync with head.
 1.21.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.22.26.1 03-Dec-2017  jdolecek update from HEAD
 1.2 30-May-2016  nakayama Adapt to new sljit.
 1.1 23-Jul-2014  alnsn branches: 1.1.2; 1.1.6; 1.1.8;
Rename sljitarch.h to sljit_machdep.h.
 1.1.8.1 09-Jul-2016  skrll Sync with HEAD
 1.1.6.3 03-Dec-2017  jdolecek update from HEAD
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 23-Jul-2014  tls file sljit_machdep.h was added on branch tls-maxphys on 2014-08-20 00:03:24 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 23-Jul-2014  tls file sljit_machdep.h was added on branch tls-earlyentropy on 2014-08-10 06:54:08 +0000
 1.4 23-Jul-2014  alnsn Rename sljitarch.h to sljit_machdep.h.
 1.3 22-Jul-2014  alnsn Cast to sparc_cache_flush() argument types. This change makes it clear
thatr sparc_cache_flush() is defined by sljit (unlike other ports).
 1.2 17-Nov-2013  alnsn branches: 1.2.2;
Always define SLJIT_CACHE_FLUSH(), start include guards with '_' and use _LP64 guard.
 1.1 05-Nov-2012  alnsn branches: 1.1.2; 1.1.4; 1.1.6;
Add sljitarch.h on sparc.
 1.1.6.1 18-May-2014  rmind sync with head
 1.1.4.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.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.1.4.1 05-Nov-2012  yamt file sljitarch.h was added on branch yamt-pagecache on 2013-01-16 05:33:04 +0000
 1.1.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.2.2 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.1.2.1 05-Nov-2012  tls file sljitarch.h was added on branch tls-maxphys on 2012-11-20 03:01:43 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.24 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.23 11-Dec-2005  christos merge ktrace-lwp.
 1.22 20-Apr-2005  matt For GCC3 and later, use the __builtin_va* constructs.
 1.21 30-Dec-2004  christos branches: 1.21.2; 1.21.8; 1.21.10;
- don't try to to lint the va_arg() macros, instead replace them.
- replace the va_start() macro for lint
 1.20 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.19 28-Apr-2003  bjh21 branches: 1.19.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.18 20-Jul-2002  mrg sync these with the sparc64 versions.
 1.17 13-Oct-2000  christos branches: 1.17.4; 1.17.8; 1.17.16;
void cast for lint.
 1.16 03-Feb-2000  kleink Add a C99-style va_copy macro.
 1.15 04-May-1999  christos branches: 1.15.2;
clean up old GCC.1 stuff.
 1.14 03-May-1999  christos Define __extension__ if __GNUC__ < 2
Define __builtin_* for lint.
 1.13 20-Feb-1999  kristerw branches: 1.13.4;
The recent simplification of the lint version of the va_arg macro broke
linting of vfprintf.c, where va_arg is used as
*va_arg(ap, quad_t *) = ret;
Make the macro slightly more complicated...
 1.12 13-Feb-1999  christos Avoid defining __extension__ if we don't need to. Breaks lint.
 1.11 27-Jul-1998  mycroft Delint.
 1.10 27-Dec-1996  pk branches: 1.10.14;
Annul `__builtin_classify_type' and `__extension__' if __lint__.
 1.9 29-Dec-1995  mycroft Make this work for GCC < 2.6.
 1.8 25-Dec-1995  mycroft Stylistic changes.
 1.7 25-Dec-1995  mycroft Update for GCC 2.7, and fix bugs.
 1.6 28-Jan-1995  jtc ANSI says that <stdarg.h>'s va_end macro must expand to a void expression.
For consistancy, I'm changing <varargs.h> too.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.3 25-May-1994  pk sync with 4.4-lite
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.14.1 01-Feb-1999  cgd pull up rev 1.11 from trunk (PR#6862). (mycroft)
 1.13.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.16.1 31-Aug-2002  gehenna catch up with -current.
 1.17.8.1 01-Aug-2002  nathanw Catch up to -current.
 1.17.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.10.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.21.8.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.21.2.1 29-Apr-2005  kent sync with -current
 1.8 20-Jun-1998  mrg moved to <dev/sun/disklabel.h>
 1.7 29-Jun-1996  pk Put native NetBSD disk label in a piece of wasteland within a SunOS label.
 1.6 07-Jan-1996  thorpej New generic disk framework. Highlights:

- New metrics handling. Metrics are now kept in the new
`struct disk'. Busy time is now stored as a timeval, and
transfer count in bytes.

- Storage for disklabels is now dynamically allocated, so that
the size of the disk structure is not machine-dependent.

- Several new functions for attaching and detaching disks, and
handling metrics calculation.

Old-style instrumentation is still supported in drivers that did it before.
However, old-style instrumentation is being deprecated, and will go away
once the userland utilities are updated for the new framework.

For usage and architectural details, see the forthcoming disk(9) manual
page.
 1.5 26-Jun-1995  pk sl_xxx2 -> sl_pcylinder, for Chucks new xd driver.
 1.4 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.3 20-Nov-1994  deraadt copyright/Id cleanup
 1.2 02-Nov-1994  deraadt ioctl u_long cmd
 1.1 17-Sep-1994  deraadt sunos disklabels are translated into netbsd disklabels.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76; 1.2.78; 1.2.80;
merge ktrace-lwp.
 1.1 11-Jul-2005  christos branches: 1.1.6;
new file
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file sunos_machdep.h was added on branch ktrace-lwp on 2005-11-10 13:58:56 +0000
 1.2.80.1 16-May-2008  yamt sync with head.
 1.2.78.1 18-May-2008  yamt sync with head.
 1.2.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file sunos_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:12 +0000
 1.14 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.13 28-Apr-2008  martin branches: 1.13.86; 1.13.88;
Remove clause 3 and 4 from TNF licenses
 1.12 04-Mar-2006  uwe branches: 1.12.68; 1.12.70; 1.12.72;
De-__P.
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.6;
merge ktrace-lwp.
 1.10 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.9 18-Jan-2003  thorpej branches: 1.9.2; 1.9.18;
Merge the nathanw_sa branch.
 1.8 21-Jan-1999  christos branches: 1.8.26;
Remove old prototypes (move to mi code), and add the xrs gunk!
 1.7 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.6 13-Sep-1998  pk Sync function prototypes; remove unsed variables.
 1.5 05-Sep-1998  christos Assign copyright to TNF.
 1.4 31-Mar-1996  pk Various cleanup; mostly trailing spaces/tabs.
 1.3 26-Mar-1996  christos Make fpu_regs a union of doubles and ints to get the alignment of the
machine dependent portion of the context correct. Thanks pk [1 of 2]!
 1.2 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.1 31-Mar-1995  christos First pass at the ucontext stuff.
 1.8.26.1 20-Nov-2001  pk Adjust prototypes for SA support.
 1.9.18.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.72.1 16-May-2008  yamt sync with head.
 1.12.70.1 18-May-2008  yamt sync with head.
 1.12.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.88.1 10-Jun-2019  christos Sync with HEAD
 1.13.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.5 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.4 28-Apr-2008  martin branches: 1.4.44; 1.4.64;
Remove clause 3 and 4 from TNF licenses
 1.3 04-Mar-2006  uwe branches: 1.3.68; 1.3.70; 1.3.72;
s/u_intN_t/uintN_t/
 1.2 14-Mar-2000  jdc branches: 1.2.6; 1.2.46; 1.2.60; 1.2.62;
Fix RCS ID.
Add port power management.
 1.1 15-Dec-1999  garbled branches: 1.1.2;
Add new spl level for tadpole devices splts102.
Device entrypoints for tctrl device (tadpole micro controller)
add header for direct-access ioctl to the tadpole microcontroller.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.62.1 22-Apr-2006  simonb Sync with head.
 1.2.60.1 09-Sep-2006  rpaulo sync with head
 1.2.46.1 21-Jun-2006  yamt sync with head.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 14-Mar-2000  bouyer file tctrl.h was added on branch thorpej_scsipi on 2000-11-20 20:25:40 +0000
 1.3.72.1 16-May-2008  yamt sync with head.
 1.3.70.1 18-May-2008  yamt sync with head.
 1.3.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.64.1 22-Sep-2015  skrll Sync with HEAD
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.20 24-Jan-2021  mrg avoid using 'extern <func|data>;' inside a .c file, but instead
use header files and ensure definitions are not duplicated or
are technically (if not in codegen) wrong.
 1.19 19-Dec-2018  maxv branches: 1.19.12;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.18 27-Mar-2011  martin branches: 1.18.54; 1.18.56;
On second thought do not use bit 13 as a flag for syscall numbers, userland
typically sets those from a 13bit signed integer immediate field in the
instruction, so would need to jump through hoops (ok, small hoops) to
avoid sign extension.
Use a combination of the existing syscall flags instead.
 1.17 23-Mar-2011  martin Add a syscall variant passing the return address in %g5 (we need %g7 for
pthread_self and %g2 is an application register, so we can not use those
anymore).
 1.16 11-Dec-2005  christos branches: 1.16.100; 1.16.106;
merge ktrace-lwp.
 1.15 26-Oct-2005  uwe Comment change: Clarify meaning of some user traps.
 1.14 15-Oct-2003  pk branches: 1.14.16; 1.14.18;
sun4m_access_fault: Treat text/data error traps as if they were text/data
exception traps, except that they're logged on the console.
 1.13 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.12 23-Dec-2002  pk branches: 1.12.2;
xcallintr() receive a `clockframe *' argument, not a `trapframe *'.
Setup a DDB context for paused CPUs by defining a soft trap (T_DBPAUSE)
which uses the generic trap handler code to get the trapframe constructed
and then calls on a debugger-defined `suspend' routine.
 1.11 20-Jan-1999  pk branches: 1.11.26;
Catch `Unimplemented Flush' traps.
 1.10 01-Dec-1996  pk trap 0x2a: divide by zero for hardware [su]div instruction.
 1.9 16-May-1996  abrown Copyright police (s/Harvard University/Harvard College/).
 1.8 15-May-1996  mrg remove some RCS id's we don't need.
 1.7 31-Mar-1996  pk Add SRMMU/sun4m support. Size and layout of `struct pmap' has changed.
 1.6 04-Jul-1995  christos Fix bug in the KGDB trap definition. Add svr4 software traps.
 1.5 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.4 20-Nov-1994  deraadt copyright/Id cleanup
 1.3 22-Mar-1994  deraadt move defn of trapvec to cpu.h
 1.2 10-Nov-1993  deraadt use p_emul flag to indicate OS emulation
handle syscalls at standard sun place, ie. trap#80 not #89
add SunOS OMAGIC support
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11.26.1 29-Dec-2002  thorpej Sync with HEAD.
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.18.1 02-Nov-2005  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.16.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.100.1 21-Apr-2011  rmind sync with head
 1.18.56.1 10-Jun-2019  christos Sync with HEAD
 1.18.54.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.19.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.73 20-Mar-2023  martin __HAVE_HASHLOCKED_ATOMICS needs to be visible to userland
 1.72 30-Jul-2022  riastradh sys/atomic.h: Fix atomic_store_* on sparcv7, sparcv8.

These did not cooperate with the hash-locked scheme of the other
atomic operations, with the effect that, for instance, a typical
naive spin lock based on atomic_*,

volatile unsigned locked = 0;
lock()
{
while (atomic_swap_uint(&locked, 1))
continue;
membar_acquire();
}
unlock()
{
membar_release();
atomic_store_relaxed(&locked, 0);
}

would fail to achieve mutual exclusion.

For this case, we need to use atomic_swap_* (or, for 8- or 16-bit
objects, atomic_cas_32 loops, since there is no atomic_swap_8 or
atomic_swap_16).

The new machine/types.h macro __HAVE_HASHLOCKED_ATOMICS says whether
these contortions are necessary.

Note that this _requires_ the use of atomic_store_*(p, v), not
regular stores *p = v, to work with the r/m/w atomic operations.
 1.71 23-Jan-2021  christos Document via __HAVE_BUS_SPACE_8 platforms that implement bus_space_*_8
 1.70 06-Dec-2020  christos undo previous; __register_t is already defined
 1.69 06-Dec-2020  christos don't expose register_t
 1.68 17-May-2020  martin branches: 1.68.2;
__HAVE_CPU_DATA_FIRST is still true for sparc64 (which shares this file)
 1.67 16-May-2020  ad PR port-sparc/55261: sparc still panics running ATF tests

Reinstate the cpu_info change and remove __HAVE_CPU_DATA_FIRST to fix
build failure.
 1.66 23-Jan-2016  christos expose the kernel types for standalone code.
 1.65 23-Jan-2016  christos Hide {p,v}{addr,size}_t and register_t (and a couple more types that
are machine-specific) from userland unless _KERNEL/_KMEMUSER and a
new _KERNTYPES variables is defined. The _KERNTYPES should be fixed
for many subsystems that should not be using it (rump)...
 1.64 06-Oct-2015  martin Do not use #ifdef SUN4U when testing for cpu features of post-v8 CPUs,
it is not good for SUN4V-only kernels. Instead use __sparc_v9__ (which
is also defined by the sparc compiler when called with cpu=ultrasparc).
ok: mrg@
 1.63 27-Aug-2015  pooka Fix PTHREAD_FOO_INITIALIZER for C++ by not using volatile in the relevant
pthread types in C++ builds, attempt 2.

The problem with attempt 1 was making assumptions of what the MD
__cpu_simple_lock_t (declared volatile) looks like. To get a same type
except non-volatile, we change the MD type to __cpu_simple_lock_nv_t
and typedef __cpu_simple_lock_t as a volatile __cpu_simple_lock_nv_t.
IMO, __cpu_simple_lock_t should not be volatile at all, but changing it
now is too risky.

Fixes at least Rumprun w/ gcc 5.1/5.2. Furthermore, the mpd application
(and possibly others) will no longer require NetBSD-specific patches.

Tested: build.sh for i386, Rumprun for x86_64 w/ gcc 5.2.

Based on the patch from Christos in lib/49989.
 1.62 02-Nov-2012  chs branches: 1.62.14;
Add RAS support for sparc.
 1.61 30-Jul-2011  martin branches: 1.61.2; 1.61.12;
Get rid of #ifdef __sparc__ in uvm code - as noted by cgd back 1996,
now that we have __HAVE_CPU_VMSPACE_EXEC/cpu_vmspace_exec().
 1.60 17-Jul-2011  dyoung Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.59 18-Jun-2011  nakayama Add fast softint(9) support for sparc64.

Reviewed on port-sparc64.
 1.58 12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.57 30-Mar-2011  martin branches: 1.57.2;
Enable TLS on sparc and sparc64
 1.56 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

Ports that support this feature provide __HAVE____LWP_GETPRIVATE_FAST in
machine/types.h and a corresponding __lwp_getprivate_fast in
machine/mcontext.h.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.55 26-Dec-2010  martin branches: 1.55.2; 1.55.4;
Move ci_data first in struct cpu_info
 1.54 26-Dec-2010  martin sparc64 currently does not have ci_data as first member in cpu_info!
 1.53 22-Dec-2010  christos Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.52 10-Jan-2010  martin branches: 1.52.4;
Better support for FC-AL controllers/boot disks:
- on FC-AL disks, use wwn instead of target index to match a particular drive
- use the new device_register_post_config() to match "sd" device against
the bootpath after they have gained their wwn device property
- supply firmwares notion of port and node wwn for FC controllers
as device properties (the builtin ones don't see to have a separate nvram)
 1.51 11-Dec-2009  matt Add PRIx{P,V}{ADDR,SIZE}, PRIu{P,V}SIZE, and PRIxREGISTER{,32,64} for all
(except where they will be added via merge). These should be used to print
{p,v}{addr,size}_t and register*_t as appropriate.
 1.50 20-Jan-2008  joerg branches: 1.50.10;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.49 29-Nov-2007  ad branches: 1.49.6;
__HAVE_ATOMIC64_OPS for SUN4U.
 1.48 17-Oct-2007  garbled branches: 1.48.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.47 14-Jul-2007  ad branches: 1.47.8; 1.47.10;
Generic soft interrupts are mandatory.
 1.46 09-Feb-2007  ad branches: 1.46.6; 1.46.14;
Merge newlock2 to head.
 1.45 03-Sep-2006  gdamore branches: 1.45.2;
Convert both sparc and sparc64 to MI todr.
 1.44 03-Sep-2006  bjh21 Nothing in the kernel now tests __HAVE_NWSCONS, so stop defining it everywhere.
 1.43 28-Jun-2006  martin Align the size and alignment of label_t (kernel jmp_buf equivalent)
with the use in setjmp/longjmp. Duh!
This makes DDB work again on sparc kernels compiled with gcc4.
 1.42 07-Jun-2006  kardel branches: 1.42.2;
convert to timecounters (from branch simonb-timecounters)
 1.41 24-Dec-2005  perry branches: 1.41.4; 1.41.6; 1.41.8; 1.41.14;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.40 11-Dec-2005  christos merge ktrace-lwp.
 1.39 10-Jul-2005  christos - add syscall_{plain,fancy}
- make it use mi_userret
 1.38 10-Feb-2004  bjh21 branches: 1.38.16;
__HAVE_NWSCONS seems to mean, "If this port uses pckbc(4), it also uses
sys/dev/pckbc/files.pckbc." This is true of sparc, so define __HAVE_NWSCONS,
and remove the code in pckbc_machdep_cnattach() that was conditional on its
not being defined and that is no longer needed (since with __HAVE_NWSCONS,
pckbc_cnattach() will call pckbd_cnattach() itself if necessary).
 1.37 18-Jan-2004  martin Do not export __HAVE_RAS to userland. Applications are supposed to try
rasctl() and detect failure with EOPNOTSUPP.
 1.36 06-Jan-2004  martin Implement restartable atomic sequences (RAS) for sparc64.
 1.35 26-Sep-2003  nathanw Move __cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED to machine/types.h
so that they can be used in a namespace-friendly way.
 1.34 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.33 06-Aug-2003  bsh add __GENERIC_SOFT_INTERRUPTS_ALL_LEVELS to machine/types.h for
following ports:

acorn26, amiga, hpcarm, sparc, sparc64

This was proposed by Martin Husemann at teck-kern@ in May to properly
test whether softintr can be established for all IPL, or only for
IPL_SOFT*. OKed by acorn26, hpcarm and sparc port masters.
 1.32 28-Apr-2003  bjh21 branches: 1.32.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.31 07-Dec-2002  pk Use MI versions of {set,rem}runqueue().
 1.30 07-Oct-2002  martin All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.29 22-Sep-2002  simonb Use "#define\t" instead of "#define ".
 1.28 22-Sep-2002  gmcgarry Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives.
 1.27 28-Feb-2002  simonb branches: 1.27.10;
Use "#define<tab>".
 1.26 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.25 27-Sep-2001  mrg branches: 1.25.4;
implement generic soft interrupts as described in softintr(9). convert
the network, clock & serial softint's to use them.
 1.24 12-May-2001  kleink branches: 1.24.2; 1.24.4;
Delint my previous change.
 1.23 28-Apr-2001  kleink * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.22 03-Jan-2001  takemura branches: 1.22.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.21 04-Dec-2000  mrg sync a comment with sparc64/include/types.h
 1.20 19-Mar-2000  pk Remove __BROKEN_CONFIG_UNIT_USAGE.
 1.19 05-Feb-2000  cgd add __BROKEN_CONFIG_UNIT_USAGE #define, becuase these ports do very
wrong things with device configuration data "cf_unit" information.
 1.18 01-Feb-2000  danw #define __HAVE_DEVICE_REGISTER on ports that have it, and check for
that, rather than a list of architecture defines, in config_attach
 1.17 30-Nov-1999  mrg oops; remove part of the previous that was not intended (yet).
 1.16 27-Nov-1999  mrg merge sparc64 types.h; these files are now identical.
 1.15 21-Aug-1998  pk branches: 1.15.12; 1.15.18;
Remove vm_offset_t & vm_size_t.
 1.14 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.13 14-Jun-1998  kleink branches: 1.13.2;
GC the unused `physadr' type, which was not able to hold a complete physical
address on 2 architectures anyhow. Also, move the definition of the `label_t'
type inside _KERNEL protection, since it is specific to the in-kernel
setjmp()/longjmp() implementations.
 1.12 05-Nov-1997  thorpej Mark uses of long long with /* LONGLONG */ for lint. From
Chris Demetriou <cgd@pa.dec.com>.
 1.11 10-Dec-1996  pk branches: 1.11.14;
Kill __BROKEN_INDIRECT_CONF.
 1.10 05-Dec-1996  cgd First step inn removing config_scan() and the hacks that gave devices
on indirect-config busses a (permanent) softc that they could share
between 'match' and 'attach' routines:

Define __BROKEN_INDIRECT_CONFIG so that old autoconfiguration
interfaces are used, until drivers are converted to use the new
interfaces (actually, converted back to use the _older_ interfaces)
which prohibit indirect configuration devices from receiving a softc
in their match routine that they can share with their attach routine.
 1.9 14-Mar-1996  pk Remove __FORK_BRAINDAMAGE.
 1.8 09-Dec-1995  mycroft Define __FORK_BRAINDAMAGE.
 1.7 05-Jul-1995  pk remove __BDEVSW_DUMP_OLD_TYPE
#include <sys/cdefs.h>.
 1.6 26-Jun-1995  cgd define __BDEVSW_DUMP_OLD_TYPE for ports where it's true. clean up
some m68k ports inclusion of common header.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 20-Oct-1994  cgd update for new syscall args description mechanism
 1.3 20-Jul-1994  cgd define __BIT_TYPES_DEFINED__ for compatibility with things like BIND and nvi
 1.2 24-May-1994  deraadt branches: 1.2.2;
liten
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.2.2.1 20-Jul-1994  cgd update from trunk.
 1.11.14.1 05-Nov-1997  thorpej Update from trunk: Mark usese of long long with /* LONGLONG */ for lint.
 1.13.2.2 12-Aug-1998  eeh Protect XOPEN and POSIX code from vm_offset_t, paddr_t, vaddr_t, vm_size_t, psize_t, and vsize_t.
 1.13.2.1 30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.15.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.12.3 05-Jan-2001  bouyer Sync with HEAD
 1.15.12.2 08-Dec-2000  bouyer Sync with HEAD.
 1.15.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.22.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.24.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.24.2.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.24.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.24.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.25.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.25.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.25.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.25.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.25.4.1 27-Sep-2001  nathanw file types.h was added on branch nathanw_sa on 2002-01-08 00:27:40 +0000
 1.27.10.1 07-Dec-2002  he Pull up revision 1.30 (requested by martin in ticket #907):
All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.32.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.32.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.32.2.1 03-Aug-2004  skrll Sync with HEAD
 1.38.16.6 21-Jan-2008  yamt sync with head
 1.38.16.5 07-Dec-2007  yamt sync with head
 1.38.16.4 03-Sep-2007  yamt sync with head.
 1.38.16.3 26-Feb-2007  yamt sync with head.
 1.38.16.2 30-Dec-2006  yamt sync with head.
 1.38.16.1 21-Jun-2006  yamt sync with head.
 1.41.14.1 19-Jun-2006  chap Sync with head.
 1.41.8.3 14-Sep-2006  yamt sync with head.
 1.41.8.2 11-Aug-2006  yamt sync with head
 1.41.8.1 26-Jun-2006  yamt sync with head.
 1.41.6.1 27-May-2006  kardel sparc has grown timecounter support
 1.41.4.1 09-Sep-2006  rpaulo sync with head
 1.42.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.45.2.1 29-Dec-2006  ad Checkpoint work in progress.
 1.46.14.1 03-Oct-2007  garbled Sync with HEAD
 1.46.6.2 03-Dec-2007  ad Sync with HEAD.
 1.46.6.1 15-Jul-2007  ad Sync with head.
 1.47.10.3 23-Mar-2008  matt sync with HEAD
 1.47.10.2 09-Jan-2008  matt sync with HEAD
 1.47.10.1 06-Nov-2007  matt sync with HEAD
 1.47.8.1 03-Dec-2007  joerg Sync with HEAD.
 1.48.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.48.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.49.6.1 23-Jan-2008  bouyer Sync with HEAD.
 1.50.10.1 11-Mar-2010  yamt sync with head
 1.52.4.4 21-Apr-2011  rmind sync with head
 1.52.4.3 05-Mar-2011  rmind sync with head
 1.52.4.2 24-Mar-2010  mrg only define __HAVE_MM_MD_READWRITE for !SUN4U builds.
 1.52.4.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.55.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.55.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.57.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.61.12.2 03-Dec-2017  jdolecek update from HEAD
 1.61.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.61.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.62.14.3 19-Mar-2016  skrll Sync with HEAD
 1.62.14.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.62.14.1 22-Sep-2015  skrll Sync with HEAD
 1.68.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.68.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.11 29-Nov-2019  ad PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().
 1.10 23-Nov-2019  ad Looks like sparc clears want_ast with interrupts enabled, so check+clear it
and call mi_userret() in a loop.
 1.9 21-Nov-2019  ad mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
 1.8 05-Nov-2007  ad branches: 1.8.108;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.7 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.6 17-May-2007  yamt branches: 1.6.8; 1.6.10; 1.6.14;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.5 09-Feb-2007  ad branches: 1.5.2; 1.5.6; 1.5.8; 1.5.14;
Merge newlock2 to head.
 1.4 16-Feb-2006  perry branches: 1.4.12; 1.4.16;
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.3 24-Dec-2005  perry branches: 1.3.2; 1.3.4; 1.3.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 10-Jul-2005  christos branches: 1.1.6;
- add syscall_{plain,fancy}
- make it use mi_userret
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 10-Jul-2005  skrll file userret.h was added on branch ktrace-lwp on 2005-11-10 13:58:56 +0000
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.4.16.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.4.16.1 12-Jan-2007  ad sparc MD changes.
 1.4.12.5 15-Nov-2007  yamt sync with head.
 1.4.12.4 03-Sep-2007  yamt sync with head.
 1.4.12.3 26-Feb-2007  yamt sync with head.
 1.4.12.2 21-Jun-2006  yamt sync with head.
 1.4.12.1 16-Feb-2006  yamt file userret.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:12 +0000
 1.5.14.1 22-May-2007  matt Update to HEAD.
 1.5.8.1 11-Jul-2007  mjf Sync with head.
 1.5.6.2 03-Dec-2007  ad Sync with HEAD.
 1.5.6.1 27-May-2007  ad Sync with head.
 1.5.2.1 28-Apr-2007  mrg port yamt-idlelwp to sparc. this does not work yet, but others have
asked that i commit this work-in-progress.

currently kernel threads end up running with PSR_S missing from %psr
and end up failing to dump a user corefile.
 1.6.14.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.10.1 06-Nov-2007  matt sync with HEAD
 1.6.8.1 06-Nov-2007  joerg Sync with HEAD.
 1.8.108.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.13 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.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 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.10 29-Dec-1995  mycroft branches: 1.10.64;
Make this work for GCC < 2.6.
 1.9 26-Dec-1995  mycroft Make the type of __builtin_va_list a long.
 1.8 26-Dec-1995  mycroft Use __builtin_va_alist.
 1.7 25-Dec-1995  mycroft Update for GCC 2.7, and fix bugs.
 1.6 20-Nov-1994  deraadt copyright/Id cleanup
 1.5 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.4 25-May-1994  pk sync with 4.4-lite
 1.3 27-Jan-1994  pk move varargs stuff to arch/<machine>/include.
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.10.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.64.1 03-Aug-2004  skrll Sync with HEAD
 1.48 29-Mar-2019  christos remove extra token
 1.47 29-Mar-2019  christos Go back to not always defining PAGE_{SIZE,SHIFT,MASK}
 1.46 29-Mar-2019  christos add more exceptions for standalone and modules
 1.45 28-Mar-2019  christos make rump work again..
 1.44 27-Mar-2019  christos provide the max page size for userland
 1.43 07-Jan-2013  chs branches: 1.43.38;
switch to __USE_TOPDOWN_VM.
 1.42 14-Nov-2010  uebayasi branches: 1.42.8; 1.42.18;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.41 06-Nov-2010  uebayasi Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.40 06-Mar-2009  joerg branches: 1.40.2; 1.40.4;
Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
 1.39 02-Jan-2008  ad branches: 1.39.10; 1.39.18; 1.39.24;
Merge vmlocking2 to head.
 1.38 07-Feb-2006  chs branches: 1.38.44; 1.38.50; 1.38.54; 1.38.58;
reduce MAXSSIZ to 32 MB, like most other ports. fixes PR 30918.
 1.37 11-Dec-2005  christos branches: 1.37.2; 1.37.4; 1.37.6;
merge ktrace-lwp.
 1.36 03-Apr-2004  pk branches: 1.36.10; 1.36.12;
Max data size -> 512MB; default stack size -> 8MB.
 1.35 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.34 09-Apr-2003  thorpej branches: 1.34.2;
Don't define PAGE_SIZE, etc. in terms of NBPG, rather use the same
logic as used by <machine/param.h> to define constant PAGE_SIZE if
possible.

Also define the minimum and maximum PAGE_SIZE that might appear in
any given configuration (4K and 8K, respectively).
 1.33 13-Feb-2003  pk Move the PV list header into the VM page vm_page_md structure.
Also, start using a spin lock to protect PV list operations.
 1.32 10-Dec-2002  thorpej Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
 1.31 03-Sep-2002  thorpej Increase the default stack limit to 2M (from 512K on sparc and 1M
on sparc64).
 1.30 15-Nov-2001  soren branches: 1.30.10;
MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.29 02-Jun-2001  chs branches: 1.29.2; 1.29.8;
remove bogus curly braces from a structure forward-declaration.
 1.28 01-May-2001  thorpej Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.27 29-Apr-2001  thorpej Add a VM_MDPAGE_MEMBERS macro that defines pmap-specific data for
each vm_page structure. Add a VM_MDPAGE_INIT() macro to init this
data when pages are initialized by UVM. These macros are mandatory,
but ports may #define them to nothing if they are not needed/used.

This deprecates struct pmap_physseg. As a transitional measure,
allow a port to #define PMAP_PHYSSEG so that it can continue to
use it until its pmap is converted to use VM_MDPAGE_MEMBERS.

Use all this stuff to eliminate a lot of extra work in the Alpha
pmap module (it's smaller and faster now). Changes to other pmap
modules will follow.
 1.26 27-Feb-2001  pk branches: 1.26.2;
* Make PAGE_SIZE et.al. constants, if possible.
* Add pvlist pointer to `struct pmap_physseg'
* Because of the above, add guard against multiple inclusions.
 1.25 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.24 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.23 26-Jan-2000  cjs Don't explode when we've got a lot of RAM. Limit our space for buffers
to 1/4 of the kernel VM map.
 1.22 04-Dec-1999  ragge CL* discarding.
 1.21 27-Nov-1999  mrg MNN has been standard for a Long Time.
 1.20 26-Apr-1999  thorpej branches: 1.20.2; 1.20.8;
Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.
 1.19 18-Apr-1999  mrg fix some comments.
 1.18 16-Jan-1999  chuck branches: 1.18.4;
MNN is no longer optional, remove dead code
 1.17 21-Aug-1998  pk Convert to [pv]addr_t & [pv]size_t.
 1.16 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.15 13-Jan-1998  pk Commit to MACHINE_NEW_NONCONFIG.
 1.14 08-Jan-1998  mrg add new version of non contiguous memory code, written by chuck cranor,
called "MACHINE_NEW_NONCONGIG". this is required for UVM, the new VM
system (also written by chuck) that is coming soon. adds new functions:
vm_page_physload() -- tell the VM system about an area of memory.
vm_physseg_find() -- returns index in vm_physmem array that this
address is in.
and several new versions of old functions/macros defined in vm_page.h.


this is the sparc portion.
 1.13 12-Jul-1997  perry update comment from 1981 on memory and disk prices -- pr-2754 from Curt Sampson
 1.12 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainilne.
 1.11 12-Nov-1996  pk branches: 1.11.4; 1.11.8;
Allow larger text (64MB) and data (256MB) segments.
On sun4/sun4c with a virtual address hole (starting at 512MB), this seems
like a reasonable compromise: about 196MB left for shared libs and sysv-style
shared memory segments.
On the sun4m the limits can easily be made larger: consider turning
MAXTSIZ and MAXDSIZ into tunable variables..
 1.10 14-Mar-1996  christos Add missing prototypes and fix the fp struct for svr4.
 1.9 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.8 11-Dec-1995  pk Prototype dvma helper functions `dvma_malloc()/dvma_free()'
 1.7 06-Dec-1995  pk DVMA space is described by the variables `dvma_start' and `dvma_end'.
Prototype dvma_map*() routines.
 1.6 05-Jul-1995  pk #define MACHINE_NONCONTIG here, so all vm_*.c files see it timely.
 1.5 20-Nov-1994  deraadt copyright/Id cleanup
 1.4 02-Oct-1994  deraadt sun4/300 support works
 1.3 18-Apr-1994  deraadt decl SHMMAXPGS
 1.2 11-Oct-1993  deraadt stdarg.h, varargs.h, psl.h, autoconf.h: posted patches from torek
cpu.h: cpu_adjstack() won't work well in the NetBSD execve - need a
different model, stub enablertclock() for now..
exec.h: a netbsd-type exec.h file (ie. empty)
param.h: add MID_MACHINE
pmap.h: delete kernel_pmap hack - it doesn't work for us, + two proto's
vmparam.h: VM_MIN_ADDRESS = 0!
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.11.8.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.11.4.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.18.4.2 04-Jul-1999  chs add UBC parameters.
 1.18.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.20.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.20.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.20.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.26.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.29.8.4 11-Dec-2002  thorpej Sync with HEAD.
 1.29.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.29.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.29.8.1 02-Jun-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:27:40 +0000
 1.29.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.29.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.10.1 30-Nov-2002  he Pull up revision 1.31 (requested by thorpej in ticket #763):
Increase the default stack limit to 2M (from 512K on sparc
and 1M on sparc64).
 1.34.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.34.2.1 03-Aug-2004  skrll Sync with HEAD
 1.36.12.2 21-Jan-2008  yamt sync with head
 1.36.12.1 21-Jun-2006  yamt sync with head.
 1.36.10.1 14-Feb-2006  tron Pull up following revision(s) (requested by chs in ticket #1165):
sys/arch/sparc/include/vmparam.h: revision 1.38
reduce MAXSSIZ to 32 MB, like most other ports. fixes PR 30918.
 1.37.6.1 22-Apr-2006  simonb Sync with head.
 1.37.4.1 09-Sep-2006  rpaulo sync with head
 1.37.2.1 18-Feb-2006  yamt sync with head.
 1.38.58.1 02-Jan-2008  bouyer Sync with HEAD
 1.38.54.1 01-Jan-2008  ad Locking changes for sparc.
 1.38.50.1 18-Feb-2008  mjf Sync with HEAD.
 1.38.44.1 09-Jan-2008  matt sync with HEAD
 1.39.24.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.18.1 28-Apr-2009  skrll Sync with HEAD.
 1.39.10.1 04-May-2009  yamt sync with head.
 1.40.4.1 05-Mar-2011  rmind sync with head
 1.40.2.4 16-Nov-2010  uebayasi Sync with HEAD.
 1.40.2.3 26-Apr-2010  uebayasi Remove the unfinished code to add a memory segment after uvm_page_init().
It doesn't even compile.

(In the future, we should allocate struct vm_page [] on the added memory
segment for NUMA's sake.)
 1.40.2.2 25-Feb-2010  uebayasi Use VM_PAGE_TO_MD(). Only compile tested.
 1.40.2.1 23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.42.18.1 25-Feb-2013  tls resync with head
 1.42.8.1 23-Jan-2013  yamt sync with head
 1.43.38.1 10-Jun-2019  christos Sync with HEAD
 1.3 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.2 20-Nov-1994  deraadt branches: 1.2.46; 1.2.50; 1.2.58;
copyright/Id cleanup
 1.1 21-Jul-1994  deraadt branches: 1.1.2;
make X11R5 compile easier
 1.1.2.2 21-Jul-1994  deraadt make X11R5 compile easier
 1.1.2.1 21-Jul-1994  deraadt file vuid_event.h was added on branch netbsd-1-0 on 1994-07-21 22:06:21 +0000
 1.2.58.1 31-Aug-2002  gehenna catch up with -current.
 1.2.50.1 27-Aug-2002  nathanw Catch up to -current.
 1.2.46.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.74; 1.2.76; 1.2.78;
merge ktrace-lwp.
 1.1 08-May-2004  kleink branches: 1.1.2;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 08-May-2004  skrll file wchar_limits.h was added on branch ktrace-lwp on 2004-08-03 10:40:56 +0000
 1.2.78.1 16-May-2008  yamt sync with head.
 1.2.76.1 18-May-2008  yamt sync with head.
 1.2.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.11 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.10 26-Jun-2010  tsutsui Forgot to commit this one that should have been done with zs.c rev 1.119:
> Establish interrupt handlers with proper softc per each zs device
> rather than sharing them among all zs devices and searching softc
> in handlers.
>
> The latter method is derived from ancient sun3 zs driver which tried
> to reduce overhead on autovectored interrupts, but nowadays such hack
> might cause recursive global locks on modern SMP capable framework.
>
> Fixes "5.99.30 sparc panic during startup" reported by Hauke Fath
> on tech-kern@:
> http://mail-index.NetBSD.org/tech-kern/2010/06/19/msg008374.html
> and also tested by Jochen Kunz on SS20 with both serial and kbd console.
>
> Ok'ed by mrg@ and dyoung@.

Noticed by martin@.
 1.9 29-Mar-2008  tsutsui branches: 1.9.4; 1.9.14; 1.9.24; 1.9.26;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.8 04-Mar-2006  uwe branches: 1.8.68;
De-__P.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6;
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 03-May-2003  wiz branches: 1.5.2;
DMA, not dma nor Dma.
 1.4 11-Mar-2002  chs override cn_trap() with zs_abort() so we can drop to the monitor
if there's no DDB. fixes PR 12547.
 1.3 19-Mar-2000  pk branches: 1.3.8; 1.3.12;
Add fields to hold PROM info to be used in console device matching.
 1.2 21-Mar-1998  pk branches: 1.2.14;
Add bus tags to softc.
 1.1 18-Oct-1997  gwr Use common zs code.
 1.2.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.12.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.8.1 16-Mar-2002  jdolecek Catch up with -current.
 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.16.1 21-Jun-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.8.68.1 03-Apr-2008  mjf Sync with HEAD.
 1.9.26.1 03-Jul-2010  rmind sync with head
 1.9.24.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.14.1 08-Mar-2011  riz Apply patches (requested by mrg in ticket #1564):
sys/arch/sparc/dev/zs.c: patch
sys/arch/sparc/include/cpu.h: patch
sys/arch/sparc/include/z8530var.h: patch
sys/arch/sparc/sparc/cpu.c: patch
sys/arch/sparc/sparc/cpuvar.h: patch
sys/arch/sparc/sparc/db_interface.c: patch
sys/arch/sparc/sparc/genassym.cf: patch
sys/arch/sparc/sparc/intr.c: patch
sys/arch/sparc/sparc/locore.s: patch
sys/arch/sparc/sparc/machdep.c: patch
sys/arch/sparc/sparc/timer.c: patch
sys/arch/sparc/sparc/timer_sun4m.c: patch
sys/arch/sparc/sparc/timervar.h: patch
sys/arch/sparc/sparc/trap.c: patch
sys/arch/sparc/sparc/vm_machdep.c: patch

- fix a panic in savefpstate. idea, and code suggestions from uwe
- convert xpmsg_lock to IPL_SCHED. the old spl/simple_lock code ran at
splsched(), and this significantly helps with stability under load when
running with multiple active CPUs
- in strayintr() don't print about stray zs inters in MP case
- fix a deadlock in xcall()
- consolidate the interrupt evcnt(9) into a full set of per-IPL per-CPU
soft/hard counters
- fix xcall() failure messages in some cases
- addd new ddb command "mach xcall"
- use schedintr() (not schedintr_4m()) on MP or single CPU configurations
- call hardclock() the same way on cpu0 in MP and !MP cases
- request the appropriate stack space for nmi_sun4m, in particular,
make sure we have space for %g2...%g5. now entering ddb via eg,
serial break no longer causes cpu1 to fault.
- give memfault_sun*() some entry points that both gdb and ddb will find.
from tsutsui:
- fix panic in interrupt handlers in zs
 1.9.4.1 11-Aug-2010  yamt sync with head.

RSS XML Feed