Home | History | Annotate | only in /src/sys/arch/sh3/include
History log of /src/sys/arch/sh3/include
RevisionDateAuthorComments
 1.32 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.31 04-Nov-2024  christos Undo previous lwp.h change.
 1.30 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.29 12-Jul-2018  maxv branches: 1.29.36;
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.28 02-Mar-2018  uwe branches: 1.28.2; 1.28.4;
Introduce sh3/sysarch.h and add SH3_SYNC_ICACHE
 1.27 25-Aug-2016  christos fenv.h for sh
 1.26 17-Jul-2011  dyoung branches: 1.26.12; 1.26.30;
Do not install bus.h.
 1.25 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.24 09-Feb-2007  ad Merge newlock2 to head.
 1.23 26-Jul-2006  drochner branches: 1.23.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.22 21-May-2006  uwe Nuke va-sh.h. stdarg.h and varargs.h now use __builtin_va_*.
 1.21 01-Feb-2006  dsl branches: 1.21.2; 1.21.4; 1.21.8; 1.21.10;
Need to install byte_swap.h and bswap.h needs to include sh3/byte_swap.h.
 1.20 11-Dec-2005  christos branches: 1.20.2; 1.20.4;
merge ktrace-lwp.
 1.19 08-May-2004  kleink branches: 1.19.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.18 18-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.16 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.15 10-May-2002  uch branches: 1.15.2; 1.15.6;
clean up disassembler code.
 1.14 09-May-2002  uch rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]
 1.13 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.12 07-Mar-2002  thorpej Remove some files that no longer exist.
 1.11 15-Apr-2001  kleink branches: 1.11.2;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.10 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.9 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.8 26-Jun-2000  kleink branches: 1.8.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 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 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.5 24-Feb-2000  msaitoh watchdog timer
 1.4 17-Jan-2000  kleink Add NAN constant glue for sh3.
 1.3 14-Jan-2000  msaitoh add cpgreg.h and pfcreg.h for "make includes"
 1.2 02-Jan-2000  msaitoh remove exec_coff.h
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.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.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.15.6.4 11-Dec-2002  thorpej Sync with HEAD.
 1.15.6.3 13-Aug-2002  nathanw Catch up to -current.
 1.15.6.2 20-Jun-2002  thorpej Machine-dependent kernel portion of {get,set}context(). From
Klaus Klein.
 1.15.6.1 10-May-2002  thorpej file Makefile was added on branch nathanw_sa on 2002-06-20 23:00:49 +0000
 1.15.2.1 31-Aug-2002  gehenna catch up with -current.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.12.3 26-Feb-2007  yamt sync with head.
 1.19.12.2 30-Dec-2006  yamt sync with head.
 1.19.12.1 21-Jun-2006  yamt sync with head.
 1.20.4.1 09-Sep-2006  rpaulo sync with head
 1.20.2.1 18-Feb-2006  yamt sync with head.
 1.21.10.1 19-Jun-2006  chap Sync with head.
 1.21.8.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.21.4.2 11-Aug-2006  yamt sync with head
 1.21.4.1 24-May-2006  yamt sync with head.
 1.21.2.1 01-Jun-2006  kardel Sync with head.
 1.23.4.1 01-Feb-2007  ad Get sh3 compiling.
 1.26.30.1 05-Oct-2016  skrll Sync with HEAD
 1.26.12.1 03-Dec-2017  jdolecek update from HEAD
 1.28.4.1 10-Jun-2019  christos Sync with HEAD
 1.28.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.29.36.1 02-Aug-2025  perseant Sync with HEAD
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 15-Oct-2003  uwe branches: 1.2.4;
Use 'CH' for channel select in the ADCSR bits format string for consistency.
 1.1 10-Oct-2003  uwe Register definitions for sh7709 analog->digital converter.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 15-Oct-2003  skrll file adcreg.h was added on branch ktrace-lwp on 2004-08-03 10:40:15 +0000
 1.17 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.16 17-Jun-2015  martin branches: 1.16.18;
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.15 17-Jul-2011  joerg branches: 1.15.12; 1.15.28; 1.15.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.14 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.13 11-Jan-2009  christos branches: 1.13.4; 1.13.6;
merge christos-time_t
 1.12 17-Oct-2007  garbled branches: 1.12.16; 1.12.18; 1.12.22; 1.12.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.11 03-Sep-2007  drochner clean up some definitions around rune_t which are not needed anymore
 1.10 04-Oct-2006  tnozaki branches: 1.10.8; 1.10.16; 1.10.22; 1.10.26; 1.10.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.9 15-May-2006  uwe branches: 1.9.8; 1.9.10;
Change _BSD_VA_LIST_ from "void *" to "__builtin_va_list" for newer
gcc versions and "char *" otherwise. This is what most other arches
use, modulo different __GNUC_PREREQ__.

This is in preparation for replacing stdarg.h and varargs.h with
versions based on __builtin_* instead of handwritten code that gcc
3.3.6 and up refuse to compile b/c of lhs casts.

Identical binary code produced.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.12;
merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 02-Mar-2003  tshiozak branches: 1.6.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.5 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.4 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.3 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.2 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.10;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.10.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.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.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.3 27-Oct-2007  yamt sync with head.
 1.7.16.2 30-Dec-2006  yamt sync with head.
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.8.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.8.1 24-May-2006  yamt sync with head.
 1.8.6.1 01-Jun-2006  kardel Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.9.10.1 22-Oct-2006  yamt sync with head
 1.9.8.1 18-Nov-2006  ad Sync with head.
 1.10.28.1 06-Nov-2007  matt sync with HEAD
 1.10.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.10.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.10.16.1 03-Oct-2007  garbled Sync with HEAD
 1.10.8.1 09-Oct-2007  ad Sync with head.
 1.12.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.22.2 11-Aug-2010  yamt sync with head.
 1.12.22.1 04-May-2009  yamt sync with head.
 1.12.18.3 04-Jan-2009  christos revert all but time_t
 1.12.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.12.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.12.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.13.6.1 30-May-2010  rmind sync with head
 1.13.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.15.30.1 22-Sep-2015  skrll Sync with HEAD
 1.15.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.15.12.1 03-Dec-2017  jdolecek update from HEAD
 1.16.18.1 10-Jun-2019  christos Sync with HEAD
 1.4 10-Dec-2002  thorpej Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.3 28-Apr-2002  uch branches: 1.3.6;
Use "#define<tab>", white space nits.
 1.2 17-Mar-2002  uch cosmetic changes, fix comments.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.6.2 11-Dec-2002  thorpej Sync with HEAD.
 1.3.6.1 28-Apr-2002  thorpej file aout_machdep.h was added on branch nathanw_sa on 2002-12-11 06:11:54 +0000
 1.32 08-May-2025  uwe sh3: asm.h - no ## at token boundaries

For the ## "if the result is not a valid preprocessing token, the
behavior is undefined", so you 1) don't need to 2) must not use it to
concatenate a token with a non-token, like .arg or arg()

The point is kinda moot, as traditionally asm with cpp uses traditional
cpp, not ANSI cpp (many assemblers use # for literals, which conflicts
with the ANSI CPP # stringization and requires awkward workarounds),
but don't set a bad example even if it never gets called out by the
compiler.
 1.31 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.30 04-Jan-2025  martin PR 58960: sh3/asm.h: Respect _NETBSD_REVISIONID.
 1.29 17-Apr-2020  joerg branches: 1.29.26;
Mark the .ident section as mergable string section to avoid redundant
entries.
 1.28 12-Sep-2013  joerg branches: 1.28.30; 1.28.40;
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.27 20-Dec-2010  joerg branches: 1.27.8; 1.27.18; 1.27.22;
Consistently use .gnu.warning with .pushsectio and .popsection on all
architectures instead of obsolete STABS frames for linker warnings.
 1.26 19-Sep-2008  uwe branches: 1.26.16;
Use pushsection/popsection for RCSID.
 1.25 20-Jan-2006  christos branches: 1.25.72; 1.25.76; 1.25.78; 1.25.82;
Add a STRONG_ALIAS macro
 1.24 06-Jan-2006  uwe Provide PIC_EPILOGUE_SLOT that is safe to use in delay slot.
 1.23 05-Jan-2006  uwe Introduce PIC_PROLOGUE_NOSAVE for functions that do non-local jumps
and don't need to save/restore r12. Shaves off two instructions.
 1.22 05-Jan-2006  uwe mova can only have r0 as destination, so PIC_PROLOGUE can not specify
an arbitrary temp register.
 1.21 05-Jan-2006  uwe Macros for .size directive.
 1.20 31-Dec-2005  uwe First cut at PIC macros.
 1.19 24-Dec-2005  uwe branches: 1.19.2;
Implement WARN_REFERENCES.
 1.18 24-Dec-2005  uwe Prettify.
 1.17 11-Dec-2005  christos merge ktrace-lwp.
 1.16 24-Nov-2003  uwe branches: 1.16.14; 1.16.16;
Definition of __KERNEL_RCSID for asm files.
 1.15 27-Aug-2003  uwe Bring _PROF_PROLOGUE back. The breakage was caused by calls to
__udivsi3 being treated specially by gcc.
 1.14 10-Aug-2003  uwe Undo previous. It breaks profiling, but I managed to test against the
wrong tree and so missed it.
 1.13 10-Aug-2003  uwe Real _PROF_PROLOGUE so that assembly language functions can be profiled.
 1.12 09-Aug-2003  uwe For ELF put RCSID strings into .ident section.
 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 28-Apr-2002  uch branches: 1.10.6; 1.10.12;
Use "#define<tab>", white space nits.
 1.9 17-Mar-2002  uch cosmetic changes, fix comments.
 1.8 16-Dec-2001  thorpej Consider __NO_LEADING_UNDERSCORES__ provided by the new ELF toolchain.
 1.7 10-Jun-2001  msaitoh branches: 1.7.2;
.type xxx,@function isn't supported under COFF
 1.6 09-Apr-2001  marcus Altentries should also be marked as functions, to keep linker happy.
 1.5 09-Apr-2001  marcus Mark syscalls as functions.
 1.4 25-Feb-2001  msaitoh branches: 1.4.2;
check __LEADING_UNDERSCORE
 1.3 14-Dec-2000  marcus Made weak_alias create correct labels on sh-elf.
 1.2 23-Jun-2000  kleink Add a WEAK_ALIAS() macro.
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.12;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.12.1 25-Jul-2000  kleink Pull up rev. 1.2 (approved by thorpej):
For ELF, add a WEAK_ALIAS() macro.
 1.1.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.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.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.12.1 03-Aug-2004  skrll Sync with HEAD
 1.10.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.10.6.1 28-Apr-2002  uch file asm.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.16.16.1 21-Jun-2006  yamt sync with head.
 1.16.14.7 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1094):
sys/arch/sh3/include/asm.h: revision 1.24
Provide PIC_EPILOGUE_SLOT that is safe to use in delay slot.
 1.16.14.6 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1094):
sys/arch/sh3/include/asm.h: revision 1.23
Introduce PIC_PROLOGUE_NOSAVE for functions that do non-local jumps
and don't need to save/restore r12. Shaves off two instructions.
 1.16.14.5 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1094):
sys/arch/sh3/include/asm.h: revision 1.22
mova can only have r0 as destination, so PIC_PROLOGUE can not specify
an arbitrary temp register.
 1.16.14.4 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1094):
sys/arch/sh3/include/asm.h: revision 1.21
Macros for .size directive.
 1.16.14.3 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1094):
sys/arch/sh3/include/asm.h: revision 1.20
First cut at PIC macros.
 1.16.14.2 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1094):
sys/arch/sh3/include/asm.h: revision 1.19
Implement WARN_REFERENCES.
 1.16.14.1 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1094):
sys/arch/sh3/include/asm.h: revision 1.18
Prettify.
 1.19.2.2 01-Feb-2006  yamt sync with head.
 1.19.2.1 15-Jan-2006  yamt sync with head.
 1.25.82.1 19-Oct-2008  haad Sync with HEAD.
 1.25.78.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.25.76.1 04-May-2009  yamt sync with head.
 1.25.72.1 28-Sep-2008  mjf Sync with HEAD.
 1.26.16.1 05-Mar-2011  rmind sync with head
 1.27.22.1 18-May-2014  rmind sync with head
 1.27.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.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.28.40.1 20-Apr-2020  bouyer Sync with HEAD
 1.28.30.1 21-Apr-2020  martin Sync with HEAD
 1.29.26.1 02-Aug-2025  perseant Sync with HEAD
 1.3 08-Mar-2002  uch branches: 1.3.8;
remove unneeded code and files.
 1.2 12-Feb-2002  uch ANSIfy KNF.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.2 08-Mar-2002  uch remove unneeded code and files.
 1.3.8.1 08-Mar-2002  uch file bootinfo.h was added on branch nathanw_sa on 2002-03-08 13:22:15 +0000
 1.7 17-Feb-2008  uwe Define constants for setting bus widths of physical space areas in BCR2.
 1.6 11-Dec-2005  christos branches: 1.6.50; 1.6.56;
merge ktrace-lwp.
 1.5 29-Jun-2005  christos branches: 1.5.2;
more register definitions, from nonaka's landisk port.
 1.4 28-Apr-2002  uch branches: 1.4.6; 1.4.12;
Use "#define<tab>", white space nits.
 1.3 28-Feb-2002  uch Cleanup register definition
 1.2 16-Sep-1999  msaitoh branches: 1.2.16;
cleanup
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.12.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.4.6.1 28-Apr-2002  uch file bscreg.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.5.2.1 27-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 01-Feb-2006  dsl Need to install byte_swap.h and bswap.h needs to include sh3/byte_swap.h.
 1.6 31-Jan-2006  dsl branches: 1.6.2;
Make the sh3 bswap headers look like all the other ports
 1.5 24-Dec-2005  perry branches: 1.5.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 28-Apr-2002  uch branches: 1.4.6; 1.4.28;
Use "#define<tab>", white space nits.
 1.3 17-Mar-2002  uch cosmetic changes, fix comments.
 1.2 12-Feb-2002  uch ANSIfy KNF.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.28.1 21-Jun-2006  yamt sync with head.
 1.4.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.4.6.1 28-Apr-2002  uch file bswap.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.5.2.2 18-Feb-2006  yamt sync with head.
 1.5.2.1 01-Feb-2006  yamt sync with head.
 1.6.2.1 09-Sep-2006  rpaulo sync with head
 1.19 17-Jul-2011  dyoung Switch to new-style <sys/bus.h>.
 1.18 15-Mar-2010  uwe Sync with <sys/bus_proto.h>: constify source arg of bus_space_write* &co,
fix size_t vs. bus_size_t confusion.

Makes mmeye kernel build again.
 1.17 28-Apr-2008  martin branches: 1.17.20;
Remove clause 3 and 4 from TNF licenses
 1.16 04-Mar-2006  uwe branches: 1.16.68; 1.16.70; 1.16.72;
s/u_intN_t/uintN_t/
 1.15 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.14 29-Jan-2006  dsl branches: 1.14.2; 1.14.4;
Make almost everything #include <sys/bswap.h> instead of <machine/bswap.h>
The bswap.h and endian.h files are all rather incestuous, but I want to
get the constant folding stuff into one place - sys/bswap.h
 1.13 24-Dec-2005  perry branches: 1.13.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 15-Sep-2005  uwe Drop obsolete bus_space_* compat defs.
 1.10 11-Mar-2005  matt branches: 1.10.4;
Add missing stream methods (for wdc_pcmcia.c)
 1.9 28-Apr-2002  uch branches: 1.9.6; 1.9.12; 1.9.20; 1.9.22;
Use "#define<tab>", white space nits.
 1.8 28-Feb-2002  uch Remove #if 0 #endif
 1.7 12-Feb-2002  uch ANSIfy KNF.
 1.6 19-Jul-2001  thorpej 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.5 30-Jan-2001  msaitoh branches: 1.5.4;
add some macros for 8bit PCMCIA access
 1.4 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.3 24-Feb-2000  msaitoh branches: 1.3.4;
SH4!
 1.2 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.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.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.3.4.2 08-Oct-2001  he Pull up revision 1.5 (requested by msaitoh):
Add missing macros for 8-bit PCMCIA access.
 1.3.4.1 30-Jun-2000  simonb Pull up revision 1.4 (requested by simonb):
Pull up mmap paddr_t/off_t changes from trunk.
 1.5.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.5.4.1 03-Aug-2001  lukem update to -current
 1.9.22.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.20.1 29-Apr-2005  kent sync with -current
 1.9.12.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.12.1 01-Apr-2005  skrll Sync with HEAD.
 1.9.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.9.6.1 28-Apr-2002  uch file bus.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.13.2.2 18-Feb-2006  yamt sync with head.
 1.13.2.1 01-Feb-2006  yamt sync with head.
 1.14.4.1 22-Apr-2006  simonb Sync with head.
 1.14.2.1 09-Sep-2006  rpaulo sync with head
 1.16.72.2 11-Aug-2010  yamt sync with head.
 1.16.72.1 16-May-2008  yamt sync with head.
 1.16.70.1 18-May-2008  yamt sync with head.
 1.16.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.20.1 30-Apr-2010  uebayasi 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.4 25-Jul-2011  dyoung Move some macros back to sh3/include/bus_funcs.h from
sh3/sh3/sh3_machdep.c, where I moved them by mistake.

Pull the bus_space(9) routines into a new module,
sh3/sh3/sh3_bus_space.c, that is built only on !landisk.

Fixes the mmeye and landisk builds. Should fix other sh3 ports.
 1.3 25-Jul-2011  dyoung Move the sh_memio_*() declarations back to sh3/include/bus_funcs.h.
Should fix the mmeye build.
 1.2 20-Jul-2011  dyoung Remove redundant, static inline bus_space(9) declarations
from sh3/bus_funcs.h and move the non-inline definitions to
sh3/sh3_machdep.c.
 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.4 17-Feb-2006  skrll branches: 1.4.12;
Match comment against #endif with #ifdef
 1.3 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.2 02-Feb-2006  skrll branches: 1.2.2;
Fix the multiple inclusion protection. hi dsl.
 1.1 31-Jan-2006  dsl branches: 1.1.2; 1.1.4;
Make the sh3 bswap headers look like all the other ports
 1.1.4.3 18-Feb-2006  yamt sync with head.
 1.1.4.2 01-Feb-2006  yamt sync with head.
 1.1.4.1 31-Jan-2006  yamt file byte_swap.h was added on branch yamt-uio_vmspace on 2006-02-01 14:51:31 +0000
 1.1.2.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 22-Apr-2006  simonb Sync with head.
 1.4.12.2 21-Jun-2006  yamt sync with head.
 1.4.12.1 17-Feb-2006  yamt file byte_swap.h was added on branch yamt-lazymbuf on 2006-06-21 14:55:31 +0000
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 24-Sep-2006  tsutsui branches: 1.8.52; 1.8.54; 1.8.56;
Allow shared PV mappings in pmap_enter(9) even on SH4 if VAs of shared pages
have the same virtual cache indexes (i.e. they won't cause virtual cache
aliases). Also prepare PMAP_PREFER(9) for SH4 to avoid some possible virtual
cache aliases.
More stuff should be added in pmap_enter(9), but at least this changes
should fix some existing problems. See discussion on port-sh3 ML for details.

