Home | History | Annotate | only in /src/sys/arch/m68k/include
History log of /src/sys/arch/m68k/include
RevisionDateAuthorComments
 1.38 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.37 04-Nov-2024  christos Undo previous lwp.h change.
 1.36 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.35 14-Jan-2024  thorpej branches: 1.35.2;
Add a common m68k interrupt dispatch implementation.
 1.34 27-Dec-2023  thorpej Add a header file for 68030-specific MMU definitions, specifically the
Transparent Translation registers, that do not exist on the 68851. A
big comment at the top of the file describes the differences between
the 68851 and the 68030's MMU.
 1.33 27-Dec-2023  thorpej Add new headers that describe the 68851 (and 68030) MMU and
68040 (and 68060) MMU structures using names that more closely
align with Motorola's documentation.

The definitions here automagically adapt to 4K or 8K pages, based
on the value of PGSHIFT, which must be a compile-time constant.
 1.32 01-Feb-2020  tsutsui Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.
For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.31 22-Aug-2018  msaitoh branches: 1.31.4; 1.31.6;
- 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.30 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.29 24-Dec-2015  christos branches: 1.29.16; 1.29.18;
fenv for m68k
 1.28 17-Jul-2013  matt branches: 1.28.8;
Export fpreg.h for libc
 1.27 17-Jul-2011  joerg branches: 1.27.2; 1.27.12; 1.27.16;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.26 09-Feb-2007  ad Merge newlock2 to head.
 1.25 26-Jul-2006  drochner branches: 1.25.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.24 13-Apr-2006  oster Populate /usr/include/m68k with both pmap_motorola.h and pte_motorola.h.
/usr/include/m68k/pmap.h expects to find pmap_motorola.h, and
/usr/include/machine/pte.h wants pte_motorola.h.
 1.23 11-Dec-2005  christos branches: 1.23.4; 1.23.6; 1.23.8; 1.23.10; 1.23.12;
merge ktrace-lwp.
 1.22 08-May-2004  kleink branches: 1.22.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.21 22-Sep-2003  cl SA_SIGINFO support for m68k
 1.20 17-Jan-2003  thorpej branches: 1.20.2;
Merge the nathanw_sa branch.
 1.19 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.18 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.17 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.16 10-Apr-2002  briggs branches: 1.16.2;
bus_dma(9) pulled pretty much verbatim from next68k.
 1.15 28-Nov-2001  kleink No point in installing svr4_machdep.h.
 1.14 15-Apr-2001  kleink branches: 1.14.2; 1.14.8;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.13 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.12 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.11 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.10 06-Apr-2001  tsutsui Install byte_swap.h on make includes.
 1.9 26-Jun-2000  kleink branches: 1.9.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.8 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.7 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.6 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.5 19-Apr-1999  kleink branches: 1.5.2;
Add COMPAT_SVR4 for m68k.
 1.4 09-Feb-1999  is branches: 1.4.4;
Provide a minimal instruction/data cache synchronization C binding.
(The function has always been in the kernels as special trap #12).
In response to PR 4951 by Hauke Fath.
 1.3 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2 12-Jul-1998  veego Add elf_machdep.h to the INCS list.
 1.1 12-Jun-1998  cgd Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.5.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.9.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.9.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.14.8.10 11-Dec-2002  thorpej Sync with HEAD.
 1.14.8.9 13-Aug-2002  nathanw Catch up to -current.
 1.14.8.8 06-Aug-2002  nathanw m68k/lwp.h is gone.
 1.14.8.7 01-Aug-2002  nathanw Catch up to -current.
 1.14.8.6 17-Apr-2002  nathanw Catch up to -current.
 1.14.8.5 08-Jan-2002  nathanw Catch up to -current.
 1.14.8.4 21-Nov-2001  scw Install lwp.h during `includes' pass.
 1.14.8.3 17-Nov-2001  scw Kernel support for Scheduler Activations on m68k-based ports using
mvme68k as a testbed.

Boots multi-user on an mvme162, although userland support for SA is not
yet integrated/tested.
 1.14.8.2 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.14.8.1 15-Apr-2001  scw file Makefile was added on branch nathanw_sa on 2001-11-10 21:22:50 +0000
 1.14.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.2 31-Aug-2002  gehenna catch up with -current.
 1.16.2.1 16-Jul-2002  gehenna catch up with -current.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.12.3 26-Feb-2007  yamt sync with head.
 1.22.12.2 30-Dec-2006  yamt sync with head.
 1.22.12.1 21-Jun-2006  yamt sync with head.
 1.23.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.23.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.23.8.2 11-Aug-2006  yamt sync with head
 1.23.8.1 24-May-2006  yamt sync with head.
 1.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.25.4.1 01-Feb-2007  ad Header file cleanup.
 1.27.16.1 28-Aug-2013  rmind sync with head
 1.27.12.2 03-Dec-2017  jdolecek update from HEAD
 1.27.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.2.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.8.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.29.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.29.18.1 10-Jun-2019  christos Sync with HEAD
 1.29.16.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.29.16.1 28-Jul-2018  pgoyette Sync with HEAD
 1.31.6.1 29-Feb-2020  ad Sync with head.
 1.31.4.1 10-Feb-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #682):

sys/arch/next68k/include/vmparam.h: revision 1.27
sys/arch/mac68k/include/vmparam.h: revision 1.46
sys/arch/sun3/include/vmparam.h: revision 1.38
sys/arch/m68k/include/vmparam.h: revision 1.1
sys/arch/hp300/include/vmparam.h: revision 1.41
sys/arch/m68k/include/Makefile: revision 1.32
sys/arch/amiga/include/vmparam.h: revision 1.48
distrib/sets/lists/comp/ad.m68k: revision 1.63
sys/arch/x68k/include/vmparam.h: revision 1.40
sys/arch/mvme68k/include/vmparam.h: revision 1.38
sys/arch/luna68k/include/vmparam.h: revision 1.23
sys/arch/news68k/include/vmparam.h: revision 1.23
sys/arch/atari/include/vmparam.h: revision 1.34
sys/arch/cesfic/include/vmparam.h: revision 1.19

Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.

For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.35.2.1 02-Aug-2025  perseant Sync with HEAD
 1.25 07-May-2019  kamil Switch all users (except ia64) of custom machine/ansi.h to common_ansi.h

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

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

Proposed and discussed on a mailing list (twice).

Itanium uses custom !ELF fallback switch, temporarily leave it as it is.
 1.24 17-Jun-2015  martin branches: 1.24.18;
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.23 17-Jul-2011  joerg branches: 1.23.12; 1.23.28; 1.23.30;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.22 27-Mar-2010  tnozaki 1. {wctype,wctrans,mbstate}_t: switch MD to MI like other
libc implementation (such as *BSD and glibc2).

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

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

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

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

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

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.14 02-Mar-2003  tshiozak branches: 1.14.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.13 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.12 26-Dec-2000  itojun make mbstate_t bigger (32 -> 128 bytes).
XXX if you have libc after citrus locale import, please recompile libc,
and your applications that use mbstate_t (rather rare). really sorry
for the mess.
 1.11 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.10 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.9 27-Apr-1998  kleink branches: 1.9.14; 1.9.22;
Provide definitions for intptr_t and uintptr_t, signed resp. unsigned integral
types large enough to hold any pointer.
 1.8 23-Nov-1997  kleink Add _BSD_SUSECONDS_T_ and _BSD_USECONDS_T_; do some space vs. tab formatting
cleanup
 1.7 15-Nov-1996  jtc Define _BSD_CLOCKID_T_ and _BSD_TIMER_T_
 1.6 16-Mar-1996  jtc Add _BSD_WINT_T_ definition so we can handle wint_t type added in NA1.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 21-May-1994  cgd new way of naming things
 1.3 09-May-1994  chopps Add _SSIZE_T_.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd add from net2. were symlinks to ../../vax/include/*
 1.9.22.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.9.14.2 05-Jan-2001  bouyer Sync with HEAD
 1.9.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.8.1 29-Apr-2005  kent sync with -current
 1.16.2.2 27-Oct-2007  yamt sync with head.
 1.16.2.1 30-Dec-2006  yamt sync with head.
 1.17.22.1 22-Oct-2006  yamt sync with head
 1.17.20.1 18-Nov-2006  ad Sync with head.
 1.18.28.1 06-Nov-2007  matt sync with HEAD
 1.18.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.18.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.18.16.1 03-Oct-2007  garbled Sync with HEAD
 1.18.8.1 09-Oct-2007  ad Sync with head.
 1.20.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.22.2 11-Aug-2010  yamt sync with head.
 1.20.22.1 04-May-2009  yamt sync with head.
 1.20.18.3 04-Jan-2009  christos revert all but time_t
 1.20.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.20.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.20.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.21.6.1 30-May-2010  rmind sync with head
 1.21.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.23.30.1 22-Sep-2015  skrll Sync with HEAD
 1.23.28.1 16-Jul-2015  riz Pull up following revision(s) (requested by martin in ticket #846):
sys/arch/mips/include/ansi.h: revision 1.29
sys/arch/sh3/include/ansi.h: revision 1.16
sys/arch/sparc64/include/ansi.h: revision 1.18
sys/arch/m68k/include/ansi.h: revision 1.24
sys/arch/powerpc/include/ansi.h: revision 1.30
sys/arch/hppa/include/ansi.h: revision 1.14
sys/arch/i386/include/ansi.h: revision 1.27
sys/arch/alpha/include/ansi.h: revision 1.25
sys/arch/usermode/include/ansi.h: revision 1.5
sys/arch/sparc/include/ansi.h: revision 1.24
Make _BSD_CLOCK_T_ unsigned int so it's the same for IPL32 and LP64
environments. We don't really have a powerpc64 native userland
and the mips64 native userland is IPL32 so this shouldn't affect anything.
Make clock_t unsigned
Make clock_t unsigned int everywhere.
Ok: matt@, mrg@
 1.23.12.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.1 10-Jun-2019  christos Sync with HEAD
 1.4 10-Dec-2002  thorpej Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.3 18-May-2001  fredette branches: 1.3.8;
Don't define __LDPGSZ if it's already defined.
 1.2 09-Apr-1997  thorpej branches: 1.2.34;
Garbage-collect some things no longer needed since there are no longer
m68k4k ports.
 1.1 08-Sep-1996  thorpej All of the m68k ports' exec.h's were essentially the same. Merge them.

Override the N_PAGSIZ() macro; this one checks the MID of the executable
and returns the appropriate page size.
 1.2.34.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.8.2 11-Dec-2002  thorpej Sync with HEAD.
 1.3.8.1 18-May-2001  thorpej file aout_machdep.h was added on branch nathanw_sa on 2002-12-11 06:10:40 +0000
 1.37 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.36 04-Jan-2025  martin PR 58960: m68k/asm.h: Respect NETBSD_REVISIONID.
 1.35 26-Sep-2023  tsutsui branches: 1.35.6;
Remove trailing spaces and TABs.
 1.34 17-Apr-2020  joerg Mark the .ident section as mergable string section to avoid redundant
entries.
 1.33 12-Sep-2013  joerg branches: 1.33.30; 1.33.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.32 18-Jul-2013  matt Adjust LEA_LCL, GOT_SETUP, INTERRUPT_{SAVE,RESTORE}REG for Coldfire
 1.31 16-Jul-2013  matt branches: 1.31.2;
Make INTERRUPT_{SAVE,RESTORE}REG visible to userland
 1.30 16-Jul-2013  matt Remove non __ELF__ clauses.
Add GOT_SETUP and LEA_LCL macros.
 1.29 16-Jul-2013  matt Add an END macro. reorder EXTBL macro
 1.28 12-Feb-2011  matt branches: 1.28.4; 1.28.14; 1.28.18;
Put RCSIDs in section .ident. (use .pushsection/.popsection)
 1.27 20-Dec-2010  joerg branches: 1.27.2; 1.27.4;
Consistently use .gnu.warning with .pushsectio and .popsection on all
architectures instead of obsolete STABS frames for linker warnings.
 1.26 20-Dec-2010  matt Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.25 28-Apr-2008  martin branches: 1.25.22;
Remove clause 3 and 4 from TNF licenses
 1.24 20-Jan-2006  christos branches: 1.24.72; 1.24.74; 1.24.76;
Add a STRONG_ALIAS macro
 1.23 27-May-2001  chs branches: 1.23.8; 1.23.40; 1.23.52;
mcount() is named __mcount() on ELF, do the right thing.
 1.22 12-May-2001  chs define VECTOR() and friends in non-_KERNEL environments too.
 1.21 03-May-2001  fredette Add an EXTBL macro.
 1.20 23-Jun-2000  kleink branches: 1.20.2;
Add a WEAK_ALIAS() macro.
 1.19 25-Oct-1999  thorpej branches: 1.19.6;
Add register prefixes.
 1.18 01-May-1999  kleink branches: 1.18.2; 1.18.4; 1.18.6;
* Change multiple inclusion protection symbols to use the standard naming
convention (not that it should matter for assembly).
* Provide an additional set of _C_LABEL() macros for ELF.
* Provide a PIC_PLT() macro for the benefit of ELF.
 1.17 02-Dec-1998  thorpej branches: 1.17.6;
Argh, fix the ANSI CPP version of the a.out WARN_REFERENCES().
 1.16 02-Dec-1998  thorpej Implement WARN_REFERENCES().
 1.15 04-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.14 14-Jul-1997  thorpej branches: 1.14.2;
Don't have kernel vs. non-kernel versions of _ENTRY(); there's no
reason to omit the .type directive in the kernel case.
 1.13 24-Apr-1997  thorpej Add several useful macros:
- ENTRY_NOPROFILE() and ASENTRY_NOPROFILE(), similar to ENTRY() and
ASENTRY(), but without the profiling prologue.
- GLOBAL()/ASGLOBAL() and LOCAL()/ASLOCAL(), for defining global and
local variables with C and ASM labels.
- BSS()/ASBSS(), for defining items in the BSS segment, with C or
ASM labels.
- PANIC("panic message") - shorthand for calling panic() from assembly code.
- VECTOR(), ASVECTOR(), VECTOR_UNUSED - shorthand for defining entries
in the vector table.
Also, change RCSID() to pad out the string to even boundary.
 1.12 30-Nov-1996  jtc PROF -> GPROF
 1.11 24-Sep-1996  jtc Added new macro _PROF_PROLOG which contains the code sequence needed
to call mcount(). This is needed because the ``link a6,#0'' insn used
trips up gcc's ANSI preprocessor (A # in a function-type macro must be
followed by a macro argument). _PROF_PROLOG is also used in the i386
asm.h.

Solaris' asm_linkage.h has a MCOUNT macro similar to _PROF_PROLOG
except it expands to different code sequences based on whether a
function is being compiled with "prof" or "gprof" instrumentation.

I also discovered that the m68k ALTENTRY is very different than the
implementation used by other NetBSD ports. Usually ALTENTRY simply
provides an alternate function entry point. The m68k version takes a
second argument and jumps inside the second function when profiling is
enabled. The m68k behavior is similar to the ENTRY2 macro found in
solaris.

Providing ENTRY2 and changing all the code that uses ALTENTRY to use
it would be a desirable change.
 1.10 26-Mar-1995  briggs KERNEL -> _KERNEL
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 18-Mar-1994  brezak Add RCSID macro; be sure ENTRY is in .text
 1.7 01-Mar-1994  glass so you can compile a kernel w/o using our hacked gas
 1.6 30-Jan-1994  mycroft Remove bogus \ that someone inserted.
 1.5 30-Jan-1994  mycroft GPROF --> PROF
 1.4 29-Jan-1994  mycroft Forgot the .even...
 1.3 29-Jan-1994  mycroft Fix typo.
 1.2 29-Jan-1994  mycroft Add .type directive.
 1.1 22-Jan-1994  briggs Define ENTRY and ALTENTRY--hopefully for both STDC and K&R style...
Nabbed & mangled from sun3/include/asm.h and locore.s...
 1.14.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.18.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.4.1 15-Nov-1999  fvdl Sync with -current
 1.18.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.6.1 25-Jul-2000  kleink Pull up rev. 1.20 (approved by thorpej):
For ELF, add a WEAK_ALIAS() macro.
 1.20.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.52.1 01-Feb-2006  yamt sync with head.
 1.23.40.1 21-Jun-2006  yamt sync with head.
 1.23.8.2 27-May-2001  chs mcount() is named __mcount() on ELF, do the right thing.
 1.23.8.1 27-May-2001  chs file asm.h was added on branch nathanw_sa on 2001-05-27 01:01:09 +0000
 1.24.76.1 16-May-2008  yamt sync with head.
 1.24.74.1 18-May-2008  yamt sync with head.
 1.24.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.22.1 05-Mar-2011  rmind sync with head
 1.27.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.27.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.28.18.2 18-May-2014  rmind sync with head
 1.28.18.1 28-Aug-2013  rmind sync with head
 1.28.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.31.2.1 23-Jul-2013  riastradh sync with HEAD
 1.33.40.1 20-Apr-2020  bouyer Sync with HEAD
 1.33.30.1 21-Apr-2020  martin Sync with HEAD
 1.35.6.1 02-Aug-2025  perseant Sync with HEAD
 1.10 18-May-2022  andvar fix typos in word "access" and it derivatives, mainly in comments.
 1.9 20-Oct-2009  snj Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.8 03-Aug-2006  mhitch branches: 1.8.62;
gcc4 checks for and warns of matching constraints that don't specify
a register operand. Remove the matching constraint and change the output
operand constraint from "=m" (write-only) to "+m" (read-write).
 1.7 27-Jun-2006  tsutsui Backout previous since there is an objection and I'm not a toolchain guy.
 1.6 25-Jun-2006  tsutsui Fix "warning: matching constraint does not allow a register" on gcc4.
(I guess constraints "0-9" are valid only for register operands, right?)
 1.5 24-Dec-2005  perry branches: 1.5.4; 1.5.8; 1.5.16;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 25-Jan-2002  thorpej branches: 1.4.32;
Fix asm constraints. Sun3 kernels built with the new toolchain boot now.
 1.3 25-Jul-1998  is branches: 1.3.28; 1.3.32;
no semicolon, please
 1.2 05-Nov-1997  thorpej asm -> __asm__, volatile -> __volatile
 1.1 16-Sep-1996  leo branches: 1.1.14;
Add macro's that do bclr/bset in a single instruction.
 1.1.14.1 05-Nov-1997  thorpej Pullup from trunk: asm -> __asm__, volatile -> __volatile
 1.3.32.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.28.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.32.2 30-Dec-2006  yamt sync with head.
 1.4.32.1 21-Jun-2006  yamt sync with head.
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.8.2 11-Aug-2006  yamt sync with head
 1.5.8.1 26-Jun-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.8.62.1 11-Mar-2010  yamt sync with head
 1.4 31-Jan-2006  dsl 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.3 30-Mar-2001  leo branches: 1.3.8; 1.3.40; 1.3.52;
Optimize bswap16() and bswap32() functions to inline assembly.
 1.2 21-Aug-1999  simonb branches: 1.2.2; 1.2.14;
Include <sys/bswap.h> for function prototypes. i386, pc532 and vax
still include <machine/byte_swap.h> and define macros for some of
the bswap*() functions.
 1.1 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2.14.1 09-Apr-2001  nathanw Catch up with -current.
 1.2.2.1 21-Apr-2001  bouyer Sync with HEAD
 1.3.52.1 01-Feb-2006  yamt sync with head.
 1.3.40.1 21-Jun-2006  yamt sync with head.
 1.3.8.2 30-Mar-2001  leo Optimize bswap16() and bswap32() functions to inline assembly.
 1.3.8.1 30-Mar-2001  leo file bswap.h was added on branch nathanw_sa on 2001-03-30 20:00:06 +0000
 1.14 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.13 05-Dec-2021  msaitoh s/from from/from/ in comment.
 1.12 30-Jun-2011  wiz dependant -> dependent
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 17-Oct-2007  garbled branches: 1.10.16; 1.10.18; 1.10.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.9 07-Jun-2007  tsutsui branches: 1.9.10;
Enable _pmap_set_page_cacheable(), _pmap_set_page_cacheinhibit() and
_pmap_page_is_cacheable() on all pmap_motorola.c ports and add
BUS_DMA_COHERENT support (from mvme68k) to common m68k bus_dma.c.

Tested with (not-yet-integrated) MI Sonic Ethernet driver on mac68k
http://mail-index.netbsd.org/port-mac68k/2007/06/07/0000.html
and ok'ed by thorpej.
 1.8 04-Mar-2007  christos branches: 1.8.2; 1.8.4; 1.8.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 21-Feb-2007  mrg add a pair of new bus_dma(9) functions:
int _bus_dmatag_subregion(bus_dma_tag_t tag,
bus_addr_t min_addr,
bus_addr_t max_addr,
bus_dma_tag_t *newtag,
int flags)
void _bus_dmatag_destroy(bus_dma_tag_t tag)

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

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

XXX: bus_dma(9) needs an update still.
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 09-Mar-2005  matt branches: 1.5.4;
Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.
 1.4 28-Aug-2004  thorpej branches: 1.4.4; 1.4.6;
De-__P
 1.3 04-Dec-2003  keihan netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.2 28-Jan-2003  kent branches: 1.2.2;
Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.1 10-Apr-2002  briggs branches: 1.1.2; 1.1.8;
bus_dma(9) pulled pretty much verbatim from next68k.
 1.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 10-Apr-2002  jdolecek file bus_dma.h was added on branch kqueue on 2002-06-23 17:37:40 +0000
 1.1.2.2 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.1 10-Apr-2002  nathanw file bus_dma.h was added on branch nathanw_sa on 2002-04-17 00:03:29 +0000
 1.2.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.2.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.2 03-Sep-2004  skrll Sync with HEAD
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.5.4.2 03-Sep-2007  yamt sync with head.
 1.5.4.1 26-Feb-2007  yamt sync with head.
 1.6.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.6.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.8.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.8.4.1 11-Jul-2007  mjf Sync with head.
 1.8.2.1 09-Jun-2007  ad Sync with head.
 1.9.10.1 06-Nov-2007  matt sync with HEAD
 1.10.20.1 16-May-2008  yamt sync with head.
 1.10.18.1 18-May-2008  yamt sync with head.
 1.10.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.11 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.10 18-Jul-2013  matt Teach to use coldfire isac byterev if available, otherwise let the compiler
figure it since there is rorw instruction to fall back on.
 1.9 28-Apr-2008  martin branches: 1.9.34; 1.9.44; 1.9.50; 1.9.58;
Remove clause 3 and 4 from TNF licenses
 1.8 30-Jan-2006  dsl branches: 1.8.72; 1.8.74; 1.8.76;
Move all the stuff that detects bswapxx(constant) into the MI sys/bswap.h
Put the minimum to define the required inline assembler or C into the MD files.
NB: there may be some fallout from this!
 1.7 28-Dec-2005  perry branches: 1.7.2;
inline -> __inline
 1.6 24-Dec-2005  perry __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.5 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 05-Dec-2001  lukem branches: 1.4.32;
convert from macros to static inlines. allen briggs confirms resultant code
is the same with -Ox, for x>0 (as expected).
 1.3 09-Apr-2001  leo branches: 1.3.2; 1.3.4; 1.3.10;
Remove '_KERNEL' conditionalizing. This break userland apps.
Noted by Steve Allan.
 1.2 04-Apr-2001  is branches: 1.2.2;
This only works with data registers.
 1.1 30-Mar-2001  leo Optimize bswap16() and bswap32() functions to inline assembly.
 1.2.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.3.10.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.10.1 09-Apr-2001  nathanw file byte_swap.h was added on branch nathanw_sa on 2002-01-08 00:25:54 +0000
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.1 09-Apr-2001  bouyer file byte_swap.h was added on branch thorpej_scsipi on 2001-04-21 17:53:55 +0000
 1.4.32.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 01-Feb-2006  yamt sync with head.
 1.8.76.1 16-May-2008  yamt sync with head.
 1.8.74.1 18-May-2008  yamt sync with head.
 1.8.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.58.1 23-Jul-2013  riastradh sync with HEAD
 1.9.50.1 28-Aug-2013  rmind sync with head
 1.9.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.34.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16 06-Jun-2010  mrg fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

i built these kernels to ensure i did not break their builds:

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.15 28-Apr-2008  martin branches: 1.15.20; 1.15.22;
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 13-Jun-2007  he branches: 1.13.10;
Fix the 060 variants to not have conflicting definitions for the
cache ops common to 060 and 040. Also remove the now-redundant
definitions for the 060 variant which simply pointed to the 040
variants.
This fixes the build of the mvme68k VME172 kernel.
 1.12 08-Jun-2007  tsutsui DCFA(), DCPA(), ICPL(), ICPP(), DCPL(), DCPP, DCFL(), and DCFP()
cache ops are identical between M68040 and M68060 and they are not
available on M68020 and M68030, so no need to check cputype even on
multi CPU kernels and they can always be inlined.

This improves MI Sonic xfer speed ~5%.
http://mail-index.netbsd.org/port-mac68k/2007/06/07/0003.html
 1.11 11-Dec-2005  christos branches: 1.11.30; 1.11.32; 1.11.38;
merge ktrace-lwp.
 1.10 28-Aug-2004  thorpej branches: 1.10.12;
De-__P
 1.9 02-Nov-2002  chs branches: 1.9.6;
finish conversion to the common m68k cacheops:
add support for machine-specific flavors of the ops for off-chip caches.
many thanks to Izumi Tsutsui for his help with this.
 1.8 05-Apr-2000  is branches: 1.8.12;
Bug fixes for 68020only or 68030only machines, by Aymeric Vincent.
 1.7 15-Jan-2000  aymeric make DCIAS work for 020-only / 030-only kernels
 1.6 27-Sep-1999  itohy branches: 1.6.2;
Add missing TBIA() definition for 68030-only machine.
 1.5 25-Sep-1999  is Replace leftover vm_offset_t's by paddr_t or vaddr_t, as appropriate.
Rename variables/parameters from "va" to "pa" where they are a paddr_t.
Correct DCIAS to take a paddr_t (instead of vaddr_t).
 1.4 23-Sep-1999  minoura #ifndef _M68K_CACHEOPS_H_ - #endif.
 1.3 02-Sep-1998  leo Nuke vm_offset_t/vm_size_t.
 1.2 15-Sep-1997  leo Add DCFA() definitions.
 1.1 02-Jun-1997  leo branches: 1.1.4;
An attempt to make a generic m68k implementation for cache control operations.
Not yet completely finished.
 1.1.4.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.12.1 11-Nov-2002  nathanw Catch up to -current
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Sep-2004  skrll Sync with HEAD
 1.10.12.1 03-Sep-2007  yamt sync with head.
 1.11.38.1 26-Jun-2007  garbled Sync with HEAD.
 1.11.32.1 11-Jul-2007  mjf Sync with head.
 1.11.30.1 15-Jul-2007  ad Sync with head.
 1.13.10.1 06-Nov-2007  matt sync with HEAD
 1.14.20.2 11-Aug-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.15.22.1 03-Jul-2010  rmind sync with head
 1.15.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 16-Feb-2006  perry branches: 1.8.68; 1.8.70; 1.8.72;
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.7 24-Dec-2005  perry branches: 1.7.2; 1.7.4; 1.7.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.6 03-Nov-2002  chs branches: 1.6.22;
use "static __inline" instead of "extern __inline" so that we can
build without optimization.
 1.5 06-Nov-1999  thorpej branches: 1.5.12;
Add register prefixes.
 1.4 02-Sep-1998  leo branches: 1.4.12; 1.4.14; 1.4.18;
Nuke vm_offset_t/vm_size_t.
 1.3 05-Nov-1997  thorpej inline -> __inline
 1.2 13-Oct-1997  leo branches: 1.2.2;
Correct TBIS_20 parameters, add DCFA/DCPA defines for the 020/030 (From
Ignatios).
 1.1 02-Jun-1997  leo branches: 1.1.4;
An attempt to make a generic m68k implementation for cache control operations.
Not yet completely finished.
 1.1.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 05-Nov-1997  thorpej Update from trunk: inline -> __inline
 1.4.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.14.1 15-Nov-1999  fvdl Sync with -current
 1.4.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.12.1 11-Nov-2002  nathanw Catch up to -current
 1.6.22.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.7.2.1 18-Feb-2006  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.10 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 16-Feb-2006  perry branches: 1.8.68; 1.8.70; 1.8.72;
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.7 24-Dec-2005  perry branches: 1.7.2; 1.7.4; 1.7.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.6 03-Nov-2002  chs branches: 1.6.22;
use "static __inline" instead of "extern __inline" so that we can
build without optimization.
 1.5 06-Nov-1999  thorpej branches: 1.5.12;
Add register prefixes.
 1.4 02-Sep-1998  leo branches: 1.4.12; 1.4.14; 1.4.18;
Nuke vm_offset_t/vm_size_t.
 1.3 05-Nov-1997  thorpej inline -> __inline
 1.2 13-Oct-1997  leo branches: 1.2.2;
Correct TBIS_20 parameters, add DCFA/DCPA defines for the 020/030 (From
Ignatios).
 1.1 02-Jun-1997  leo branches: 1.1.4;
An attempt to make a generic m68k implementation for cache control operations.
Not yet completely finished.
 1.1.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 05-Nov-1997  thorpej Update from trunk: inline -> __inline
 1.4.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.14.1 15-Nov-1999  fvdl Sync with -current
 1.4.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.12.1 11-Nov-2002  nathanw Catch up to -current
 1.6.22.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.7.2.1 18-Feb-2006  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 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 17-Oct-2007  garbled branches: 1.10.16; 1.10.18; 1.10.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.9 08-Jun-2007  tsutsui branches: 1.9.10;
Use pointers for variables assigned to %a0 by __asm("%a0") so that
gcc may generate silightly better inlined code on optimization.
 1.8 16-Feb-2006  perry branches: 1.8.24; 1.8.26; 1.8.32;
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.7 24-Dec-2005  perry branches: 1.7.2; 1.7.4; 1.7.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.6 03-Nov-2002  chs branches: 1.6.22;
use "static __inline" instead of "extern __inline" so that we can
build without optimization.
 1.5 06-Nov-1999  thorpej branches: 1.5.12;
Add register prefixes.
 1.4 25-Sep-1999  is branches: 1.4.2; 1.4.4; 1.4.8;
Replace leftover vm_offset_t's by paddr_t or vaddr_t, as appropriate.
Rename variables/parameters from "va" to "pa" where they are a paddr_t.
Correct DCIAS to take a paddr_t (instead of vaddr_t).
 1.3 02-Sep-1998  leo Nuke vm_offset_t/vm_size_t.
 1.2 05-Nov-1997  thorpej inline -> __inline
 1.1 02-Jun-1997  leo branches: 1.1.8;
An attempt to make a generic m68k implementation for cache control operations.
Not yet completely finished.
 1.1.8.1 05-Nov-1997  thorpej Update from trunk: inline -> __inline
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.4.1 15-Nov-1999  fvdl Sync with -current
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.12.1 11-Nov-2002  nathanw Catch up to -current
 1.6.22.2 03-Sep-2007  yamt sync with head.
 1.6.22.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.7.2.1 18-Feb-2006  yamt sync with head.
 1.8.32.1 26-Jun-2007  garbled Sync with HEAD.
 1.8.26.1 11-Jul-2007  mjf Sync with head.
 1.8.24.1 15-Jul-2007  ad Sync with head.
 1.9.10.1 06-Nov-2007  matt sync with HEAD
 1.10.20.1 16-May-2008  yamt sync with head.
 1.10.18.1 18-May-2008  yamt sync with head.
 1.10.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.14 26-Sep-2023  tsutsui TAB/space cleanup.
 1.13 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.12 17-Oct-2007  garbled branches: 1.12.16; 1.12.18; 1.12.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.11 13-Jun-2007  he branches: 1.11.10;
Revert last commit to this file, and re-introduce the _60 variants
of the cache ops macros which are common between 040 and 060, as
per discussion with tsutsui@.
 1.10 13-Jun-2007  he Fix the 060 variants to not have conflicting definitions for the
cache ops common to 060 and 040. Also remove the now-redundant
definitions for the 060 variant which simply pointed to the 040
variants.
This fixes the build of the mvme68k VME172 kernel.
 1.9 08-Jun-2007  tsutsui Use pointers for variables assigned to %a0 by __asm("%a0") so that
gcc may generate silightly better inlined code on optimization.
 1.8 08-Jun-2007  tsutsui DCFA(), DCPA(), ICPL(), ICPP(), DCPL(), DCPP, DCFL(), and DCFP()
cache ops are identical between M68040 and M68060 and they are not
available on M68020 and M68030, so no need to check cputype even on
multi CPU kernels and they can always be inlined.

This improves MI Sonic xfer speed ~5%.
http://mail-index.netbsd.org/port-mac68k/2007/06/07/0003.html
 1.7 16-Feb-2006  perry branches: 1.7.24; 1.7.26; 1.7.32;
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.6 24-Dec-2005  perry branches: 1.6.2; 1.6.4; 1.6.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.5 03-Nov-2002  chs branches: 1.5.22;
use "static __inline" instead of "extern __inline" so that we can
build without optimization.
 1.4 06-Nov-1999  thorpej branches: 1.4.12;
Add register prefixes.
 1.3 02-Sep-1998  leo branches: 1.3.12; 1.3.14; 1.3.18;
Nuke vm_offset_t/vm_size_t.
 1.2 05-Nov-1997  thorpej inline -> __inline
 1.1 02-Jun-1997  leo branches: 1.1.8;
An attempt to make a generic m68k implementation for cache control operations.
Not yet completely finished.
 1.1.8.1 05-Nov-1997  thorpej Update from trunk: inline -> __inline
 1.3.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.14.1 15-Nov-1999  fvdl Sync with -current
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.12.1 11-Nov-2002  nathanw Catch up to -current
 1.5.22.2 03-Sep-2007  yamt sync with head.
 1.5.22.1 21-Jun-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 18-Feb-2006  yamt sync with head.
 1.7.32.1 26-Jun-2007  garbled Sync with HEAD.
 1.7.26.1 11-Jul-2007  mjf Sync with head.
 1.7.24.1 15-Jul-2007  ad Sync with head.
 1.11.10.1 06-Nov-2007  matt sync with HEAD
 1.12.20.1 16-May-2008  yamt sync with head.
 1.12.18.1 18-May-2008  yamt sync with head.
 1.12.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 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.6 20-Mar-1999  thorpej branches: 1.6.182; 1.6.186;
Garbage-collect.
 1.5 28-Feb-1998  veego Sync it with the i386 version so lint doesn't complains about an syntax
error for __warn_references.
 1.4 04-Nov-1997  thorpej Bug fixes and cleanup from Chris Demetriou <cgd@pa.dec.com>:
- fix _C_LABEL so that it actually works.
- make __RENAME use _C_LABEL.
- fix __RENAME so that it expects an unquoted argument.
- fix __indr_reference and __warn_references so that they
supply their own final semicolon.
- define __warn_references to nothing if not GNU C (required
by the way it's used).

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

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

For most ports, _C_LABEL(x) will expand to "_x", for ELF based ports
_C_LABEL(x) will expand to "x".
 1.2.18.2 04-Nov-1997  thorpej Pull up from trunk: bug fixes and cleaups.
 1.2.18.1 22-Oct-1997  thorpej Pull up from trunk: Implement __RENAME() in <machine/cdefs.h>
 1.6.186.1 18-Feb-2012  mrg merge to -current.
 1.6.182.1 17-Apr-2012  yamt sync with head
 1.25 28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.24 27-Feb-2024  nat Use proper clockframe size for those platforms that require it.

XXX This is a tempory measure, better to fix clock interrupts to take the
common clockframe size.

OK thorpej@.
 1.23 20-Jan-2024  thorpej What good are comments, really, if you can't have a little color? Add
a note above CLKF_INTR() about why NetBSD will likely never switch to
using the "master" stack for the kernel, and thus why the not-enabled
version of CLKF_INTR() will never be enabled.

(Adding the comment here, rather than just deleting the code, has value,
I think, for future retrocomputing archeologists.)
 1.22 20-Jan-2024  thorpej Largely unify the <machine/cpu.h> headers on the m68k platforms.
 1.21 18-Jan-2024  thorpej Remove a comment that is no longer applicable.
 1.20 18-Jan-2024  thorpej Make the M68K_MMU_* defines real kernel options, available in opt_m68k_arch.h.
For 68030, 68040, and 68060, infer M68K_MMU_MOTOROLA. For 68010 and 68020, it
must be an explicit option (set in std.${MACHINE} or, in the case of hp300,
inferred from the specific model option).
 1.19 03-Jan-2024  thorpej G/C some bit defs that are redundant with mmu_{51,40}.h
 1.18 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.17 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.16 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.15 19-Sep-2011  rkujawa branches: 1.15.52; 1.15.54;
Move CACHELINE_* from bus_dma.c to cpu.h (needed for PCI configuration on amiga port).
 1.14 08-Feb-2011  rmind 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.13 01-Jan-2011  he branches: 1.13.2; 1.13.4;
Protect the include of <sys/cpu_data.h> with a test for either _KERNEL
or _KMEMUSER. This should fix the build problem in libkvm for our m68k
ports.
 1.12 22-Dec-2010  matt Collect cpu_info and friends and move to m68k/include/cpu.h
Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.11 11-Dec-2005  christos branches: 1.11.100;
merge ktrace-lwp.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 19-Jan-2003  thorpej branches: 1.9.2;
Merge the nathanw_sa branch.
 1.8 29-Sep-2002  wiz "definitions" has lots of 'i's, but that's not reason to leave one out.
 1.7 14-Jun-2001  thorpej branches: 1.7.2; 1.7.8;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.6 19-Dec-2000  scw branches: 1.6.2;
Unification of the m68k syscall() function.
 1.5 21-Oct-1997  gwr branches: 1.5.14;
Move the (boiled down) interface declarations into m68k.h
Too late for the release, unfortunately...
 1.4 09-Apr-1997  thorpej Prototype regdump().
 1.3 02-Feb-1997  thorpej prototype mappedcopy{in,out}(), {copy,zero}page().
 1.2 12-Sep-1996  thorpej Add an FPU_UNKNOWN constant; just a placeholder for any unknown FPU.
 1.1 11-Sep-1996  thorpej Factor out common Motorola 68k CPU definitions from the m68k port
cpu.h header files.

Some more work could be done here, but it's a good start.
 1.5.14.1 05-Jan-2001  bouyer Sync with HEAD
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.7.8.2 17-Nov-2001  scw Re-sync with current MI SA code.
 1.7.8.1 14-Jun-2001  scw file cpu.h was added on branch nathanw_sa on 2001-11-17 18:18:23 +0000
 1.7.2.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.100.1 05-Mar-2011  rmind sync with head
 1.13.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.13.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.54.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.54.1 10-Jun-2019  christos Sync with HEAD
 1.15.52.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.10 26-Sep-2023  tsutsui TAB/space cleanup.
 1.9 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.8 05-Dec-2021  msaitoh s/expecially/especially/ in comment.
 1.7 07-Sep-2020  mrg move the __packed attribute from struct frame::F_t into the single
unaligned member inside. CTASSERT() the size is unchanged.

with this, sun3 and GCC 9 appears to work.
 1.6 02-Jul-2017  christos remove f_pad, conflicts with new <sys/file.h> define.
 1.5 08-Feb-2011  rmind branches: 1.5.14; 1.5.32;
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.4 11-Dec-2005  christos branches: 1.4.100; 1.4.106; 1.4.108;
merge ktrace-lwp.
 1.3 27-Oct-2003  cl branches: 1.3.4;
appease lint's ``warning: nonportable bit-field type'' in MD header
 1.2 23-Sep-2003  cl move #defines back to frame.h
 1.1 22-Sep-2003  cl SA_SIGINFO support for m68k
 1.3.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.4.2 03-Aug-2004  skrll Sync with HEAD
 1.3.4.1 27-Oct-2003  skrll file cpuframe.h was added on branch ktrace-lwp on 2004-08-03 10:36:40 +0000
 1.4.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.4.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.100.1 05-Mar-2011  rmind sync with head
 1.5.32.1 28-Aug-2017  skrll Sync with HEAD
 1.5.14.1 03-Dec-2017  jdolecek update from HEAD
 1.35 26-Sep-2023  tsutsui TAB/space cleanup.
 1.34 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.33 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.32 05-Nov-2017  christos The XXX comment (do not pull in the uvm headers) might have been a nice idea
at the time, but now all other db_machdep files do this, so we follow suit.
 1.31 31-Jan-2012  mlelstv branches: 1.31.6;
Enable build of crash(8) for m86k platforms.
 1.30 26-May-2011  joerg branches: 1.30.4; 1.30.8;
Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.29 11-Apr-2011  mrg obsolete DB_AOUT_SYMBOLS. however, we need to leave most of the code
in db_sym.[ch] as it is used by the elf version of crash(8).

i will be cleaning up the db_sym.c code in a follow up commit to avoid
having dead code compiled.
 1.28 14-Jan-2011  rmind branches: 1.28.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.27 01-Apr-2006  cherry branches: 1.27.88;
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.26 11-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10; 1.26.12;
merge ktrace-lwp.
 1.25 28-Aug-2004  thorpej branches: 1.25.12;
- De-__P.
- Also define DB_ELF_SYMBOLS and DB_ELFSIZE.
 1.24 29-Apr-2003  scw branches: 1.24.2;
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.23 30-Mar-2003  kristerw Remove unneeded cast that prevents PC_REGS from being used as lvalue.
 1.22 26-Jun-2000  mrg <vm/vm_param.h> -> <uvm/uvm_param.h>
 1.21 02-Sep-1998  leo branches: 1.21.12;
Nuke vm_offset_t/vm_size_t.
 1.20 26-Jun-1997  thorpej #define DB_AOUT_SYMBOLS
 1.19 18-Feb-1997  gwr Remove some unnecessary <vm/*> headers. Have to keep <vm/vm_param.h>,
at least until boolean_t moves to <sys/types.h> or someplace...
Also make ddb_regs extern here. Closes PR#3213
 1.18 12-Feb-1997  gwr Add kgdb_reg_t, KGDB_NUMREGS, KGDB_BUFLEN
 1.17 06-Feb-1997  gwr branches: 1.17.2;
FIXUP_PC_AFTER_BREAK now takes an arg of type db_regs_t *
 1.16 05-Feb-1997  scottr db_expr_t is now a long.
 1.15 27-Jan-1997  gwr Include <machine/frame.h> and typedef db_regs_t using struct trapframe
(instead of replicating trapframe here by a different name). Update the
macros that refer to members of db_regs_t to use the trapframe members.
 1.14 15-Jan-1997  gwr Use db_regs_t instead of struct mc68020_saved_state
 1.13 29-Apr-1996  leo branches: 1.13.2;
Prototype + -Wall fixes.
 1.12 26-Oct-1994  cgd new RCS ID format.
 1.11 09-Oct-1994  mycroft Remove BYTE_MSF.
 1.10 23-May-1994  mycroft Merge with 4.4-Lite.
 1.9 18-Apr-1994  briggs vm/queue.h doesn't exist any more.
 1.8 31-Jan-1994  mycroft Specify the byte order.
 1.7 10-Jan-1994  mycroft Fix some bogus spacing.
 1.6 10-Jan-1994  mycroft Add some padding before SR.
 1.5 09-Jan-1994  mycroft T_WATCHPOINT doesn't really exist. Deal.
 1.4 09-Jan-1994  mycroft Alias T_TRAP15 to T_BREAKPOINT globally.
 1.3 09-Jan-1994  cgd kill logs, and minor cleanup
 1.2 10-Aug-1993  glass fixed problem that caused two consecutive segments to be using the same
pmeg unknowingly. still too many printfs, not sure how many are actualy
in the machine dependent code. reaches cpu_startup() where it stops
deliberately. next project: autoconfig(), maybe kgdb
 1.1 08-Aug-1993  glass various changes
 1.13.2.1 18-Jan-1997  thorpej Update from trunk.
 1.17.2.1 12-Mar-1997  is Merge in changes from Trunk
 1.21.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.24.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.2.1 03-Sep-2004  skrll Sync with HEAD
 1.25.12.1 21-Jun-2006  yamt sync with head.
 1.26.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.26.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.26.8.1 11-Apr-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.27.88.3 31-May-2011  rmind sync with head
 1.27.88.2 21-Apr-2011  rmind sync with head
 1.27.88.1 05-Mar-2011  rmind sync with head
 1.28.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.8.1 18-Feb-2012  mrg merge to -current.
 1.30.4.1 17-Apr-2012  yamt sync with head
 1.31.6.1 03-Dec-2017  jdolecek update from HEAD
 1.9 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.8 30-May-2009  skrll branches: 1.8.22;
Add TLS relocation definitions.
 1.7 28-Jan-2002  thorpej branches: 1.7.122;
Define EF_CPU32 and EF_M68000.
 1.6 09-Dec-2001  thorpej Add support for dumping ELF-cormat core files.
 1.5 02-Apr-2000  minoura branches: 1.5.8; 1.5.12;
Move dl* function definitions to libc on ELF.
Based on the patch supplied by Takuya Shiozaki <tshiozak@astec.co.jp>.
See http://mail-index.netbsd.org/tech-userlevel/2000/02/23/0000.html.
 1.4 30-Oct-1999  frueauf fix typo: s/EM_68k/EM_68K/
 1.3 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.2 12-Jul-1998  thorpej branches: 1.2.14; 1.2.16; 1.2.18;
Add m68k relocation types.
 1.1 12-Jul-1998  thorpej Basic elf_machdep.h for m68k; doesn't include relocations, yet.
 1.2.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.16.1 15-Nov-1999  fvdl Sync with -current
 1.2.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.12.2 28-Feb-2002  nathanw Catch up to -current.
 1.5.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.5.8.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.5.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.122.1 20-Jun-2009  yamt sync with head
 1.8.22.1 03-Dec-2017  jdolecek update from HEAD
 1.17 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.16 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.15 21-Aug-1999  simonb branches: 1.15.2;
Include <sys/endian.h> after defining whether where are little- or
big-endian. i386, pc532 and vax still include <machine/byte_swap.h>
and define macros for the {n,h}to{h,n}*() functions. mips also
defines some endian-independent assembly-code aliases for unaligned
memory accesses.
 1.14 24-Jan-1999  mycroft Mark [hn]to[nh][ls]() with __const__, so they are subject to CSE.
 1.13 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.12 31-Jul-1998  mycroft (Always) (practice) (safe) (macro expansion).
 1.11 09-Oct-1997  bouyer branches: 1.11.4;
Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.10 13-Oct-1996  christos branches: 1.10.10;
use in_addr_t and in_port_t
 1.9 14-Aug-1996  thorpej Back out previous; this is a bigger problem than I expected.
 1.8 14-Aug-1996  thorpej The htonl(), htons(), etc. functions return u_long and u_short. Add
casts to the big-endian versions of these calls so that the compiler
won't complain when they're passed as arguments to printf().
 1.7 29-Mar-1996  briggs Make NTOH[SL] and HTON[SL] (void) (x) instead of (x) to get around
compiler warnings. Followed the lead set in the sparc port.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 10-Apr-1994  chopps protect against multiple inclusion
 1.4 06-Dec-1993  mycroft Add quad stuff, etc.
 1.3 13-Oct-1993  cgd get rid of #ifndef KERNEL around inclusion of cdefs.h
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd add from net/2 sources. was symlink to ../../tahoe/include/endian.h
 1.10.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.4.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.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:11:39 +0000
 1.2 08-Oct-1996  cgd moved to aout_machdep.h (via repository copy)
 1.1 08-Sep-1996  thorpej All of the m68k ports' exec.h's were essentially the same. Merge them.

Override the N_PAGSIZ() macro; this one checks the MID of the executable
and returns the appropriate page size.
 1.2 13-Jan-2024  thorpej Make getsfc() and getdfc() inlines; it's slightly smaller.
 1.1 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.10 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.9 26-Sep-2023  tsutsui branches: 1.9.6;
Remove trailing spaces and TABs.
 1.8 26-Oct-2019  christos disable -Wshadow because in c99 mode these get marked as builtins.
 1.7 13-Sep-2017  phx branches: 1.7.2; 1.7.6;
The __fgetenv() macro operates on a fenv_t, not on a fenv_t *.
Fixes a segfault in fegetenv() and feholdexcept().
 1.6 22-Mar-2017  chs branches: 1.6.6;
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.5 27-Feb-2017  chs use FPCR instead of FPSR to manipulate the exception mask.
 1.4 05-Jan-2016  ozaki-r branches: 1.4.2; 1.4.4;
Fix #endif; it should be after __END_DECLS

This unbreaks the build of sun2.
 1.3 29-Dec-2015  christos disable code that does not work for sun2/coldfire
 1.2 25-Dec-2015  christos branches: 1.2.2;
make this compile for c++
 1.1 24-Dec-2015  christos fenv for m68k
 1.2.2.4 28-Aug-2017  skrll Sync with HEAD
 1.2.2.3 19-Mar-2016  skrll Sync with HEAD
 1.2.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.2.2.1 25-Dec-2015  skrll file fenv.h was added on branch nick-nhusb on 2015-12-27 12:09:37 +0000
 1.4.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.4.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.6.6.1 23-Sep-2017  snj Pull up following revision(s) (requested by phx in ticket #286):
sys/arch/m68k/include/fenv.h: revision 1.7
The __fgetenv() macro operates on a fenv_t, not on a fenv_t *.
Fixes a segfault in fegetenv() and feholdexcept().
 1.7.6.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.2.2 03-Dec-2017  jdolecek update from HEAD
 1.7.2.1 13-Sep-2017  jdolecek file fenv.h was added on branch tls-maxphys on 2017-12-03 11:36:23 +0000
 1.9.6.1 02-Aug-2025  perseant Sync with HEAD
 1.27 07-Oct-2025  nat Get the constants right for m68k softfloat.

Now the libm test results are 0 failures, 1 expected failure.
 1.26 04-Oct-2025  riastradh x86, m68k <machine/float.h>: `Significand', not `mantissa'.

The IEEE 754 standard uses `significand' and has since its first
edition in 1985; Kahan and Knuth both use `significand' and
explicitly reject `mantissa'; `significand' doesn't have a
conflicting definition in logarithms; and in actual usage in the
floating-point and numerical analysis literature, `significand'
dominates.

No functional change intended -- comment-only.
 1.25 04-Oct-2025  nat Increase LDL_MIN_EXP for softfloat.

An exponent of zero(-16382) has special signifiance for softfloat.

Found by atf-tests testing exponent values lower than the possible minimum.
 1.24 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.23 15-Jun-2024  rillig branches: 1.23.2;
{m68k,x86}/float.h: fix cross references
 1.22 31-Dec-2023  dholland {x86,m68k}/float.h: document LDBL_MIN behavior

It seems that even though both these platforms have 12-byte floats
that are pretty much the same representation and both allegedly
IEEE-compliant, they manifest the top bit of the mantissa and then
differ slightly in the behavior of the extra encodings this permits.

Thanks to riastradh@ for helping sort this out.
 1.21 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.20 18-Jul-2013  matt Coldfire FPU looks like the 68010 FPU (no long double)
 1.19 11-Dec-2005  christos branches: 1.19.112; 1.19.122; 1.19.128; 1.19.136;
merge ktrace-lwp.
 1.18 26-Oct-2003  kleink Hide the extended-precision definitions from __mc68010__.
 1.17 23-Oct-2003  kleink * Move the definitions for types other than single-precision and double-
precision back to machine-dependent headers. C99 has no strict
requirement which, if any, extended-precision type `long double' must
match, and even between 80-bit formats there are differences in
implementation (m68k vs. x86).
* On arm, consider __VFP_FP__.
 1.16 12-May-2003  kleink branches: 1.16.2;
Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.15 20-Apr-2003  bjh21 Use <sys/float_ieee.h> rather than <sys/math_ieee.h>, which doesn't exist.
 1.14 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.13 27-Sep-1998  mycroft The smallest positive normalized number in extended precision is 2^-16383.
Underflow handling is different from i387.
 1.12 18-Feb-1998  mycroft Include correct information for long doubles (mc68881 extended precision).
 1.11 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.10 20-Jun-1995  jtc branches: 1.10.18;
Wrap with #ifndef _XXX_FLOAT_H_/#define _XXX_FLOAT_H_/ ... /#endif.
 1.9 20-Jun-1995  jtc #include <sys/cdefs.h>.
Wrap __flt_rounds() declaration with __BEGIN_DECLS/__END_DECLS.
 1.8 07-Apr-1995  jtc Changed FLT_ROUNDS from constant to a call to __flt_rounds(), so that the
current rounding mode is accurately reported.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 11-Apr-1994  mycroft Someone made a typo.
 1.5 10-Apr-1994  chopps protect against multiple inclusion
 1.4 15-Aug-1993  mycroft Adjust DBL_MIN so it doesn't underflow.
 1.3 15-Aug-1993  mycroft Adjust DBL_MAX so it doesn't overflow.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.10.18.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.136.1 23-Jul-2013  riastradh sync with HEAD
 1.19.128.1 28-Aug-2013  rmind sync with head
 1.19.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.112.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.2 18-Jul-2013  matt Fix some definitions
 1.1 27-Jan-2009  martin branches: 1.1.2; 1.1.6; 1.1.8; 1.1.20; 1.1.30; 1.1.34; 1.1.42;
Move FPSR_ register bit definitions into their own file
 1.1.42.1 23-Jul-2013  riastradh sync with HEAD
 1.1.34.1 28-Aug-2013  rmind sync with head
 1.1.30.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.20.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.2 04-May-2009  yamt sync with head.
 1.1.8.1 27-Jan-2009  yamt file fpreg.h was added on branch yamt-nfs-mp on 2009-05-04 08:11:26 +0000
 1.1.6.2 03-Mar-2009  skrll Sync with HEAD.
 1.1.6.1 27-Jan-2009  skrll file fpreg.h was added on branch nick-hppapmap on 2009-03-03 18:29:02 +0000
 1.1.2.2 02-Feb-2009  snj Pull up following revision(s) (requested by martin in ticket #332):
sys/arch/m68k/fpe/fpu_emulate.h: revision 1.13
sys/arch/m68k/include/fpreg.h: revision 1.1
Move FPSR_ register bit definitions into their own file
 1.1.2.1 27-Jan-2009  snj file fpreg.h was added on branch netbsd-5 on 2009-02-02 00:32:23 +0000
 1.35 13-Jan-2024  thorpej G/C some unused definitions.
 1.34 12-Jan-2024  thorpej We only need one copy of getvbr() and setvbr().
 1.33 26-Sep-2023  tsutsui TAB/space cleanup.
 1.32 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.31 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.30 08-Feb-2011  rmind branches: 1.30.56;
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.29 05-Apr-2008  tsutsui branches: 1.29.26; 1.29.32; 1.29.34;
Use generic atomic_cas_uint() for mutex(9) and rwlock(9), and
remodel old RAS based _lock_cas() implementation for m68010
into genereic atomic_cas_32().
Now sun2 kernel compiles and even works on multiuser. (hehe)

Tested on tme (emulationg 2/120 and 3/150) and (real) 3/80.
 1.28 13-Mar-2007  thorpej branches: 1.28.36;
LOCK_CAS_CHECK(): make sure we're in kernel mode.
 1.27 12-Mar-2007  thorpej branches: 1.27.2;
- Define LOCK_CAS_CHECK() in m68k/frame.h (there because it operates on
a clockframe).
- Call LOCK_CAS_CHECK() in clock_intr() (noted by Izumi Tsutsui).
 1.26 11-Dec-2005  christos branches: 1.26.26; 1.26.30;
merge ktrace-lwp.
 1.25 07-Sep-2005  drochner namespace sanity: don't expose compatibility sigcontext stuff
unnecessarily
 1.24 28-Aug-2004  thorpej branches: 1.24.10; 1.24.12; 1.24.14;
De-__P
 1.23 25-Sep-2003  christos constify siginfo/trapsignal
 1.22 23-Sep-2003  cl move #defines back to frame.h
 1.21 22-Sep-2003  cl SA_SIGINFO support for m68k
 1.20 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.19 17-Jan-2003  thorpej branches: 1.19.2;
Merge the nathanw_sa branch.
 1.18 16-Aug-2001  fredette branches: 1.18.6;
Added the crucial "packed" attribute to the type 8 frame structure.
 1.17 28-Mar-2001  fredette branches: 1.17.2;
Added support for the 68010 bus error frame.
 1.16 19-Apr-1999  kleink branches: 1.16.2; 1.16.14;
Move linux_reenter_syscall() to a common location and rename it to
reenter_syscall() - it's going to be shared with COMPAT_SVR4 and soon be
used by native code.
 1.15 03-May-1997  mycroft branches: 1.15.18;
Oops; put the __attribute__ in the right place.
 1.14 03-May-1997  mycroft Make sure struct trapframe is packed tightly.
 1.13 27-Jan-1997  gwr Protect this agains multiple includes so it can be included by db_machdep.h
 1.12 16-May-1996  is 3 more constants for 68060 access error trap stack frames.
 1.11 12-Mar-1996  is M68060 additional frame formats and bits. Closes PR 1174.

This shouldn't break anything; I find ... grep ... all the relevant
kernel sources subdirecotry trees I could think of for the defines
that don't use the new FSLW or FPF6 prefix. But in case it does anyway,
tell me immediately.
 1.10 12-May-1995  mycroft Redefine the first part of struct frame to be a struct trapframe, and add a
struct switchframe.
 1.9 12-May-1995  chopps add stdframe (4-word frame)
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 23-May-1994  mycroft Add RCS ids.
 1.6 23-May-1994  mycroft Merge with 4.4-Lite.
 1.5 10-Apr-1994  chopps protect against multiple inclusion
 1.4 26-Jan-1994  mw Add support for 68040 frames and flag bits.
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.15.18.1 21-Jun-1999  thorpej Sync w/ -current.
 1.16.14.1 09-Apr-2001  nathanw Catch up with -current.
 1.16.2.1 21-Apr-2001  bouyer Sync with HEAD
 1.17.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.18.6.3 02-Dec-2001  scw G/C the FPFRAME_IS_NULL() macro; it's been moved to the source file
where it's used.

Declare a global which holds a reference floating point `idle' frame
for use in cpu_{g,s}etmcontext(). This helps when restoring an FP
context saved in usermode.

XXX: Need to test this on 6888[12], which have more complex idle frames...
 1.18.6.2 21-Nov-2001  scw Add an MD flag for uc_flags which indicates if the exception frame
area of m68k's mcontext_t structure has valid contents.

In cpu_getcontext(), set the flag for all frame formats >= FMT4 such
that cpu_setcontext() does The Right Thing with both user and kernel
saved contexts.

Make null FP frame detection work for the 68060's FPU, and ensure we
always do at least an fsave/frestore when saving/restoring FPU regs.

Both kernel and user-level get/set context calls pass all Nathan's
context tests now.
 1.18.6.1 16-Aug-2001  scw file frame.h was added on branch nathanw_sa on 2001-11-21 20:25:03 +0000
 1.19.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.2 03-Sep-2004  skrll Sync with HEAD
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.14.1 10-Apr-2006  tron Pull up following revision(s) (requested by oster in ticket #1249):
sys/arch/m68k/include/frame.h: revision 1.25
namespace sanity: don't expose compatibility sigcontext stuff
unnecessarily
 1.24.12.2 03-Sep-2007  yamt sync with head.
 1.24.12.1 21-Jun-2006  yamt sync with head.
 1.24.10.1 10-Apr-2006  tron Pull up following revision(s) (requested by oster in ticket #1249):
sys/arch/m68k/include/frame.h: revision 1.25
namespace sanity: don't expose compatibility sigcontext stuff
unnecessarily
 1.26.30.2 10-Apr-2007  ad Sync with head.
 1.26.30.1 13-Mar-2007  ad Sync with head.
 1.26.26.2 24-Mar-2007  yamt sync with head.
 1.26.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.2.1 11-Jul-2007  mjf Sync with head.
 1.28.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.34.1 17-Feb-2011  bouyer Sync with HEAD
 1.29.32.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.26.1 05-Mar-2011  rmind sync with head
 1.30.56.1 10-Jun-2019  christos Sync with HEAD
 1.18 02-Jul-2025  christos use uint32_t like the x86 file does.
 1.17 22-Jan-2024  kre branches: 1.17.2;

Add multiple inclusion protection guard - the long double math routines
have a tendency to sometimes make that happen.

This seems to fix the sun3 build, and probably other m68k builds which
were working before the libm upgrades (it will do nothing for any that
were failing before that).
 1.16 20-Sep-2010  christos cargo cult the x86 changes.
 1.15 22-Feb-2007  mhitch branches: 1.15.46; 1.15.66; 1.15.68;
Extract extended precision fraction correctly. Now gdtoa works properly
on m68k for extended precision numbers.
 1.14 22-Feb-2007  mhitch Whitespace
 1.13 17-Feb-2007  mhitch From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
 1.12 11-Dec-2005  christos branches: 1.12.24; 1.12.26;
merge ktrace-lwp.
 1.11 15-Apr-2005  kleink branches: 1.11.2;
Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.10 28-Oct-2003  kleink branches: 1.10.8; 1.10.14;
Similar to sparc, make available the extended-precision definitions for
_KERNEL; the FPE package will require it once it's used on sun2.
 1.9 27-Oct-2003  kleink Err, rename some members added in previous to make them reflect their
semantics better.
 1.8 26-Oct-2003  kleink For convenient use in libc, add unions of the C floating types and their
corresponding structure definitions.
 1.7 26-Oct-2003  kleink Correct the position of the QUIETNAN bit.
 1.6 26-Oct-2003  kleink Use <sys/ieee754.h> where applicable.
 1.5 26-Oct-2003  kleink Hide the extended-precision definitions from __mc68010__.
 1.4 23-Oct-2003  kleink Account separately for the explicit integer bit in extended-precision
format, due to its role in denormal representation; inspired by communication
with Charles Hannum.
 1.3 23-Oct-2003  kleink Make struct ieee_ext actually match the layout of m68k extended-precision.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 30-Sep-1996  ws branches: 1.1.2; 1.1.52;
PowerPC port
 1.1.52.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.52.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.52.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.52.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.14.1 19-Apr-2005  tron Pull up revision 1.11 (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.10.8.1 29-Apr-2005  kent sync with -current
 1.11.2.1 26-Feb-2007  yamt sync with head.
 1.12.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.12.24.1 07-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.15.68.1 05-Mar-2011  rmind sync with head
 1.15.66.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.15.46.1 09-Oct-2010  yamt sync with head
 1.17.2.1 02-Aug-2025  perseant Sync with HEAD
 1.11 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.10 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.9 27-Feb-2017  chs the FP_* constants need to be different from the new FE_* constants
to preserve the ABI, so shift them as needed when using them.
 1.8 25-Dec-2015  christos branches: 1.8.2; 1.8.4;
get rid of dup fenv.
 1.7 27-Jan-2009  martin branches: 1.7.24; 1.7.42;
The FE_* constants are used verbatim to set the RND field in the FPCR
register - so FE_UPWARD needs to be 3 and FE_DOWNWARD 2 - otherwise
our libc code for fpsetround(), fpgetround() and __flt_rounds() would
need to be adjust (and become slower). This fixes a failure in the
lib/libc/ieeefp/round regression test.

OK: matt
 1.6 05-Aug-2008  matt branches: 1.6.2; 1.6.4;
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.5 11-Dec-2005  christos branches: 1.5.74; 1.5.78; 1.5.80; 1.5.84;
merge ktrace-lwp.
 1.4 28-Aug-2004  thorpej De-__P
 1.3 05-Jan-1998  perry branches: 1.3.48;
RCSID Police.
 1.2 09-Apr-1995  mycroft Shift the bit positions.
 1.1 09-Apr-1995  mycroft Move fp_except and fp_rnd definitions to machine/include.
 1.3.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.48.1 03-Sep-2004  skrll Sync with HEAD
 1.5.84.1 19-Oct-2008  haad Sync with HEAD.
 1.5.80.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.78.1 04-May-2009  yamt sync with head.
 1.5.74.1 28-Sep-2008  mjf Sync with HEAD.
 1.6.4.1 02-Feb-2009  snj Pull up following revision(s) (requested by martin in ticket #332):
sys/arch/m68k/include/ieeefp.h: revision 1.7
The FE_* constants are used verbatim to set the RND field in the FPCR
register - so FE_UPWARD needs to be 3 and FE_DOWNWARD 2 - otherwise
our libc code for fpsetround(), fpgetround() and __flt_rounds() would
need to be adjust (and become slower). This fixes a failure in the
lib/libc/ieeefp/round regression test.
OK: matt
 1.6.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.7.42.2 28-Aug-2017  skrll Sync with HEAD
 1.7.42.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.7.24.1 03-Dec-2017  jdolecek update from HEAD
 1.8.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.8.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.8.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.4 13-Aug-2014  matt Include <sys/common_int_const.h> if __INTMAX_C_SUFFIX__ is defined.
 1.3 29-May-2010  tnozaki branches: 1.3.18;
fix wrong integer promotion rule(removed U suffix from UINT{8,16}_C).
see ISO/IEC 9899:1999 7.18.4.3.
 1.2 28-Apr-2008  martin branches: 1.2.20; 1.2.22;
Remove clause 3 and 4 from TNF licenses
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12; 1.1.130; 1.1.132; 1.1.134;
Add definitions of C99 integer constant macros.
 1.1.134.2 11-Aug-2010  yamt sync with head.
 1.1.134.1 16-May-2008  yamt sync with head.
 1.1.132.1 18-May-2008  yamt sync with head.
 1.1.130.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
 1.1.12.1 14-Apr-2001  kleink file int_const.h was added on branch nathanw_sa on 2001-04-14 22:38:39 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_const.h was added on branch thorpej_scsipi on 2001-04-21 17:53:55 +0000
 1.2.22.1 30-May-2010  rmind sync with head
 1.2.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.18.1 03-Dec-2017  jdolecek update from HEAD
 1.6 17-Aug-2014  martin Revert previous (SCN*FAST*) and make PRI*FAST* identical.
Should fix the default (gcc 4.5 based) build.
 1.5 15-Aug-2014  martin Fix the SCN*FAST* defines
 1.4 13-Aug-2014  matt include <sys/common_int_fmtio.h> if __INTPTR_FMTd__ is defined
 1.3 28-Apr-2008  martin branches: 1.3.44;
Remove clause 3 and 4 from TNF licenses
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.10; 1.2.128; 1.2.130; 1.2.132;
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:53:56 +0000
 1.2.132.1 16-May-2008  yamt sync with head.
 1.2.130.1 18-May-2008  yamt sync with head.
 1.2.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.10.2 26-Apr-2001  kleink Add definitions for C99 fastest minimum-width integer types.
 1.2.10.1 26-Apr-2001  kleink file int_fmtio.h was added on branch nathanw_sa on 2001-04-26 16:25:23 +0000
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.44.1 03-Dec-2017  jdolecek update from HEAD
 1.9 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.8 13-Aug-2014  matt Include <sys/common_init_limits.h> if __SIG_ATOMIC_MAX__ is defined.
 1.7 28-Apr-2008  martin branches: 1.7.44;
Remove clause 3 and 4 from TNF licenses
 1.6 17-Oct-2007  garbled branches: 1.6.16; 1.6.18; 1.6.20;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.5 31-Aug-2007  drochner Fix definitions of UCHAR_MAX/USHRT_MAX and related
types. C99 requires that these definitions promote to (signed/unsigned)
integer the same way as the types the definition is for. And since
unsigned char/short fit into an "int" on all our archs and thus promote
to signed int, the definitions must not be unsigned.
Fixes PR lib/31306 by Neil Booth.
 1.4 11-Dec-2005  christos branches: 1.4.30; 1.4.38; 1.4.44; 1.4.48; 1.4.50;
merge ktrace-lwp.
 1.3 08-May-2004  kleink branches: 1.3.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.10; 1.2.26;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_limits.h was added on branch thorpej_scsipi on 2001-04-21 17:53:56 +0000
 1.2.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.10.2 26-Apr-2001  kleink Add definitions for C99 fastest minimum-width integer types.
 1.2.10.1 26-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-26 16:25:23 +0000
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.12.1 03-Sep-2007  yamt sync with head.
 1.4.50.1 06-Nov-2007  matt sync with HEAD
 1.4.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.4.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.4.38.1 03-Oct-2007  garbled Sync with HEAD
 1.4.30.1 09-Oct-2007  ad Sync with head.
 1.6.20.1 16-May-2008  yamt sync with head.
 1.6.18.1 18-May-2008  yamt sync with head.
 1.6.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.44.1 03-Dec-2017  jdolecek update from HEAD
 1.6 15-Aug-2014  martin Fix editor mishap
 1.5 13-Aug-2014  matt include <sys/common_int_mwgwtypes.h> if __UINT_FAST64_TYPE__ is defined.
 1.4 28-Apr-2008  martin branches: 1.4.44;
Remove clause 3 and 4 from TNF licenses
 1.3 24-Dec-2005  perry branches: 1.3.74; 1.3.76; 1.3.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.10; 1.2.42;
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:53:56 +0000
 1.2.42.1 21-Jun-2006  yamt sync with head.
 1.2.10.2 26-Apr-2001  kleink Add definitions for C99 fastest minimum-width integer types.
 1.2.10.1 26-Apr-2001  kleink file int_mwgwtypes.h was added on branch nathanw_sa on 2001-04-26 16:25:23 +0000
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.78.1 16-May-2008  yamt sync with head.
 1.3.76.1 18-May-2008  yamt sync with head.
 1.3.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.10 13-Aug-2014  matt Include <sys/common_int_types.h> if __UINTPTR_TYPE__ is defined.
 1.9 24-Dec-2005  perry branches: 1.9.122;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 06-Sep-2005  kleink signed -> __signed
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 28-Apr-2001  kleink branches: 1.5.8; 1.5.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.4 12-Apr-2001  kleink Replace the 'unsigned __COMPILER_INT64__' construct with a new name,
__COMPILER_UINT64__, to be supplied - if such a case is made, it shouldn't
be assumed that the unsigned type-specifier may be applied to it.
 1.3 03-Jan-2001  takemura branches: 1.3.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.2 27-Jun-2000  kleink branches: 1.2.2;
Resolve some formatting nits; add __intptr_t and __uintptr_t.
 1.1 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.2.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 27-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:11:39 +0000
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.5.8.2 28-Apr-2001  kleink * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.5.8.1 28-Apr-2001  kleink file int_types.h was added on branch nathanw_sa on 2001-04-28 15:41:32 +0000
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.9.122.1 03-Dec-2017  jdolecek update from HEAD
 1.9 08-Feb-2024  andvar s/sharable/shareable in comments and documentation.
 1.8 19-Jan-2024  thorpej Now that we've agreed on the name "intr_depth", let's agree on the type, too.
 1.7 19-Jan-2024  thorpej Consistently use "intr_depth" as the name of the interrupt depth counter
on m68k platforms.
 1.6 19-Jan-2024  thorpej Add _KERNEL guards around most of the definitions in these files.
 1.5 16-Jan-2024  thorpej - Declare idepth as volatile.
- Provide a m68k_intrvec_intrhand() routine that returns the interrupt
handle for a given vectored interrupt. XXX This is gross and should
burn to the ground, but is needed to support legacy ISR interfaces.
 1.4 15-Jan-2024  thorpej Provide a m68k_count_intr() macro that hides the details of how interrupts
are counted, and also ensures that ci_data.cpu_nintr is incremented.
 1.3 15-Jan-2024  thorpej Use evcnt to count interrupts for the non-__HAVE_LEGACY_INTRCNT case.
 1.2 15-Jan-2024  thorpej Add the "ISR priority" notion that's used on some m68k platforms:

/*
* Some devices are particularly sensitive to interrupt
* handling latency. Unbuffered serial ports, for example,
* can lose data if their interrupts aren't handled with
* reasonable speed. For this reason, we sort interrupt
* handlers by an abstract "ISR" priority, inserting higher-
* priority interrupts before lower-priority interrupts.
*/

(...within the same shared auto-vectored interrupt list.)
 1.1 14-Jan-2024  thorpej Add a common m68k interrupt dispatch implementation.
 1.7 29-Jan-2023  mlelstv fix typo
 1.6 27-Jan-2023  tsutsui Use proper uintNN_t integer types.
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 21-May-2001  fredette branches: 1.4.8; 1.4.126; 1.4.128; 1.4.130;
Added support for kernel cores on the sun2. This
increases sizeof(struct cpu_kcore_hdr).
 1.3 01-May-1997  gwr branches: 1.3.34;
Remove unused part of sun3_kcore_hdr.
 1.2 09-Apr-1997  thorpej New kcore.h for m68k, includes all possible m68k formats in a self-describing
layout, facilitating sharing libkvm on all m68ks.

NOTE: This changes the crash dump format of all m68k ports that use the
new libkvm!
 1.1 10-Mar-1996  leo Add the include files and the atari kernel support for new format panic
dumps.
 1.3.34.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.130.1 16-May-2008  yamt sync with head.
 1.4.128.1 18-May-2008  yamt sync with head.
 1.4.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.8.2 21-May-2001  fredette Added support for kernel cores on the sun2. This
increases sizeof(struct cpu_kcore_hdr).
 1.4.8.1 21-May-2001  fredette file kcore.h was added on branch nathanw_sa on 2001-05-21 14:48:59 +0000
 1.24 21-Jan-2019  dholland Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
PR 53298 from Roberto E. Vargas Caballero.
 1.23 21-Apr-2014  matt branches: 1.23.26; 1.23.28;
Since all our compilers support __DBL_* and __FLT_*, use them to define
{DBL,FLT}_{DIG,MIN,MAX}
 1.22 11-Apr-2013  christos branches: 1.22.4; 1.22.8;
add missing SSIZE_MIN
 1.21 28-Mar-2012  christos branches: 1.21.2;
- Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.20 07-Jun-2010  tnozaki branches: 1.20.8; 1.20.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.19 17-Oct-2007  garbled branches: 1.19.20; 1.19.40; 1.19.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.18 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.17 11-Dec-2005  christos branches: 1.17.30; 1.17.38; 1.17.44; 1.17.48; 1.17.50;
merge ktrace-lwp.
 1.16 07-Aug-2003  agc branches: 1.16.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.15 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 04-May-2001  simonb branches: 1.14.8;
Be consistent with limit constants:
- use "U" suffix for unsigned constants
- use "L" suffix for long constants
- use "UL" suffix for unsigned long constants
- use hexadecimal instead of decimal

Fixes build problems with vi (now that warnings/errors are enabled) on
mips, powerpc and arm platforms.
 1.13 08-Aug-2000  tshiozak branches: 1.13.2;
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.12 07-Mar-2000  kleink branches: 1.12.2; 1.12.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.11 06-Aug-1998  kleink branches: 1.11.12;
_POSIX_SOURCE -> _POSIX_C_SOURCE
 1.10 09-Jan-1998  perry multiple include protect machine/limits.h, fixes pr 4473 (from Mika Nystrom)
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 05-Oct-1994  jtc Add constants required by XPG3
 1.7 09-May-1994  chopps Add SSIZE_MAX and SIZE_T_MAX, also fix other broken values.
 1.6 10-Apr-1994  chopps protect against multiple inclusion
 1.5 07-Dec-1993  mycroft Make sure min values are correct when used at a larger size.
 1.4 06-Dec-1993  mycroft Add quad support.
 1.3 18-Aug-1993  jtc Removed CLK_TCK, it's value is not machine dependant.
It's supposed to be defined in <time.h>, not <limits.h> anyway.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd add from net2. were symlinks to ../../vax/include/*
 1.11.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.12.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.12.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.8.2 04-May-2001  simonb Be consistent with limit constants:
- use "U" suffix for unsigned constants
- use "L" suffix for long constants
- use "UL" suffix for unsigned long constants
- use hexadecimal instead of decimal

Fixes build problems with vi (now that warnings/errors are enabled) on
mips, powerpc and arm platforms.
 1.14.8.1 04-May-2001  simonb file limits.h was added on branch nathanw_sa on 2001-05-04 15:12:33 +0000
 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.16.16.1 03-Sep-2007  yamt sync with head.
 1.17.50.1 06-Nov-2007  matt sync with HEAD
 1.17.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.17.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.17.38.1 03-Oct-2007  garbled Sync with HEAD
 1.17.30.1 09-Oct-2007  ad Sync with head.
 1.19.42.1 03-Jul-2010  rmind sync with head
 1.19.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.19.20.1 11-Aug-2010  yamt sync with head.
 1.20.12.1 05-Apr-2012  mrg sync to latest -current.
 1.20.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.20.8.1 17-Apr-2012  yamt sync with head
 1.21.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.2.1 23-Jun-2013  tls resync from head
 1.22.8.1 10-Aug-2014  tls Rebase.
 1.22.4.1 18-May-2014  rmind sync with head
 1.23.28.1 10-Jun-2019  christos Sync with HEAD
 1.23.26.1 26-Jan-2019  pgoyette Sync with HEAD
 1.17 13-Feb-2022  riastradh m68k: __cpu_simple_unlock audit.

- Use `cc' clobbers in asm volatile because they touch the condition
codes.

- Use `memory' clobbers in asm volatile so the compiler doesn't move
up loads and stores in the critical section at _other_ addresses
than the lock so they happen before __cpu_simple_lock or
__cpu_simple_lock_try.

- Not sure if we have any (or if there even are any?) multicore m68k
systems out there, but __cpu_simple_unlock needs __insn_barrier
either way so the compiler doesn't delay loads and stores prior to
__cpu_simple_unlock so they happen after it.
 1.16 29-Nov-2019  riastradh Nix mb_* on m68k.
 1.15 17-Sep-2017  christos branches: 1.15.4;
more const.
 1.14 28-Apr-2008  martin branches: 1.14.44;
Remove clause 3 and 4 from TNF licenses
 1.13 17-Oct-2007  garbled branches: 1.13.16; 1.13.18; 1.13.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.12 10-Sep-2007  skrll Merge nick-csl-alignment.
 1.11 09-Feb-2007  ad branches: 1.11.6; 1.11.14; 1.11.18; 1.11.22; 1.11.24;
Merge newlock2 to head.
 1.10 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.9 28-Dec-2005  perry branches: 1.9.20; 1.9.22;
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 28-Aug-2004  thorpej branches: 1.6.12;
De-__P
 1.5 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.4 17-Jan-2003  thorpej branches: 1.4.2;
Merge the nathanw_sa branch.
 1.3 02-May-2000  thorpej branches: 1.3.6; 1.3.14;
On the m68k, the most efficient type for __cpu_simple_lock_t is
an unsigned char, since that is what the `tas' instruction uses.

While I'm here, implement the __cpu_simple_lock family of routines.
Why? One, because they're easy. Two, so Steve can get master/slave
MVME systems talking across the backplane. :-)
 1.2 02-May-2000  thorpej Let each platform typedef the new __cpu_simple_lock_t, which should
be the most efficient type used for the atomic operations in the
simplelock structure, and should also be __volatile.
 1.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.3.14.2 25-Nov-2001  scw Oops, got a bit too enthusiastic in the last change. Drop the volatile
qualifier from __rv, otherwise the compiler generates even worse code
than normal. ;)
 1.3.14.1 25-Nov-2001  scw In __cpu_simple_lock_try(), move the initialisation of __rv down into