OK'ed by uwe and chs, and closes PR port-sh3/34243.
 1.7 21-Jan-2006  uwe branches: 1.7.18; 1.7.20;
There's no need to duplicate cpu type ifdef dance here. cputypes.h
already defines CPU_IS_SH[34] as constants for kernels that support
only single cpu type.
 1.6 11-Dec-2005  christos branches: 1.6.2;
merge ktrace-lwp.
 1.5 29-Jun-2005  christos branches: 1.5.2;
more info for sh4 from nonaka's landisk port.
 1.4 09-May-2002  uch branches: 1.4.6; 1.4.12;
remove obsolete interface. add defines for inquire cache feature.
 1.3 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.2 17-Feb-2002  uch branches: 1.2.2; 1.2.8;
change register naming.
 1.1 11-Feb-2002  uch add new cache routine.
 1.2.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 17-Feb-2002  jdolecek file cache.h was added on branch kqueue on 2002-03-16 15:59:36 +0000
 1.2.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.4.12.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.2 09-May-2002  uch remove obsolete interface. add defines for inquire cache feature.
 1.4.6.1 09-May-2002  uch file cache.h was added on branch nathanw_sa on 2002-05-09 12:30:46 +0000
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.6.2.1 01-Feb-2006  yamt sync with head.
 1.7.20.1 22-Oct-2006  yamt sync with head
 1.7.18.1 18-Nov-2006  ad Sync with head.
 1.8.56.1 16-May-2008  yamt sync with head.
 1.8.54.1 18-May-2008  yamt sync with head.
 1.8.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.10 16-May-2009  nonaka Added SH7706 cache flush op.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 04-Mar-2006  uwe branches: 1.8.68; 1.8.70; 1.8.72;
s/u_intN_t/uintN_t/
 1.7 24-Dec-2005  perry branches: 1.7.4; 1.7.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.6 28-Apr-2002  uch branches: 1.6.6; 1.6.28;
Use "#define<tab>", white space nits.
 1.5 17-Mar-2002  uch cosmetic changes, fix comments.
 1.4 16-Mar-2002  chs branches: 1.4.2;
only comments may follow #endif on a line.
 1.3 28-Feb-2002  uch branches: 1.3.2;
Cleanup register definition
 1.2 17-Feb-2002  uch change register naming.
 1.1 11-Feb-2002  uch add new cache routine.
 1.3.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.1 16-Mar-2002  jdolecek file cache_sh3.h was added on branch kqueue on 2002-03-16 15:59:36 +0000
 1.6.28.1 21-Jun-2006  yamt sync with head.
 1.6.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6.6.1 28-Apr-2002  uch file cache_sh3.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 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.2 20-Jun-2009  yamt 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.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 04-Mar-2006  uwe branches: 1.11.68; 1.11.70; 1.11.72;
s/u_intN_t/uintN_t/
 1.10 24-Dec-2005  perry branches: 1.10.4; 1.10.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 07-Jul-2005  nonaka Added EMODE cache operation.
 1.7 30-Jun-2005  nonaka branches: 1.7.2;
remove EMODE support code.
- EMODE support doesn't work fine yet.
- This code is broken for dreamcast.
dramcast call sh4_icache_sync_all() before sh4_cache_config().
(at locore.S)
 1.6 29-Jun-2005  christos more additions from nonaka's landisk port.
 1.5 28-Apr-2002  uch branches: 1.5.6; 1.5.12;
Use "#define<tab>", white space nits.
 1.4 17-Mar-2002  uch cosmetic changes, fix comments.
 1.3 28-Feb-2002  uch branches: 1.3.2; 1.3.8;
Cleanup register definition
 1.2 17-Feb-2002  uch change register naming.
 1.1 11-Feb-2002  uch add new cache routine.
 1.3.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.1 28-Feb-2002  jdolecek file cache_sh4.h was added on branch kqueue on 2002-03-16 15:59:36 +0000
 1.3.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.5.12.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5.6.1 28-Apr-2002  uch file cache_sh4.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.72.1 16-May-2008  yamt sync with head.
 1.11.70.1 18-May-2008  yamt sync with head.
 1.11.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 28-Feb-2002  uch branches: 1.3.10;
Cleanup register definition
 1.2 17-Jan-2000  msaitoh branches: 1.2.8;
add some bit definitions
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.10.2 28-Feb-2002  uch Cleanup register definition
 1.3.10.1 28-Feb-2002  uch file ccrreg.h was added on branch nathanw_sa on 2002-02-28 01:56:58 +0000
 1.6 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.5 28-Apr-2002  uch branches: 1.5.6; 1.5.152; 1.5.156;
Use "#define<tab>", white space nits.
 1.4 17-Mar-2002  uch cosmetic changes, fix comments.
 1.3 16-Dec-2001  thorpej Consider __NO_LEADING_UNDERSCORES__ provided by the new ELF toolchain.
 1.2 25-Feb-2001  msaitoh branches: 1.2.4;
check __LEADING_UNDERSCORE instead of __sh3__
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.156.1 18-Feb-2012  mrg merge to -current.
 1.5.152.1 17-Apr-2012  yamt sync with head
 1.5.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5.6.1 28-Apr-2002  uch file cdefs.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.5 11-Jul-2020  uwe Fix doc comment for sh_clock_init.

Forgot to update it back in 2006 when sh3 ports were converted to
todr(9) and its second argument (struct rtc_ops) was removed.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 20-Sep-2006  uwe branches: 1.3.52; 1.3.54; 1.3.56;
Switch the rest of sh3 ports to todr(9)
Split code to handle on-chip rtc into a separate driver
Eliminate all todr code from clock.c
Move __HAVE_GENERIC_TODR to sh3/include/types.h
 1.2 28-Apr-2002  uch branches: 1.2.6; 1.2.28; 1.2.58; 1.2.60;
Use "#define<tab>", white space nits.
 1.1 22-Feb-2002  uch branches: 1.1.2; 1.1.8;
New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.
 1.1.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.8.1 22-Feb-2002  jdolecek file clock.h was added on branch kqueue on 2002-03-16 15:59:37 +0000
 1.1.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.2.60.1 22-Oct-2006  yamt sync with head
 1.2.58.1 18-Nov-2006  ad Sync with head.
 1.2.28.1 30-Dec-2006  yamt sync with head.
 1.2.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.2.6.1 28-Apr-2002  uch file clock.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.3.56.1 16-May-2008  yamt sync with head.
 1.3.54.1 18-May-2008  yamt sync with head.
 1.3.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.6 28-Apr-2002  uch branches: 1.6.6;
Use "#define<tab>", white space nits.
 1.5 17-Mar-2002  uch cosmetic changes, fix comments.
 1.4 02-Aug-2000  msaitoh branches: 1.4.4;
check _BYTE_ORDER instead of BYTE_ORDER
 1.3 04-Jun-2000  mycroft branches: 1.3.2;
Move a bunch of the COFF definitions into exec_coff.h, so they can be used by
other code. XXX Not tested on SH3 yet.
 1.2 02-Jan-2000  msaitoh branches: 1.2.2;
EXEC_COFF cleanup
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.2.1 08-Aug-2000  msaitoh Pullup revision 1.4 (approved by thorpej):

check _BYTE_ORDER instead of BYTE_ORDER to fix namespace pollution
(it's necessary to compile src/usr.bin/xlint/llib)
 1.4.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6.6.1 28-Apr-2002  uch file coff_machdep.h was added on branch nathanw_sa on 2002-04-28 17:10:34 +0000
 1.5 28-Apr-2002  uch branches: 1.5.6;
Use "#define<tab>", white space nits.
 1.4 17-Mar-2002  uch cosmetic changes, fix comments.
 1.3 28-Feb-2002  uch Cleanup register definition
 1.2 16-Sep-1999  msaitoh branches: 1.2.16;
remove extra Id
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.5.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5.6.1 28-Apr-2002  uch file cpgreg.h was added on branch nathanw_sa on 2002-04-28 17:10:35 +0000
 1.61 23-Feb-2022  andvar fix various typos in comments, mainly immediatly/immediately/,
as well shared and recently fixed typos in OpenBSD code by Jonathan Grey.
 1.60 03-Aug-2020  uwe SH3_P2SEG_FUNC(f) - get a P2 address of a function.


Just SH3_P1SEG_TO_P2SEG + cast, but we now define SH3_P1SEG_TO_P2SEG
and SH3_P2SEG_TO_P1SEG to use arithmetic, not bitwise ops. That gives
the same result for the correct P1/P2 input values, but addition can
be done at link time with addends. Thus SH3_P2SEG_FUNC compiles to a
constant P2 address.
 1.59 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.58 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.57 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.56 19-Oct-2013  christos branches: 1.56.28; 1.56.30;
make cpu_need_resched() macros consistent; __USE flags
 1.55 22-Dec-2010  nisimura branches: 1.55.8; 1.55.18; 1.55.22;
PROC_PC() should have been changed to LWP_PC().
 1.54 21-Oct-2009  rmind branches: 1.54.4;
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.53 22-Mar-2008  uwe branches: 1.53.4;
Revert interrupt stack changes. There are some issues and, at least
in the current form, they complicate implementation of fast software
interrupts. I'd rather get fast softints in now and may be revisit
interrupt stack later.
 1.52 16-Mar-2008  uwe Rewrite RUN_P2, RUN_P1 in asm. gcc4 is too happy to optimize away
assigned-goto versions if try to do anything fancy with them
(discovered by trying to wrap RUN_P2 into an "if").
 1.51 27-Feb-2008  xtraeme Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.50 07-Jan-2008  uwe branches: 1.50.2; 1.50.6;
Now that sh3 has didicated interrupt stack we can check for cpu_intr_p
with simple sp comparison, so we can drop ci_idepth.
 1.49 14-Dec-2007  uwe Use dedicated interrupt stack. Tested on hpcsh and landisk. This has
been sitting in my tree for quite a while. While here s/top/bottom/
in a few places related to stacks to confirm to conventional
terminology.
 1.48 03-Dec-2007  ad branches: 1.48.2; 1.48.6;
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.47 17-Oct-2007  garbled branches: 1.47.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.46 01-Oct-2007  ad Make want_resched a member of cpu_info.
 1.45 04-Aug-2007  ad branches: 1.45.2; 1.45.4;
Add ci_cpuid where it's missing.
 1.44 17-May-2007  yamt branches: 1.44.2; 1.44.4; 1.44.8;
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.43 16-Feb-2007  ad branches: 1.43.2; 1.43.6; 1.43.8; 1.43.14;
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 09-Feb-2007  ad Merge newlock2 to head.
 1.41 21-Jan-2006  uwe branches: 1.41.18;
Declare cpu_reset as __attribute__((__noreturn__)).
 1.40 21-Jan-2006  uwe Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.
 1.39 21-Jan-2006  uwe Use uint32_t.
 1.38 24-Dec-2005  perry branches: 1.38.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.37 11-Dec-2005  christos merge ktrace-lwp.
 1.36 25-Sep-2004  yamt branches: 1.36.12;
include sys/cpu_data.h only if defined(_KERNEL)
 1.35 22-Sep-2004  yamt move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.34 24-Mar-2004  wiz Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.
 1.33 04-Jan-2004  jdolecek 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.32 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.31 18-Jan-2003  thorpej branches: 1.31.2;
Merge the nathanw_sa branch.
 1.30 13-Nov-2002  msaitoh add some definitions for P[VR]R register
 1.29 07-May-2002  thorpej branches: 1.29.6;
Make CLKF_INTR() slightly less broken. The previous definition always
tested true if the CPU was running in the kernel at the time of the clock
interrupt, therefore all such time (kernel and idle) was counted as interrupt
time. The new definition simply punts on trying to count interrupt time,
which allows us to see kernel and idle time.
 1.28 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.27 26-Apr-2002  msaitoh add SH4 Processor Version Register
 1.26 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.25 17-Mar-2002  uch cosmetic changes, fix comments.
 1.24 17-Mar-2002  uch change to per-process AST.
 1.23 08-Mar-2002  uch cpu_swapout() moved to cpu.h
 1.22 04-Mar-2002  uch CTL_MACHDEP definitions are integrated into sh3/include/cpu.h again.
 1.21 03-Mar-2002  uch machine dependent sysctl are moved to machine/cpu.h
dreamcast, hpcsh ... CPU_CONSDEV
mmeye, evbsh3 ... CPU_CONSDEV, CPU_LOADANDRESET
 1.20 28-Feb-2002  uch cpu_dumpconf, reserve_dumppages, dumpsys, cpu_reset are moved to sh3/sh3_machdep.c
 1.19 24-Feb-2002  uch Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.
 1.18 22-Feb-2002  uch New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.
 1.17 19-Feb-2002  uch Clean up function declaration.
 1.16 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.15 12-Feb-2002  uch ANSIfy KNF.
 1.14 11-Feb-2002  uch add useful macro for running P2, P1 area.
 1.13 24-Jun-2001  msaitoh branches: 1.13.2;
fix KERNELMODE() macro (check MD bits, too)
 1.12 30-May-2001  mrg use _KERNEL_OPT
 1.11 02-Feb-2001  thorpej branches: 1.11.2;
Add some comments about P/USEG
 1.10 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.9 07-Jun-2000  tsubai branches: 1.9.2;
Remove child_return prototype; it is now in sys/proc.h.
 1.8 26-May-2000  thorpej branches: 1.8.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.7 24-Feb-2000  msaitoh SH4!
 1.6 14-Jan-2000  msaitoh add SH3_{PHYS,P1SEG,P2SEG}_TO_{PHYS,P1SEG,P2SEG} macros
 1.5 24-Dec-1999  msaitoh back to previous one (suggested by cgd)
 1.4 21-Dec-1999  msaitoh move sysctl definitions into ${MACHINE}/include/cpu.h
 1.3 21-Dec-1999  msaitoh G.C.
 1.2 14-Sep-1999  tsubai branches: 1.2.2; 1.2.8;
Catch up with -current.
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.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.8.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.1 08-Oct-2001  he Pull up revision 1.13 (requested by msaitoh):
Fix KERNELMODE macro (check MD bits too).
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.29.6.4 11-Dec-2002  thorpej Sync with HEAD.
 1.29.6.3 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.29.6.2 21-Jun-2002  thorpej Add support for scheduler activations on SuperH. Boots multi-user
on Dreamcast (SH4) with stock userland.
 1.29.6.1 07-May-2002  thorpej file cpu.h was added on branch nathanw_sa on 2002-06-21 21:26:27 +0000
 1.31.2.5 19-Oct-2004  skrll Sync with HEAD
 1.31.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.31.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.31.2.1 03-Aug-2004  skrll Sync with HEAD
 1.36.12.8 24-Mar-2008  yamt sync with head.
 1.36.12.7 17-Mar-2008  yamt sync with head.
 1.36.12.6 21-Jan-2008  yamt sync with head
 1.36.12.5 07-Dec-2007  yamt sync with head
 1.36.12.4 27-Oct-2007  yamt sync with head.
 1.36.12.3 03-Sep-2007  yamt sync with head.
 1.36.12.2 26-Feb-2007  yamt sync with head.
 1.36.12.1 21-Jun-2006  yamt sync with head.
 1.38.2.1 01-Feb-2006  yamt sync with head.
 1.41.18.1 01-Feb-2007  ad Get sh3 compiling.
 1.43.14.2 03-Oct-2007  garbled Sync with HEAD
 1.43.14.1 22-May-2007  matt Update to HEAD.
 1.43.8.1 11-Jul-2007  mjf Sync with head.
 1.43.6.4 03-Dec-2007  ad Sync with HEAD.
 1.43.6.3 09-Oct-2007  ad Sync with head.
 1.43.6.2 20-Aug-2007  ad Sync with HEAD.
 1.43.6.1 27-May-2007  ad Sync with head.
 1.43.2.2 05-Apr-2007  uwe Provide cpu_did_resched() that MI code calls with proper locking.
 1.43.2.1 25-Mar-2007  uwe Adapt sh3 to yamt-idlelwp.
 1.44.8.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.44.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.44.8.1 04-Aug-2007  jmcneill Sync with HEAD.
 1.44.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.44.2.1 07-Aug-2007  matt Sync with HEAD.
 1.45.4.1 06-Oct-2007  yamt sync with head.
 1.45.2.3 23-Mar-2008  matt sync with HEAD
 1.45.2.2 09-Jan-2008  matt sync with HEAD
 1.45.2.1 06-Nov-2007  matt sync with HEAD
 1.47.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.47.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.47.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.48.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.48.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.48.2.1 26-Dec-2007  ad Sync with head.
 1.50.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.50.2.1 24-Mar-2008  keiichi sync with head.
 1.53.4.1 11-Mar-2010  yamt sync with head
 1.54.4.1 05-Mar-2011  rmind sync with head
 1.55.22.1 18-May-2014  rmind sync with head
 1.55.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.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.56.30.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.56.30.1 10-Jun-2019  christos Sync with HEAD
 1.56.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.15 03-Mar-2002  uch branches: 1.15.8;
SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.14 28-Feb-2002  uch Cleanup register definition
 1.13 22-Feb-2002  uch New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.
 1.12 19-Feb-2002  uch Clean up functions
disable_intr, enable_intr, disable_interrupt, enable_interrupt,
disable_ext_intr, enable_ext_intr.
New functions:
for external interrupt:
_cpu_intr_suspend and _cpu_intr_resume.
for exception:
_cpu_exception_suspend and _cpu_exception_resume.
 1.11 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.10 12-Feb-2002  uch ANSIfy KNF.
 1.9 11-Feb-2002  uch add new cache routine.
 1.8 08-Feb-2002  uch add SH-internal memory mapped register access method.
 1.7 24-Jun-2001  msaitoh branches: 1.7.2;
use MMUCR_TF macro defined in mmureg.h
 1.6 06-Sep-2000  tsubai Add breakpoint().
 1.5 04-Sep-2000  msaitoh - move MMUCR_VALIDBITS definition into mmureg.h.
- access correct address in cacheflush().
 1.4 24-Feb-2000  msaitoh branches: 1.4.4;
SH4!
 1.3 12-Jan-2000  msaitoh KNF
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
enclose tlbflush(), disable_intr() and enable_intr() with #ifder _KERNEL
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.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.4.4.1 21-Sep-2000  msaitoh pullup a part of rev. 1.5 (approved by thorpej):

access correct address in cacheflush().
 1.7.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.15.8.2 03-Mar-2002  uch SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.15.8.1 03-Mar-2002  uch file cpufunc.h was added on branch nathanw_sa on 2002-03-03 14:31:26 +0000
 1.14 28-Jul-2020  skrll _LKM -> _MODULE
 1.13 25-Jul-2020  uwe Define CPU_PRODUCT_STX7105.

I'm not sure if this should rather be named CPU_PRODUCT_ST40_300, but
that's probably too general. These constants don't have to be
backward compatible, so we can re-do this properly later if we need to.
 1.12 21-Apr-2009  nonaka Add SH7706
 1.11 28-Apr-2008  martin branches: 1.11.8; 1.11.14;
Remove clause 3 and 4 from TNF licenses
 1.10 21-Jan-2006  uwe branches: 1.10.72; 1.10.74; 1.10.76;
Add CONSTCOND to make lint happy.
 1.9 11-Dec-2005  christos branches: 1.9.2;
merge ktrace-lwp.
 1.8 29-Jun-2005  christos branches: 1.8.2;
more additions from nonaka's landisk port.
 1.7 28-Apr-2002  uch branches: 1.7.6; 1.7.12;
Use "#define<tab>", white space nits.
 1.6 23-Apr-2002  uch remove duplicated SH3, SH4 define.
 1.5 20-Apr-2002  thorpej * Defflag the SH3 and SH4 options.
* In <sh3/cputypes.h>, always define both SH3 and SH4 if _LKM is defined.
 1.4 16-Apr-2002  uch Define all CPU types if _LKM is defined.
 1.3 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.2 17-Feb-2002  uch To determine CPU architecture and product, add cpu_arch and cpu_prduct variables.
these are initialized by sh_cpu_init()@sh3/sh3_machdep.c
(see sh3/include/cputypes.h for detail.)
add "options SH3" for SH3 kernel config file.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.7.12.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.7.6.1 28-Apr-2002  uch file cputypes.h was added on branch nathanw_sa on 2002-04-28 17:10:35 +0000
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 01-Feb-2006  yamt sync with head.
 1.10.76.2 04-May-2009  yamt sync with head.
 1.10.76.1 16-May-2008  yamt sync with head.
 1.10.74.1 18-May-2008  yamt sync with head.
 1.10.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 05-Nov-2003  uwe branches: 1.1.4;
Register definitions for SH7709 DAC.
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 05-Nov-2003  skrll file dacreg.h was added on branch ktrace-lwp on 2004-08-03 10:40:15 +0000
 1.3 10-May-2002  uch branches: 1.3.4;
clean up disassembler code.
 1.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.2 10-May-2002  uch clean up disassembler code.
 1.3.4.1 10-May-2002  uch file db_disasm.h was added on branch nathanw_sa on 2002-05-10 15:27:06 +0000
 1.18 02-Sep-2023  andvar remove (db_addr_t) cast in sh3 PC_REGS(regs) definition.

Fixes KGDB build option for SH3/4 code.
 1.17 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.16 26-May-2011  joerg branches: 1.16.14;
Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.15 14-Jan-2011  rmind branches: 1.15.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.14 07-Jun-2008  uwe branches: 1.14.20;
Fix IS_BREAKPOINT_TRAP: EXP_BREAK is not a breakpoint trap, it's UBC
(user break controller) trap, and we use UBC for single-stepping, not
for ddb breakpoints. ddb breakpoints are "trapa 0xc3".
 1.13 21-Feb-2007  thorpej branches: 1.13.42; 1.13.44; 1.13.46; 1.13.48;
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.12 10-May-2006  skrll branches: 1.12.14;
Fix a bunch of cast lvalues.
 1.11 01-Apr-2006  cherry 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.10 18-Dec-2005  uwe branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
Declare ddb_regs extern in db_machdep.h and provide the defintion in
db_interface.c.
 1.9 29-Apr-2003  scw branches: 1.9.18;
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.8 09-May-2002  uch branches: 1.8.6;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]
 1.7 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6 17-Mar-2002  uch cosmetic changes, fix comments.
 1.5 02-Mar-2002  uch Initial support for KGDB on the sh3.
 1.4 08-Feb-2002  uch TLB dump command added to DDB
 1.3 08-Sep-2000  tsubai branches: 1.3.4;