the asm code otherwise the compiler optimises it away...
 1.3.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.6.1 02-May-2000  bouyer file lock.h was added on branch thorpej_scsipi on 2000-11-20 20:11:39 +0000
 1.4.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.2 03-Sep-2004  skrll Sync with HEAD
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.12.4 27-Oct-2007  yamt sync with head.
 1.6.12.3 26-Feb-2007  yamt sync with head.
 1.6.12.2 30-Dec-2006  yamt sync with head.
 1.6.12.1 21-Jun-2006  yamt sync with head.
 1.9.22.1 10-Dec-2006  yamt sync with head.
 1.9.20.2 06-Feb-2007  ad Make amiga & mac68k compile.
 1.9.20.1 18-Nov-2006  ad Sync with head.
 1.11.24.1 06-Nov-2007  matt sync with HEAD
 1.11.22.1 02-Oct-2007  joerg Sync with HEAD.
 1.11.18.1 15-Aug-2007  skrll Provide __SIMPLELOCK_{UN,}LOCKED_P and __cpu_simple_lock_{set,clear}
for all architectures.
 1.11.14.1 03-Oct-2007  garbled Sync with HEAD
 1.11.6.1 09-Oct-2007  ad Sync with head.
 1.13.20.1 16-May-2008  yamt sync with head.
 1.13.18.1 18-May-2008  yamt sync with head.
 1.13.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.44.1 03-Dec-2017  jdolecek update from HEAD
 1.15.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 04-Nov-2024  christos Undo previous lwp.h change.
 1.2 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.1 17-Nov-2001  scw branches: 1.1.2;
file lwp.h was initially added on branch nathanw_sa.
 1.1.2.3 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 18-Nov-2001  scw White space nit.
 1.1.2.1 17-Nov-2001  scw Kernel support for Scheduler Activations on m68k-based ports using
mvme68k as a testbed.

Boots multi-user on an mvme162, although userland support for SA is not
yet integrated/tested.
 1.2 01-Dec-2024  skrll branches: 1.2.4;
Shuffle code so it compiles
 1.1 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.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 01-Dec-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:55:48 +0000
 1.27 13-Jan-2024  thorpej Make getsfc() and getdfc() inlines; it's slightly smaller.
 1.26 26-Sep-2023  tsutsui TAB/space cleanup.
 1.25 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.24 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.23 14-Mar-2019  thorpej G/C "MAPPECOPY". It is the deadest of wood, and never actually worked in
NetBSD.
 1.22 19-Feb-2012  rmind branches: 1.22.40;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.21 22-Dec-2011  tsutsui Adjust for function merge and move.
 1.20 15-Nov-2011  tsutsui branches: 1.20.4;
Merge copy-and-pasted fpu_probe() function (to share it among more m68k ports).
Tested on TT030, Sun3/80, and X68030.
 1.19 16-May-2011  tsutsui branches: 1.19.4;