DDB single step and stack trace support.
 1.2 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.8.6.2 09-May-2002  uch rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]
 1.8.6.1 09-May-2002  uch file db_machdep.h was added on branch nathanw_sa on 2002-05-09 12:24:21 +0000
 1.9.18.2 26-Feb-2007  yamt sync with head.
 1.9.18.1 21-Jun-2006  yamt sync with head.
 1.10.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.10.10.2 11-May-2006  elad sync with head
 1.10.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.10.8.2 24-May-2006  yamt sync with head.
 1.10.8.1 11-Apr-2006  yamt sync with head
 1.10.6.2 01-Jun-2006  kardel Sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.12.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.13.48.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.46.1 04-May-2009  yamt sync with head.
 1.13.44.1 17-Jun-2008  yamt sync with head.
 1.13.42.1 29-Jun-2008  mjf Sync with HEAD.
 1.14.20.2 31-May-2011  rmind sync with head
 1.14.20.1 05-Mar-2011  rmind sync with head
 1.15.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.14.1 03-Dec-2017  jdolecek update from HEAD
 1.7 06-Oct-2021  andvar s/embeded/embedded/ in comments and messages.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 21-Jan-2006  uwe branches: 1.5.72; 1.5.74; 1.5.76;
Use foo &= ~(type)mask; instead of foo &= (type)~mask; to make lint happy.
While here, convert to uintN_t.
 1.4 24-Dec-2005  perry branches: 1.4.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.3 08-Nov-2002  tsutsui branches: 1.3.22;
Add _reg_bset_[124]() and _reg_bclr_[124]() macro for
SH embeded device registers.
 1.2 28-Apr-2002  uch branches: 1.2.6;
Use "#define<tab>", white space nits.
 1.1 28-Feb-2002  uch branches: 1.1.6; 1.1.10;
Cleanup register definition
 1.1.10.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.10.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.6.1 28-Feb-2002  jdolecek file devreg.h was added on branch kqueue on 2002-03-16 15:59:37 +0000
 1.2.6.2 11-Nov-2002  nathanw Catch up to -current
 1.2.6.1 28-Apr-2002  nathanw file devreg.h was added on branch nathanw_sa on 2002-11-11 22:04:02 +0000
 1.3.22.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 01-Feb-2006  yamt sync with head.
 1.5.76.1 16-May-2008  yamt sync with head.
 1.5.74.1 18-May-2008  yamt sync with head.
 1.5.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.9 16-May-2013  christos name it like other ports do
 1.8 23-Nov-2009  pooka branches: 1.8.12; 1.8.22;
If cpu_disklabel includes struct dkbad, define __HAVE_DISKLABEL_DKBAD.
This allows use of subr_disk_mbr on all archs. Default to it for
the rump disk component. No functional change for regular kernels.
(The other option would've been to include dkbad in disklabels
everywhere, but arguably this approach has less possible side-effects,
especially given that wedges and related magic will take over the
world any second now).
 1.7 11-Dec-2005  christos branches: 1.7.78;
merge ktrace-lwp.
 1.6 12-Jun-2005  dyoung Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/. That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such. I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
 1.5 08-Oct-2003  lukem Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
 1.4 22-May-2002  uch branches: 1.4.2; 1.4.8;
change disklabel to
16 partition.
no bsd area of the disk.
 1.3 28-Apr-2002  uch branches: 1.3.2;
Use "#define<tab>", white space nits.
 1.2 12-Feb-2002  uch ANSIfy KNF.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.2.1 30-May-2002  gehenna Catch up with -current.
 1.4.8.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.8.1 03-Aug-2004  skrll Sync with HEAD
 1.4.2.2 22-May-2002  uch change disklabel to
16 partition.
no bsd area of the disk.
 1.4.2.1 22-May-2002  uch file disklabel.h was added on branch nathanw_sa on 2002-05-22 15:01:34 +0000
 1.7.78.1 11-Mar-2010  yamt sync with head
 1.8.22.1 23-Jun-2013  tls resync from head
 1.8.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5 30-Sep-2025  rillig sh3/dmacreg.h: revert snprintb change

The the snprintb format strings produced nice-looking output, even
though they combine the 'f' and ':' conversions, which in other cases
can produce garbled output. Instead of "fixing" these particular format
strings, the snprintb function should allow these variants.
 1.4 29-Sep-2025  rillig sh3/dmacreg.h: fix snprintb definitions

In the previous definitions, the 'f' conversion was combined with the
':' conversion, which snprintb rejects at runtime, starting with
snprintb.c 1.47 from 2024-04-07.
 1.3 29-Mar-2007  uwe Include #include <sh3/devreg.h> like other *reg.h do.
 1.2 11-Dec-2005  christos branches: 1.2.26; 1.2.30; 1.2.32;
merge ktrace-lwp.
 1.1 08-Apr-2004  uwe branches: 1.1.2; 1.1.14;
Register definitions for sh3 integrated DMA controller.
 1.1.14.1 03-Sep-2007  yamt sync with head.
 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-Apr-2004  skrll file dmacreg.h was added on branch ktrace-lwp on 2004-08-03 10:40:16 +0000
 1.2.32.1 11-Jul-2007  mjf Sync with head.
 1.2.30.1 10-Apr-2007  ad Sync with head.
 1.2.26.1 15-Apr-2007  yamt sync with head.
 1.13 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.12 05-Dec-2016  joerg binutils decided to shuffle around its extensions a long time ago. Since
we don't actually use them for anything, follow them.
 1.11 23-Oct-2014  christos branches: 1.11.2; 1.11.4;
instead of bitching about the missing endianness, get it.
 1.10 30-May-2009  skrll branches: 1.10.22; 1.10.38;
Add TLS relocation definitions.
 1.9 25-Nov-2006  riz branches: 1.9.56;
Don't worry about the ELF32_MACHDEP_ENDIANNESS macro when compiling
a host tool - it's never used there.
 1.8 28-Apr-2002  uch branches: 1.8.6; 1.8.28; 1.8.58; 1.8.60;
Use "#define<tab>", white space nits.
 1.7 29-Jan-2002  thorpej Add SuperH ELF header flags.
 1.6 29-Jan-2002  thorpej Add SuperH relocation types.
 1.5 09-Dec-2001  thorpej Add support for dumping ELF-cormat core files.
 1.4 29-Mar-2001  marcus branches: 1.4.2;
When the endians are little, they are little.
 1.3 02-Apr-2000  minoura branches: 1.3.6;
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.2 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.4; 1.1.6;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.4.1 15-Nov-1999  fvdl Sync with -current
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.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.3.6.1 09-Apr-2001  nathanw Catch up with -current.
 1.4.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.60.1 10-Dec-2006  yamt sync with head.
 1.8.58.1 12-Jan-2007  ad Sync with head.
 1.8.28.1 30-Dec-2006  yamt sync with head.
 1.8.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.8.6.1 28-Apr-2002  uch file elf_machdep.h was added on branch nathanw_sa on 2002-04-28 17:10:35 +0000
 1.9.56.1 20-Jun-2009  yamt sync with head
 1.10.38.1 25-Jan-2015  martin Pull up following revision(s) (requested by mrg for ticket #448):
sys/arch/sh3/include/elf_machdep.h: revision 1.11
instead of bitching about the missing endianness, get it.
 1.10.22.1 03-Dec-2017  jdolecek update from HEAD
 1.11.4.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.11.2.1 05-Feb-2017  skrll Sync with HEAD
 1.4 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.3 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.2 14-Jan-2000  msaitoh block prototype definitions with _LOCORE (for .S)
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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:24:29 +0000
 1.12 16-May-2009  nonaka Add SH4 INTEVT codes for GPIO.
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 23-Mar-2008  uwe branches: 1.10.2; 1.10.4;
Sort SH4_INTEVT_PCI* codes.
 1.9 22-Jul-2006  uwe branches: 1.9.58;
exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.
 1.8 04-Mar-2006  uwe branches: 1.8.2;
s/u_intN_t/uintN_t/
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6;
merge ktrace-lwp.
 1.6 29-Jun-2005  christos branches: 1.6.2;
more additions from nonaka's landisk port.
 1.5 25-Mar-2004  uwe INTEVT2 values for DMAC interrupts.
 1.4 29-Dec-2002  uwe branches: 1.4.2;
Add sh7709 INTEVT2 codes for IRQs, PINTs, IRDA and ADC.
 1.3 09-May-2002  uch branches: 1.3.6; 1.3.8;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]
 1.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.1 24-Mar-2002  uch branches: 1.1.2;
Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.1.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.1 09-May-2002  jdolecek file exception.h was added on branch kqueue on 2002-06-23 17:40:39 +0000
 1.3.6.2 29-Dec-2002  thorpej Sync with HEAD.
 1.3.6.1 09-May-2002  thorpej file exception.h was added on branch nathanw_sa on 2002-12-29 19:37:28 +0000
 1.4.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.2.3 24-Mar-2008  yamt sync with head.
 1.6.2.2 30-Dec-2006  yamt sync with head.
 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.2.1 11-Aug-2006  yamt sync with head
 1.9.58.2 02-Jun-2008  mjf Sync with HEAD.
 1.9.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.10.4.2 20-Jun-2009  yamt sync with head
 1.10.4.1 16-May-2008  yamt sync with head.
 1.10.2.1 18-May-2008  yamt sync with head.
 1.2 02-Jan-2000  msaitoh remove exec_coff.h
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.4 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.3 22-Mar-2017  chs branches: 1.3.12; 1.3.52;
provide a common softfloat fenv implemenation and use it for softfloat builds.
restore ABI compatibility with previous releases for ieeefp.h on sh3.
add namespace.h protection for all the fenv interfaces.
use MKSOFTFLOAT on sh3 instead of assuming softfloat.
standardize on comparing MKSOFTFLOAT with "no".
remove the arm-specific softfloat fenv code (which also had several bugs).
fix logic errors in the arm hardfloat feraiseexcept() and feupdateenv().
 1.2 25-Aug-2016  christos branches: 1.2.2; 1.2.4; 1.2.6;
fake some stuff for softfloat.
 1.1 25-Aug-2016  christos fenv.h for sh
 1.2.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.2.4.3 28-Aug-2017  skrll Sync with HEAD
 1.2.4.2 05-Oct-2016  skrll Sync with HEAD
 1.2.4.1 25-Aug-2016  skrll file fenv.h was added on branch nick-nhusb on 2016-10-05 20:55:35 +0000
 1.2.2.3 26-Apr-2017  pgoyette Sync with HEAD
 1.2.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.2.2.1 25-Aug-2016  pgoyette file fenv.h was added on branch pgoyette-localcount on 2016-09-14 03:04:17 +0000
 1.3.52.1 02-Aug-2025  perseant Sync with HEAD
 1.3.12.2 03-Dec-2017  jdolecek update from HEAD
 1.3.12.1 22-Mar-2017  jdolecek file fenv.h was added on branch tls-maxphys on 2017-12-03 11:36:42 +0000
 1.5 12-May-2003  kleink Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.4 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.3 28-Apr-2002  uch branches: 1.3.6;
Use "#define<tab>", white space nits.
 1.2 17-Mar-2002  uch cosmetic changes, fix comments.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file float.h was added on branch nathanw_sa on 2002-04-28 17:10:35 +0000
 1.1 25-Aug-2016  christos branches: 1.1.2; 1.1.4; 1.1.18;
fenv.h for sh
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 25-Aug-2016  jdolecek file fpreg.h was added on branch tls-maxphys on 2017-12-03 11:36:42 +0000
 1.1.4.2 05-Oct-2016  skrll Sync with HEAD
 1.1.4.1 25-Aug-2016  skrll file fpreg.h was added on branch nick-nhusb on 2016-10-05 20:55:35 +0000
 1.1.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.1.2.1 25-Aug-2016  pgoyette file fpreg.h was added on branch pgoyette-localcount on 2016-09-14 03:04:17 +0000
 1.20 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.19 22-Nov-2008  uwe branches: 1.19.16; 1.19.20;
Move COMPAT_16 signal stuff to the new compat_16_machdep.c file, so
that it can be built as part of a module.
 1.18 15-Oct-2008  wrstuden branches: 1.18.2;
Merge wrstuden-revivesa into HEAD.
 1.17 01-Jun-2008  uwe branches: 1.17.4;
Add GBR register to switchframe.

While here, reorder switchframe so that we can shave off a few
instructions when restoring it (group stack registers at the end, make
sure that last and first registers are safe to load/store in delay
slots).
 1.16 01-Jun-2008  uwe Add GBR register to trapframe.
 1.15 09-Feb-2007  ad branches: 1.15.44; 1.15.46; 1.15.48; 1.15.50;
Merge newlock2 to head.
 1.14 11-Dec-2005  christos branches: 1.14.20;
merge ktrace-lwp.
 1.13 24-Mar-2004  wiz branches: 1.13.16;
Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.
 1.12 23-Nov-2003  uwe Implement siginfo for sh3.
 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 18-Jan-2003  thorpej branches: 1.10.2;
Merge the nathanw_sa branch.
 1.9 23-Jun-2002  thorpej When delivering a signal, don't push the signum, code, and context pointer,
or handler onto the stack. Instead, just stuff them into the correct
argument registers (handler is a "4th arg").
 1.8 09-May-2002  uch branches: 1.8.2; 1.8.6;
s/trapno/expevt/ for clarity.
 1.7 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.5 17-Mar-2002  uch cosmetic changes, fix comments.
 1.4 17-Mar-2002  uch kernel stack fix. old code simply P3 address converted to P1, it
caused memory destruction when kernel stack grow over 1 page. new
code use P3 address for kernel stack. but for the sake of debug, P1
kernel stack mode remain.
 1.3 24-Feb-2002  uch Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.
 1.2 08-Sep-2000  tsubai branches: 1.2.4;
DDB single step and stack trace support.
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.8.6.4 01-Aug-2002  nathanw Catch up to -current.
 1.8.6.3 05-Jul-2002  thorpej When delivering an upcall, invoke the upcall directly, using the
trampoline only to exit if the upcall returns.
 1.8.6.2 21-Jun-2002  thorpej Add support for scheduler activations on SuperH. Boots multi-user
on Dreamcast (SH4) with stock userland.
 1.8.6.1 09-May-2002  thorpej file frame.h was added on branch nathanw_sa on 2002-06-21 21:26:27 +0000
 1.8.2.1 17-Jul-2002  gehenna catch up with -current.
 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.13.16.1 26-Feb-2007  yamt sync with head.
 1.14.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.50.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.50.3 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.15.50.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.15.50.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.15.48.1 04-May-2009  yamt sync with head.
 1.15.46.1 04-Jun-2008  yamt sync with head
 1.15.44.2 17-Jan-2009  mjf Sync with HEAD.
 1.15.44.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.4.1 19-Oct-2008  haad Sync with HEAD.
 1.18.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.20.1 24-Feb-2012  mrg sync to -current.
 1.19.16.1 17-Apr-2012  yamt sync with head
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 15-Apr-2005  kleink 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.6 26-Oct-2003  kleink branches: 1.6.8; 1.6.14;
Use <sys/ieee754.h> where applicable.
 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 28-Feb-2002  uch branches: 1.4.12; 1.4.18;