- merge and move pasted m68k MD setreg() functions into m68k/m68k_machdep.c
- move m68881_save() and m68881_restore() declarations into <m68k/m68k.h>

Briefly tested and no obvious breakage on atari, sun3, and x68k.
 1.18 08-Feb-2011  rmind 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.17 07-Jul-2010  chs branches: 1.17.2; 1.17.4;
implement ucas_* for m68k.
 1.16 19-Dec-2009  tsutsui branches: 1.16.2; 1.16.4;
Move declaration of setfunc_trampoline() into <m68k/m68k.h>.
 1.15 19-Dec-2009  tsutsui Move declaration of lwp_trampoline() into <m68k/m68k.h>.
 1.14 30-May-2009  martin Do not use lwp_trampoline for cpu_setfunc, we do not want to call
lwp_startup() after a setfunc. Grow a simplified setfunc_trampoline
instead.
 1.13 17-Oct-2007  garbled branches: 1.13.20; 1.13.30; 1.13.36;
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.12 21-May-2007  tsutsui branches: 1.12.10;
Move declarations of m68k common functions
from <machine/cpu.h> to <m68k/m68k.h>.
While here, remove some obsolete function decls.
 1.11 11-Dec-2005  christos branches: 1.11.30; 1.11.32; 1.11.38;
merge ktrace-lwp.
 1.10 28-Aug-2004  thorpej branches: 1.10.12;
De-__P
 1.9 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.8 14-Jun-2001  fredette branches: 1.8.8; 1.8.24;
Added prototypes for w16zero and w16copy, found
in the new w16copy.s.
 1.7 03-May-2001  fredette Add a CPU_68010 macro.
 1.6 21-Oct-1997  gwr branches: 1.6.26;
comments
 1.5 21-Oct-1997  gwr Declarations for things exported by sources in this directory.
(i.e. stuff that does not belong in <machine/cpu.h>)
 1.4 09-Apr-1997  thorpej branches: 1.4.8;
Prototype regdump().
 1.3 02-Feb-1997  thorpej prototype mappedcopy{in,out}(), {copy,zero}page().
 1.2 12-Sep-1996  thorpej Add an FPU_UNKNOWN constant; just a placeholder for any unknown FPU.
 1.1 11-Sep-1996  thorpej Factor out common Motorola 68k CPU definitions from the m68k port
cpu.h header files.

Some more work could be done here, but it's a good start.
 1.4.8.1 22-Oct-1997  mellon pull up from main trunk
 1.6.26.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.24.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.24.3 18-Sep-2004  skrll Sync with HEAD.
 1.8.24.2 03-Sep-2004  skrll Sync with HEAD
 1.8.24.1 03-Aug-2004  skrll Sync with HEAD
 1.8.8.2 14-Jun-2001  fredette Added prototypes for w16zero and w16copy, found
in the new w16copy.s.
 1.8.8.1 14-Jun-2001  fredette file m68k.h was added on branch nathanw_sa on 2001-06-14 15:49:06 +0000
 1.10.12.1 03-Sep-2007  yamt sync with head.
 1.11.38.1 22-May-2007  matt Update to HEAD.
 1.11.32.1 11-Jul-2007  mjf Sync with head.
 1.11.30.1 27-May-2007  ad Sync with head.
 1.12.10.1 06-Nov-2007  matt sync with HEAD
 1.13.36.1 05-Jun-2009  snj branches: 1.13.36.1.2;
Pull up following revision(s) (requested by martin in ticket #787):
sys/arch/m68k/include/m68k.h: revision 1.14
sys/arch/m68k/m68k/switch_subr.s: revision 1.22
sys/arch/m68k/m68k/vm_machdep.c: revision 1.28
Do not use lwp_trampoline for cpu_setfunc, we do not want to call
lwp_startup() after a setfunc. Grow a simplified setfunc_trampoline
instead.
 1.13.36.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.13.30.1 05-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #787):
sys/arch/m68k/include/m68k.h: revision 1.14
sys/arch/m68k/m68k/switch_subr.s: revision 1.22
sys/arch/m68k/m68k/vm_machdep.c: revision 1.28
Do not use lwp_trampoline for cpu_setfunc, we do not want to call
lwp_startup() after a setfunc. Grow a simplified setfunc_trampoline
instead.
 1.13.20.3 11-Aug-2010  yamt sync with head.
 1.13.20.2 11-Mar-2010  yamt sync with head
 1.13.20.1 20-Jun-2009  yamt sync with head
 1.16.4.2 31-May-2011  rmind sync with head
 1.16.4.1 05-Mar-2011  rmind sync with head
 1.16.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.17.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.17.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.4.1 17-Apr-2012  yamt sync with head
 1.20.4.2 24-Feb-2012  mrg sync to -current.
 1.20.4.1 18-Feb-2012  mrg merge to -current.
 1.22.40.1 10-Jun-2019  christos Sync with HEAD
 1.9 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.8 18-Jul-2013  matt Coldfire FPU looks like the 68010 FPU (no long double)
 1.7 11-Dec-2005  christos branches: 1.7.112; 1.7.122; 1.7.128; 1.7.136;
merge ktrace-lwp.
 1.6 30-Oct-2003  kleink Don't define __HAVE_LONG_DOUBLE for __mc68010__.
 1.5 28-Oct-2003  kleink #define __HAVE_LONG_DOUBLE on platforms which implement a distinct
`long double' type.
 1.4 19-Feb-2002  simonb branches: 1.4.16;
Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.3 05-Feb-2000  kleink branches: 1.3.6; 1.3.10; 1.3.14;
Improve namespace test macros a bit.
 1.2 04-Jan-2000  kleink const -> __const and include <sys/cdefs.h> earlier; fixes PR lib/9052
by Takahiro Kambe.
 1.1 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.3.14.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.10.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.6.1 05-Feb-2000  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:11:39 +0000
 1.4.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.1 03-Aug-2004  skrll Sync with HEAD
 1.7.136.1 23-Jul-2013  riastradh sync with HEAD
 1.7.128.1 28-Aug-2013  rmind sync with head
 1.7.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.112.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16 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 04-Oct-2020  rin Add missing __{BEGIN,END}_DECLS in order to catch up with
sanitizer_linux_libcdep.cc rev 1.17:

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux_libcdep.cc#rev1.17

Fix build with HAVE_GCC=9.
 1.11 07-Sep-2020  mrg pass a pointer conversion via uintptr_t *and* the desired type casts.
avoids new GCC 9 warnings with C++ code.
 1.10 15-Feb-2018  kamil Introduce _UC_MACHINE_FP() as a macro

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

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


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

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

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

Once ia64 will mature, this should be revisited.

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


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

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

Proposed on tech-userlevel@.

Sponsored by <The NetBSD Foundation>
 1.9 22-Nov-2011  joerg branches: 1.9.42;
Add TLS support for m68k.
 1.8 24-Feb-2011  joerg branches: 1.8.4;
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 23-Feb-2011  joerg Fix ucontext32_t on AMD64. Add optional compile time assertions for
ucontext_t and ucontext32_t to ensure that they don't change.
Provide the constants for AMD64, ARM, i386, and M68K.
 1.6 28-Apr-2008  martin branches: 1.6.22; 1.6.28; 1.6.30;
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 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.3 22-Sep-2003  cl SA_SIGINFO support for m68k
 1.2 17-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 10-Nov-2001  scw branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.7 10-Jan-2003  thorpej On second thought, make __mc_frame _KERNEL || __M68K_MCONTEXT_PRIVATE.
 1.1.2.6 10-Jan-2003  thorpej Expose the remainder of the frame/fpframe in the mcontext to userland
(and namespace-cleanse the member names in doing so).
 1.1.2.5 28-Dec-2001  nathanw Add a macro, _UC_MACHINE_SP(), to fetch the user stack pointer from
a ucontext_t.
 1.1.2.4 02-Dec-2001  scw Add a comment about the padding in mcontext_t, and simplify fpregs.
 1.1.2.3 25-Nov-2001  scw When restoring thread context, check the _UC_USER bit and DTRT when
checking frame format and fpu saved state.

The whole `full fpu state cannot be saved/restored from userland' needs
more thought.

XXX: _UC_USER really ought to be defined in <sys/ucontext.h> ...
 1.1.2.2 21-Nov-2001  scw Add an MD flag for uc_flags which indicates if the exception frame
area of m68k's mcontext_t structure has valid contents.

In cpu_getcontext(), set the flag for all frame formats >= FMT4 such
that cpu_setcontext() does The Right Thing with both user and kernel
saved contexts.

Make null FP frame detection work for the 68060's FPU, and ensure we
always do at least an fsave/frestore when saving/restoring FPU regs.

Both kernel and user-level get/set context calls pass all Nathan's
context tests now.
 1.1.2.1 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 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.1 16-May-2008  yamt sync with head.
 1.5.76.1 18-May-2008  yamt sync with head.
 1.5.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.30.1 05-Mar-2011  bouyer Sync with HEAD
 1.6.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.22.1 05-Mar-2011  rmind sync with head
 1.8.4.1 17-Apr-2012  yamt sync with head
 1.9.42.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.9.42.2 26-Feb-2018  snj revert ticket 552, which broke the build
 1.9.42.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.13.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 08-Jul-2025  thorpej Add common '030 and '040/'060 routines for configuring the transparent
translation registers. Adjust luna68k and news68k to use them.
 1.2 01-Feb-2025  andvar s/Futhermore/Furthermore/ in comment.
 1.1 27-Dec-2023  thorpej branches: 1.1.2;
Add a header file for 68030-specific MMU definitions, specifically the
Transparent Translation registers, that do not exist on the 68851. A
big comment at the top of the file describes the differences between
the 68851 and the 68030's MMU.
 1.1.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 08-Jul-2025  thorpej Add common '030 and '040/'060 routines for configuring the transparent
translation registers. Adjust luna68k and news68k to use them.
 1.3 09-Feb-2024  andvar branches: 1.3.2;
fix spelling mistakes, mainly in comments and log messages.
 1.2 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.1 27-Dec-2023  thorpej Add new headers that describe the 68851 (and 68030) MMU and
68040 (and 68060) MMU structures using names that more closely
align with Motorola's documentation.

The definitions here automagically adapt to 4K or 8K pages, based
on the value of PGSHIFT, which must be a compile-time constant.
 1.3.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 08-Feb-2024  andvar s/sharable/shareable in comments and documentation.
 1.3 09-Jan-2024  thorpej Statically-initialize the '851 / '030 protorp with MMU51_SRP_BITS. In
pmap_init(), re-initialize protorp with MMU51_CRP_BITS. Remove the now-
redundant code that does this in each of the m68k platforms.
 1.2 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.1 27-Dec-2023  thorpej Add new headers that describe the 68851 (and 68030) MMU and
68040 (and 68060) MMU structures using names that more closely
align with Motorola's documentation.

The definitions here automagically adapt to 4K or 8K pages, based
on the value of PGSHIFT, which must be a compile-time constant.
 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 08-Mar-2020  rin Remove mutex stubs for 68010 that merely fall back to C codes, and
do not work with kern_mutex.c rev 1.85 and later:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_mutex.c#rev1.85
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_mutex.c#rev1.86

Fix sun2 kernel freeze during early boot stage in mutex_exit(9).
 1.9 29-Nov-2019  riastradh Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.8 29-Nov-2019  riastradh Nix mb_* on m68k.
 1.7 28-Apr-2008  martin branches: 1.7.88;
Remove clause 3 and 4 from TNF licenses
 1.6 05-Apr-2008  tsutsui branches: 1.6.2; 1.6.4;
Use generic atomic_cas_uint() for mutex(9) and rwlock(9), and
remodel old RAS based _lock_cas() implementation for m68010
into genereic atomic_cas_32().
Now sun2 kernel compiles and even works on multiuser. (hehe)

Tested on tme (emulationg 2/120 and 3/150) and (real) 3/80.
 1.5 21-Nov-2007  yamt branches: 1.5.14;
make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.4 11-Mar-2007  thorpej branches: 1.4.16; 1.4.18; 1.4.22; 1.4.24;
- Shrink ipl_cookie_t from 32-bits to 16-bits (large enough to hold
an SR value or an IPL_* constant).
- Take advange of the smaller ipl_cookie_t to shrink kmutex_t from
16 bytes to 8 bytes by overlapping storage where possible.
- Implement a RAS-based _lock_cas() for mc68010 systems (Sun2). See
sun68k/sun68k/isr.c.

Tested on various m68k platforms, but NOT Sun2. In any case, at least
Sun2 compiles now.
 1.3 15-Feb-2007  mhitch branches: 1.3.2; 1.3.4; 1.3.8;
Add lock stubs for m68k. Amiga builds and runs now.
 1.2 09-Feb-2007  ad Merge newlock2 to head.
 1.1 06-Feb-2007  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.1 06-Feb-2007  ad Make amiga & mac68k compile.
 1.3.8.2 03-Dec-2007  ad Sync with HEAD.
 1.3.8.1 13-Mar-2007  ad Sync with head.
 1.3.4.4 07-Dec-2007  yamt sync with head
 1.3.4.3 03-Sep-2007  yamt sync with head.
 1.3.4.2 26-Feb-2007  yamt sync with head.
 1.3.4.1 15-Feb-2007  yamt file mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:07:11 +0000
 1.3.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.24.1 08-Dec-2007  mjf Sync with HEAD.
 1.4.22.1 21-Nov-2007  bouyer Sync with HEAD
 1.4.18.1 09-Jan-2008  matt sync with HEAD
 1.4.16.1 21-Nov-2007  joerg Sync with HEAD.
 1.5.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.4.1 16-May-2008  yamt sync with head.
 1.6.2.1 18-May-2008  yamt sync with head.
 1.7.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.24 31-May-2021  simonb Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.23 01-May-2020  isaki branches: 1.23.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.22 07-Jan-2019  jdolecek branches: 1.22.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.21 24-Jan-2012  christos branches: 1.21.46; 1.21.48;
Use and define ALIGN() ALIGN_POINTER() and STACK_ALIGN() consistently,
and avoid definining them in 10 different places if not needed.
 1.20 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.19 05-Mar-2011  matt branches: 1.19.4; 1.19.8;
If _KERNEL is not defined, force MACHINE to be "m68k". Userland should be
using uname/sysctl to get this value.
 1.18 08-Feb-2011  rmind 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.17 08-Feb-2010  joerg branches: 1.17.2; 1.17.4; 1.17.6;
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.16 11-Dec-2009  tsutsui branches: 1.16.2;
Refactoring MD segment related definitions on m68k ports:
- move macro SEGSHIFT, NBSEG, and SEGOFSET from <machine/param.h>
to <m68k/pmap_motorola.h> where they should belong
- also simplify NBSEG macro for both 020/030 and 040/060 cases
- also move m68k_trunc_seg(), m68k_round_seg(), and m68k_seg_offset()
(that use SEGOFSET) from <m68k/param.h> to <m68k/pmap_motorola.h>
- add comments about each segment size value used on pmap_motorola
implementation
- add TIA_SIZE, TIA_SHIFT, TIB_SIZE, and TIB_SHIFT macro which can be
used for ste/pte index sizes
- use proper vaddr_t cast instead of unsigned for SEGOFSET/PGOFSET macro

Tested on atari, hp300, and news68k.
 1.15 28-Aug-2006  yamt branches: 1.15.60;
- 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 30-Oct-2003  mycroft branches: 1.13.16;
Allow a port to override MAXPHYS.
 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 26-Feb-2002  simonb branches: 1.11.16;
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.10 30-May-2001  mrg branches: 1.10.2; 1.10.8;
use _KERNEL_OPT
 1.9 03-May-2001  fredette Now only define MACHINE_ARCH, _MACHINE_ARCH, and
MID_MACHINE if they haven't already been defined.
 1.8 30-Jun-2000  itojun branches: 1.8.2;
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.7 12-Dec-1999  scottr branches: 1.7.4;
Add m68k_seg_offset() and m68k_page_offset() to complement m68k_trunc_seg()
m68k_trunc_page(), respectively. Motivated primarily by a desire for
code clarity and symmetry.
 1.6 04-Dec-1999  ragge CL* discarding.
 1.5 29-Apr-1998  thorpej branches: 1.5.14; 1.5.20;
Pull in opt_gateway.h as appropriate.
 1.4 20-Sep-1997  leo Move the definition of MSGBUFSIZE up to the machine-arch level if
possible. Pointed out by Bernd Ernesti.
 1.3 10-Jul-1997  veego branches: 1.3.2;
Move the defines of UPAGES and NPTEPG back to the MD param.h, execpt that
the sun3[x] doesn't use NPTEPG.
 1.2 10-Jun-1997  veego Add the 'Mach derived conversion macros' from <arch>/include/param.h.
 1.1 10-Jun-1997  veego New MI include file. Based on the param.h from all m68k ports.
 1.3.2.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.20.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.5.20.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.5.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.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.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.10.8.1 30-May-2001  nathanw file param.h was added on branch nathanw_sa on 2002-02-28 04:10:34 +0000
 1.10.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.11.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.16.1 03-Aug-2004  skrll 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.60.1 11-Mar-2010  yamt sync with head
 1.16.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.6.1 17-Feb-2011  bouyer Sync with HEAD
 1.17.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.2.2 06-Mar-2011  rmind sync with head (and fix few botches with this)
 1.17.2.1 05-Mar-2011  rmind sync with head
 1.19.8.1 18-Feb-2012  mrg merge to -current.
 1.19.4.1 17-Apr-2012  yamt sync with head
 1.21.48.1 10-Jun-2019  christos Sync with HEAD
 1.21.46.1 18-Jan-2019  pgoyette Synch with HEAD
 1.22.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.23.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.11 26-Sep-2023  tsutsui TAB/space cleanup.
 1.10 08-Feb-2011  rmind 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.9 14-Jan-2011  rmind branches: 1.9.2; 1.9.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.8 02-Dec-2009  tsutsui branches: 1.8.4;
Add a common pmap_bootstrap_finalize() function which initializes
lwp0 uarea, curlwp, and curpcb after MMU is turned on, using
lwp0uarea variable saved during pmap_bootstrap() (or equivalent functions)
for pmap_motorola based ports. Discussed with rmind@.
 1.7 04-Mar-2007  christos branches: 1.7.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 10-Aug-2000  scw branches: 1.4.24;
Add a `/t' modifier to the m68k ddb's `trace' command. This enables
one to perform a kernel traceback of any (non-swapped-out) process in
the system. For example, to show the traceback for PID 178:

db> t/t 0t178
trace: pid 178 at 0xabcd68
_mi_switch(0x109f60) + 164
...
db>
 1.3 03-Nov-1999  he Provide multiple inclusion protection.
 1.2 06-Jan-1998  thorpej branches: 1.2.14; 1.2.16; 1.2.18;
The user segment table pointer is no longer kept here. Change it to
a spare field.
 1.1 31-Mar-1997  gwr Need a common <m68k/pcb.h> for gdb.
 1.2.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.16.1 15-Nov-1999  fvdl Sync with -current
 1.2.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.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.5.16.1 03-Sep-2007  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.44.1 11-Mar-2010  yamt sync with head
 1.8.4.1 05-Mar-2011  rmind sync with head
 1.9.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.9.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6 28-Sep-2023  skrll whitespace nit
 1.5 28-Sep-2023  skrll #define<space> -> #define<tab> for consistency
 1.4 20-Dec-2020  skrll Support __HAVE_PMAP_PV_TRACK in sys/uvm/pmap based pmaps (aka common pmap)
 1.3 07-Aug-2020  skrll branches: 1.3.2;
Provide a pmap_segtab_deactivate for symmetry with pmap_segtab_activate
and use it in pmap_deactivate

Call pmap_md_xtab_{,de}activate from pmap_segtab_{,de}activate to be used
for PMAP_HWPAGEWALKER and any caches ops that might be required.

Provide empty (for now) pmap_md_xtab_{,de}activate functions on the
platforms that use sys/uvm/pmap
 1.2 18-Mar-2014  riastradh branches: 1.2.4; 1.2.8;
Merge riastradh-drm2 to HEAD.
 1.1 18-Jul-2013  matt branches: 1.1.2; 1.1.4;
pte and pmap files for the soft tlb on coldfire cpus.
(uncompiled and mostly probably wrong.)
 1.1.4.2 28-Aug-2013  rmind sync with head
 1.1.4.1 18-Jul-2013  rmind file pmap_coldfire.h was added on branch rmind-smpnet on 2013-08-28 23:59:18 +0000
 1.1.2.2 23-Jul-2013  riastradh sync with HEAD
 1.1.2.1 18-Jul-2013  riastradh file pmap_coldfire.h was added on branch riastradh-drm2 on 2013-07-23 21:07:34 +0000
 1.2.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.8.1 18-Mar-2014  tls file pmap_coldfire.h was added on branch tls-maxphys on 2014-08-20 00:03:10 +0000
 1.2.4.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.4.1 18-Mar-2014  yamt file pmap_coldfire.h was added on branch yamt-pagecache on 2014-05-22 11:39:55 +0000
 1.3.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.43 31-Dec-2023  thorpej Provide a vtophys() function like other platforms do, and implement
kvtop() (which will be g/c'd shortly) in terms of it.
 1.42 27-Dec-2023  thorpej Stop using magic numbers for the MMU root pointer attributes and the
Translation Control register, and also get rid of "#if PGSHIFT == ..."
where those magic numbers are used.

Instead, define new macros: MMU51_SRP_BITS, MMU51_CRP_BITS, MMU51_TCR_BITS,
and MMU40_TCR_BITS, in terms of the definitions in mmu_{40,51}.h. These
automagically adapt to 8K and 4K pages based on the machine-specific value
of PGSHIFT.
 1.41 26-Dec-2023  thorpej Move active_pmap() and active_user_pmap() macros into pmap_motorola.c
 1.40 26-Dec-2023  thorpej - G/C the PMAP_ACTIVATE() macro, just call loadustp() directly.
- In pmap_activate(), rather than checking for an idle LWP and skipping
the loadustp() in that case, just check if the pmap being activate is
the kernel pmap. Also, KASSERT() that the specified lwp is the current
lwp.
 1.39 25-Dec-2023  thorpej loadustp(): Optimize for the overwhelmingly common case of "not the HP MMU".
Rather than converting the level 1 table address to a page number before
calling loadustp() only to have loadustp() convert it back to an address
for the '851, '030, '040, and '060, instead pass the address and convert
to a page number only in the case of the HP MMU.

This is a wash on HP MMU machines (9000/320 and 9000/350), and saves at
least 4 instructions (2x moveq + 2x lsXl) on every context switch on
everything else.
 1.38 26-Sep-2023  tsutsui Remove trailing spaces and TABs.
 1.37 19-Sep-2021  andvar fix various typos in comments, messages and documentation.
 1.36 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.35 01-Feb-2020  tsutsui Use "__nothing" macro defined in <sys/cdefs.h> for empty pmap_update().

Suggested by pgoyette@ in PR/54869.
 1.34 29-Oct-2011  tsutsui branches: 1.34.54; 1.34.60;
Use pool(9) for struct pv_entry allocations rather than
uvm_km_alloc(9)/uvm_km_free(9) and ancient homegrown pv_page_info structures.

Calling uvm_km_free(9) during pmap_remove(9) could cause rw_lock error
in uvm_unmap1() as noted in PR port-m68k/45519.

NetBSD/x68k (both real X68030 and XM6i emulator) still gets weird panic
(corrupted kernel stack pointer?) on some heavy load:
---
panic: MMU fault
Stopped in pid 363.1 (X68k) at netbsd:cpu_Debugger+0x6: unlk a6
db> tr
cpu_Debugger(4012004,8,1cbb528,2a618e0,2a5b000) + 6
db>
---
but it also occurs without this change so there might be some more bugs
in m68k pmap...
 1.33 03-Jun-2011  tsutsui - remove simple_lock(9) and use atomic_ops(3) to account pmap reference count,
perrequest from rmind@
- while here no need to export struct pmap on sun2/sun3/sun3x

No particular problem for a week on hp300 and sun3x kernels with disabled
tcp_vtw which has been broken for a month on low memory machines.
 1.32 06-Jan-2011  tsutsui branches: 1.32.2; 1.32.6;
Use #ifdef CACHE_HAVE_VAC rather than #ifdef M68K_MMU_HP where
the pmap code indends.
(though currently only MMU_HP machines have VAC in pmap_motorola ports)
 1.31 02-Jan-2011  tsutsui Make pmap_aliasmask unsigned and declare it in <m68k/pmap_motorola.h>.

XXX: does anyone still have working HP320 or HP350 with 020+HP_MMU+VAC?
 1.30 06-Jun-2010  he Only include opt_m68k_arch.h if _KERNEL_OPT is defined, so that librump
builds again. OK'ed by mrg@.
 1.29 06-Jun-2010  mrg fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

i built these kernels to ensure i did not break their builds:

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.28 13-Dec-2009  tsutsui branches: 1.28.2; 1.28.4;
- update some comments
- use unsigned constant for shift op
 1.27 11-Dec-2009  tsutsui Define SYSMAP_VA in <m68k/pmap_motorola.h>
where the Sysmap pointer is declared.
 1.26 11-Dec-2009  tsutsui Refactoring MD segment related definitions on m68k ports:
- move macro SEGSHIFT, NBSEG, and SEGOFSET from <machine/param.h>
to <m68k/pmap_motorola.h> where they should belong
- also simplify NBSEG macro for both 020/030 and 040/060 cases
- also move m68k_trunc_seg(), m68k_round_seg(), and m68k_seg_offset()
(that use SEGOFSET) from <m68k/param.h> to <m68k/pmap_motorola.h>
- add comments about each segment size value used on pmap_motorola
implementation
- add TIA_SIZE, TIA_SHIFT, TIB_SIZE, and TIB_SHIFT macro which can be
used for ste/pte index sizes
- use proper vaddr_t cast instead of unsigned for SEGOFSET/PGOFSET macro

Tested on atari, hp300, and news68k.
 1.25 08-Dec-2009  tsutsui Remove unused M68K_SEG_SIZE macro. All sources use NBSEG directly.

XXX: It looks NBSEG definitions in <machine/param.h>
XXX: for all m68k port are incorrect, since 1997 or 2002.
 1.24 06-Dec-2009  tsutsui Move initialization of protection_codes[] and kernel_pmap()
from MD pmap bootstrap sources to common pmap_bootstrap_finalize().

Tested on atari, hp300, mac68k, and news68k.

XXX: Why is protection_codes[] array initialized at run time?
 1.23 06-Dec-2009  tsutsui pm_stfree in struct pmap is a bitmap value so make it unsigned.
 1.22 02-Dec-2009  tsutsui Add a common pmap_bootstrap_finalize() function which initializes
lwp0 uarea, curlwp, and curpcb after MMU is turned on, using
lwp0uarea variable saved during pmap_bootstrap() (or equivalent functions)
for pmap_motorola based ports. Discussed with rmind@.
 1.21 26-Aug-2009  thorpej Minor tweak to the pv_table management in the Hibler-derived m68k pmaps:
The head of the list is now a pv_header, which contains the first pv_entry
as well as a 16-bit attributes field (replaces the pmap_attributes array
plus the pv_entry::pv_flags field) as a 16-bit count of caller-specified
cache-inhibited mappings.

Tested on hp300 (shared pmap_motorola.c), changes to atari and amiga copies
are purely mechanical.
 1.20 17-Jan-2009  tsutsui Move extern decls for Sysseg, Sysptmap, Sysptsize, mem_size, virtual_avail,
virtual_end, and protection_codes[] to common <m68k/pmap_motorola.h>,
and also make protection_codes[] unsigned.

XXX: avail_start and avail_end should also be moved, but it causes
XXX: -Wshadow warnings in uvm/uvm_page.c:uvm_page_physload() and
XXX: I don't have a good idea of alternative names for now.
 1.19 28-Dec-2008  tsutsui Use the global kernel_pmap_ptr pointer in each MD pmap_bootstrap.c
(where MMU is not enabled yet) and make kernel_pmap_store static again.
Also consistently use uintptr_t on address conversion in RELOC() macro.

Tested on hp300 (PA != VA) and news68k (PA == VA).
 1.18 10-Dec-2008  tsutsui Restore kernel_pmap_store declaration since it's still used by
most m68k ports in pmap_bootstrap.c.
 1.17 10-Dec-2008  pooka Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.16 06-Jan-2008  dsl branches: 1.16.6; 1.16.10; 1.16.16; 1.16.18;
include sys/simplelock.h
 1.15 17-Oct-2007  garbled branches: 1.15.2; 1.15.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.14 07-Jun-2007  tsutsui branches: 1.14.10;
Enable _pmap_set_page_cacheable(), _pmap_set_page_cacheinhibit() and
_pmap_page_is_cacheable() on all pmap_motorola.c ports and add
BUS_DMA_COHERENT support (from mvme68k) to common m68k bus_dma.c.

Tested with (not-yet-integrated) MI Sonic Ethernet driver on mac68k
http://mail-index.netbsd.org/port-mac68k/2007/06/07/0000.html
and ok'ed by thorpej.
 1.13 12-May-2007  mhitch Changes to enable support of 8K pagesize.
 1.12 05-Mar-2007  tsutsui branches: 1.12.2; 1.12.4; 1.12.10;
Allocate msgbufaddr in pmap_bootstrap.c where it's initilized,
and move its declaration into <m68k/pmap_motorola.h>.
 1.11 04-Mar-2007  tsutsui Move declarations of CADDR1 and CADDR2 from m68k/pmap_motorola.c
to <m68k/pmap_motorola.h>.
 1.10 16-Feb-2006  perry branches: 1.10.20;
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.9 24-Dec-2005  perry branches: 1.9.2; 1.9.4; 1.9.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 01-Apr-2005  yamt branches: 1.7.2;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.6 17-Jan-2005  atatat branches: 1.6.2;
Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
 1.5 28-Aug-2004  thorpej branches: 1.5.4;
De-__P
 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 02-Apr-2003  thorpej branches: 1.3.2;
Use PAGE_SIZE rather than NBPG.
 1.2 05-Nov-2002  chs branches: 1.2.2;
merge pmap.c for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.1 03-Nov-2002  chs merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.2.2.2 11-Nov-2002  nathanw Catch up to -current
 1.2.2.1 05-Nov-2002  nathanw file pmap_motorola.h was added on branch nathanw_sa on 2002-11-11 21:59:38 +0000
 1.3.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.3.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.3.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.2 03-Sep-2004  skrll Sync with HEAD
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.4.1 29-Apr-2005  kent sync with -current
 1.6.2.1 23-Feb-2005  yamt change mac68k's kernel address space layout in order to simplify
interaction between upper layer of the vm during bootstrap.
- move Sysmap to the end of address space.
- move IOBase etc immediately after proc0 uarea.
- tweak virtual_avail/end accordingly.

tested by Chuck Silvers, on his quadra 950.
XXX this breaks other m68k platforms. i'll fix them later.
 1.7.2.2 21-Jan-2008  yamt sync with head
 1.7.2.1 03-Sep-2007  yamt sync with head.
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.20.2 17-May-2007  yamt sync with head.
 1.10.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.12.10.1 22-May-2007  matt Update to HEAD.
 1.12.4.1 11-Jul-2007  mjf Sync with head.
 1.12.2.2 09-Jun-2007  ad Sync with head.
 1.12.2.1 27-May-2007  ad Sync with head.
 1.14.10.2 09-Jan-2008  matt sync with HEAD
 1.14.10.1 06-Nov-2007  matt sync with HEAD
 1.15.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.15.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.16.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.16.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.10.4 11-Aug-2010  yamt sync with head.
 1.16.10.3 11-Mar-2010  yamt sync with head
 1.16.10.2 16-Sep-2009  yamt sync with head
 1.16.10.1 04-May-2009  yamt sync with head.
 1.16.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.28.4.3 12-Jun-2011  rmind sync with head
 1.28.4.2 05-Mar-2011  rmind sync with head
 1.28.4.1 03-Jul-2010  rmind sync with head
 1.28.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.32.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.32.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.34.60.1 29-Feb-2020  ad Sync with head.
 1.34.54.1 08-Apr-2020  martin Merge changes from current as of 20200406
 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:36:45 +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:02 +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:27 +0000
 1.8 06-Dec-2020  christos Don't expose register_t
 1.7 14-Jan-2011  rmind branches: 1.7.72;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.6 21-Nov-2009  rmind branches: 1.6.4;
Include sys/user.h for MD proc.h (hppa and m68k ports).
 1.5 11-Dec-2005  christos branches: 1.5.78;
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 17-Jan-2003  thorpej branches: 1.3.2;
Merge the nathanw_sa branch.
 1.2 13-Jul-2002  drochner branches: 1.2.2; 1.2.4; 1.2.6;
make sure struct proc and struct frame are declared
 1.1 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.2.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 13-Jul-2002  jdolecek file proc.h was added on branch kqueue on 2002-09-06 08:36:46 +0000
 1.2.4.4 06-Aug-2002  nathanw Need to forward-declare struct lwp, not struct proc.
 1.2.4.3 02-Aug-2002  gmcgarry LWPify.
 1.2.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.4.1 13-Jul-2002  nathanw file proc.h was added on branch nathanw_sa on 2002-08-01 02:42:15 +0000
 1.2.2.2 16-Jul-2002  gehenna catch up with -current.
 1.2.2.1 13-Jul-2002  gehenna file proc.h was added on branch gehenna-devsw on 2002-07-16 08:36:47 +0000
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.78.1 11-Mar-2010  yamt sync with head
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.7.72.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.22 18-Mar-2014  riastradh Merge riastradh-drm2 to HEAD.
 1.21 18-Jul-2013  matt Coldfire FPU looks like the 68010 FPU (no long double)
 1.20 21-Mar-2012  he branches: 1.20.2; 1.20.4; 1.20.10;
Use c89 function declarations in MCOUNT definition.
 1.19 07-Aug-2006  tsutsui branches: 1.19.96; 1.19.100;
Remove __P().
 1.18 16-Feb-2006  perry branches: 1.18.2;
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.17 24-Dec-2005  perry branches: 1.17.2; 1.17.4; 1.17.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.16 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.15 11-Dec-2005  christos merge ktrace-lwp.
 1.14 02-Oct-2005  chs put mcount.c in the normal object list, so that "make depend" works.
use a gcc attribute to prevent it from being instrumented.
 1.13 07-Aug-2003  agc branches: 1.13.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.12 27-May-2001  chs branches: 1.12.8; 1.12.24;
change the one non-extended asm back to using a single % before a
register name. the rule is that extended asms should have the
regsiter-prefix %s escaped by doubling them, but non-extended asms
don't do the escaping thing, so there the %s should not be doubled.
 1.11 18-May-2001  fredette Only on the 68010, define a different mcount() function,
one that doesn't use the memory-indirect addressing mode.
 1.10 07-Dec-2000  kleink branches: 1.10.2;
In the ELF toolchain, use __mcount instead of mcount.
 1.9 22-Nov-2000  leo Revert previous change. I cannot see why this ever worked... Pointed out
by Steve Woodford.
 1.8 19-Oct-2000  leo %%<reg> -> %<reg>
 1.7 06-Nov-1999  thorpej Add register prefixes.
 1.6 05-Nov-1997  thorpej branches: 1.6.14; 1.6.16; 1.6.20;
inline -> __inline
 1.5 05-Nov-1997  thorpej asm -> __asm__, volatile -> __volatile
 1.4 08-Apr-1997  leo branches: 1.4.8;
Turn the 'extern' definition of mcount() into a full prototype.
 1.3 26-Mar-1995  briggs KERNEL -> _KERNEL
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 13-May-1994  mycroft Needed for new profiling code.
 1.4.8.2 05-Nov-1997  thorpej Update from trunk: inline -> __inline
 1.4.8.1 05-Nov-1997  thorpej Pullup from trunk: asm -> __asm__, volatile -> __volatile
 1.6.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.16.1 15-Nov-1999  fvdl Sync with -current
 1.6.14.2 08-Dec-2000  bouyer Sync with HEAD.
 1.6.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.24.1 03-Aug-2004  skrll Sync with HEAD
 1.12.8.2 27-May-2001  chs change the one non-extended asm back to using a single % before a
register name. the rule is that extended asms should have the
regsiter-prefix %s escaped by doubling them, but non-extended asms
don't do the escaping thing, so there the %s should not be doubled.
 1.12.8.1 27-May-2001  chs file profile.h was added on branch nathanw_sa on 2001-05-27 00:58:58 +0000
 1.13.16.2 30-Dec-2006  yamt sync with head.
 1.13.16.1 21-Jun-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 18-Feb-2006  yamt sync with head.
 1.18.2.1 11-Aug-2006  yamt sync with head
 1.19.100.1 05-Apr-2012  mrg sync to latest -current.
 1.19.96.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.96.1 17-Apr-2012  yamt sync with head
 1.20.10.1 23-Jul-2013  riastradh sync with HEAD
 1.20.4.1 28-Aug-2013  rmind sync with head
 1.20.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19 16-Jan-2024  thorpej Provide PSLTOIPL() and IPLTOPSL() macros.
 1.18 14-Jan-2024  thorpej Provide a _splx() inline.
 1.17 12-Jan-2024  thorpej Make getsr() an inline in <m68k/psl.h> and G/C all of the now-redudant
copies.
 1.16 27-Jan-2023  tsutsui Use proper uintNN_t integer types.
 1.15 27-Jul-2012  matt Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).
 1.14 06-May-2009  mhitch branches: 1.14.12;
Add memory clobber to the instructions that change the IPL in the status
register. See also kern/38637.
 1.13 16-Feb-2006  perry branches: 1.13.72; 1.13.82; 1.13.86; 1.13.88;
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.12 24-Dec-2005  perry branches: 1.12.2; 1.12.4; 1.12.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.11 11-Dec-2005  christos merge ktrace-lwp.
 1.10 07-Aug-2003  agc branches: 1.10.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 05-Aug-2001  matt branches: 1.9.6; 1.9.22;
If = is in a constraint, it must be the first character.
 1.8 11-Dec-2000  scw branches: 1.8.4;
Some micro-optimisations to _spl() and _splraise(), saving one instruction
in the former, and three to seven in the latter.
 1.7 06-Nov-1999  thorpej Add register prefixes.
 1.6 05-Aug-1999  thorpej branches: 1.6.2; 1.6.4; 1.6.8;
Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

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

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 23-May-1994  mycroft Add RCS ids.
 1.3 23-May-1994  mycroft Merge with 4.4-Lite.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.4.1 15-Nov-1999  fvdl Sync with -current
 1.6.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.9.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.22.1 03-Aug-2004  skrll Sync with HEAD
 1.9.6.2 05-Aug-2001  matt If = is in a constraint, it must be the first character.
 1.9.6.1 05-Aug-2001  matt file psl.h was added on branch nathanw_sa on 2001-08-05 04:40:04 +0000
 1.10.16.1 21-Jun-2006  yamt sync with head.
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.12.2.1 18-Feb-2006  yamt sync with head.
 1.13.88.1 10-May-2009  snj branches: 1.13.88.1.2;
Pull up following revision(s) (requested by mhitch in ticket #743):
sys/arch/m68k/include/psl.h: revision 1.14
Add memory clobber to the instructions that change the IPL in the status
register. See also kern/38637.
 1.13.88.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.13.86.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.82.1 10-May-2009  snj Pull up following revision(s) (requested by mhitch in ticket #743):
sys/arch/m68k/include/psl.h: revision 1.14
Add memory clobber to the instructions that change the IPL in the status
register. See also kern/38637.
 1.13.72.1 16-May-2009  yamt sync with head
 1.14.12.1 30-Oct-2012  yamt sync with head
 1.2 18-Mar-2014  riastradh branches: 1.2.4; 1.2.8;
Merge riastradh-drm2 to HEAD.
 1.1 18-Jul-2013  matt branches: 1.1.2; 1.1.4;
pte and pmap files for the soft tlb on coldfire cpus.
(uncompiled and mostly probably wrong.)
 1.1.4.2 28-Aug-2013  rmind sync with head
 1.1.4.1 18-Jul-2013  rmind file pte_coldfire.h was added on branch rmind-smpnet on 2013-08-28 23:59:18 +0000
 1.1.2.2 23-Jul-2013  riastradh sync with HEAD
 1.1.2.1 18-Jul-2013  riastradh file pte_coldfire.h was added on branch riastradh-drm2 on 2013-07-23 21:07:34 +0000
 1.2.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.8.1 18-Mar-2014  tls file pte_coldfire.h was added on branch tls-maxphys on 2014-08-20 00:03:10 +0000
 1.2.4.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.4.1 18-Mar-2014  yamt file pte_coldfire.h was added on branch yamt-pagecache on 2014-05-22 11:39:55 +0000
 1.10 01-Jan-2024  thorpej Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.
 1.9 27-Dec-2023  thorpej Stop using magic numbers for the MMU root pointer attributes and the
Translation Control register, and also get rid of "#if PGSHIFT == ..."
where those magic numbers are used.

Instead, define new macros: MMU51_SRP_BITS, MMU51_CRP_BITS, MMU51_TCR_BITS,
and MMU40_TCR_BITS, in terms of the definitions in mmu_{40,51}.h. These
automagically adapt to 8K and 4K pages based on the machine-specific value
of PGSHIFT.
 1.8 08-Feb-2011  rmind branches: 1.8.86;
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.7 07-Dec-2009  tsutsui branches: 1.7.4; 1.7.6; 1.7.8;
Remove "#if defined(amiga) || defined(atari)" for PG_SHIFT.
Use PGSHIFT from <machine/param.h> instead.
 1.6 17-Jan-2009  tsutsui Make st_entry_t and pt_entry_t unsigned.
These values contain paddr_t and bitmap flags.

XXX paddr_t is unsigned long, not unsigned int.
 1.5 17-Oct-2007  garbled branches: 1.5.16; 1.5.20; 1.5.28;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.4 05-Jun-2007  mhitch branches: 1.4.10;
Page table sizes depend on pagesize - fix M68K_MAX_PTSIZE to account for
pagesize. M68K_MAX_KPTSIZE also dependent on pagesize, and was 1/4 the
maximum size of a user pagetable.
 1.3 11-Dec-2005  christos branches: 1.3.30; 1.3.32; 1.3.38;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 14-Oct-2002  chs branches: 1.1.2; 1.1.8;
merge pte.h for m68k w/ motorola or compatible MMU
(only 4k-page platforms so far).
 1.1.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.8.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 14-Oct-2002  nathanw file pte_motorola.h was added on branch nathanw_sa on 2002-10-18 02:38:15 +0000
 1.2.16.1 03-Sep-2007  yamt sync with head.
 1.3.38.1 26-Jun-2007  garbled Sync with HEAD.
 1.3.32.1 11-Jul-2007  mjf Sync with head.
 1.3.30.1 09-Jun-2007  ad Sync with head.
 1.4.10.1 06-Nov-2007  matt sync with HEAD
 1.5.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.20.2 11-Mar-2010  yamt sync with head
 1.5.20.1 04-May-2009  yamt sync with head.
 1.5.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.7.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.4.1 05-Mar-2011  rmind sync with head
 1.8.86.1 27-Jun-2024  martin Pull up following revision(s) (requested by rin in ticket #724
to fix build fallout on the branch):

sys/arch/m68k/m68k/compat_16_sigreturn14.s: revision 1.6
sys/arch/mvme68k/mvme68k/locore.s: revision 1.129
sys/arch/news68k/news68k/locore.s: revision 1.84
sys/arch/hp300/hp300/locore.s: revision 1.183
sys/arch/m68k/m68k/compat_13_sigreturn13.s: revision 1.8
sys/arch/m68k/m68k/sigreturn.s: file removal
sys/arch/m68k/include/pte_motorola.h: revision 1.10
sys/arch/atari/atari/locore.s: revision 1.125
sys/arch/amiga/amiga/locore.s: revision 1.169
sys/arch/sun2/sun2/locore.s: revision 1.37
sys/arch/next68k/next68k/locore.s: revision 1.84
sys/arch/x68k/x68k/locore.s: revision 1.130
sys/arch/sun3/sun3x/locore.s: revision 1.77
sys/arch/cesfic/cesfic/locore.s: revision 1.45
sys/arch/m68k/conf/files.m68k: revision 1.53
sys/arch/sun3/sun3/locore.s: revision 1.109
sys/arch/luna68k/luna68k/locore.s: revision 1.81
sys/arch/mac68k/mac68k/locore.s: revision 1.182

Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.

Make compat_13_sigreturn13.s and compat_16_sigreturn14.s build as their
own stand-alone files and G/C the now-empty sigreturn.s.
 1.13 18-Jun-2019  kamil Introduce PTRACE_REG_FP() a helper macro to retrieve the frame pointer

The macro is dummy for ia64 (the FP register is unknown and can change
freely) and sparc/sparc64 (not stored in struct reg).
 1.12 12-Apr-2017  kamil branches: 1.12.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.11 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.10 25-Sep-2015  christos branches: 1.10.2; 1.10.4;
For processors that have memory breakpoints, add macros for them to help
libproc
 1.9 15-Sep-2015  christos Provide access to pc/sp/syscall-return registers like we have for mcontext
 1.8 25-Jan-2008  skrll branches: 1.8.54; 1.8.74;
Define PT_MACHDEP_STRINGS
 1.7 26-Jan-1995  mycroft branches: 1.7.82; 1.7.144; 1.7.150;
Add PT_[GS]ETFPREGS.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 10-Apr-1994  chopps protect against multiple inclusion
 1.4 30-Jan-1994  mycroft PT_[SG]ETFPREGS are not yet implemented.
 1.3 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.2 09-Jan-1994  cgd define PT_STEP, and clean up some
 1.1 08-Jan-1994  cgd common code
 1.7.150.1 18-Feb-2008  mjf Sync with HEAD.
 1.7.144.1 23-Mar-2008  matt sync with HEAD
 1.7.82.1 04-Feb-2008  yamt sync with head.
 1.8.74.3 28-Aug-2017  skrll Sync with HEAD
 1.8.74.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.8.74.1 22-Sep-2015  skrll Sync with HEAD
 1.8.54.1 03-Dec-2017  jdolecek update from HEAD
 1.10.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.10.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.12.12.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.21 27-Oct-2019  rin Expose register difinitions for _STANDALONE.
Fix build failure in arch/luna68k/stand/boot.
 1.20 26-Oct-2019  christos Hide the register definitions that should eventually be removed (or prefixed
with _REG_ with #ifdef _KERNEL. This avoids conflicts with let's say PC in
<termcap.h>.
 1.19 04-Jan-2014  dsl branches: 1.19.30;
Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
 1.18 08-Feb-2011  rmind branches: 1.18.4; 1.18.14; 1.18.18;
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.17 11-Dec-2005  christos branches: 1.17.100; 1.17.106; 1.17.108;
merge ktrace-lwp.
 1.16 28-Aug-2004  thorpej De-__P
 1.15 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.14 17-Jan-2003  thorpej branches: 1.14.2;
Merge the nathanw_sa branch.
 1.13 19-Apr-1999  kleink branches: 1.13.20;
Define FP as a synonym for A6.
 1.12 17-Dec-1996  gwr branches: 1.12.24;
Add prototypes for process_read_regs, etc. (fix warnings)
 1.11 26-Mar-1995  briggs KERNEL -> _KERNEL
 1.10 26-Jan-1995  mycroft Add struct fpreg.
 1.9 26-Jan-1995  mycroft Rearrange struct reg to match what the rest of the world expects.
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 08-Jan-1994  cgd HP300 -> M68K, and light trimming
 1.6 06-Jan-1994  mycroft Still need old #defines for now.
 1.5 06-Jan-1994  mycroft Implement `struct reg'.
 1.4 08-Dec-1993  mycroft Move #define of NIPCREG outside #fidef.
 1.3 02-Sep-1993  mycroft Ditto.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.12.24.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.20.1 17-Nov-2001  scw Kernel support for Scheduler Activations on m68k-based ports using
mvme68k as a testbed.

Boots multi-user on an mvme162, although userland support for SA is not
yet integrated/tested.
 1.14.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.2 03-Sep-2004  skrll Sync with HEAD
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.17.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.100.1 05-Mar-2011  rmind sync with head
 1.18.18.1 18-May-2014  rmind sync with head
 1.18.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.4.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 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 05-Apr-2008  tsutsui branches: 1.4.2; 1.4.4;
Use generic atomic_cas_uint() for mutex(9) and rwlock(9), and
remodel old RAS based _lock_cas() implementation for m68010
into genereic atomic_cas_32().
Now sun2 kernel compiles and even works on multiuser. (hehe)

Tested on tme (emulationg 2/120 and 3/150) and (real) 3/80.
 1.3 21-Nov-2007  yamt branches: 1.3.14;
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 06-Feb-2007  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 06-Feb-2007  ad Make amiga & mac68k compile.
 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.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:07:12 +0000
 1.3.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.4.1 16-May-2008  yamt sync with head.
 1.4.2.1 18-May-2008  yamt sync with head.
 1.5.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.7 15-Oct-2008  wrstuden branches: 1.7.28; 1.7.32;
Merge wrstuden-revivesa into HEAD. Catch some files that I forgot
to revive on HEAD in previous commit.
 1.6 11-May-2008  wrstuden branches: 1.6.2; 1.6.6;
Oops. These are supposed to come alive on the branch, not the head.
 1.5 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.4 24-Mar-2008  yamt branches: 1.4.4;
remove an empty file.
 1.3 09-Feb-2007  ad branches: 1.3.44;
Merge newlock2 to head.
 1.2 17-Jan-2003  thorpej branches: 1.2.18; 1.2.48;
Merge the nathanw_sa branch.
 1.1 17-Nov-2001  scw branches: 1.1.2;
file saframe.h was initially added on branch nathanw_sa.
 1.1.2.3 02-Aug-2002  nathanw Add return address, remove upcall pointer.
 1.1.2.2 17-Nov-2001  scw Re-sync with current MI SA code.
 1.1.2.1 17-Nov-2001  scw Kernel support for Scheduler Activations on m68k-based ports using
mvme68k as a testbed.

Boots multi-user on an mvme162, although userland support for SA is not
yet integrated/tested.
 1.2.48.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.2.18.1 26-Feb-2007  yamt sync with head.
 1.3.44.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.44.1 03-Apr-2008  mjf Sync with HEAD.
 1.4.4.1 04-May-2009  yamt sync with head.
 1.6.6.1 19-Oct-2008  haad Sync with HEAD.
 1.6.2.2 11-May-2008  wrstuden Try this again, on the correct branch this time!

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.6.2.1 11-May-2008  wrstuden file saframe.h was added on branch wrstuden-revivesa on 2008-05-11 00:23:34 +0000
 1.7.32.1 24-Feb-2012  mrg sync to -current.
 1.7.28.1 17-Apr-2012  yamt sync with head
 1.2 15-Sep-1998  thorpej Need 21 longs for jmp_buf now, due to 128-bit signal mask (and use
of the sigcontext structure in the jmp_buf).
 1.1 20-Dec-1994  cgd make the definition of _JBLEN mach. dep. header-dependent.
 1.28 29-Oct-2021  thorpej Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility.
 1.27 27-Oct-2021  thorpej Make sigcontext13 visible only to _KERNEL.
 1.26 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.25 27-Jan-2009  martin Centralize fpu exception to siginfo code encoding for all m68k archs,
fixes a failure in the lib/libc/ieeefp/except regression test.
 1.24 19-Nov-2008  ad 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.23 01-Apr-2006  oster branches: 1.23.62; 1.23.66; 1.23.72; 1.23.74; 1.23.76;
We don't need (or want!) to include cpuframe.h or have sigstate
visible to userland on m68k. Fixes numerous pkgsrc build issues where
"struct frame" as defined in cpuframe.h pollutes the local namespace.

Compile-tested full builds for hp300, mac68k, amiga, sun3, and next68k.

OK'ed by matt@.
 1.22 11-Dec-2005  christos branches: 1.22.4; 1.22.6; 1.22.8; 1.22.10; 1.22.12;
merge ktrace-lwp.
 1.21 07-Sep-2005  drochner namespace sanity: don't expose compatibility sigcontext stuff
unnecessarily
 1.20 29-Jul-2004  is branches: 1.20.10; 1.20.12; 1.20.14;
Revert last change. It breaks the build due to interactions with
frame.h.
 1.19 28-Jul-2004  is For a while, we exported symbols in the user namespace (which should only
be interesting for the kernel), thus breaking (e.g.) vim. (PR 26048)
 1.18 10-May-2004  drochner SIGTRAMP_VALID() should not pollute the user namespace
 1.17 26-Mar-2004  drochner nothing cares about __HAVE_SIGINFO anymore, so nuke it
 1.16 25-Nov-2003  christos bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
 1.15 18-Oct-2003  briggs Define SIGTRAMP_VALID(v).
 1.14 22-Sep-2003  cl SA_SIGINFO support for m68k
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.12 28-Apr-2003  bjh21 branches: 1.12.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.11 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 04-Jul-2002  thorpej During signal delivery, arrange to have the signal handler invoked
directly, using the trampoline only for the return path. Saves a
"jsr" in the trampoline.

Reviewed, tested and OK'd by Steve Woodford.
 1.9 23-Jun-2002  thorpej Swap the order of the sigcontext and hardware state in the sigframe.
 1.8 30-Sep-1998  thorpej branches: 1.8.26; 1.8.30; 1.8.38;
Pull in <m68k/frame.h> if __M68K_SIGNAL_PRIVATE, for sigstate.
 1.7 30-Sep-1998  thorpej Put the sigstate and sigframe definitions in signal.h, protected by
__M68K_SIGNAL_PRIVATE.
 1.6 15-Sep-1998  thorpej Define the new sigcontext structure.
 1.5 25-May-1998  kleink If any of _ANSI_SOURCE, _POSIX_C_SOURCE or _XOPEN_SOURCE are defined, don't
provide any identifiers other than sig_atomic_t.
 1.4 10-Jan-1995  jtc Only define sig_atomic_t when _ANSI_SOURCE is defined.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 10-Apr-1994  chopps protect against multiple inclusion
 1.1 13-Oct-1993  cgd md signal context.
 1.8.38.1 16-Jul-2002  gehenna catch up with -current.
 1.8.30.2 16-Jan-2003  thorpej * Include <sys/sigtypes.h> rather than <sys/signal.h> in <sys/ucontext.h>.
* Define _UCONTEXT_TO_SIGCONTEXT() and _SIGCONTEXT_TO_UCONTEXT()
macros for converting a ucontext -> sigcontext and back again.
These macros in turn use machine-dependent macros _MCONTEXT_TO_SIGCONTEXT()
and _SIGCONTEXT_TO_MCONTEXT() provided by <machine/signal.h>.

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

Also note that the mcontext conversion may not be enough for all platforms
(m68k is a good example of this). These macros should be used only if
you really know what you're doing.
 1.8.30.1 01-Aug-2002  nathanw Catch up to -current.
 1.8.26.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.12.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.14.1 06-Apr-2006  tron Pull up following revision(s) (requested by oster in ticket #1243):
sys/arch/m68k/include/signal.h: revision 1.23
We don't need (or want!) to include cpuframe.h or have sigstate
visible to userland on m68k. Fixes numerous pkgsrc build issues where
"struct frame" as defined in cpuframe.h pollutes the local namespace.
Compile-tested full builds for hp300, mac68k, amiga, sun3, and next68k.
OK'ed by matt@.
 1.20.12.1 21-Jun-2006  yamt sync with head.
 1.20.10.1 06-Apr-2006  tron Pull up following revision(s) (requested by oster in ticket #1243):
sys/arch/m68k/include/signal.h: revision 1.23
We don't need (or want!) to include cpuframe.h or have sigstate
visible to userland on m68k. Fixes numerous pkgsrc build issues where
"struct frame" as defined in cpuframe.h pollutes the local namespace.
Compile-tested full builds for hp300, mac68k, amiga, sun3, and next68k.
OK'ed by matt@.
 1.22.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.22.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.22.8.1 11-Apr-2006  yamt sync with head
 1.22.6.1 22-Apr-2006  simonb Sync with head.
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.23.76.1 02-Feb-2009  snj Pull up following revision(s) (requested by martin in ticket #332):
sys/arch/amiga/amiga/trap.c: revision 1.122
sys/arch/atari/atari/trap.c: revision 1.99
sys/arch/cesfic/cesfic/trap.c: revision 1.43
sys/arch/hp300/hp300/trap.c: revision 1.140
sys/arch/luna68k/luna68k/trap.c: revision 1.55
sys/arch/m68k/include/signal.h: revision 1.25
sys/arch/m68k/m68k/sig_machdep.c: revision 1.41
sys/arch/mac68k/mac68k/trap.c: revision 1.136 via patch
sys/arch/mvme68k/mvme68k/trap.c: revision 1.98
sys/arch/news68k/news68k/trap.c: revision 1.60
sys/arch/next68k/next68k/trap.c: revision 1.75
sys/arch/sun2/sun2/trap.c: revision 1.37
sys/arch/sun3/sun3/trap.c: revision 1.136
sys/arch/x68k/x68k/trap.c: revision 1.97
Centralize fpu exception to siginfo code encoding for all m68k archs,
fixes a failure in the lib/libc/ieeefp/except regression test.
 1.23.74.2 03-Mar-2009  skrll Sync with HEAD.
 1.23.74.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.72.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.66.1 04-May-2009  yamt sync with head.
 1.23.62.1 17-Jan-2009  mjf Sync with HEAD.
 1.5 22-Dec-2011  tsutsui Remove obsolete header.
 1.4 28-Apr-2008  martin branches: 1.4.34; 1.4.38;
Remove clause 3 and 4 from TNF licenses
 1.3 03-Dec-2007  ad branches: 1.3.14; 1.3.16; 1.3.18;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.2 04-Mar-2007  tsutsui branches: 1.2.2; 1.2.4; 1.2.20; 1.2.22; 1.2.24; 1.2.30;
Hide #include <m68k/softintr.h> inside #ifdef _KERNEL in <machine/intr.h>
to avoid exporting unnecessary files to userland.
Should fix build.sh failure, which was pointed out by isaki@.

XXX: which userland program would require contents of <machine/intr.h>?
 1.1 04-Mar-2007  tsutsui Add common soft interrupt routines for m68k ports which use
hp300 derived simulated software interrupt with VAX REI emulation.
Just taken from hp300/hp300/softintr.c and sys/arch/hp300/include/intr.h.
 1.2.30.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.24.3 07-Dec-2007  yamt sync with head
 1.2.24.2 03-Sep-2007  yamt sync with head.
 1.2.24.1 04-Mar-2007  yamt file softintr.h was added on branch yamt-lazymbuf on 2007-09-03 14:27:12 +0000
 1.2.22.1 09-Jan-2008  matt sync with HEAD
 1.2.20.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.2.4.2 12-Mar-2007  rmind Sync with HEAD (missed new files in previous).
 1.2.4.1 04-Mar-2007  rmind file softintr.h was added on branch yamt-idlelwp on 2007-03-12 06:14:50 +0000
 1.2.2.1 03-Dec-2007  ad Sync with HEAD.
 1.3.18.1 16-May-2008  yamt sync with head.
 1.3.16.1 18-May-2008  yamt sync with head.
 1.3.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.38.1 18-Feb-2012  mrg merge to -current.
 1.4.34.1 17-Apr-2012  yamt sync with head
 1.24 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.23 11-Dec-2005  christos merge ktrace-lwp.
 1.22 14-Apr-2005  matt For GCC3 and beyond, use the __builtin_va_* types and functions to
deal with variable argument lists.
 1.21 07-Aug-2003  agc branches: 1.21.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.20 28-Apr-2003  bjh21 branches: 1.20.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.19 03-Feb-2000  kleink Add a C99-style va_copy macro.
 1.18 04-May-1999  christos branches: 1.18.2;
whitespace...
 1.17 03-May-1999  christos Define __builtin_*() for lint
 1.16 22-Jan-1999  mycroft branches: 1.16.4;
Use __builtin_next_arg(). Fixed PR 6862.
 1.15 27-Jul-1998  mycroft Delint.
 1.14 25-Dec-1995  mycroft branches: 1.14.16;
Stylistic changes.
 1.13 25-Dec-1995  mycroft Stylistic changes.
 1.12 25-Dec-1995  mycroft Update for GCC 2.7, and fix bugs.
 1.11 07-Sep-1995  jtc Fix bug when the second argument of va_start was a char, short or float.
(ie. not promoted); fixes PR# 1193. Thanks to Bernd Ernesti and Markus
Wild.
 1.10 26-Mar-1995  briggs KERNEL -> _KERNEL
 1.9 28-Jan-1995  jtc ANSI says that <stdarg.h>'s va_end macro must expand to a void expression.
For consistancy, I'm changing <varargs.h> too.
 1.8 28-Dec-1994  cgd do the right thing with strange-sized varargs objects.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.5 21-May-1994  cgd update from lite
 1.4 10-Apr-1994  chopps protect against multiple inclusion
 1.3 28-Jan-1994  mycroft Protect against multiple inclusions.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd add from net2. were symlinks to ../../vax/include/*
 1.14.16.1 01-Feb-1999  cgd pull up revs 1.15-1.16 from trunk (PR#6862). (mycroft)
 1.16.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.18.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.20.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.8.1 29-Apr-2005  kent sync with -current
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76; 1.2.78; 1.2.80;
merge ktrace-lwp.
 1.1 11-Jul-2005  christos branches: 1.1.6;
new file
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file sunos_machdep.h was added on branch ktrace-lwp on 2005-11-10 13:57:09 +0000
 1.2.80.1 16-May-2008  yamt sync with head.
 1.2.78.1 18-May-2008  yamt sync with head.
 1.2.76.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file sunos_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:53:01 +0000
 1.6 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.5 28-Apr-2008  martin branches: 1.5.86; 1.5.88;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.74; 1.4.76; 1.4.78;
merge ktrace-lwp.
 1.3 28-Aug-2004  thorpej De-__P
 1.2 13-Jul-2002  scw branches: 1.2.6;
m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.1 19-Apr-1999  kleink branches: 1.1.2; 1.1.18; 1.1.22; 1.1.30;
Add COMPAT_SVR4 for m68k.
 1.1.30.1 16-Jul-2002  gehenna catch up with -current.
 1.1.22.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.18.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Sep-2004  skrll Sync with HEAD
 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.88.1 10-Jun-2019  christos Sync with HEAD
 1.5.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 07-Aug-2006  tsutsui branches: 1.4.58; 1.4.60; 1.4.62;
Remove __P().
 1.3 13-Apr-1999  kleink branches: 1.3.52; 1.3.66; 1.3.70;
* Declaration mismatch: len is a size_t, not a pointer to one.
* Userlevel header: remove argument names from declaration, use
__{BEGIN,END}_DECLS to ensure correct linkage.
 1.2 15-Feb-1999  hubertf branches: 1.2.2;
RCS ID police
 1.1 09-Feb-1999  is Provide a minimal instruction/data cache synchronization C binding.
(The function has always been in the kernels as special trap #12).
In response to PR 4951 by Hauke Fath.
 1.2.2.1 15-Apr-1999  kleink branches: 1.2.2.1.2;
Pull up rev. 1.3; approved by perry.
 1.2.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.70.1 11-Aug-2006  yamt sync with head
 1.3.66.1 09-Sep-2006  rpaulo sync with head
 1.3.52.1 30-Dec-2006  yamt sync with head.
 1.4.62.1 16-May-2008  yamt sync with head.
 1.4.60.1 18-May-2008  yamt sync with head.
 1.4.58.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 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.2 27-Feb-2008  xtraeme branches: 1.2.90; 1.2.92;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.1 17-Dec-1996  gwr branches: 1.1.78; 1.1.140; 1.1.160; 1.1.164;
CTL_MACHDEP definitions. (Common to all m68k ports.)
This should be included by each m68k port's cpu.h so
/usr/sbin/sysctl can be shared on all of them.
 1.1.164.1 03-Apr-2008  mjf Sync with HEAD.
 1.1.160.1 24-Mar-2008  keiichi sync with head.
 1.1.140.1 23-Mar-2008  matt sync with HEAD
 1.1.78.1 17-Mar-2008  yamt sync with head.
 1.2.92.1 10-Jun-2019  christos Sync with HEAD
 1.2.90.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.12 16-Oct-2024  isaki TAB/space cleanup.
 1.11 08-Feb-2011  rmind branches: 1.11.92;
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.10 11-Dec-2005  christos branches: 1.10.100; 1.10.106; 1.10.108;
merge ktrace-lwp.
 1.9 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.8 26-Oct-1994  cgd branches: 1.8.66;
new RCS ID format.
 1.7 23-May-1994  mycroft Add RCS ids.
 1.6 23-May-1994  mycroft Merge with 4.4-Lite.
 1.5 10-Apr-1994  chopps protect against multiple inclusion
 1.4 09-Jan-1994  mycroft Alias T_TRAP15 to T_BREAKPOINT globally.
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.8.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.66.1 03-Aug-2004  skrll Sync with HEAD
 1.10.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.10.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.100.1 05-Mar-2011  rmind sync with head
 1.11.92.1 02-Aug-2025  perseant Sync with HEAD
 1.34 24-Mar-2021  simonb s/depreciated/deprecated/g
 1.33 23-Jan-2016  christos branches: 1.33.30; 1.33.32;
expose the kernel types for standalone code.
 1.32 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.31 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.30 22-Nov-2011  joerg branches: 1.30.8; 1.30.26;
Add TLS support for m68k.
 1.29 22-Dec-2010  matt branches: 1.29.8;
Collect cpu_info and friends and move to m68k/include/cpu.h
Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.28 11-Dec-2009  matt branches: 1.28.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.27 17-Oct-2007  garbled branches: 1.27.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.26 02-Jun-2007  tsutsui branches: 1.26.10;
Add #define __NO_STRICT_ALIGNMENT.
 1.25 01-Jun-2007  skrll __HAVE_MD_RUNQUEUE is no longer relevant.
 1.24 24-Dec-2005  perry branches: 1.24.30; 1.24.32; 1.24.38;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.23 11-Dec-2005  christos merge ktrace-lwp.
 1.22 18-Jan-2004  martin branches: 1.22.16;
Do not export __HAVE_RAS to userland. Applications are supposed to try
rasctl() and detect failure with EOPNOTSUPP.
 1.21 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.20 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

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

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

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

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.18 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.17 22-Sep-2002  simonb Use "#define\t" instead of "#define ".
 1.16 22-Sep-2002  gmcgarry Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives.
 1.15 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.14 28-Apr-2001  kleink branches: 1.14.2; 1.14.8; 1.14.16;
* 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.13 03-Jan-2001  takemura branches: 1.13.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.12 13-Aug-1998  eeh branches: 1.12.12;
Merge paddr_t changes into the main branch.
 1.11 14-Jun-1998  kleink branches: 1.11.2;
GC the unused `physadr' type, which was not able to hold a complete physical
address on 2 architectures anyhow. Also, move the definition of the `label_t'
type inside _KERNEL protection, since it is specific to the in-kernel
setjmp()/longjmp() implementations.
 1.10 05-Nov-1997  thorpej Mark uses of long long with /* LONGLONG */ for lint. From
Chris Demetriou <cgd@pa.dec.com>.
 1.9 06-Jul-1995  cgd branches: 1.9.18;
add <sys/cdefs.h> inclusions. namsspace-protect physadr, label_t
def'ns against _POSIX_SOURCE and _ANSI_SOURCE.
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 20-Oct-1994  cgd update for new syscall args description mechanism
 1.6 20-Jul-1994  cgd define __BIT_TYPES_DEFINED__ for compatibility with things like BIND and nvi
 1.5 23-May-1994  cgd branches: 1.5.2;
can't use u_long
 1.4 10-Apr-1994  chopps protect against multiple inclusion
 1.3 14-Mar-1994  cgd add basic integral types (a la sparc port) that new nvi wants.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.5.2.1 20-Jul-1994  cgd update from trunk.
 1.9.18.1 05-Nov-1997  thorpej Update from trunk: Mark usese of long long with /* LONGLONG */ for lint.
 1.11.2.2 12-Aug-1998  eeh Protect XOPEN and POSIX code from vm_offset_t, paddr_t, vaddr_t, vm_size_t, psize_t, and vsize_t.
 1.11.2.1 30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.12.12.1 05-Jan-2001  bouyer Sync with HEAD
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.16.1 16-Jul-2002  gehenna catch up with -current.
 1.14.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.14.8.3 07-Oct-2002  gmcgarry All m68k ports now support RAS in the common cpu_switch().
 1.14.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.14.8.1 28-Apr-2001  nathanw file types.h was added on branch nathanw_sa on 2002-08-01 02:42:16 +0000
 1.14.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.14.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.16.2 03-Sep-2007  yamt sync with head.
 1.22.16.1 21-Jun-2006  yamt sync with head.
 1.24.38.1 26-Jun-2007  garbled Sync with HEAD.
 1.24.32.1 11-Jul-2007  mjf Sync with head.
 1.24.30.1 09-Jun-2007  ad Sync with head.
 1.26.10.1 06-Nov-2007  matt sync with HEAD
 1.27.20.1 11-Mar-2010  yamt sync with head
 1.28.4.1 05-Mar-2011  rmind sync with head
 1.29.8.1 17-Apr-2012  yamt sync with head
 1.30.26.2 19-Mar-2016  skrll Sync with HEAD
 1.30.26.1 22-Sep-2015  skrll Sync with HEAD
 1.30.8.1 03-Dec-2017  jdolecek update from HEAD
 1.33.32.1 03-Apr-2021  thorpej Sync with HEAD.
 1.33.30.1 03-Apr-2021  thorpej Sync with HEAD.
 1.17 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.16 11-Dec-2005  christos merge ktrace-lwp.
 1.15 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.14 26-Dec-1995  mycroft branches: 1.14.64;
Make the type of __builtin_va_list a long.
 1.13 26-Dec-1995  mycroft Use __builtin_va_alist.
 1.12 25-Dec-1995  mycroft Stylistic changes.
 1.11 25-Dec-1995  mycroft Update for GCC 2.7, and fix bugs.
 1.10 26-Mar-1995  briggs KERNEL -> _KERNEL
 1.9 28-Jan-1995  jtc ANSI says that <stdarg.h>'s va_end macro must expand to a void expression.
For consistancy, I'm changing <varargs.h> too.
 1.8 28-Dec-1994  cgd do the right thing with strange-sized varargs objects.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.5 29-Jun-1994  deraadt _MACHINE_VARGS_H_
 1.4 21-May-1994  cgd update from lite
 1.3 16-May-1994  cgd USL copyright foo
 1.2 10-Apr-1994  chopps protect against multiple inclusion
 1.1 27-Jan-1994  pk move varargs stuff to arch/<machine>/include.
 1.14.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.64.1 03-Aug-2004  skrll Sync with HEAD
 1.6 01-Feb-2024  andvar s/Prototol/Protocol/ and s/Umimplemented/Unimplemented/ in comments.
 1.5 19-Jan-2024  thorpej Ensuire VECO_TO_VECI() returns an 8-bit index.
 1.4 14-Jan-2024  thorpej Provide NAUTOVECTORS and NUSERVECTORS constants.
 1.3 13-Jan-2024  thorpej Expose saved_vbr directly.
 1.2 13-Jan-2024  thorpej Provide some vector table override hooks and interfaces needed by the
sun68k platforms.
 1.1 13-Jan-2024  thorpej Add a common vector table implementation for m68k platforms.
 1.1 01-Feb-2020  tsutsui branches: 1.1.2; 1.1.4; 1.1.8;
Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.
For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.1.8.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.8.1 01-Feb-2020  martin file vmparam.h was added on branch phil-wifi on 2020-04-08 14:07:43 +0000
 1.1.4.2 29-Feb-2020  ad Sync with head.
 1.1.4.1 01-Feb-2020  ad file vmparam.h was added on branch ad-namecache on 2020-02-29 20:18:25 +0000
 1.1.2.2 10-Feb-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #682):

sys/arch/next68k/include/vmparam.h: revision 1.27
sys/arch/mac68k/include/vmparam.h: revision 1.46
sys/arch/sun3/include/vmparam.h: revision 1.38
sys/arch/m68k/include/vmparam.h: revision 1.1
sys/arch/hp300/include/vmparam.h: revision 1.41
sys/arch/m68k/include/Makefile: revision 1.32
sys/arch/amiga/include/vmparam.h: revision 1.48
distrib/sets/lists/comp/ad.m68k: revision 1.63
sys/arch/x68k/include/vmparam.h: revision 1.40
sys/arch/mvme68k/include/vmparam.h: revision 1.38
sys/arch/luna68k/include/vmparam.h: revision 1.23
sys/arch/news68k/include/vmparam.h: revision 1.23
sys/arch/atari/include/vmparam.h: revision 1.34
sys/arch/cesfic/include/vmparam.h: revision 1.19

Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.

For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.1.2.1 01-Feb-2020  martin file vmparam.h was added on branch netbsd-9 on 2020-02-10 18:46:40 +0000
 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:36:40 +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.

RSS XML Feed