Remove #if 0 #endif
 1.3 03-May-2001  kleink branches: 1.3.2;
There is no extended-precision format on sh3.
 1.2 02-Aug-2000  msaitoh branches: 1.2.2;
check _BYTE_ORDER instead of BYTE_ORDER
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.12;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.12.2 03-May-2001  he Pull up revision 1.3 (requested by kleink):
There is no extended-precision format on sh3.
 1.1.12.1 08-Aug-2000  msaitoh Pullup revision 1.2 (approved by thorpej):

check _BYTE_ORDER instead of BYTE_ORDER to fix namespace pollution
(and it's necessary to compile src/usr.bin/xlint/llib)
 1.1.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.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.18.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.18.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.2 28-Feb-2002  uch Remove #if 0 #endif
 1.4.12.1 28-Feb-2002  uch file ieee.h was added on branch nathanw_sa on 2002-02-28 01:58:54 +0000
 1.6.14.1 19-Apr-2005  tron Pull up revision 1.7 (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.6.8.1 29-Apr-2005  kent sync with -current
 1.7 22-Mar-2017  chs provide a common softfloat fenv implemenation and use it for softfloat builds.
restore ABI compatibility with previous releases for ieeefp.h on sh3.
add namespace.h protection for all the fenv interfaces.
use MKSOFTFLOAT on sh3 instead of assuming softfloat.
standardize on comparing MKSOFTFLOAT with "no".
remove the arm-specific softfloat fenv code (which also had several bugs).
fix logic errors in the arm hardfloat feraiseexcept() and feupdateenv().
 1.6 25-Aug-2016  christos branches: 1.6.2;
fake some stuff for softfloat.
 1.5 25-Aug-2016  christos use fenv.h
 1.4 05-Aug-2008  matt branches: 1.4.38; 1.4.58; 1.4.62;
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.3 28-Apr-2002  uch branches: 1.3.6; 1.3.114; 1.3.118; 1.3.120; 1.3.124;
Use "#define<tab>", white space nits.
 1.2 17-Mar-2002  uch cosmetic changes, fix comments.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.124.1 19-Oct-2008  haad Sync with HEAD.
 1.3.120.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.3.118.1 04-May-2009  yamt sync with head.
 1.3.114.1 28-Sep-2008  mjf Sync with HEAD.
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file ieeefp.h was added on branch nathanw_sa on 2002-04-28 17:10:35 +0000
 1.4.62.2 26-Apr-2017  pgoyette Resolve a couple of conflicts
 1.4.62.1 26-Apr-2017  pgoyette Sync with HEAD
 1.4.58.2 28-Aug-2017  skrll Sync with HEAD
 1.4.58.1 05-Oct-2016  skrll Sync with HEAD
 1.4.38.1 03-Dec-2017  jdolecek update from HEAD
 1.6.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.5 13-Aug-2014  matt Include <sys/common_int_const.h> if __INTMAX_C_SUFFIX__ is defined.
 1.4 29-May-2010  tnozaki branches: 1.4.18;
fix wrong integer promotion rule(removed U suffix from UINT{8,16}_C).
see ISO/IEC 9899:1999 7.18.4.3.
 1.3 28-Apr-2008  martin branches: 1.3.20; 1.3.22;
Remove clause 3 and 4 from TNF licenses
 1.2 28-Apr-2002  uch branches: 1.2.6; 1.2.114; 1.2.116; 1.2.118;
Use "#define<tab>", white space nits.
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.6;
Add definitions of C99 integer constant macros.
 1.1.6.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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:36 +0000
 1.2.118.2 11-Aug-2010  yamt sync with head.
 1.2.118.1 16-May-2008  yamt sync with head.
 1.2.116.1 18-May-2008  yamt sync with head.
 1.2.114.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.2.6.1 28-Apr-2002  uch file int_const.h was added on branch nathanw_sa on 2002-04-28 17:10:36 +0000
 1.3.22.1 30-May-2010  rmind sync with head
 1.3.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.18.1 03-Dec-2017  jdolecek update from HEAD
 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 28-Apr-2002  uch branches: 1.3.6; 1.3.114; 1.3.116; 1.3.118;
Use "#define<tab>", white space nits.
 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:36 +0000
 1.2.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.118.1 16-May-2008  yamt sync with head.
 1.3.116.1 18-May-2008  yamt sync with head.
 1.3.114.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file int_fmtio.h was added on branch nathanw_sa on 2002-04-28 17:10:36 +0000
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.9 13-Aug-2014  matt Include <sys/common_init_limits.h> if __SIG_ATOMIC_MAX__ is defined.
 1.8 28-Apr-2008  martin branches: 1.8.44;
Remove clause 3 and 4 from TNF licenses
 1.7 17-Oct-2007  garbled branches: 1.7.16; 1.7.18; 1.7.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.6 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.5 11-Dec-2005  christos branches: 1.5.30; 1.5.38; 1.5.44; 1.5.48; 1.5.50;
merge ktrace-lwp.
 1.4 08-May-2004  kleink branches: 1.4.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.3 28-Apr-2002  uch branches: 1.3.6; 1.3.12;
Use "#define<tab>", white space nits.
 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 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:37 +0000
 1.2.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.12.1 03-Aug-2004  skrll Sync with HEAD
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file int_limits.h was added on branch nathanw_sa on 2002-04-28 17:10:36 +0000
 1.4.12.1 03-Sep-2007  yamt sync with head.
 1.5.50.1 06-Nov-2007  matt sync with HEAD
 1.5.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.5.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.5.38.1 03-Oct-2007  garbled Sync with HEAD
 1.5.30.1 09-Oct-2007  ad Sync with head.
 1.7.20.1 16-May-2008  yamt sync with head.
 1.7.18.1 18-May-2008  yamt sync with head.
 1.7.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.44.1 03-Dec-2017  jdolecek update from HEAD
 1.6 13-Aug-2014  matt include <sys/common_int_mwgwtypes.h> if __UINT_FAST64_TYPE__ is defined.
 1.5 28-Apr-2008  martin branches: 1.5.44;
Remove clause 3 and 4 from TNF licenses
 1.4 24-Dec-2005  perry branches: 1.4.74; 1.4.76; 1.4.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 28-Apr-2002  uch branches: 1.3.6; 1.3.28;
Use "#define<tab>", white space nits.
 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:37 +0000
 1.2.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.28.1 21-Jun-2006  yamt sync with head.
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file int_mwgwtypes.h was added on branch nathanw_sa on 2002-04-28 17:10:36 +0000
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 18-May-2008  yamt sync with head.
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.44.1 03-Dec-2017  jdolecek update from HEAD
 1.9 13-Aug-2014  matt Include <sys/common_int_types.h> if __UINTPTR_TYPE__ is defined.
 1.8 24-Dec-2005  perry branches: 1.8.122;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 25-May-2005  kleink branches: 1.6.2;
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.5 07-Aug-2003  agc branches: 1.5.6; 1.5.14;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 28-Apr-2001  kleink branches: 1.4.18; 1.4.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.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.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:24:30 +0000
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.24.1 03-Aug-2004  skrll Sync with HEAD
 1.4.18.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.4.18.1 28-Apr-2001  kleink file int_types.h was added on branch nathanw_sa on 2001-04-28 15:41:33 +0000
 1.5.14.1 28-May-2005  tron Pull up revision 1.6 (requested by klein in ticket #346):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.5.6.1 29-May-2005  riz Pull up revision 1.6 (requested by kleink in ticket #1555):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.6.2.1 21-Jun-2006  yamt sync with head.
 1.8.122.1 03-Dec-2017  jdolecek update from HEAD
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 16-Aug-2005  nonaka Added SH7751{,R} integrated PCI controller support.
 1.8 29-Jun-2005  christos branches: 1.8.2;
more additions from nonaka's landisk port.
 1.7 07-Oct-2003  uwe Add definitions for IRR0 bits.
 1.6 28-Apr-2002  uch branches: 1.6.6; 1.6.12;
Use "#define<tab>", white space nits.
 1.5 24-Mar-2002  uch add SH7750S IPRD register define
 1.4 28-Feb-2002  uch Cleanup register definition
 1.3 02-Aug-2000  msaitoh branches: 1.3.4;
check _BYTE_ORDER instead of BYTE_ORDER
 1.2 16-Sep-1999  msaitoh branches: 1.2.2; 1.2.12;
remove extra Id
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

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

check _BYTE_ORDER instead of BYTE_ORDER to fix namespace pollution
(and it's necessary to compile src/usr.bin/xlint/llib)
 1.2.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.3.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.6.12.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.12.1 03-Aug-2004  skrll Sync with HEAD
 1.6.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6.6.1 28-Apr-2002  uch file intcreg.h was added on branch nathanw_sa on 2002-04-28 17:10:36 +0000
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.26 21-Mar-2009  uwe Interrupt handling changes (revision 1.23) bumped down _IPL_N to 8 for
some reason. Restore it to correct 16.

HTF did hpcsh work all this time with hd6446x_imask[_IPL_N] indexed
with IPLs 0..15 is a mistery... Discovered by accidentally triggering
hd64461 timer interrupt that is not enabled and should have been
masked.

_IPL_N used to be *also incorrect* 15 before Andy's change, which
makes one wonder if dumb luck is severly underappreciated.
 1.25 28-Apr-2008  martin branches: 1.25.8; 1.25.10; 1.25.14;
Remove clause 3 and 4 from TNF licenses
 1.24 04-Jan-2008  uwe branches: 1.24.6; 1.24.8; 1.24.10;
G/c bogus includes that do nothing but add circular dependency between
intr.h and mutex.h
 1.23 03-Dec-2007  ad branches: 1.23.6;
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.22 24-Jan-2006  uwe branches: 1.22.28; 1.22.46; 1.22.48; 1.22.54;
EVTCODE_TO_MAP_INDEX - tweak to help gcc produce better code.
 1.21 11-Dec-2005  christos branches: 1.21.2;
merge ktrace-lwp.
 1.20 16-Aug-2005  nonaka Added SH7751{,R} integrated PCI controller support.
 1.19 04-Nov-2003  uwe branches: 1.19.16;
Redo a quick hack for intc_intr_disable() and intc_intr_enable() to have
a saner interface/semantic.
 1.18 18-Oct-2003  uwe Make intc_intr_priority() return old level. While here, make the code
more compact by factoring out register update to happen in one place,
outside the switch statements.

Add intc_intr_disable() and intc_intr_enable().
 1.17 28-Apr-2002  uch branches: 1.17.6; 1.17.12;
Use "#define<tab>", white space nits.
 1.16 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.15 03-Mar-2002  uch branches: 1.15.2;
SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.14 19-Feb-2002  uch Clean up functions
disable_intr, enable_intr, disable_interrupt, enable_interrupt,
disable_ext_intr, enable_ext_intr.
New functions:
for external interrupt:
_cpu_intr_suspend and _cpu_intr_resume.
for exception:
_cpu_exception_suspend and _cpu_exception_resume.
 1.13 12-Feb-2002  uch ANSIfy KNF.
 1.12 16-Sep-2001  wiz Spell 'occurred' with two 'r's.
 1.11 13-Apr-2001  thorpej branches: 1.11.2; 1.11.4;
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.10 14-Jan-2001  thorpej branches: 1.10.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.9 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.8 21-Aug-2000  thorpej Make sure we provide splsched() as described in spl(9).
 1.7 17-Aug-2000  msaitoh add an INTEVT code for WDT
 1.6 06-Jul-2000  msaitoh make spllower() return void.
 1.5 13-Apr-2000  msaitoh branches: 1.5.4;
move the Interrput Priority Level (IPL_*) definitions into MD part.
 1.4 24-Feb-2000  msaitoh multiple interrputs!!!
 1.3 27-Dec-1999  msaitoh fix missing SCI IRQ mask/unmask code.
 1.2 14-Sep-1999  tsubai branches: 1.2.2;
Catch up with -current.
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.2.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.4.1 08-Aug-2000  msaitoh Pullup revision 1.6 (approved by thorpej):

fix the return value of the spllower() to void.
 1.10.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.11.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.11.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.1 17-Mar-2002  thorpej IPL_IMP -> IPL_VM
 1.17.12.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.12.1 03-Aug-2004  skrll Sync with HEAD
 1.17.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.17.6.1 28-Apr-2002  uch file intr.h was added on branch nathanw_sa on 2002-04-28 17:10:36 +0000
 1.19.16.3 21-Jan-2008  yamt sync with head
 1.19.16.2 07-Dec-2007  yamt sync with head
 1.19.16.1 21-Jun-2006  yamt sync with head.
 1.21.2.1 01-Feb-2006  yamt sync with head.
 1.22.54.2 18-Feb-2008  mjf Sync with HEAD.
 1.22.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.48.1 09-Jan-2008  matt sync with HEAD
 1.22.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.28.1 03-Dec-2007  ad Sync with HEAD.
 1.23.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.24.10.2 04-May-2009  yamt sync with head.
 1.24.10.1 16-May-2008  yamt sync with head.
 1.24.8.1 18-May-2008  yamt sync with head.
 1.24.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.10.1 24-Mar-2009  snj Pull up following revision(s) (requested by uwe in ticket #591):
sys/arch/sh3/include/intr.h: revision 1.26
Interrupt handling changes (revision 1.23) bumped down _IPL_N to 8 for
some reason. Restore it to correct 16.
HTF did hpcsh work all this time with hd6446x_imask[_IPL_N] indexed
with IPLs 0..15 is a mistery... Discovered by accidentally triggering
hd64461 timer interrupt that is not enabled and should have been
masked.
_IPL_N used to be *also incorrect* 15 before Andy's change, which
makes one wonder if dumb luck is severly underappreciated.
 1.25.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.15 21-Jan-2019  dholland Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
PR 53298 from Roberto E. Vargas Caballero.
 1.14 21-Apr-2014  matt branches: 1.14.26; 1.14.28;
Since all our compilers support __DBL_* and __FLT_*, use them to define
{DBL,FLT}_{DIG,MIN,MAX}
 1.13 11-Apr-2013  christos branches: 1.13.4; 1.13.8;
add missing SSIZE_MIN
 1.12 28-Mar-2012  christos branches: 1.12.2;
- Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.11 07-Jun-2010  tnozaki branches: 1.11.8; 1.11.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.10 17-Oct-2007  garbled branches: 1.10.20; 1.10.40; 1.10.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.9 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.8 11-Dec-2005  christos branches: 1.8.30; 1.8.38; 1.8.44; 1.8.48; 1.8.50;
merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 28-Apr-2003  bjh21 branches: 1.6.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.5 28-Apr-2002  uch branches: 1.5.6;
Use "#define<tab>", white space nits.
 1.4 17-Mar-2002  uch cosmetic changes, fix comments.
 1.3 08-Aug-2000  tshiozak branches: 1.3.4;
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.2 07-Mar-2000  kleink branches: 1.2.2; 1.2.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.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.2.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.3.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5.6.1 28-Apr-2002  uch file limits.h was added on branch nathanw_sa on 2002-04-28 17:10:36 +0000
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 03-Sep-2007  yamt sync with head.
 1.8.50.1 06-Nov-2007  matt sync with HEAD
 1.8.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.8.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.8.38.1 03-Oct-2007  garbled Sync with HEAD
 1.8.30.1 09-Oct-2007  ad Sync with head.
 1.10.42.1 03-Jul-2010  rmind sync with head
 1.10.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.10.20.1 11-Aug-2010  yamt sync with head.
 1.11.12.1 05-Apr-2012  mrg sync to latest -current.
 1.11.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.11.8.1 17-Apr-2012  yamt sync with head
 1.12.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.2.1 23-Jun-2013  tls resync from head
 1.13.8.1 10-Aug-2014  tls Rebase.
 1.13.4.1 18-May-2014  rmind sync with head
 1.14.28.1 10-Jun-2019  christos Sync with HEAD
 1.14.26.1 26-Jan-2019  pgoyette Sync with HEAD
 1.19 13-Feb-2022  riastradh sh3: __cpu_simple_unlock needs __insn_barrier.

No multiprocessor support here but the compiler can still reorder
memory access.
 1.18 29-Nov-2019  riastradh Nix mb_* on sh3.
 1.17 17-Sep-2017  christos branches: 1.17.4;
more const.
 1.16 13-Oct-2009  uwe branches: 1.16.22;
Fix inline asm for tas.b. "=m" is not restrictive enough and gcc may
decide to use addressing modes that tas.b does not support. 'V' is
advertised to be "non-offsettable" subset of 'm' but there's a bug in
gcc that prevents "=V" from working.

When in doubt use brute force, so pass lock pointer as "r" input and
declare "memory" as clobbered.

Landisk kernel diff is 5 instructions (register choice for lock
address in __cpu_simple_lock_try).

sys/dev/raidframe/rf_copyback.c - where old __asm triggered incorrect code
- successfully compiles (as part of sys/rump/dev/lib/libraidframe).
 1.15 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.14 17-Oct-2007  garbled branches: 1.14.16; 1.14.18; 1.14.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.13 10-Sep-2007  skrll Merge nick-csl-alignment.
 1.12 12-Mar-2007  uwe branches: 1.12.8; 1.12.12; 1.12.16; 1.12.18;
Note in that TAS.B in inline asm clobbers "cc".
Use MOVT instead of clear+rotate with carry in __cpu_simple_lock_try.
 1.11 09-Feb-2007  ad branches: 1.11.2; 1.11.6;
Merge newlock2 to head.
 1.10 03-Jan-2006  uwe branches: 1.10.18;
Nuke __P.
 1.9 28-Dec-2005  perry branches: 1.9.2;
inline -> __inline
 1.8 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 26-Sep-2003  nathanw branches: 1.6.16;
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.5 14-Feb-2003  itohy branches: 1.5.2;
- Change __cpu_simple_lock_t from int to unsigned char.
This makes simple lock work on big-endian platforms.
- Assembly-level optimization of __cpu_simple_lock_try().

OK'd by Gregory McGarry. Closes PR port-sh3/20311.
 1.4 16-Sep-2002  gmcgarry Implement CPU spinlocks. Compile-tested only.
 1.3 17-Mar-2002  uch branches: 1.3.8;
cosmetic changes, fix comments.
 1.2 02-May-2000  thorpej branches: 1.2.6; 1.2.10;
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.1 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.2.10.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.2.10.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 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 02-May-2000  bouyer file lock.h was added on branch thorpej_scsipi on 2000-11-20 20:24:30 +0000
 1.3.8.2 17-Sep-2002  nathanw Catch up to -current.
 1.3.8.1 17-Mar-2002  nathanw file lock.h was added on branch nathanw_sa on 2002-09-17 21:17:25 +0000
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.4 27-Oct-2007  yamt sync with head.
 1.6.16.3 03-Sep-2007  yamt sync with head.
 1.6.16.2 26-Feb-2007  yamt sync with head.
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 15-Jan-2006  yamt sync with head.
 1.10.18.1 01-Feb-2007  ad Get sh3 compiling.
 1.11.6.2 09-Oct-2007  ad Sync with head.
 1.11.6.1 13-Mar-2007  ad Sync with head.
 1.11.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.18.1 06-Nov-2007  matt sync with HEAD
 1.12.16.1 02-Oct-2007  joerg Sync with HEAD.
 1.12.12.1 15-Aug-2007  skrll Provide __SIMPLELOCK_{UN,}LOCKED_P and __cpu_simple_lock_{set,clear}
for all architectures.
 1.12.8.1 03-Oct-2007  garbled Sync with HEAD
 1.14.20.2 11-Mar-2010  yamt sync with head
 1.14.20.1 16-May-2008  yamt sync with head.
 1.14.18.1 18-May-2008  yamt sync with head.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.22.1 03-Dec-2017  jdolecek update from HEAD
 1.17.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.22 04-Feb-2011  uwe Since __INTR_MASK + __EXCEPTION_UNBLOCK is common sequence, provide
__INTR_MASK_EXCEPTION_UNBLOCK combo version that does stc/ldc just once.
 1.21 04-Feb-2011  uwe __EXCEPTION_ENTRY - "tst" already does logical AND, so shave off extra
"mov" and "and" and just test PSL_MD bit directly.

While here - shuffle around instructions to construct PSL_MD to break
dependencies.

While still here - only interrupt vector uses SSR and SPC as function
args, so don't bother saving them here in r4 and r5. Other vectors
don't need them and interrupt vector can just as well "stc" them
directly before exceptions are enabled.
 1.20 18-Jan-2011  joerg branches: 1.20.2;
Allow co-existance of traditional and modern CPP
 1.19 01-Jun-2008  uwe branches: 1.19.20; 1.19.26;
Add GBR register to trapframe.
 1.18 31-May-2008  uwe In __EXCEPTION_RETURN use ldc.l to shave off couple of instructions.
 1.17 28-Apr-2008  martin branches: 1.17.2;
Remove clause 3 and 4 from TNF licenses
 1.16 23-Feb-2008  uwe branches: 1.16.2; 1.16.4;
Tweak __EXCEPTION_BLOCK so that original SR value is preserved in Rm.
We can then often use just "ldc Rm, sr" instead of matching
__EXCEPTION_UNBLOCK and thus shave off a few instructions.
 1.15 17-Oct-2007  garbled branches: 1.15.12; 1.15.16;
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.14 25-Sep-2007  uwe Shave off an instruction in __EXCEPTION_UNBLOCK.
 1.13 25-Sep-2007  uwe Misc comment fixes.
 1.12 25-Sep-2007  uwe Don't expose asm macros (traditional cpp) to C code (ANSI cpp) so that
we don't have to do weird dances protecting # that indicates asm
immediate operand from being iterpreted as cpp stringification
operator.
 1.11 23-Jan-2006  uwe branches: 1.11.28; 1.11.36; 1.11.46; 1.11.48; 1.11.50;
Use cpp-safe labels.
 1.10 11-Dec-2005  christos branches: 1.10.2;
merge ktrace-lwp.
 1.9 01-Oct-2003  uwe branches: 1.9.16;
Whitespace nit.
 1.8 18-Jan-2003  thorpej branches: 1.8.2;
Merge the nathanw_sa branch.
 1.7 09-May-2002  uch branches: 1.7.6;
s/trapno/expevt/ for clarity.
 1.6 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.4 17-Mar-2002  uch cosmetic changes, fix comments.
 1.3 17-Mar-2002  uch kernel stack fix. old code simply P3 address converted to P1, it
caused memory destruction when kernel stack grow over 1 page. new
code use P3 address for kernel stack. but for the sake of debug, P1
kernel stack mode remain.
 1.2 28-Feb-2002  uch branches: 1.2.2; 1.2.8;
Change foo_r0_r1 macro in sh3/locore.h to foo(Rn, Rm)
 1.1 24-Feb-2002  uch Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.
 1.2.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 28-Feb-2002  jdolecek file locore.h was added on branch kqueue on 2002-03-16 15:59:38 +0000
 1.2.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.7.6.2 21-Jun-2002  thorpej Add support for scheduler activations on SuperH. Boots multi-user
on Dreamcast (SH4) with stock userland.
 1.7.6.1 09-May-2002  thorpej file locore.h was added on branch nathanw_sa on 2002-06-21 21:26:28 +0000
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.3 27-Feb-2008  yamt sync with head.
 1.9.16.2 27-Oct-2007  yamt sync with head.
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.10.2.1 01-Feb-2006  yamt sync with head.
 1.11.50.1 06-Oct-2007  yamt sync with head.
 1.11.48.2 23-Mar-2008  matt sync with HEAD
 1.11.48.1 06-Nov-2007  matt sync with HEAD
 1.11.46.1 02-Oct-2007  joerg Sync with HEAD.
 1.11.36.1 03-Oct-2007  garbled Sync with HEAD
 1.11.28.1 09-Oct-2007  ad Sync with head.
 1.15.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.15.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.15.12.1 24-Mar-2008  keiichi sync with head.
 1.16.4.2 04-May-2009  yamt sync with head.
 1.16.4.1 16-May-2008  yamt sync with head.
 1.16.2.2 04-Jun-2008  yamt sync with head
 1.16.2.1 18-May-2008  yamt sync with head.
 1.17.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.26.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.20.1 05-Mar-2011  rmind sync with head
 1.20.2.1 08-Feb-2011  bouyer Sync with HEAD
 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:07 +0000
 1.3 19-Feb-2002  simonb branches: 1.3.12;
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.2 05-Feb-2000  kleink branches: 1.2.6; 1.2.10;
Improve namespace test macros a bit.
 1.1 17-Jan-2000  kleink Add NAN constant glue for sh3.
 1.2.10.1 16-Mar-2002  jdolecek Catch up with -current.
 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 05-Feb-2000  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:24:30 +0000
 1.3.12.2 19-Feb-2002  simonb 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.12.1 19-Feb-2002  simonb file math.h was added on branch nathanw_sa on 2002-02-19 13:08:16 +0000
 1.17 27-Apr-2025  uwe sh3/mcontext.h: make asm-friendly, respect _LOCORE
 1.16 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.15 04-Nov-2024  christos Undo previous lwp.h change.
 1.14 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.13 18-May-2024  thorpej branches: 1.13.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.12 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.11 15-Feb-2018  kamil branches: 1.11.4;
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.10 12-Sep-2012  manu branches: 1.10.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.9 25-Feb-2011  joerg branches: 1.9.4;
Be nicer to software that insists on -ansi and use __inline.
 1.8 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.7 01-Jun-2008  uwe branches: 1.7.20; 1.7.26; 1.7.28;
Recycle unused _REG_EXPEVT slot in mcontext for _REG_GBR.

As the size of mcontext is not changed, we avoid the hassle of
versioning all the calls that use it.

_REG_EXPEVT was never used by any code in the tree. Reporting EXPEVT
makes sense only for signals and in that case we pass it to userland
in ksi_trap already which is official MI way to get this (MD) information.

Old binaries running on new kernels will now have their GBR set from
new mcontext, but that's ok too, as GBR was not properly supported by
old kernels (not saved in trapframe), so old binaries couldn't have
possibly used it anyway.
 1.6 28-Apr-2008  martin branches: 1.6.2;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.76; 1.5.78;
merge ktrace-lwp.
 1.4 22-Nov-2003  uwe Add _UC_SETSTACK, _UC_CLRSTACK flags. Add __fpr_fpul to __fpregset_t
and redefine __fpr_regs as an array of 32 ints (SH3E has 16, SH4 has
32 32-bit FP registers) to reserve the space for FPU registers - we
will properly redefine this as a union when we do support FPU.
 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-Jun-2002  thorpej branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.2 20-Jun-2002  thorpej Provide _UC_MACHINE_SP().
 1.1.2.1 20-Jun-2002  thorpej Machine-dependent kernel portion of {get,set}context(). From
Klaus Klein.
 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.78.2 04-May-2009  yamt sync with head.
 1.5.78.1 16-May-2008  yamt sync with head.
 1.5.76.2 04-Jun-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.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.7.28.1 05-Mar-2011  bouyer Sync with HEAD
 1.7.26.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.20.1 05-Mar-2011  rmind sync with head
 1.9.4.1 30-Oct-2012  yamt sync with head
 1.10.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.10.32.2 26-Feb-2018  snj revert ticket 552, which broke the build
 1.10.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.11.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.13.2.1 02-Aug-2025  perseant Sync with HEAD
 1.2 16-Sep-1999  msaitoh remove sh3/include/mmeye.h
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.11 23-Feb-2022  andvar fix various typos in comments, mainly immediatly/immediately/,
as well shared and recently fixed typos in OpenBSD code by Jonathan Grey.
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 04-Mar-2006  uwe branches: 1.9.68; 1.9.70; 1.9.72;
s/u_intN_t/uintN_t/
 1.8 24-Jan-2006  uwe branches: 1.8.2; 1.8.4;
Consistently apply ifdef logic so that in SH3-only or SH4-only kernel
all references to CPU cpecific functions are direct, and unused hooks
are not defined.
 1.7 23-Jan-2006  uwe Delclare __sh_PTEH for SH3 && SH4 case.
 1.6 23-Jan-2006  uwe Fix sh_tlb_update signature for SH3 && SH4 case.
 1.5 09-May-2002  uch branches: 1.5.6; 1.5.28; 1.5.40;
remove obsoleted functions. add sh_tlb_update() for update TLB.
MMU mode is changed to multiple virtual storage mode for new pmap code.
 1.4 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3 28-Feb-2002  uch branches: 1.3.2; 1.3.8;
Cleanup register definition
 1.2 22-Feb-2002  uch New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.
 1.1 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.3.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.1 28-Feb-2002  jdolecek file mmu.h was added on branch kqueue on 2002-03-16 15:59:38 +0000
 1.3.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.5.40.1 01-Feb-2006  yamt sync with head.
 1.5.28.1 21-Jun-2006  yamt sync with head.
 1.5.6.2 09-May-2002  uch remove obsoleted functions. add sh_tlb_update() for update TLB.
MMU mode is changed to multiple virtual storage mode for new pmap code.
 1.5.6.1 09-May-2002  uch file mmu.h was added on branch nathanw_sa on 2002-05-09 12:27:05 +0000
 1.8.4.1 22-Apr-2006  simonb Sync with head.
 1.8.2.1 09-Sep-2006  rpaulo sync with head
 1.9.72.1 16-May-2008  yamt sync with head.
 1.9.70.1 18-May-2008  yamt sync with head.
 1.9.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 04-Mar-2006  uwe branches: 1.6.68; 1.6.70; 1.6.72;
s/u_intN_t/uintN_t/
 1.5 24-Dec-2005  perry branches: 1.5.4; 1.5.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.4 09-May-2002  uch branches: 1.4.6; 1.4.28;
fix ASID mask define
 1.3 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.2 28-Feb-2002  uch branches: 1.2.2; 1.2.8;
Cleanup register definition
 1.1 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.2.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 28-Feb-2002  jdolecek file mmu_sh3.h was added on branch kqueue on 2002-03-16 15:59:38 +0000
 1.2.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.4.28.1 21-Jun-2006  yamt sync with head.
 1.4.6.2 09-May-2002  uch fix ASID mask define
 1.4.6.1 09-May-2002  uch file mmu_sh3.h was added on branch nathanw_sa on 2002-05-09 12:26:17 +0000
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.72.1 16-May-2008  yamt sync with head.
 1.6.70.1 18-May-2008  yamt sync with head.
 1.6.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.8 28-Apr-2023  andvar fix few typos and grammar in comments.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 04-Mar-2006  uwe branches: 1.6.68; 1.6.70; 1.6.72;
s/u_intN_t/uintN_t/
 1.5 24-Dec-2005  perry branches: 1.5.4; 1.5.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.4 09-May-2002  uch branches: 1.4.6; 1.4.28;
fix ASID mask define
 1.3 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.2 28-Feb-2002  uch branches: 1.2.2; 1.2.8;
Cleanup register definition
 1.1 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.2.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 28-Feb-2002  jdolecek file mmu_sh4.h was added on branch kqueue on 2002-03-16 15:59:38 +0000
 1.2.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.4.28.1 21-Jun-2006  yamt sync with head.
 1.4.6.2 09-May-2002  uch fix ASID mask define
 1.4.6.1 09-May-2002  uch file mmu_sh4.h was added on branch nathanw_sa on 2002-05-09 12:26:17 +0000
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.72.1 16-May-2008  yamt sync with head.
 1.6.70.1 18-May-2008  yamt sync with head.
 1.6.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.8 28-Feb-2002  uch branches: 1.8.10;
Cleanup register definition
 1.7 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.6 11-Feb-2002  uch add defines
 1.5 08-Feb-2002  uch add SH3/SH4 namespace free defines.
 1.4 04-Sep-2000  msaitoh branches: 1.4.4;
- move MMUCR_VALIDBITS definition into mmureg.h.
- access correct address in cacheflush().
 1.3 20-Mar-2000  msaitoh move MMUCR register definitions into mmureg.h
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
remove extra Id
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.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.4.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.8.10.2 28-Feb-2002  uch Cleanup register definition
 1.8.10.1 28-Feb-2002  uch file mmureg.h was added on branch nathanw_sa on 2002-02-28 01:56:58 +0000
 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 25-Aug-2021  thorpej branches: 1.11.4;
- In kern_mutex.c, if MUTEX_CAS() is not defined, define it in terms of
atomic_cas_ulong().
- For arm, ia64, m68k, mips, or1k, riscv, vax: don't define our own
MUTEX_CAS(), as they either use atomic_cas_ulong() or equivalent
(atomic_cas_uint() on m68k).
- For alpha and sparc64, don't define MUTEX_CAS() in terms of their own
_lock_cas(), which has its own memory barriers; the call sites in
kern_mutex.c already have the appropriate memory barrier calls. Thus,
alpha and sparc64 can use default definition.
- For sh3, don't define MUTEX_CAS() in terms of its own _lock_cas();
atomic_cas_ulong() is strong-aliased to _lock_cas(), therefore defining
our own MUTEX_CAS() is redundant.

Per thread:
https://mail-index.netbsd.org/tech-kern/2021/07/25/msg027562.html
 1.10 29-Nov-2019  riastradh Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.9 28-Apr-2008  martin branches: 1.9.88;
Remove clause 3 and 4 from TNF licenses
 1.8 29-Nov-2007  ad branches: 1.8.14; 1.8.16; 1.8.18;
Pending review by uwe@:

- Make _lock_cas() do "compare and swap", not "compare and set".
- Add aliases for atomic_cas_ulong() and friends.
 1.7 21-Nov-2007  yamt make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.6 14-Mar-2007  uwe branches: 1.6.14; 1.6.16; 1.6.20; 1.6.22;
Implement fast-path mutex_enter and mutex_exit stubs.
 1.5 12-Mar-2007  uwe branches: 1.5.2;
Use simple mutexes. This file is effectively a copy of arm's one now.
 1.4 22-Feb-2007  uwe branches: 1.4.2; 1.4.6;
Undef __HAVE_MUTEX_STUBS, there are no mutex stubs yet.
 1.3 15-Feb-2007  ad branches: 1.3.2;
Add MUTEX_CLEAR_WAITERS().
 1.2 09-Feb-2007  ad Merge newlock2 to head.
 1.1 01-Feb-2007  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.2 02-Feb-2007  ad Fix declarations. Spotted by uebayasi.
 1.1.2.1 01-Feb-2007  ad Get sh3 compiling.
 1.3.2.3 24-Mar-2007  yamt sync with head.
 1.3.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.3.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.4.6.3 03-Dec-2007  ad Sync with HEAD.
 1.4.6.2 10-Apr-2007  ad Sync with head.
 1.4.6.1 13-Mar-2007  ad Sync with head.
 1.4.2.4 07-Dec-2007  yamt sync with head
 1.4.2.3 03-Sep-2007  yamt sync with head.
 1.4.2.2 26-Feb-2007  yamt sync with head.
 1.4.2.1 22-Feb-2007  yamt file mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:06 +0000
 1.5.2.1 11-Jul-2007  mjf Sync with head.
 1.6.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.20.1 21-Nov-2007  bouyer Sync with HEAD
 1.6.16.1 09-Jan-2008  matt sync with HEAD
 1.6.14.2 03-Dec-2007  joerg Sync with HEAD.
 1.6.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.8.18.1 16-May-2008  yamt sync with head.
 1.8.16.1 18-May-2008  yamt sync with head.
 1.8.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.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.26 31-May-2021  simonb Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.25 01-May-2020  isaki branches: 1.25.6;
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.24 07-Jan-2019  jdolecek branches: 1.24.4;
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.23 10-Feb-2012  para branches: 1.23.46; 1.23.48;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.22 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.21 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.20 08-Feb-2010  joerg branches: 1.20.10; 1.20.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.19 26-Oct-2007  uwe branches: 1.19.20; 1.19.40;
We don't need MIN_LWP_ALIGNMENT.
 1.18 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.17 23-Sep-2007  pooka branches: 1.17.2;
include machine/cpu.h instead of sh3/cpu.h. Effectively it's the
same, but makes rump build on sh3 platforms.
 1.16 09-Feb-2007  ad branches: 1.16.6; 1.16.14; 1.16.22; 1.16.24; 1.16.26;
Merge newlock2 to head.
 1.15 28-Aug-2006  yamt branches: 1.15.2;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.8;
merge ktrace-lwp.
 1.13 24-Mar-2004  wiz branches: 1.13.16;
Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.
 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 09-May-2002  uch branches: 1.11.6; 1.11.12;
new pmap designed for SH3/SH4.
 1.10 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.9 17-Mar-2002  uch kernel stack fix. old code simply P3 address converted to P1, it
caused memory destruction when kernel stack grow over 1 page. new
code use P3 address for kernel stack. but for the sake of debug, P1
kernel stack mode remain.
 1.8 10-Mar-2002  uch common part are moved to sh3/include/param.h
 1.7 28-Feb-2002  uch Remove #if 0 #endif
 1.6 26-Feb-2002  simonb 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.5 04-Jan-2001  itojun branches: 1.5.4;
split MACHINE_ARCH sh3e[lb]. userland build still needs checking.
 1.4 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.3 11-Feb-2000  thorpej branches: 1.3.4;
Update for the NKMEMPAGES changes.
 1.2 04-Dec-1999  ragge CL* discarding.
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.8;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.8.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.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.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.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.3.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.5.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.11.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.12.1 03-Aug-2004  skrll Sync with HEAD
 1.11.6.2 09-May-2002  uch new pmap designed for SH3/SH4.
 1.11.6.1 09-May-2002  uch file param.h was added on branch nathanw_sa on 2002-05-09 12:28:09 +0000
 1.13.16.3 27-Oct-2007  yamt sync with head.
 1.13.16.2 26-Feb-2007  yamt sync with head.
 1.13.16.1 30-Dec-2006  yamt sync with head.
 1.14.8.1 03-Sep-2006  yamt sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.2.1 01-Feb-2007  ad Get sh3 compiling.
 1.16.26.1 06-Oct-2007  yamt sync with head.
 1.16.24.1 06-Nov-2007  matt sync with HEAD
 1.16.22.2 28-Oct-2007  joerg Sync with HEAD.
 1.16.22.1 02-Oct-2007  joerg Sync with HEAD.
 1.16.14.1 03-Oct-2007  garbled Sync with HEAD
 1.16.6.2 03-Dec-2007  ad Sync with HEAD.
 1.16.6.1 09-Oct-2007  ad Sync with head.
 1.17.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.19.40.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.19.20.1 11-Mar-2010  yamt sync with head
 1.20.14.1 18-Feb-2012  mrg merge to -current.
 1.20.10.1 17-Apr-2012  yamt sync with head
 1.23.48.1 10-Jun-2019  christos Sync with HEAD
 1.23.46.1 18-Jan-2019  pgoyette Synch with HEAD
 1.24.4.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.25.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.10 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.9 28-Apr-2008  martin branches: 1.9.88;
Remove clause 3 and 4 from TNF licenses
 1.8 04-Mar-2007  christos branches: 1.8.40; 1.8.42; 1.8.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 09-May-2002  uch branches: 1.7.6; 1.7.28; 1.7.66;
new pmap designed for SH3/SH4.
 1.6 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5 17-Mar-2002  uch cosmetic changes, fix comments.
 1.4 17-Mar-2002  uch kernel stack fix. old code simply P3 address converted to P1, it
caused memory destruction when kernel stack grow over 1 page. new
code use P3 address for kernel stack. but for the sake of debug, P1
kernel stack mode remain.
 1.3 03-Mar-2002  uch SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.2 14-Sep-1999  tsubai branches: 1.2.16;
Catch up with -current.
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.7.66.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.28.1 03-Sep-2007  yamt sync with head.
 1.7.6.2 09-May-2002  uch new pmap designed for SH3/SH4.
 1.7.6.1 09-May-2002  uch file pcb.h was added on branch nathanw_sa on 2002-05-09 12:28:09 +0000
 1.8.44.1 16-May-2008  yamt sync with head.
 1.8.42.1 18-May-2008  yamt sync with head.
 1.8.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.88.1 10-Jun-2019  christos Sync with HEAD
 1.3 21-Jan-2012  nonaka fix my license notice.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.114; 1.2.118;
merge ktrace-lwp.
 1.1 16-Aug-2005  nonaka branches: 1.1.6;
Added SH7751{,R} integrated PCI controller support.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 16-Aug-2005  skrll file pcicreg.h was added on branch ktrace-lwp on 2005-11-10 13:58:38 +0000
 1.2.118.1 18-Feb-2012  mrg merge to -current.
 1.2.114.1 17-Apr-2012  yamt sync with head
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file pcicreg.h was added on branch yamt-lazymbuf on 2006-06-21 14:55:31 +0000
 1.2 24-Feb-2002  uch branches: 1.2.10;
remove obsolete file.
 1.1 01-Feb-2002  uch branches: 1.1.2;
if PCLOCK isn't setted, use estimated value calculated by kernel.
 1.1.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 01-Feb-2002  jdolecek file pclock.h was added on branch kqueue on 2002-02-11 20:09:01 +0000
 1.2.10.2 24-Feb-2002  uch remove obsolete file.
 1.2.10.1 24-Feb-2002  uch file pclock.h was added on branch nathanw_sa on 2002-02-24 18:13:07 +0000
 1.6 28-Apr-2002  uch branches: 1.6.6;
Use "#define<tab>", white space nits.
 1.5 17-Mar-2002  uch cosmetic changes, fix comments.
 1.4 28-Feb-2002  uch Cleanup register definition
 1.3 21-Feb-2001  uch branches: 1.3.4;
add SH7709/SH7709A I/O port register define
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
remove extra Id
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.2.1 12-Mar-2001  bouyer Sync with HEAD.
 1.3.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.6.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6.6.1 28-Apr-2002  uch file pfcreg.h was added on branch nathanw_sa on 2002-04-28 17:10:37 +0000
 1.3 28-Feb-2002  uch branches: 1.3.10;
Remove unneeded header.
 1.2 21-Sep-2001  chs fix type-o.
 1.1 13-Sep-1999  itojun branches: 1.1.14; 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.14.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.10.2 28-Feb-2002  uch Remove unneeded header.
 1.3.10.1 28-Feb-2002  uch file pio.h was added on branch nathanw_sa on 2002-02-28 01:52:29 +0000
 1.37 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.36 03-Sep-2016  christos branches: 1.36.16;
Fix pmap_prefer for topdown and turn topdown on.
 1.35 14-Nov-2010  uebayasi branches: 1.35.18; 1.35.36;
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.34 21-Oct-2009  rmind branches: 1.34.2; 1.34.4;
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.33 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.32 28-Apr-2008  martin branches: 1.32.6; 1.32.8;
Remove clause 3 and 4 from TNF licenses
 1.31 21-Mar-2007  uwe branches: 1.31.34; 1.31.36; 1.31.38;
There are only 32 bits in a VA, not 33 - sync comment with this harsh reality.
 1.30 21-Feb-2007  thorpej branches: 1.30.4; 1.30.6; 1.30.8;
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.29 24-Sep-2006  tsutsui branches: 1.29.4;
Allow shared PV mappings in pmap_enter(9) even on SH4 if VAs of shared pages
have the same virtual cache indexes (i.e. they won't cause virtual cache
aliases). Also prepare PMAP_PREFER(9) for SH4 to avoid some possible virtual
cache aliases.
More stuff should be added in pmap_enter(9), but at least this changes
should fix some existing problems. See discussion on port-sh3 ML for details.

OK'ed by uwe and chs, and closes PR port-sh3/34243.
 1.28 10-Apr-2006  uwe branches: 1.28.8; 1.28.10;
Decorate pmap_remove_all() with /* ARGSUSED */
 1.27 16-Feb-2006  perry branches: 1.27.2; 1.27.4; 1.27.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.26 24-Dec-2005  perry branches: 1.26.2; 1.26.4; 1.26.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.25 22-Sep-2002  chs branches: 1.25.22;
it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.24 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.23 09-May-2002  uch branches: 1.23.6;
new pmap designed for SH3/SH4.
 1.22 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.21 04-Apr-2002  uch remove obsolete functions, decralations and structure.
 1.20 03-Apr-2002  msaitoh sync with i386/include/pmap.h rev. 1.45:

make dangerous pmap_copy() and pmap_move() no-op.
 1.19 03-Mar-2002  uch SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.18 28-Feb-2002  uch Remove #if 0 #endif
 1.17 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.16 12-Feb-2002  uch ANSIfy KNF.
 1.15 11-Feb-2002  uch clean up redundant PTE PG_* defines.
PG_RO -> PG_KR
PG_RW -> PG_KW
PG_u -> PG_URKR
PG_PROT -> PG_UW
PG_AVAIL1 -> PG_PVLIST
 1.14 10-Sep-2001  chris 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.13 26-May-2001  chs branches: 1.13.2; 1.13.4;
replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.12 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.11 22-Apr-2001  uch make this compile again under SH4
 1.10 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.9 21-Apr-2001  thorpej pmap_update() should not be equated with "flush entire TLB", it is
used to process deferred pmap operations. Since these pmaps don't
defer anything, pmap_update() is a noop.
 1.8 19-Feb-2001  msaitoh branches: 1.8.2;
temporary fix a serious pmap problem with dummy PMAP_{MAP,UNMAP}_POOLPAGE().

To fix correctly, set IOM_RAM_BEGIN with P0 addr instead of P1 addr and
fix machdep.c and pmap.c.
 1.7 02-Feb-2001  thorpej Rewrite how mod/ref emulation is done. In particular, make
modified attribute checking actually work. Previously, a
page could be reported as modified even if it wasn't! This
is very bad, and e.g. caused the VM system to attempt to
"clean" pages of read-only files.

Only lip-services is paid to referenced attribute emulation.
This could be improved.
 1.6 28-Sep-2000  is We do wired page accounting. Tell UVM about this.
 1.5 25-Apr-2000  tsubai branches: 1.5.4;
Use P1SEG to map pool pages.
 1.4 24-Feb-2000  msaitoh SH4!
 1.3 14-Jan-2000  msaitoh remove SH3_PHYS_TO_P1SEG macro
 1.2 14-Sep-1999  tsubai branches: 1.2.2;
Catch up with -current.
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.2.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.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.4.1 28-Sep-2000  is Pullup from -current, requested by is, approved by thorpej:

sys/arch/arm32/include/pmap.h 1.18
sys/arch/atari/include/pmap.h 1.21
sys/arch/i386/include/pmap.h 1.50
sys/arch/pc532/include/pmap.h 1.29
sys/arch/sh3/include/pmap.h 1.6

These are architectures that do implemented wired page accounting;
advertize it to UVM, so that mlock() from non-root processes works.
 1.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.13.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.13.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.13.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.23.6.2 18-Oct-2002  nathanw Catch up to -current.
 1.23.6.1 09-May-2002  nathanw file pmap.h was added on branch nathanw_sa on 2002-10-18 02:39:44 +0000
 1.25.22.4 03-Sep-2007  yamt sync with head.
 1.25.22.3 26-Feb-2007  yamt sync with head.
 1.25.22.2 30-Dec-2006  yamt sync with head.
 1.25.22.1 21-Jun-2006  yamt sync with head.
 1.26.6.1 22-Apr-2006  simonb Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.26.2.1 18-Feb-2006  yamt sync with head.
 1.27.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.27.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.27.2.1 11-Apr-2006  yamt sync with head
 1.28.10.1 22-Oct-2006  yamt sync with head
 1.28.8.1 18-Nov-2006  ad Sync with head.
 1.29.4.2 24-Mar-2007  yamt sync with head.
 1.29.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.30.8.1 29-Mar-2007  reinoud Pullup to -current
 1.30.6.1 11-Jul-2007  mjf Sync with head.
 1.30.4.1 10-Apr-2007  ad Sync with head.
 1.31.38.3 11-Mar-2010  yamt sync with head
 1.31.38.2 04-May-2009  yamt sync with head.
 1.31.38.1 16-May-2008  yamt sync with head.
 1.31.36.1 18-May-2008  yamt sync with head.
 1.31.34.2 17-Jan-2009  mjf Sync with HEAD.
 1.31.34.1 02-Jun-2008  mjf Sync with HEAD.
 1.32.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.32.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.34.4.1 05-Mar-2011  rmind sync with head
 1.34.2.1 16-Nov-2010  uebayasi Sync with HEAD.
 1.35.36.1 05-Oct-2016  skrll Sync with HEAD
 1.35.18.1 03-Dec-2017  jdolecek update from HEAD
 1.36.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 14-Sep-1999  tsubai Catch up with -current.
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.4 30-Jul-2020  uwe Publicly declare st40_pmb_init().
 1.3 30-Jul-2020  uwe ST40_PMB_DA_BITS - all values for the non-continuous size field.

Size field has two reserved bits in the middle. Don't depend on them
being zero, they can be defined in future versions. Provide exhaustive
list with all possibile "filler" bits in the middle so that we
correctly report the size field value regardless of the unrelated bits.
 1.2 30-Jul-2020  uwe Add snprintb formats. Fix PASCR name.
 1.1 25-Jul-2020  uwe Definitions for ST40 Privileged Mapping Buffer.
 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:39:49 +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 13:45:53 +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:51 +0000
 1.18 08-Jan-2019  jdolecek remove <machine/param.h> include, nothing from it is actually used here
 1.17 08-Jul-2012  dsl branches: 1.17.38; 1.17.40;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.
 1.16 26-Jan-2011  uwe branches: 1.16.4;
Add MDP_SSTEP flag. Not used yet.
 1.15 14-Jan-2011  rmind branches: 1.15.2; 1.15.4;
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.14 21-Nov-2009  rmind branches: 1.14.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.
 1.13 15-Feb-2008  uwe branches: 1.13.10;
G/c vestiges of curpute hack that was obsoleted by the fast TLB miss handler.
 1.12 09-Feb-2007  ad branches: 1.12.24; 1.12.30;
Merge newlock2 to head.
 1.11 11-Oct-2006  he Forward-declare "struct lwp" before using it in an argument declaration.
Gets rid of a recurring lint warning whenever this file is included.
 1.10 11-Dec-2005  christos branches: 1.10.20; 1.10.22;
merge ktrace-lwp.
 1.9 10-Jul-2005  uwe Implement syscall_intern for sh3.
 1.8 10-Jul-2005  uwe Cosmetic: use uintN_t, drop leading underscores from the volatile
keyword, use extern in function declarations.
 1.7 24-Mar-2004  wiz branches: 1.7.16;
Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 18-Jan-2003  thorpej branches: 1.5.2;
Merge the nathanw_sa branch.
 1.4 09-May-2002  uch branches: 1.4.6;
new pmap designed for SH3/SH4.
 1.3 17-Mar-2002  uch kernel stack fix. old code simply P3 address converted to P1, it
caused memory destruction when kernel stack grow over 1 page. new
code use P3 address for kernel stack. but for the sake of debug, P1
kernel stack mode remain.
 1.2 10-Mar-2002  uch proc0 and page table intialize routines are moved to sh3_machdep.c
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.6.3 22-Jun-2002  thorpej Include <machine/param.h> for UPAGES.
 1.4.6.2 21-Jun-2002  thorpej Add support for scheduler activations on SuperH. Boots multi-user
on Dreamcast (SH4) with stock userland.
 1.4.6.1 09-May-2002  thorpej file proc.h was added on branch nathanw_sa on 2002-06-21 21:26:28 +0000
 1.5.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.4 27-Feb-2008  yamt sync with head.
 1.7.16.3 26-Feb-2007  yamt sync with head.
 1.7.16.2 30-Dec-2006  yamt sync with head.
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.10.22.1 22-Oct-2006  yamt sync with head
 1.10.20.2 01-Feb-2007  ad Get sh3 compiling.
 1.10.20.1 18-Nov-2006  ad Sync with head.
 1.12.30.1 18-Feb-2008  mjf Sync with HEAD.
 1.12.24.1 23-Mar-2008  matt sync with HEAD
 1.13.10.1 11-Mar-2010  yamt sync with head
 1.14.4.1 05-Mar-2011  rmind sync with head
 1.15.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.15.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.4.1 30-Oct-2012  yamt sync with head
 1.17.40.1 10-Jun-2019  christos Sync with HEAD
 1.17.38.1 18-Jan-2019  pgoyette Synch with HEAD
 1.6 26-Jul-2022  andvar s/fucntion/function/ in comments.
 1.5 26-Oct-2006  uwe Fix __mcount to use bsrf to call _mcount. We know it's in the same
module (in the same file even), so we know the offset at link time and
don't need a reloc. This kills the last text relocation in the sh3
libc.so.

While here, tweak the code slightly to put delay slots into use.
 1.4 28-Apr-2002  uch branches: 1.4.6; 1.4.28; 1.4.58; 1.4.60;
Use "#define<tab>", white space nits.
 1.3 04-Feb-2002  thorpej Fix for ELF + __NO_LEADING_UNDERSCORES__.
 1.2 22-Aug-2000  tsubai branches: 1.2.4;
MD part of mcount.
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.60.1 10-Dec-2006  yamt sync with head.
 1.4.58.1 18-Nov-2006  ad Sync with head.
 1.4.28.1 30-Dec-2006  yamt sync with head.
 1.4.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.4.6.1 28-Apr-2002  uch file profile.h was added on branch nathanw_sa on 2002-04-28 17:10:37 +0000
 1.13 27-Jun-2025  andvar Fix various typos, mainly in comments.
 1.12 03-Aug-2020  uwe branches: 1.12.26;
_cpu_exception_suspend - return old SR

In a typical use case we do a very short code sequence with PSL_BL set
and restore the old PSL_BL value with _cpu_exception_resume that does
the full read/mask/set dance. In reality we are just restoring SR to
its old state as no other modifications to SR can possibly happen. So
return old SR and let the caller restore it in one instruction.
 1.11 26-Jan-2011  uwe Add sh4 PSL_FD - FPU disable bit.
 1.10 04-Jan-2008  uwe branches: 1.10.32; 1.10.38; 1.10.40;
There's no need to pull in machine/intr.h here.
 1.9 15-Oct-2006  uwe branches: 1.9.28; 1.9.34; 1.9.42;
Don't include <machine/intr.h> in asm sources.
 1.8 11-Dec-2005  christos branches: 1.8.20; 1.8.22;
merge ktrace-lwp.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 09-May-2002  uch branches: 1.6.6; 1.6.12;
remove unused macro.
 1.5 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.4 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.3 03-Mar-2002  uch SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.2 16-May-2001  msaitoh branches: 1.2.2;
sigreturn() fix (from kleink)
 1.1 13-Sep-1999  itojun branches: 1.1.12; 1.1.14;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.12.1 26-May-2001  he Pull up revision 1.2 (requested by kleink):
Validate Status Register passed from userland in sigreturn().
 1.2.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.6.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.12.1 03-Aug-2004  skrll Sync with HEAD
 1.6.6.2 09-May-2002  uch remove unused macro.
 1.6.6.1 09-May-2002  uch file psl.h was added on branch nathanw_sa on 2002-05-09 12:31:39 +0000
 1.7.16.2 21-Jan-2008  yamt sync with head
 1.7.16.1 30-Dec-2006  yamt sync with head.
 1.8.22.1 22-Oct-2006  yamt sync with head
 1.8.20.1 18-Nov-2006  ad Sync with head.
 1.9.42.1 08-Jan-2008  bouyer Sync with HEAD
 1.9.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.9.28.1 09-Jan-2008  matt sync with HEAD
 1.10.40.1 08-Feb-2011  bouyer Sync with HEAD
 1.10.38.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.32.1 05-Mar-2011  rmind sync with head
 1.12.26.1 02-Aug-2025  perseant Sync with HEAD
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 04-Mar-2006  uwe branches: 1.11.68; 1.11.70; 1.11.72;
s/u_intN_t/uintN_t/
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6;
merge ktrace-lwp.
 1.9 10-Aug-2003  chs branches: 1.9.16;
fix typos in comments.
 1.8 09-May-2002  uch branches: 1.8.6; 1.8.12;
new pmap designed for SH3/SH4.
 1.7 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6 17-Feb-2002  uch Add new MMU API. for detail, see sh3/mmu.h's comment.
 1.5 11-Feb-2002  uch change PTE PG_* bit define to support SH4 PCMCIA space attribute fully.
for detail, see pte.h.
 1.4 24-Feb-2000  msaitoh branches: 1.4.8;
SH4!
 1.3 24-Feb-2000  msaitoh G.C.
 1.2 14-Jan-2000  msaitoh write through bit (SH4)
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.4.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.8.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.12.1 03-Aug-2004  skrll Sync with HEAD
 1.8.6.2 09-May-2002  uch new pmap designed for SH3/SH4.
 1.8.6.1 09-May-2002  uch file pte.h was added on branch nathanw_sa on 2002-05-09 12:28:09 +0000
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.72.1 16-May-2008  yamt sync with head.
 1.11.70.1 18-May-2008  yamt sync with head.
 1.11.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.19 15-Oct-2020  mgorny Fix the machine-dependent ptrace requests to respect LWP number

Fix the machine-dependent ptrace register-related requests (e.g.
PT_GETXMMREGS, PT_GETXSTATE on x86) to correctly respect the LWP number
passed as the data argument. Before this change, these requests
did not operate on the requested LWP of a multithreaded program.

This change required moving ptrace_update_lwp() out of unit scope,
and changing ptrace_machdep_dorequest() function to take a pointer
to pointer as the second argument, consistently with ptrace_regs().

I am planning to extend the ATF ptrace() register tests in the future
to check for regressions in multithreaded programs, as time permits.

Reviewed by kamil.
 1.18 14-Sep-2020  mrg apply some parens to make macros safe. fixes GCC 9 sanitizer issues.
 1.17 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.16 04-Oct-2019  maya Provide PTRACE_ILLEGAL_ASM, using an illegal slot instruction
 1.15 18-Jun-2019  kamil branches: 1.15.2;
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.14 12-Apr-2017  kamil branches: 1.14.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.13 08-Apr-2017  kamil Add new ptrace(2) API: PT_SETSTEP & PT_CLEARSTEP

These operations allow to mark thread as a single-stepping one.

This allows to i.a.:
- single step and emit a signal (PT_SETSTEP & PT_CONTINUE)
- single step and trace syscall entry and exit (PT_SETSTEP & PT_SYSCALL)

The former is useful for debuggers like GDB or LLDB. The latter can be used
to singlestep a usermode kernel. These examples don't limit use-cases of
this interface.

Define PT_*STEP only for platforms defining PT_STEP.

Add new ATF tests setstep[1234].

These ptrace(2) operations first appeared in FreeBSD.

Sponsored by <The NetBSD Foundation>
 1.12 25-Sep-2015  christos branches: 1.12.2; 1.12.4;
For processors that have memory breakpoints, add macros for them to help
libproc
 1.11 15-Sep-2015  christos Provide access to pc/sp/syscall-return registers like we have for mcontext
 1.10 31-Oct-2011  uwe branches: 1.10.12; 1.10.30;
#if-0'ed defines for PT_GETFPREGS and PT_SETFPREGS. Not used yet, but
reserve the numbers as they are "leaked" to readelf(1), that has to know
them as NT_NETBSDCORE_FIRSTMACH + x (see get_netbsd_elfcore_note_type).
 1.9 28-Jan-2011  uwe Implement PT_STEP.
 1.8 27-Oct-2008  uwe branches: 1.8.14; 1.8.20; 1.8.22;
Implement PT___GETREGS40 and PT___SETREGS40 under COMPAT_40 so that
old gdb works on newer kernels.
 1.7 26-Oct-2008  uwe branches: 1.7.2;
Add r_gbr to struct reg. Provide old definition as struct __reg40.
Rename old PT_GETREG to PT___GETREG40, PT_SETREG to PT___SETREG40.
 1.6 26-Oct-2008  uwe Oops, make #endif comment properly reflect the test.
 1.5 26-Oct-2008  uwe Multiple inclusion protection.
 1.4 25-Jan-2008  skrll branches: 1.4.6; 1.4.10; 1.4.16;
Define PT_MACHDEP_STRINGS
 1.3 28-Feb-2002  uch branches: 1.3.12; 1.3.34; 1.3.96; 1.3.102;
Remove #if 0 #endif
 1.2 10-May-2000  msaitoh branches: 1.2.8;
supports single step!
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.102.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.96.1 23-Mar-2008  matt sync with HEAD
 1.3.34.1 04-Feb-2008  yamt sync with head.
 1.3.12.2 28-Feb-2002  uch Remove #if 0 #endif
 1.3.12.1 28-Feb-2002  uch file ptrace.h was added on branch nathanw_sa on 2002-02-28 01:58:54 +0000
 1.4.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.10.1 04-May-2009  yamt sync with head.
 1.4.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.22.1 08-Feb-2011  bouyer Sync with HEAD
 1.8.20.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.14.1 05-Mar-2011  rmind sync with head
 1.10.30.3 28-Aug-2017  skrll Sync with HEAD
 1.10.30.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.10.30.1 22-Sep-2015  skrll Sync with HEAD
 1.10.12.1 03-Dec-2017  jdolecek update from HEAD
 1.12.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.12.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.14.12.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.14.12.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.2.1 18-Oct-2020  martin Pull up following revision(s) (requested by kamil in ticket #1117):

sys/arch/sh3/include/ptrace.h: revision 1.19
sys/arch/amd64/amd64/process_machdep.c: revision 1.48
sys/arch/sh3/sh3/process_machdep.c: revision 1.23
sys/arch/sh3/sh3/process_machdep.c: revision 1.24
sys/arch/i386/i386/process_machdep.c: revision 1.95
sys/arch/x86/x86/fpu.c (apply patch)
sys/kern/sys_ptrace_common.c: revision 1.84
sys/arch/powerpc/powerpc/process_machdep.c: revision 1.40
sys/sys/ptrace.h: revision 1.71
sys/arch/powerpc/powerpc/process_machdep.c: revision 1.41
(all via patch, adapted)

Fix s87_tw reconstruction to correctly indicate register states

Fix the code reconstructing s87_tw (full tag word) from fx_sw (abridged
tag word) to correctly represent all register states. The previous code
only distinguished between empty/non-empty registers, and assigned
'regular value' to all non-empty registers. The new code explicitly
distinguishes the two other tag word values: empty and special.

Fix the machine-dependent ptrace register-related requests (e.g.
PT_GETXMMREGS, PT_GETXSTATE on x86) to correctly respect the LWP number
passed as the data argument. Before this change, these requests
did not operate on the requested LWP of a multithreaded program.
This change required moving ptrace_update_lwp() out of unit scope,
and changing ptrace_machdep_dorequest() function to take a pointer
to pointer as the second argument, consistently with ptrace_regs().

I am planning to extend the ATF ptrace() register tests in the future
to check for regressions in multithreaded programs, as time permits.

Reviewed by kamil.

Add missing 'error' declaration
 1.7 26-Oct-2008  uwe Fix typo in comment inherited from i386 (spotted by mjf@).
 1.6 26-Oct-2008  uwe Add r_gbr to struct reg. Provide old definition as struct __reg40.
Rename old PT_GETREG to PT___GETREG40, PT_SETREG to PT___SETREG40.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.78; 1.5.84;
merge ktrace-lwp.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 28-Apr-2002  uch branches: 1.3.6; 1.3.12;
Use "#define<tab>", white space nits.
 1.2 13-Apr-2000  msaitoh branches: 1.2.8;
exports MACH and MACL registers, too.
 1.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.12.1 03-Aug-2004  skrll Sync with HEAD
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file reg.h was added on branch nathanw_sa on 2002-04-28 17:10:37 +0000
 1.5.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.78.1 04-May-2009  yamt sync with head.
 1.5.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.11 19-Oct-2006  uwe SH_RCR2_BITS for bitmask_snprintf.
 1.10 03-Sep-2006  uwe branches: 1.10.2; 1.10.4;
Add comments to RCR1 and RCR2 bits.
 1.9 04-Mar-2006  uwe branches: 1.9.2;
s/u_intN_t/uintN_t/
 1.8 28-Apr-2002  uch branches: 1.8.6; 1.8.28; 1.8.42; 1.8.44;
Use "#define<tab>", white space nits.
 1.7 17-Mar-2002  uch cosmetic changes, fix comments.
 1.6 28-Feb-2002  uch Cleanup register definition
 1.5 22-Feb-2002  uch New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.
 1.4 22-Apr-2001  uch branches: 1.4.2;
add RTC control register 1 defines.
 1.3 21-Dec-1999  msaitoh branches: 1.3.6;
add some register definitions
 1.2 16-Sep-1999  msaitoh branches: 1.2.2; 1.2.8;
remove extra Id
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.2 23-Apr-2001  bouyer Sync with HEAD.
 1.2.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.3.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.8.44.1 22-Apr-2006  simonb Sync with head.
 1.8.42.1 09-Sep-2006  rpaulo sync with head
 1.8.28.2 30-Dec-2006  yamt sync with head.
 1.8.28.1 21-Jun-2006  yamt sync with head.
 1.8.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.8.6.1 28-Apr-2002  uch file rtcreg.h was added on branch nathanw_sa on 2002-04-28 17:10:37 +0000
 1.9.2.1 14-Sep-2006  yamt sync with head.
 1.10.4.1 22-Oct-2006  yamt sync with head
 1.10.2.1 18-Nov-2006  ad 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 29-Nov-2007  ad branches: 1.4.14; 1.4.16; 1.4.18;
Pending review by uwe@:

- Make _lock_cas() do "compare and swap", not "compare and set".
- Add aliases for atomic_cas_ulong() and friends.
 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 01-Feb-2007  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 01-Feb-2007  ad Get sh3 compiling.
 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.1 09-Jan-2008  matt sync with HEAD
 1.2.24.2 03-Dec-2007  joerg 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.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:06 +0000
 1.4.18.1 16-May-2008  yamt sync with head.
 1.4.16.1 18-May-2008  yamt sync with head.
 1.4.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.12 17-Aug-2021  andvar fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.
 1.11 28-May-2019  msaitoh s/recieve/receive/
 1.10 18-Feb-2006  uwe branches: 1.10.160;
Make _BASE visible regardless of #ifdef SHx.
Add defines for SMR bits in IrDA mode in 7709.
 1.9 14-Feb-2006  uwe Fix file comment to include the expansion for 'F' in "SCIF".
 1.8 14-Feb-2006  uwe Define scif register base(s) and offsets.
Express old defines in terms of base + offset.
Use uintN_t.
 1.7 13-Feb-2006  uwe Move/merge common defintions out of ifdef.
 1.6 11-Dec-2005  christos branches: 1.6.2; 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 29-Jun-2005  christos branches: 1.5.2;
more additions from nonaka's landisk port.
 1.4 19-May-2002  msaitoh branches: 1.4.4; 1.4.10;
fix some overflow cases.
 1.3 28-Apr-2002  uch branches: 1.3.2;
Use "#define<tab>", white space nits.
 1.2 16-Sep-1999  msaitoh branches: 1.2.16;
cleanup
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.1 30-May-2002  gehenna Catch up with -current.
 1.4.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.4.2 19-May-2002  msaitoh fix some overflow cases.
 1.4.4.1 19-May-2002  msaitoh file scifreg.h was added on branch nathanw_sa on 2002-05-19 15:10:47 +0000
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 18-Feb-2006  yamt sync with head.
 1.10.160.1 10-Jun-2019  christos Sync with HEAD
 1.10 14-May-2013  tsutsui Add a definition of SCSCMR1, smart card mode register available on 7750 etc.
 1.9 30-Apr-2009  nonaka branches: 1.9.12; 1.9.22;
Added some register definition.
 1.8 01-Jul-2003  uwe branches: 1.8.108; 1.8.122;
Correct the macro name for SCP0DT bit.
Addresses port-sh3/22025 by FURUKAWA Masashi.
 1.7 28-Apr-2002  uch branches: 1.7.6;
Use "#define<tab>", white space nits.
 1.6 26-Apr-2002  msaitoh fix around PTR and PDR
 1.5 25-Apr-2002  msaitoh add missing SCPDR_SCP0DT definition
 1.4 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.3 12-Jun-2001  wiz branches: 1.3.2;
receive, not recieve
 1.2 16-Sep-1999  msaitoh branches: 1.2.14;
cleanup
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.7.6.1 28-Apr-2002  uch file scireg.h was added on branch nathanw_sa on 2002-04-28 17:10:37 +0000
 1.8.122.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.108.1 04-May-2009  yamt sync with head.
 1.9.22.1 23-Jun-2013  tls resync from head
 1.9.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3 03-Mar-2002  uch branches: 1.3.8;
SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.2 24-Jun-2001  msaitoh branches: 1.2.2;
fix KERNELMODE() macro (check MD bits, too)
 1.1 13-Sep-1999  itojun branches: 1.1.12;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.12.1 08-Oct-2001  he Pull up revision 1.2 (requested by msaitoh):
Fix KERNELMODE macro (check MD bits too).
 1.2.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.2 03-Mar-2002  uch SR related parts moved to psl.h. cpufunc.h segments.h are removed.
kernel mode checking is only SR.MD. no check stack pointer.
 1.3.8.1 03-Mar-2002  uch file segments.h was added on branch nathanw_sa on 2002-03-03 14:31:26 +0000
 1.3 05-Jan-2006  uwe Provide defines for offsets into the jump buffer.
 1.2 28-Apr-2002  uch branches: 1.2.6; 1.2.26; 1.2.28; 1.2.40;
Use "#define<tab>", white space nits.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.40.1 15-Jan-2006  yamt sync with head.
 1.2.28.1 21-Jun-2006  yamt sync with head.
 1.2.26.1 11-Jan-2006  tron Pull up following revision(s) (requested by uwe in ticket #1098):
sys/arch/sh3/include/setjmp.h: revision 1.3
Provide defines for offsets into the jump buffer.
 1.2.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.2.6.1 28-Apr-2002  uch file setjmp.h was added on branch nathanw_sa on 2002-04-28 17:10:37 +0000
 1.3 28-Apr-2002  uch branches: 1.3.6;
Use "#define<tab>", white space nits.
 1.2 02-Aug-2000  msaitoh branches: 1.2.4;
check _BYTE_ORDER instead of BYTE_ORDER
 1.1 13-Sep-1999  itojun branches: 1.1.2; 1.1.12;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

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

check _BYTE_ORDER instead of BYTE_ORDER to fix namespace pollution
(and it's necessary to compile src/usr.bin/xlint/llib)
 1.1.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.2.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file sh_opcode.h was added on branch nathanw_sa on 2002-04-28 17:10:37 +0000
 1.3 24-Mar-2002  uch branches: 1.3.4;
shb device is integrated to sh3/dev/shb.c and clean up locators.
 1.2 12-Feb-2002  uch ANSIfy KNF.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.2 24-Mar-2002  uch shb device is integrated to sh3/dev/shb.c and clean up locators.
 1.3.4.1 24-Mar-2002  uch file shbvar.h was added on branch nathanw_sa on 2002-03-24 18:00:42 +0000
 1.17 29-Oct-2021  thorpej Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility.
 1.16 27-Oct-2021  thorpej Make sigcontext13 visible only to _KERNEL. Make sigcontext visible only
to _LIBC and _KERNEL.
 1.15 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.14 29-Nov-2017  christos need <sys/sigtypes.h> for sigset_t
 1.13 19-Nov-2008  ad branches: 1.13.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.12 11-Dec-2005  christos branches: 1.12.74; 1.12.78; 1.12.84; 1.12.86;
merge ktrace-lwp.
 1.11 10-May-2004  drochner SIGTRAMP_VALID() should not pollute the user namespace
 1.10 26-Mar-2004  drochner nothing cares about __HAVE_SIGINFO anymore, so nuke it
 1.9 25-Nov-2003  christos bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
 1.8 23-Nov-2003  uwe Implement siginfo for sh3.
 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 28-Apr-2003  bjh21 branches: 1.6.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.5 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.4 10-May-2002  uch branches: 1.4.6;
remove COMPAT_13 staff. No 1.3 release of sh3 port. these are trace of
i386 port.
 1.3 09-May-2002  uch s/trapno/expevt/ for clarity.
 1.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.6.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.4.6.1 10-May-2002  thorpej file signal.h was added on branch nathanw_sa on 2003-01-16 03:14:57 +0000
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.12.78.1 04-May-2009  yamt sync with head.
 1.12.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.13.26.1 03-Dec-2017  jdolecek update from HEAD
 1.11 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.10 03-Jul-2011  mrg add GCC 4.5 support.
 1.9 21-May-2006  uwe New stdarg.h and varargs.h based on arm and i386 versions.

Use __builtin_va_* instead of hand written code in va-sh.h that uses
LHS casts. Slightly worse code is generated by gcc 3.3.3, but LHS
casts are outlawed in gcc 3.3.6 and gcc 4.

Build-tested on hpcsh (le) and mmeye (be), run-tested on hpcsh.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.12; 1.8.14;
merge ktrace-lwp.
 1.7 05-Jan-2005  uwe branches: 1.7.10;
Fix lint stub for va_start so that lint is actually happy about it.
 1.6 28-Apr-2003  bjh21 branches: 1.6.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.5 28-Apr-2002  uch branches: 1.5.6;
Use "#define<tab>", white space nits.
 1.4 04-Feb-2002  thorpej * Make this lint'able.
* Reduce some code duplication.
 1.3 03-Feb-2000  kleink branches: 1.3.8;
Add a C99-style va_copy macro.
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
add NetBSD RCS ID
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.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.3.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5.6.1 28-Apr-2002  uch file stdarg.h was added on branch nathanw_sa on 2002-04-28 17:10:38 +0000
 1.6.2.1 17-Jan-2005  skrll Sync with HEAD.
 1.7.10.1 21-Jun-2006  yamt sync with head.
 1.8.14.1 19-Jun-2006  chap Sync with head.
 1.8.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.8.1 24-May-2006  yamt sync with head.
 1.8.6.1 01-Jun-2006  kardel Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.1 02-Mar-2018  uwe Introduce sh3/sysarch.h and add SH3_SYNC_ICACHE
 1.11 04-Mar-2006  uwe s/u_intN_t/uintN_t/
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6;
merge ktrace-lwp.
 1.9 03-Jul-2005  nonaka branches: 1.9.2;
fix timer prescaler definition.
 1.8 29-Jun-2005  christos more additions from nonaka's landisk port.
 1.7 28-Apr-2002  uch branches: 1.7.6; 1.7.12;
Use "#define<tab>", white space nits.
 1.6 28-Feb-2002  uch Cleanup register definition
 1.5 22-Feb-2002  uch New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.
 1.4 20-Mar-2000  msaitoh branches: 1.4.8;
Add the definitions of SH4's TPSC field of TCR register
(This field is not compatible with SH3's)
 1.3 17-Jan-2000  msaitoh add some bit definitions
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
cleanup
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.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.4.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.7.12.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.7.6.1 28-Apr-2002  uch file tmureg.h was added on branch nathanw_sa on 2002-04-28 17:10:38 +0000
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.4 09-May-2002  uch branches: 1.4.4;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]
 1.3 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.2 17-Mar-2002  uch change to per-process AST.
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.4.2 09-May-2002  uch rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]
 1.4.4.1 09-May-2002  uch file trap.h was added on branch nathanw_sa on 2002-05-09 12:24:21 +0000
 1.4 24-Mar-2002  uch branches: 1.4.4;
Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.3 02-Mar-2002  uch Add SH7709A INTEVT2 register define.
 1.2 28-Feb-2002  uch Cleanup register definition
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.4.2 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.4.4.1 24-Mar-2002  uch file trapreg.h was added on branch nathanw_sa on 2002-03-24 18:04:40 +0000
 1.38 30-Apr-2020  skrll G/C __HAVE_AST_PERPROC
 1.37 23-Jan-2016  christos expose the kernel types for standalone code.
 1.36 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.35 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.34 17-Jul-2011  dyoung branches: 1.34.12; 1.34.30;
Switch to new-style <sys/bus.h>.
 1.33 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.32 12-Mar-2011  joerg branches: 1.32.2;
Add TLS support for AMD64, i386 and SH3.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.31 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.30 22-Dec-2010  matt branches: 1.30.2; 1.30.4;
Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.29 11-Dec-2009  matt branches: 1.29.4;
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.28 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.27 20-Jan-2008  joerg branches: 1.27.10;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.26 17-Oct-2007  garbled branches: 1.26.2; 1.26.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.25 14-Jul-2007  ad branches: 1.25.10;
Generic soft interrupts are mandatory.
 1.24 24-Sep-2006  tsutsui branches: 1.24.8; 1.24.16;
Add timecounter support for SH3 ports. From gdamore on port-sh3,
with several minor fixes by me.

Previously sh3 ports use two timers (TMU1 and TMU2) as oneshot timer
to cause real hardware interrupts by softintr(9), but now softintr(9)
uses only TMU1 and TMU2 is configured as freerunning counter for
timecounter(9).

Tested on my dreamcast.
 1.23 20-Sep-2006  uwe Switch the rest of sh3 ports to todr(9)
Split code to handle on-chip rtc into a separate driver
Eliminate all todr code from clock.c
Move __HAVE_GENERIC_TODR to sh3/include/types.h
 1.22 11-Dec-2005  christos branches: 1.22.20; 1.22.22;
merge ktrace-lwp.
 1.21 10-Jul-2005  uwe Implement syscall_intern for sh3.
 1.20 10-Jul-2005  uwe Cosmetic: drop leading underscores from the volatile keyword.
 1.19 18-Jan-2005  chs branches: 1.19.8;
sh3 no longer abuses cf_unit.
 1.18 18-Jan-2004  martin branches: 1.18.8;
Do not export __HAVE_RAS to userland. Applications are supposed to try
rasctl() and detect failure with EOPNOTSUPP.
 1.17 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.16 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.15 28-Apr-2003  bjh21 branches: 1.15.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.14 16-Dec-2002  thorpej Add support for RAS (initially added by me on nathanw_sa branch).
 1.13 16-Dec-2002  thorpej Use MI setrunqueue()/remrunqueue().
 1.12 22-Sep-2002  simonb Use "#define\t" instead of "#define ".
 1.11 22-Sep-2002  gmcgarry Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives.
 1.10 28-Apr-2002  uch branches: 1.10.6;
Use "#define<tab>", white space nits.
 1.9 24-Mar-2002  uch Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.
 1.8 17-Mar-2002  uch cosmetic changes, fix comments.
 1.7 17-Mar-2002  uch change to per-process AST.
 1.6 28-Feb-2002  simonb Use "#define<tab>".
 1.5 28-Apr-2001  kleink branches: 1.5.2;
* 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.4 03-Jan-2001  takemura branches: 1.4.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.3 04-Sep-2000  tsubai Correct label_t size.
 1.2 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.1 13-Sep-1999  itojun branches: 1.1.2;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.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.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.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.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.10.6.4 16-Dec-2002  thorpej Sync with HEAD.
 1.10.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.6.2 07-Oct-2002  thorpej Add support for restartable atomic sequences.
 1.10.6.1 28-Apr-2002  thorpej file types.h was added on branch nathanw_sa on 2002-10-07 03:11:03 +0000
 1.15.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.8.1 29-Apr-2005  kent sync with -current
 1.19.8.4 21-Jan-2008  yamt sync with head
 1.19.8.3 03-Sep-2007  yamt sync with head.
 1.19.8.2 30-Dec-2006  yamt sync with head.
 1.19.8.1 21-Jun-2006  yamt sync with head.
 1.22.22.1 22-Oct-2006  yamt sync with head
 1.22.20.1 18-Nov-2006  ad Sync with head.
 1.24.16.1 03-Oct-2007  garbled Sync with HEAD
 1.24.8.1 15-Jul-2007  ad Sync with head.
 1.25.10.2 23-Mar-2008  matt sync with HEAD
 1.25.10.1 06-Nov-2007  matt sync with HEAD
 1.26.8.1 23-Jan-2008  bouyer Sync with HEAD.
 1.26.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.27.10.1 11-Mar-2010  yamt sync with head
 1.29.4.3 21-Apr-2011  rmind sync with head
 1.29.4.2 05-Mar-2011  rmind sync with head
 1.29.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.30.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.30.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.34.30.2 19-Mar-2016  skrll Sync with HEAD
 1.34.30.1 22-Sep-2015  skrll Sync with HEAD
 1.34.12.1 03-Dec-2017  jdolecek update from HEAD
 1.5 06-Jun-2008  uwe Provide defines for bits we use.
 1.4 04-Mar-2006  uwe branches: 1.4.68; 1.4.70; 1.4.72; 1.4.74;
s/u_intN_t/uintN_t/
 1.3 28-Apr-2002  uch branches: 1.3.6; 1.3.28; 1.3.42; 1.3.44;
Use "#define<tab>", white space nits.
 1.2 28-Feb-2002  uch Cleanup register definition
 1.1 13-Sep-1999  itojun branches: 1.1.16;
Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.1.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.44.1 22-Apr-2006  simonb Sync with head.
 1.3.42.1 09-Sep-2006  rpaulo sync with head
 1.3.28.1 21-Jun-2006  yamt sync with head.
 1.3.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.3.6.1 28-Apr-2002  uch file ubcreg.h was added on branch nathanw_sa on 2002-04-28 17:10:38 +0000
 1.4.74.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.72.1 04-May-2009  yamt sync with head.
 1.4.70.1 17-Jun-2008  yamt sync with head.
 1.4.68.1 29-Jun-2008  mjf Sync with HEAD.
 1.18 07-Jan-2020  skrll Fix indentation. NFCI
 1.17 01-Dec-2019  ad sh3: make ASTs work as expected, and fix a few things in the TLB refill path.
With help from uwe@ and martin@.
 1.16 30-Nov-2019  ad Revert previous. Looks like it requires a more extensive fix.
 1.15 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.14 02-Nov-2016  pgoyette branches: 1.14.16;
* Split sys/kern/sys_process.c into three parts:
1 - ptrace(2) syscall for native emulation
2 - common ptrace(2) syscall code (shared with compat_netbsd32)
3 - support routines that are shared with PROCFS and/or KTRACE

* Add module glue for #1 and #2. Both modules will be built-in to the
kernel if "options PTRACE" is included in the config file (this is
the default, defined in sys/conf/std).

* Mark the ptrace(2) syscall as modular in syscalls.master (generated
files will be committed shortly).

* Conditionalize all remaining portions of PTRACE code on a new kernel
option PTRACE_HOOKS.

XXX Instead of PROCFS depending on 'options PTRACE', we should probably
just add a procfs attribute to the sys/kern/sys_process.c file's
entry in files.kern, and add PROCFS to the "#if defineds" for
process_domem(). It's really confusing to have two different ways
of requiring this file.
 1.13 08-Jul-2012  dsl branches: 1.13.2; 1.13.16; 1.13.20;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.
 1.12 08-Feb-2011  rmind branches: 1.12.4;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.11 28-Jan-2011  uwe Implement PT_STEP.
 1.10 05-Nov-2007  ad branches: 1.10.42; 1.10.48; 1.10.50;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.9 16-Feb-2006  perry branches: 1.9.24; 1.9.42; 1.9.44; 1.9.48;
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.8 24-Dec-2005  perry branches: 1.8.2; 1.8.4; 1.8.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 31-Oct-2003  cl branches: 1.6.16;
Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.
 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 18-Jan-2003  thorpej branches: 1.4.2;
Merge the nathanw_sa branch.
 1.3 09-May-2002  uch branches: 1.3.6; 1.3.8;
remove postsig. postsig is called by ast().
 1.2 28-Apr-2002  msaitoh add missing postsig() call.
I don't know whether this is true fix or not.
 1.1 17-Mar-2002  uch branches: 1.1.4;
change to per-process AST.
 1.1.4.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.4.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.1 09-May-2002  jdolecek file userret.h was added on branch kqueue on 2002-06-23 17:40:45 +0000
 1.3.6.3 26-Sep-2002  nathanw Change "if (l->l_flag & L_SA_UPCALL)" to "while (l->l_flag & L_SA_UPCALL)"
in userret() functions or equivalent, to permit delivery of multiple upcalls
in a single kernel entry.

XXX It's getting crowded in here. Collapsing posting signals, upcalls, and
XXX kernel-exit handling into one mechanism would be nice.
 1.3.6.2 21-Jun-2002  thorpej Add support for scheduler activations on SuperH. Boots multi-user
on Dreamcast (SH4) with stock userland.
 1.3.6.1 09-May-2002  thorpej file userret.h was added on branch nathanw_sa on 2002-06-21 21:26:28 +0000
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 15-Nov-2007  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.8.2.1 18-Feb-2006  yamt sync with head.
 1.9.48.1 13-Nov-2007  bouyer Sync with HEAD
 1.9.44.1 06-Nov-2007  matt sync with HEAD
 1.9.42.1 06-Nov-2007  joerg Sync with HEAD.
 1.9.24.1 03-Dec-2007  ad Sync with HEAD.
 1.10.50.2 17-Feb-2011  bouyer Sync with HEAD
 1.10.50.1 08-Feb-2011  bouyer Sync with HEAD
 1.10.48.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.42.1 05-Mar-2011  rmind sync with head
 1.12.4.1 30-Oct-2012  yamt sync with head
 1.13.20.1 04-Nov-2016  pgoyette Sync with HEAD
 1.13.16.1 05-Dec-2016  skrll Sync with HEAD
 1.13.2.1 03-Dec-2017  jdolecek update from HEAD
 1.14.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7 21-May-2006  uwe Nuke va-sh.h. stdarg.h and varargs.h now use __builtin_va_*.
 1.6 31-Jan-2006  dsl branches: 1.6.2; 1.6.4; 1.6.6; 1.6.10; 1.6.12;
Change sys/arch/xxx/include/bswap.h to #include machine/byte_swap.h then
sys/bswap.h in order to pick up the MD inline routines and the constant
folding definitions in the right order.
Code can include either sys/bswap.h or machine/bswap.h with the same effect.
 1.5 28-Apr-2002  uch branches: 1.5.6; 1.5.28; 1.5.40;
Use "#define<tab>", white space nits.
 1.4 02-Aug-2000  msaitoh branches: 1.4.4;
check _BYTE_ORDER instead of BYTE_ORDER
 1.3 24-Feb-2000  msaitoh branches: 1.3.4;
include <machine/endian.h>
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
add NetBSD RCS ID
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.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.3.4.1 08-Aug-2000  msaitoh Pullup revision 1.4 (approved by thorpej):

check _BYTE_ORDER instead of BYTE_ORDER to fix namespace pollution
(and it's necessary to compile src/usr.bin/xlint/llib)
 1.4.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.40.1 01-Feb-2006  yamt sync with head.
 1.5.28.1 21-Jun-2006  yamt sync with head.
 1.5.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.5.6.1 28-Apr-2002  uch file va-sh.h was added on branch nathanw_sa on 2002-04-28 17:10:38 +0000
 1.6.12.1 19-Jun-2006  chap Sync with head.
 1.6.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.6.6.1 24-May-2006  yamt sync with head.
 1.6.4.1 01-Jun-2006  kardel Sync with head.
 1.6.2.1 09-Sep-2006  rpaulo sync with head
 1.8 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.7 21-May-2006  uwe New stdarg.h and varargs.h based on arm and i386 versions.

Use __builtin_va_* instead of hand written code in va-sh.h that uses
LHS casts. Slightly worse code is generated by gcc 3.3.3, but LHS
casts are outlawed in gcc 3.3.6 and gcc 4.

Build-tested on hpcsh (le) and mmeye (be), run-tested on hpcsh.
 1.6 28-Apr-2002  uch branches: 1.6.6; 1.6.28; 1.6.42; 1.6.44; 1.6.46; 1.6.50; 1.6.52;
Use "#define<tab>", white space nits.
 1.5 17-Mar-2002  uch cosmetic changes, fix comments.
 1.4 04-Feb-2002  thorpej * Make this lint'able.
* Reduce some code duplication.
 1.3 03-Feb-2000  kleink branches: 1.3.8;
Add a C99-style va_copy macro.
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
add NetBSD RCS ID
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.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.3.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.52.1 19-Jun-2006  chap Sync with head.
 1.6.50.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.6.46.1 24-May-2006  yamt sync with head.
 1.6.44.1 01-Jun-2006  kardel Sync with head.
 1.6.42.1 09-Sep-2006  rpaulo sync with head
 1.6.28.1 21-Jun-2006  yamt sync with head.
 1.6.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6.6.1 28-Apr-2002  uch file varargs.h was added on branch nathanw_sa on 2002-04-28 17:10:38 +0000
 1.22 03-Sep-2016  christos Fix pmap_prefer for topdown and turn topdown on.
 1.21 14-Nov-2010  uebayasi branches: 1.21.18; 1.21.36;
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.20 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.19 06-Mar-2009  joerg branches: 1.19.2; 1.19.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.18 28-Apr-2008  martin branches: 1.18.8; 1.18.14;
Remove clause 3 and 4 from TNF licenses
 1.17 04-Mar-2006  uwe branches: 1.17.68; 1.17.70; 1.17.72;
s/u_intN_t/uintN_t/
 1.16 02-Apr-2003  thorpej branches: 1.16.18; 1.16.32; 1.16.34;
Use PAGE_SIZE rather than NBPG.
 1.15 02-Apr-2003  thorpej We use 4K pages on the sh3/sh4; make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK
compile-time constants.
 1.14 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.13 09-May-2002  uch branches: 1.13.6;
new pmap designed for SH3/SH4.
 1.12 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.11 17-Mar-2002  uch cosmetic changes, fix comments.
 1.10 15-Nov-2001  soren MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.9 01-May-2001  thorpej branches: 1.9.2;
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.8 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.7 07-Feb-2001  uch branches: 1.7.2;
move VM_PHYSSEG_MAX, VM_NFREELIST, VM_FREELIST_DEFAULT defines to
machine/vmparam.h
 1.6 25-Apr-2000  tsubai GC VM_MBUF_SIZE.
 1.5 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.4 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.3 04-Dec-1999  ragge CL* discarding.
 1.2 14-Sep-1999  tsubai branches: 1.2.2; 1.2.8;
Catch up with -current.
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.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.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.9.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.6.2 11-Dec-2002  thorpej Sync with HEAD.
 1.13.6.1 09-May-2002  thorpej file vmparam.h was added on branch nathanw_sa on 2002-12-11 06:11:54 +0000
 1.16.34.1 22-Apr-2006  simonb Sync with head.
 1.16.32.1 09-Sep-2006  rpaulo sync with head
 1.16.18.1 21-Jun-2006  yamt sync with head.
 1.17.72.2 04-May-2009  yamt sync with head.
 1.17.72.1 16-May-2008  yamt sync with head.
 1.17.70.1 18-May-2008  yamt sync with head.
 1.17.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.4.1 05-Mar-2011  rmind sync with head
 1.19.2.4 16-Nov-2010  uebayasi Sync with HEAD.
 1.19.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.19.2.2 25-Feb-2010  uebayasi Make this reall build.
 1.19.2.1 23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.21.36.1 05-Oct-2016  skrll Sync with HEAD
 1.21.18.1 03-Dec-2017  jdolecek update from 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:16 +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.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 28-Apr-2002  uch branches: 1.6.6; 1.6.162; 1.6.182;
Use "#define<tab>", white space nits.
 1.5 17-Mar-2002  uch cosmetic changes, fix comments.
 1.4 12-Feb-2002  uch ANSIfy KNF.
 1.3 31-Oct-2000  msaitoh branches: 1.3.2; 1.3.6;
add interrupt mode into wdog

To use:

ioctl(fd, SIOWDOGSETMODE, &val)

val: WDOGM_RESET -> reset when counter expired
WDOGM_INTR -> print PC when counter expired (new!)

This interface is still under experimental.
 1.2 24-Feb-2000  msaitoh add RCSID and copyright
 1.1 24-Feb-2000  msaitoh watchdog timer
 1.3.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.6.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.3.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.3.2.1 31-Oct-2000  bouyer file wdogvar.h was added on branch thorpej_scsipi on 2000-11-20 20:24:31 +0000
 1.6.182.1 22-Sep-2015  skrll Sync with HEAD
 1.6.162.1 03-Dec-2017  jdolecek update from HEAD
 1.6.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.6.6.1 28-Apr-2002  uch file wdogvar.h was added on branch nathanw_sa on 2002-04-28 17:10:38 +0000
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 03-Jul-2005  uwe Make this file suitable for use in asm sources.
 1.4 28-Apr-2002  uch branches: 1.4.6; 1.4.12;
Use "#define<tab>", white space nits.
 1.3 17-Jan-2000  msaitoh branches: 1.3.8;
add some bit definitions
 1.2 16-Sep-1999  msaitoh branches: 1.2.2;
remove extra Id
 1.1 13-Sep-1999  itojun Merge in NetBSD/sh3 from cvs.kame.net repository.

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

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).
 1.2.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.3.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.12.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.2 28-Apr-2002  uch Use "#define<tab>", white space nits.
 1.4.6.1 28-Apr-2002  uch file wdtreg.h was added on branch nathanw_sa on 2002-04-28 17:10:38 +0000

RSS XML Feed