Home | History | Annotate | only in /src/sys/arch/alpha/include
History log of /src/sys/arch/alpha/include
RevisionDateAuthorComments
 1.37 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.36 04-Nov-2024  christos Undo previous lwp.h change.
 1.35 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.34 12-Jul-2018  maxv branches: 1.34.36;
Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

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

* Removes the PMC code of ARM XSCALE.

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

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

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

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.33 23-Aug-2016  christos branches: 1.33.14; 1.33.16;
fenv.h for alpha
 1.32 12-Aug-2011  dyoung branches: 1.32.12; 1.32.30;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 1.31 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.30 09-Jul-2011  dyoung Don't install alpha/bus.h any more.
 1.29 10-Mar-2008  ad Finish moving alpha over to the MI atomic ops.
 1.28 09-Feb-2007  ad branches: 1.28.12; 1.28.24; 1.28.40; 1.28.44;
Merge newlock2 to head.
 1.27 26-Jul-2006  drochner branches: 1.27.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.26 11-Dec-2005  christos branches: 1.26.4; 1.26.8;
merge ktrace-lwp.
 1.25 07-Jul-2004  drochner branches: 1.25.12;
also add <machine/joystick.h> to alpha and amd64, to allow compilation
of certain multimedia applications
 1.24 08-May-2004  kleink Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.23 17-Jan-2003  thorpej branches: 1.23.2;
Merge the nathanw_sa branch.
 1.22 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.21 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.20 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.19 16-Jan-2002  ross branches: 1.19.4; 1.19.8;
install fpu.h, needed for new lib/csu features
 1.18 19-Sep-2001  thorpej Remove alpha/include/fbio.h -- it hasn't been used for a Long Time.
 1.17 15-Apr-2001  kleink branches: 1.17.2; 1.17.4; 1.17.6;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.16 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.15 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.14 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.13 26-Jun-2000  kleink branches: 1.13.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.12 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.11 29-Apr-2000  thorpej branches: 1.11.2;
Oops, install <machine/lock.h> on these systems, too.
 1.10 26-Mar-2000  nisimura Remove local implementation switching to accelerated MI sfb.c.
 1.9 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.8 26-Feb-2000  mycroft Install pio.h.
 1.7 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.6 04-Dec-1999  lukem add atomic.h (missed by thorpej; approved by thorpej)
 1.5 02-Dec-1999  thorpej Inline the BWX instructions.
 1.4 30-Apr-1999  ross branches: 1.4.2; 1.4.8;
* New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha. (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.
 1.3 17-Apr-1999  drochner wsconsio.h is gone
 1.2 15-Jan-1999  bouyer branches: 1.2.4;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.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.2.4.2 30-Apr-1999  perry branches: 1.2.4.2.2;
pullup 1.3->1.4 (ross)
 1.2.4.1 17-Apr-1999  ross Pull up 1.3 from trunk. Approved by cjs. (drochner)
Really, really kill off old wscons. (wsconsio.h)
 1.2.4.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.17.4.6 17-Sep-2002  nathanw Catch up to -current.
 1.17.4.5 13-Aug-2002  nathanw Catch up to -current.
 1.17.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.17.4.3 25-Sep-2001  nathanw Install mcontext.h
 1.17.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.17.4.1 15-Apr-2001  nathanw file Makefile was added on branch nathanw_sa on 2001-09-21 22:34:57 +0000
 1.17.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.17.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.8.2 30-Aug-2002  gehenna catch up with -current.
 1.19.8.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.19.4.2 14-Mar-2002  thorpej Alpha rwlock primitives implementation.
 1.19.4.1 11-Mar-2002  thorpej Install mutex_impl.h
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.12.3 17-Mar-2008  yamt sync with head.
 1.25.12.2 26-Feb-2007  yamt sync with head.
 1.25.12.1 30-Dec-2006  yamt sync with head.
 1.26.8.1 11-Aug-2006  yamt sync with head
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.27.4.1 01-Feb-2007  ad Header file cleanup.
 1.28.44.1 03-Apr-2008  mjf Sync with HEAD.
 1.28.40.1 24-Mar-2008  keiichi sync with head.
 1.28.24.1 23-Mar-2008  matt sync with HEAD
 1.28.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.32.30.1 05-Oct-2016  skrll Sync with HEAD
 1.32.12.1 03-Dec-2017  jdolecek update from HEAD
 1.33.16.1 10-Jun-2019  christos Sync with HEAD
 1.33.14.1 28-Jul-2018  pgoyette Sync with HEAD
 1.34.36.1 02-Aug-2025  perseant Sync with HEAD
 1.2 05-Oct-2001  simonb Multiple include protection.
 1.1 10-Mar-1999  ross branches: 1.1.20; 1.1.22; 1.1.24;
New file, included if present for ${MACHINE_ARCH} by bsd.kmod.mk.
 1.1.24.1 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.1.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.20.1 22-Oct-2001  nathanw Catch up to -current.
 1.48 16-Mar-2025  thorpej Add an alpha_fp_init() function, and move the initialization of
FP-related event counters there.

No functional change intended.
 1.47 23-Jul-2021  thorpej branches: 1.47.16;
- Expose alpha_fp_complete_at() to callers outside fp_complete.c.
- Use ufetch_32() instead of copyin() to fetch the instruction.
 1.46 20-Jul-2021  thorpej Define the f_float in-memory format. Line of the fields in s_float and
t_float.
 1.45 05-May-2021  thorpej Remove unused dot_conv() function.
 1.44 14-Oct-2020  thorpej branches: 1.44.6;
Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.43 10-Oct-2020  thorpej Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.42 03-Oct-2020  thorpej Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
 1.41 27-Sep-2020  thorpej prom_is_qemu -> alpha_is_qemu, and export it outside of prom.c.
 1.40 18-Sep-2020  thorpej Rather than having exception_return() at the root of the call graph for
kernel threads, provide a backstop that will prevent them from ever
accidentally trying to return to user space.
 1.39 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.38 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.37 19-Apr-2018  christos branches: 1.37.2;
s/static inline/static __inline/g for consistency.
 1.36 16-Jun-2017  jdolecek branches: 1.36.4;
dumpconf(void) long doesn't exist, remove the prototype

PR kern/39714 by Henning Petersen
 1.35 16-Mar-2017  chs allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.34 16-May-2014  matt branches: 1.34.4; 1.34.8; 1.34.12;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.33 16-May-2014  rmind pcu(9):
- Remove PCU_KERNEL (hi matt!) and significantly simplify the code.
This experimental feature was tried on ARM did not meet the expectations.
It may be revived one day, but it should be done in a much simpler way.
- Add a message structure for xcall function, pass the LWP ower and thus
optimise a race condition: if LWP is discarding its state on a remote CPU,
but another LWP already did it - do not cause an unecessary re-faulting.
- Reduce the variety of flags for PCU operations (only PCU_VALID and
PCU_REENABLE are used now), pass them only to the pcu_state_load().
- Rename pcu_used_p() to pcu_valid_p(); hopefully it is less confusing.
- pcu_save_all_on_cpu: SPL ought to be used here.
- Update and improve the pcu(9) man page; it needs wizd(8) though.
 1.32 22-Aug-2013  drochner branches: 1.32.2;
-extend the pcu(9) API by a function which saves all context on the
current CPU, and use it if a CPU is taken offline
-add a bool argument to pcu_discard which tells whether the internal
"LWP has used the coprocessor" flag should be set or reset. The flag
is reported by pcu_used_p(). If set, future accesses should use the
state stored in the PCB. If reset, it should be reset to default.
The former case is useful for setmcontext().
With that, it should not be necessary anymore to manage the "FPU used"
state by an additional MD variable.

approved by matt
 1.31 26-Dec-2012  matt branches: 1.31.2;
Update to new pcu_state_{load,save,release} definitions
 1.30 06-Feb-2012  matt branches: 1.30.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.29 17-Jul-2011  joerg branches: 1.29.2; 1.29.6;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.28 06-Jul-2011  dyoung Oops, missed one: #include <sys/bus.h> instead of <machine/bus.h>.
 1.27 12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

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

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

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

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

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

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.26 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.25 08-Feb-2011  rmind branches: 1.25.2;
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.24 01-Jun-2009  martin branches: 1.24.4; 1.24.6; 1.24.8;
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.23 28-Nov-2007  ad branches: 1.23.18; 1.23.28; 1.23.34;
Hook in the atomic ops on alpha.
 1.22 17-Oct-2007  garbled branches: 1.22.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.20 11-Dec-2005  christos branches: 1.20.26; 1.20.30; 1.20.32; 1.20.36; 1.20.38;
merge ktrace-lwp.
 1.19 07-Aug-2003  agc branches: 1.19.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.18 17-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 14-Jun-2001  thorpej branches: 1.17.4;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.16 14-May-2001  ross o Deal with stray machine checks
o Add for alpha a security-sensitive rate-limiting printf(9) wrapper based
on ratecheck(9): void rlprintf(struct timeval *t, const char *fmt, ...);
 1.15 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.14 13-Dec-2000  mycroft branches: 1.14.2;
Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.13 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.12 04-Sep-2000  thorpej Define the biglock perimeter for the Alpha port, and generally clean
up a bunch of the MP code. Still doens't work properly yet, this is
just a snapshot of work-in-progress.
 1.11 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.10 08-Jun-2000  thorpej branches: 1.10.2;
And more ANSI'ification!
 1.9 01-Jun-2000  thorpej Add a global patchable variable to enable debugging printfs in the
code that finds the boot device.
 1.8 10-Apr-2000  simonb branches: 1.8.2;
Remove duplicate CTL_MACHDEP definitions (duplicated in <alpha/cpu.h>).
 1.7 29-Feb-2000  thorpej Put machine check info in cpu_info in the multiprocessor case, and
just have one statically allocate machine check info structure in the
single processor config case.
 1.6 17-Sep-1999  thorpej branches: 1.6.2;
Centralize the declaration and clearing of `cold'.
 1.5 11-Jul-1999  ross New signature for console_restart().
 1.4 29-Jun-1999  ross Prototype dot_conv(), new routine in machdep.c that formats an alpha
long like this: e081.8000.8000.0004
 1.3 20-Apr-1999  thorpej Move the inclusion of <machine/bus.h> to within a _KERNEL section.
 1.2 23-Feb-1999  thorpej branches: 1.2.2; 1.2.4; 1.2.6;
Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.1 19-Nov-1998  ross New module to hold the alpha-specific prototypes that don't need to be
exported to the MI kernel. Almost everything here was formerly in cpu.h.
Optionally, this module could in the future be used to #include anything
that is always needed by arch/alpha modules.
 1.2.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.2.4.1 02-Jul-1999  perry pullup 1.3->1.4 (ross)
 1.2.2.3 02-Aug-1999  thorpej Update from trunk.
 1.2.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.6.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.6.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.1 15-May-2001  he Pull up revision 1.16 (via patch, requested by ross):
Deal with stray machine checks.
 1.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.4.4 03-Jan-2003  thorpej Merge switch_exit() and switch_lwp_exit().
 1.17.4.3 17-Dec-2001  nathanw Sprinkle a little const around frametoreg() and regtoframe().
 1.17.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.17.4.1 14-Jun-2001  nathanw file alpha.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.16.2 07-Dec-2007  yamt sync with head
 1.19.16.1 03-Sep-2007  yamt sync with head.
 1.20.38.1 22-May-2007  matt Update to HEAD.
 1.20.36.1 19-Apr-2007  thorpej Add support for hot-patching the membar ops when we detect MP.
 1.20.32.1 11-Jul-2007  mjf Sync with head.
 1.20.30.3 03-Dec-2007  ad Sync with HEAD.
 1.20.30.2 03-Dec-2007  ad Sync with HEAD.
 1.20.30.1 27-May-2007  ad Sync with head.
 1.20.26.1 20-Mar-2007  yamt adapt alpha.
 1.21.10.2 09-Jan-2008  matt sync with HEAD
 1.21.10.1 06-Nov-2007  matt sync with HEAD
 1.21.8.1 03-Dec-2007  joerg Sync with HEAD.
 1.22.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.23.34.1 09-Jun-2009  snj branches: 1.23.34.1.2;
Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.23.34.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.23.28.1 09-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #798):
sys/arch/alpha/alpha/locore.s: revision 1.114
sys/arch/alpha/alpha/vm_machdep.c: revision 1.100
sys/arch/alpha/include/alpha.h: revision 1.24
Do not use lwp_trampoline for cpu_setfunc, but a simplified setfunc_trampoline
that does not call lwp_startup() instead.
 1.23.18.1 20-Jun-2009  yamt sync with head
 1.24.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.24.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.4.3 12-Jun-2011  rmind sync with head
 1.24.4.2 05-Mar-2011  rmind sync with head
 1.24.4.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.25.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.29.6.1 18-Feb-2012  mrg merge to -current.
 1.29.2.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.2.2 23-Jan-2013  yamt sync with head
 1.29.2.1 17-Apr-2012  yamt sync with head
 1.30.6.3 03-Dec-2017  jdolecek update from HEAD
 1.30.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.6.1 25-Feb-2013  tls resync with head
 1.31.2.2 18-May-2014  rmind sync with head
 1.31.2.1 28-Aug-2013  rmind sync with head
 1.32.2.1 10-Aug-2014  tls Rebase.
 1.34.12.1 21-Apr-2017  bouyer Sync with HEAD
 1.34.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.34.4.1 28-Aug-2017  skrll Sync with HEAD
 1.36.4.1 22-Apr-2018  pgoyette Sync with HEAD
 1.37.2.1 10-Jun-2019  christos Sync with HEAD
 1.44.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.44.6.1 13-May-2021  thorpej Sync with HEAD.
 1.47.16.1 02-Aug-2025  perseant Sync with HEAD
 1.56 20-Jul-2022  thorpej Make alpha_wmb() actually a WMB rather than an MB (all uses of
alpha_wmb() have been audited and fixed-up as necessary).
 1.55 02-Nov-2021  ryo In order to prevent _mcount() from being recursively called when built with COPTS=-O0,
sprinkle `__always_inline' to make _mcount() be generated as a single function.
 1.54 27-May-2021  thorpej Define the arithmetic exception summary bits passed in a0 to entArith.
 1.53 15-Oct-2020  thorpej branches: 1.53.6; 1.53.8;
Fix the bit position for the PMI bit in ALPHA_AMASK_BITS.
 1.52 29-Sep-2020  thorpej Add alpha_pal_wtint(), which invokes the WTINT PALcode call.
 1.51 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.50 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.49 07-Oct-2010  hans branches: 1.49.8; 1.49.12;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.48 16-Feb-2006  perry branches: 1.48.72; 1.48.92; 1.48.94;
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.47 24-Dec-2005  perry branches: 1.47.2; 1.47.4; 1.47.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.46 11-Dec-2005  christos merge ktrace-lwp.
 1.45 28-Jul-2005  rpaulo Added a new AMASK bit (ALPHA_AMASK_PMI) and a new IMPLVER family ID:
ALPHA_IMPLVER_EV7.

ok christos@
 1.44 17-Jan-2003  thorpej branches: 1.44.2; 1.44.18;
Merge the nathanw_sa branch.
 1.43 18-Dec-2001  thorpej Add a memory clobber to alpha_pal_swapctx() and alpha_pal_swpipl();
the former affects the address space, and the latter can let interrupt
handlers in to clobber memory.
 1.42 17-Jul-2001  thorpej branches: 1.42.2;
Protect userland from the inlines and kernel variable decls.
 1.41 08-Jun-2000  thorpej branches: 1.41.6;
And more ANSI'ification!
 1.40 08-Jun-2000  thorpej ANSI'ify.
 1.39 03-Apr-2000  thorpej branches: 1.39.2;
Fix a typo in a previous revision, and add bit names for amask bits for
use with bitmask_snprintf().
 1.38 20-Mar-2000  thorpej Update the amask bits.
 1.37 05-Mar-2000  thorpej Use ANSI-style function declarations for the various inline functions
here. Addresses port-alpha/9056.
 1.36 02-Dec-1999  thorpej Inline most of the remaining PALcode calls.
 1.35 02-Dec-1999  thorpej Inline the BWX instructions.
 1.34 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.33 01-Dec-1999  thorpej After reading the GCC `documentation' a little more, improve the inline
__asm() statements added previously for PALcode operations.
 1.32 30-Nov-1999  thorpej Inline several things from pal.s:
- alpha_rpcc(), alpha_mb(), alpha_wmb() -- these are instructions, and
we win by inlining them: rpcc is generally used for profiling, and
the memory barriers really should execute as quickly as possible with
minimal side-effects (like additional loads/stores required to call the
functions!)
- alpha_pal_imb(), alpha_pal_rdps(), alpha_pal_swpipl(), alpha_pal_tbi(),
alpha_pal_whami() -- these are PALcode ops. We must specify some register
clobbers for these.

We have a very decent size savings as a result. My test system:
text data bss dec hex filename
2671724 235848 377016 3284588 321e6c /netbsd.bak
2617708 235736 377016 3230460 314afc /netbsd

Most of this comes from fewer register saves/restores around spl*() calls
(now that alpha_pal_rdps() and alpha_pal_swpipl() are inlined).

Note that alpha_pal_rdps() and alpha_pal_swpipl() remain in pal.s to
maintain binary compatibility with LKMs that may use spl*() functions.
 1.31 28-Nov-1999  thorpej Implement atomic addition and subtraction on quadwords.
 1.30 25-Sep-1998  thorpej branches: 1.30.12; 1.30.18;
Implement atomic quadword load-and-latch.
 1.29 25-Sep-1998  thorpej The processor unique value in the PCB is used as a backup kernel stack
pointer when booting secondary CPUs. Add an alias for it.
 1.28 24-Sep-1998  thorpej Implement atomic test-and-set for longwords (32-bit).
 1.27 23-Sep-1998  thorpej "Gee, there was already a function to do that."
 1.26 23-Sep-1998  thorpej Implement a function to recompute the HWRPB checksum.
 1.25 22-Sep-1998  thorpej Implement quadword atomic test-and-set.
 1.24 20-Sep-1998  thorpej Add definitions for the maximum allowable `whami' procssor ID and the
maximum number of processors we'll allow (64, assuming procssor IDs start
at 0).
 1.23 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.22 08-Jul-1998  mjacob stale beer- place structure in right file
 1.21 08-Jul-1998  thorpej Define a shorthand macro that represents the mask of PTE bits that the
PALcode cares about.
 1.20 08-Jul-1998  thorpej Cosmetic change.
 1.19 08-Jul-1998  mjacob Add machine check type definitions. Structure the expected/received
machine check items.
 1.18 22-Mar-1998  thorpej Implement a set of `atomic' (using load-locked and store-conditional)
operations. Initial set includes:

alpha_atomic_setbits_q() set bits in a quad
alpha_atomic_clearbits_q() clear bits in a quad
 1.17 27-Feb-1998  thorpej Implement alpha_pal_swpctx().
 1.16 13-Feb-1998  thorpej Rewrite the way the platform model string is determined:
- Attempt to find the model string in the HWRPB's DSR area. Failing that
(if the HWRPB version is too old)...
- Look up the system variation in a variation/string table. Failing that
(unknown variation)...
- Create a default model string using the variation number.

Also, factor out a bunch of common code.
 1.15 20-Sep-1997  mjacob Add some defines for alpha interrupt types.
 1.14 17-Sep-1997  thorpej Prototype alpha_implver(), and fix a think-o in a previous commit.
 1.13 16-Sep-1997  thorpej Add stubs for the Alpha Byte/Word Extension (BWX) instructions, present
on EV56 and later processors that have the "amask BWX" bit clear. These
instructions will be used to implement non-swizzle bus access functions
on newer systems, such as the new AlphaStation 500s with EV56 and 21172
PCI chipsets.

See "Alpha Architecture Handbook, Version 3", DEC order number EC-QD2KB-TE.
 1.12 16-Sep-1997  thorpej - Define bits used in the "amask" instruction.
- Define processor family IDs returned by the "implver" instruction.
- Prototype alpha_amask().
 1.11 03-Sep-1997  thorpej branches: 1.11.2;
Add a few more PALcode operations, as documented in pages (II-B) 2-1 through
(II-B) 2-33 of the Alpha AXP Architecture Reference Manual, Second Edition:

* rdps - Read Processor Status, needed by spl* functions.
* cflush - Cache Flush
* rdval - Read System Value
* wripir - Write Interprocessor Interrupt Request
* wrval - Write System Value

cflush, rdval, wripir, and wrval are used in multi-processor environments.
 1.10 02-Sep-1997  thorpej Fix a typo: ALPHA_PTE_WRITE needs to include the "user write" bit.
 1.9 24-Apr-1997  cgd branches: 1.9.2;
comment out text after #endif. "Pasto!" pointed out by Kevin Sullivan
in PR 3529.
 1.8 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 23-Nov-1996  cgd branches: 1.7.2;
make ALPHA_K0SEG_TO_PHYS and ~0xfffffc00000000000 with the address,
rather than and-ing 16G-1. That just strips the k0seg bits, rather
than making the false assumption that the physical address is going
to be in the lower 16G. That doesn't apply for CIA device-space
addresses, for instance.
 1.6 20-Aug-1996  cgd K0SEG_END is inclusive
 1.5 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.4 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
(2) Restructure and improve machine check and correctable error
handling based on information in the 2nd Ed. of the Alpha Architecture
Reference Manual.
(3) Removed unused (and not likely useful) PALcode assembly stubs.
 1.3 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.2 11-Jul-1996  cgd Add definitions for:
Process Control Block
Interrupt/Exception/Syscall Stack Frame
Machine Check Error Summary Register
Machine Check Logout Area
clean up some, and add prototypes for all of the CPU instruction and
PALcode function stubs.
 1.1 09-Jul-1996  cgd definitions and constants which are part of the Alpha AXP
Architecture, and which relate to the OSF/1 PALcode.
 1.7.2.3 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.7.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.11.2.2 03-Sep-1997  thorpej Add a few more PALcode operations, as documented in pages (II-B) 2-1 through
(II-B) 2-33 of the Alpha AXP Architecture Reference Manual, Second Edition:

* rdps - Read Processor Status, needed by spl* functions.
* cflush - Cache Flush
* rdval - Read System Value
* wripir - Write Interprocessor Interrupt Request
* wrval - Write System Value

cflush, rdval, wripir, and wrval are used in multi-processor environments.
 1.11.2.1 03-Sep-1997  thorpej file alpha_cpu.h was added on branch bouyer-scsipi on 1997-09-03 23:09:06 +0000
 1.30.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.30.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.39.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.41.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.41.6.1 03-Aug-2001  lukem update to -current
 1.42.2.3 14-Jan-2003  nathanw Add alpha_pal_rdunique() and alpha_pal_wrunique().
 1.42.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.42.2.1 17-Jul-2001  nathanw file alpha_cpu.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.44.18.1 21-Jun-2006  yamt sync with head.
 1.44.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.47.2.1 18-Feb-2006  yamt sync with head.
 1.48.94.1 05-Mar-2011  rmind sync with head
 1.48.92.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.48.72.1 09-Oct-2010  yamt sync with head
 1.49.12.1 18-Feb-2012  mrg merge to -current.
 1.49.8.1 17-Apr-2012  yamt sync with head
 1.53.8.1 31-May-2021  cjep sync with head
 1.53.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.2 21-Nov-2023  thorpej Expose alpha_print_instruction_context to not-_KERNEL.
 1.1 21-Nov-2023  thorpej Move alpha/alpha/db_instruction.h -> alpha/include/alpha_instruction.h
 1.26 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.25 17-Jun-2015  martin branches: 1.25.18;
Make clock_t unsigned
 1.24 17-Jul-2011  joerg branches: 1.24.12; 1.24.28; 1.24.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.23 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.22 11-Jan-2009  christos branches: 1.22.4; 1.22.6;
merge christos-time_t
 1.21 17-Oct-2007  garbled branches: 1.21.16; 1.21.18; 1.21.22; 1.21.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.20 03-Sep-2007  drochner clean up some definitions around rune_t which are not needed anymore
 1.19 04-Oct-2006  tnozaki branches: 1.19.8; 1.19.16; 1.19.22; 1.19.26; 1.19.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.18 11-Dec-2005  christos branches: 1.18.20; 1.18.22;
merge ktrace-lwp.
 1.17 07-Aug-2003  agc branches: 1.17.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16 02-Mar-2003  tshiozak branches: 1.16.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.15 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.14 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.13 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.12 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.11 10-May-2000  thorpej branches: 1.11.2;
Make stdarg/varargs work with GCC 2.96.
 1.10 27-Apr-1998  kleink branches: 1.10.14;
Provide definitions for intptr_t and uintptr_t, signed resp. unsigned integral
types large enough to hold any pointer.
 1.9 23-Nov-1997  kleink Add _BSD_SUSECONDS_T_ and _BSD_USECONDS_T_; do some space vs. tab formatting
cleanup
 1.8 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 04-Apr-1997  mycroft Make the names of the member of struct __va_list namespace-clean.
 1.6 15-Nov-1996  jtc branches: 1.6.2;
Define _BSD_CLOCKID_T_ and _BSD_TIMER_T_
 1.5 09-Oct-1996  cgd change __va_list's "offset" field to be a 'int' to match what gcc now
uses, plus add a compatibility hack so that code compiled with old
versions of gcc (e.g. libraries) can work with code compiled with
new versions.
 1.4 16-Mar-1996  jtc Add _BSD_WINT_T_ definition so we can handle wint_t type added in NA1.
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.14.2 05-Jan-2001  bouyer Sync with HEAD
 1.10.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.11.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 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.17.16.2 27-Oct-2007  yamt sync with head.
 1.17.16.1 30-Dec-2006  yamt sync with head.
 1.18.22.1 22-Oct-2006  yamt sync with head
 1.18.20.1 18-Nov-2006  ad Sync with head.
 1.19.28.1 06-Nov-2007  matt sync with HEAD
 1.19.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.19.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.19.16.1 03-Oct-2007  garbled Sync with HEAD
 1.19.8.1 09-Oct-2007  ad Sync with head.
 1.21.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.22.2 11-Aug-2010  yamt sync with head.
 1.21.22.1 04-May-2009  yamt sync with head.
 1.21.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.21.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.21.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.1 30-May-2010  rmind sync with head
 1.22.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.30.1 22-Sep-2015  skrll Sync with HEAD
 1.24.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.24.12.1 03-Dec-2017  jdolecek update from HEAD
 1.25.18.1 10-Jun-2019  christos Sync with HEAD
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 10-Dec-2002  thorpej branches: 1.3.146; 1.3.150;
Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.2 06-Apr-1997  cgd branches: 1.2.34;
clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.2;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.34.1 11-Dec-2002  thorpej Sync with HEAD.
 1.3.150.1 18-Feb-2012  mrg merge to -current.
 1.3.146.1 17-Apr-2012  yamt sync with head
 1.46 09-Jun-2024  riastradh alpha/asm.h: Respect _NETBSD_REVISIONID.
 1.45 23-Feb-2023  riastradh alpha: Add missing barriers in cpu_switchto.

Details in comments.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.44 04-Sep-2020  thorpej branches: 1.44.20;
Use SysValue to store curlwp rather than curcpu. curlwp is acceessed
much more frequently, and this makes curlwp preemption-safe.
 1.43 04-Sep-2020  thorpej Missed one in last change.
 1.42 04-Sep-2020  thorpej Garbage-collect GET_CPUINFO; it's no longer used.
 1.41 04-Sep-2020  thorpej - Make the GET_CURLWP actually return curlwp, not &curlwp.
- exception_return(): Use GET_CURLWP directly, rather than a dance
acount GET_CPUINFO.
- Introduce SET_CURLWP(), to set the curlwp value.
- Garbage-collect GET_FPCURLWP.
 1.40 03-Sep-2020  thorpej The only remaining consumer of curpcb was the PROM mapping code, for if
PROM console routines are being used (only on KN8AE). We have access to
the sam information via curlwp, so use that, and eliminate the need to set
cpu_info::ci_curpcb when context switching, which saves an extra all into
PALcode.
 1.39 29-Aug-2020  thorpej G/C GET_IDLE_PCB -- it hasn't been used for some time.
 1.38 18-Apr-2020  martin Fix copy & pasto in previous (to fix the build)
 1.37 17-Apr-2020  joerg Mark the .ident section as mergable string section to avoid redundant
entries.
 1.36 14-Jan-2017  christos branches: 1.36.16; 1.36.26;
Undo; the correct fix was applied in csu/arch/alpha/crtbegin.h
 1.35 14-Jan-2017  martin Avoid stupid gcc redefinition warnings by #undef before redefine.
 1.34 11-Jul-2013  matt branches: 1.34.8; 1.34.12;
Add a RCSID macro for non _KERNEL use
 1.33 06-Feb-2012  matt branches: 1.33.6; 1.33.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.32 12-Feb-2011  matt branches: 1.32.4; 1.32.8;
Use .pushsection/.popsection for __KERNEL_RCSID/__KERNEL_COPYRIGHT.
Add an explicit .text to linux_sigcode.s
 1.31 20-Dec-2010  joerg branches: 1.31.2; 1.31.4;
Consistently use .gnu.warning with .pushsectio and .popsection on all
architectures instead of obsolete STABS frames for linker warnings.
 1.30 09-Feb-2007  ad branches: 1.30.70;
Merge newlock2 to head.
 1.29 20-Jan-2006  christos branches: 1.29.18;
Add a STRONG_ALIAS macro
 1.28 11-Dec-2005  christos branches: 1.28.2;
merge ktrace-lwp.
 1.27 04-Dec-2003  keihan branches: 1.27.16;
netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.26 18-Dec-2001  thorpej branches: 1.26.16;
We haven't done ECOFF for a long time; garbage-collect all the
__ELF__ #ifdefs (thus setting ELF in stone).
 1.25 18-Dec-2001  thorpej Disable .loc in macros for now; the new assembler is a lot more
picky about having the file number defined.
 1.24 05-Sep-2001  nathanw The return address register ($ra) is callee-saved, not caller-saved.
 1.23 23-Jun-2000  kleink branches: 1.23.2; 1.23.4;
Add a WEAK_ALIAS() macro.
 1.22 02-Dec-1998  thorpej branches: 1.22.10; 1.22.20;
Implement WARN_REFERENCES().
 1.21 13-Oct-1998  kleink Since libc is not ready for enabling weak symbol support yet, disable the
WEAK_ALIAS() macro for now (like cdefs.h).
 1.20 01-Oct-1998  erh Macros to call a linux syscall.
 1.19 27-Mar-1998  ross Get rid of a /* in a comment.
 1.18 03-Nov-1997  ross --Add handcrafted stack frame directives to locore.s palcode vector
--entries / remove kernel entry from locore / reorganize vector entry
--code. Enables access to stack frames transitively w.r.t. palcode
--vectors, e.g. upward traceback works, inverting (possibly several)
--kernel vectors. Until now, all trackbacks ended at the first-reached
--instance of trap(), which was totally useless as there is no mystery
--to trap->panic->cpu_reboot
 1.17 06-Sep-1997  thorpej branches: 1.17.4;
Split off PALcode functions into their own header file.
 1.16 29-Aug-1997  thorpej Define PAL_cflush, PAL_ipir, and PAL_OSF1_wrperfmon PALcode operations.
 1.15 14-Apr-1997  cgd branches: 1.15.4;
clean up some ELF vs. ECOFF bogons
 1.14 08-Apr-1997  cgd align after RCS ID strings if placing them in text
 1.13 08-Apr-1997  cgd include RCS IDs for assembler files, disabled with NO_KERNEL_RCSIDS
 1.12 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.11 30-Nov-1996  jtc branches: 1.11.2;
PROF -> GPROF
 1.10 17-Oct-1996  cgd add a WEAK_ALIAS macro if building on an ELF-capable system, which creates
a weak alias for a symbol.
 1.9 17-Oct-1996  cgd Add __CONCAT and ___CONCAT to concatenate identifiers. Add LLABEL to
create an assembly label, and SYSCALLNUM to convert a syscall name into
the macro that's defined to be its number. Add a CALLSYS_NOERROR macro
which invokes the named system call. (CALLSYS_NOERROR is here since
it's used in locore, for sigcode.)
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 15-Sep-1996  cgd simplify profiling entry. add 'label' argument tp PANIC, PRINTF, and MSG,
which is the label that the message string should be stored with.
 1.5 09-Jul-1996  cgd clean up comments, add OSF/1 rdmces and wrmces PALcode function calls.
 1.4 12-Apr-1996  cgd update copyright
 1.3 12-Apr-1996  cgd use jmp, rather than br, in the JMP macro
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.11.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.15.4.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.17.4.2 08-May-1998  mycroft Pull up 1.19, per request of ross.
 1.17.4.1 10-Nov-1997  thorpej Sync w/ trunk: ability to traceback past PALcode entry vectors.
 1.22.20.1 25-Jul-2000  kleink Pull up rev. 1.23 (approved by thorpej):
For ELF, add a WEAK_ALIAS() macro.
 1.22.10.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.23.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.23.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.23.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.26.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.16.1 03-Aug-2004  skrll Sync with HEAD
 1.27.16.2 26-Feb-2007  yamt sync with head.
 1.27.16.1 21-Jun-2006  yamt sync with head.
 1.28.2.1 01-Feb-2006  yamt sync with head.
 1.29.18.1 11-Jan-2007  ad Checkpoint work in progress.
 1.30.70.1 05-Mar-2011  rmind sync with head
 1.31.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.31.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.8.1 18-Feb-2012  mrg merge to -current.
 1.32.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.32.4.1 17-Apr-2012  yamt sync with head
 1.33.10.1 28-Aug-2013  rmind sync with head
 1.33.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34.12.1 20-Mar-2017  pgoyette Sync with HEAD
 1.34.8.1 05-Feb-2017  skrll Sync with HEAD
 1.36.26.1 20-Apr-2020  bouyer Sync with HEAD
 1.36.16.1 21-Apr-2020  martin Sync with HEAD
 1.44.20.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #264):

sys/arch/ia64/ia64/vm_machdep.c: revision 1.18
sys/arch/powerpc/powerpc/locore_subr.S: revision 1.67
sys/arch/aarch64/aarch64/locore.S: revision 1.91
sys/arch/mips/include/asm.h: revision 1.74
sys/arch/hppa/include/cpu.h: revision 1.13
sys/arch/arm/arm/armv6_start.S: revision 1.38
sys/arch/evbmips/ingenic/cpu_startup.S: revision 1.2
sys/arch/mips/mips/locore.S: revision 1.229
sys/arch/aarch64/aarch64/cpuswitch.S: revision 1.40
sys/arch/alpha/include/asm.h: revision 1.45
sys/arch/sparc64/sparc64/locore.s: revision 1.432
sys/arch/vax/vax/subr.S: revision 1.42
sys/arch/mips/mips/locore_mips3.S: revision 1.116
sys/arch/riscv/riscv/cpu_switch.S: revision 1.3
sys/arch/ia64/ia64/machdep.c: revision 1.44
sys/arch/arm/arm32/cpuswitch.S: revision 1.106
sys/arch/sparc/sparc/locore.s: revision 1.284

aarch64: Add missing barriers in cpu_switchto.
Details in comments.

Note: This is a conservative change that inserts a barrier where
there was a comment saying none is needed, which is probably correct.
The goal of this change is to systematically add barriers to be
confident in correctness; subsequent changes may remove some bariers,
as an optimization, with an explanation of why each barrier is not
needed.

PR kern/57240

alpha: Add missing barriers in cpu_switchto.
Details in comments.

arm32: Add missing barriers in cpu_switchto.
Details in comments.

hppa: Add missing barriers in cpu_switchto.
Not sure hppa has ever had working MULTIPROCESSOR, so maybe no
pullups needed?

ia64: Add missing barriers in cpu_switchto.
(ia64 has never really worked, so no pullups needed, right?)

mips: Add missing barriers in cpu_switchto.
Details in comments.

powerpc: Add missing barriers in cpu_switchto.
Details in comments.

riscv: Add missing barriers in cpu_switchto.
Details in comments.

sparc: Add missing barriers in cpu_switchto.

sparc64: Add missing barriers in cpu_switchto.
Details in comments.

vax: Note where cpu_switchto needs barriers.

Not sure vax has ever had working MULTIPROCESSOR, though, and I'm not
even sure how to spell store-before-load barriers on VAX, so no
functional change for now.
 1.10 10-Mar-2008  ad Finish moving alpha over to the MI atomic ops.
 1.9 28-Dec-2005  perry branches: 1.9.36; 1.9.50; 1.9.70; 1.9.74;
inline -> __inline
 1.8 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.7 17-Dec-2001  thorpej branches: 1.7.32;
Fix constraints in __asm statements (err, again). Kernels compiled
with GCC 2.95.3 work now.
 1.6 16-Apr-2001  thorpej branches: 1.6.2; 1.6.4;
Oops, properly mark a memory operand as both an input and an
output as necessary.
 1.5 08-Jun-2000  thorpej branches: 1.5.4; 1.5.6;
ANSI'ify.
 1.4 23-May-2000  thorpej branches: 1.4.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.3 05-Mar-2000  thorpej Use ANSI-style function declarations for the various inline functions
here. Addresses port-alpha/9056.
 1.2 03-Dec-1999  thorpej branches: 1.2.2;
Remove now-obsolete atomic operations.
 1.1 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.2.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.4.3 21-Apr-2001  bouyer Sync with HEAD
 1.5.4.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.5.4.1 08-Jun-2000  bouyer file atomic.h was added on branch thorpej_scsipi on 2000-11-20 22:35:40 +0000
 1.6.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.4.1 16-Apr-2001  nathanw file atomic.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.32.2 17-Mar-2008  yamt sync with head.
 1.7.32.1 21-Jun-2006  yamt sync with head.
 1.9.74.1 03-Apr-2008  mjf Sync with HEAD.
 1.9.70.1 24-Mar-2008  keiichi sync with head.
 1.9.50.1 23-Mar-2008  matt sync with HEAD
 1.9.36.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.24 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.23 06-Feb-2012  matt branches: 1.23.84;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.22 11-Dec-2005  christos branches: 1.22.112; 1.22.116;
merge ktrace-lwp.
 1.21 23-Oct-2004  thorpej Centralize the declaration of booted_device and booted_partition.
 1.20 22-Mar-2003  simonb branches: 1.20.2;
Fix a grammatical nit.
 1.19 08-Jun-2000  thorpej And more ANSI'ification!
 1.18 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.17 01-Jun-2000  matt Make booted_device global (and booted_parition for consitency).
Eliminate it from header files and other extern definitions.
 1.16 14-May-1998  thorpej branches: 1.16.14; 1.16.22;
Garbage-collect the old confargs stuff that was used in the Early Days.
It isn't really appropriate anymore. Replace it with a real mainbus
attach args structure.
 1.15 13-May-1998  thorpej Clean up some historical artifacts.
 1.14 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.13 13-Feb-1998  thorpej Define a lookup table for Alpha platform variation names.
 1.12 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.11 11-Aug-1997  cgd clean up bootinfo v1 struct a bit: add a hwrpb size field (in a backward-
compatible way), and clean up the comments to make things a bit clearer.
 1.10 25-Jul-1997  cgd branches: 1.10.2;
fix comment glitch in the last change
 1.9 25-Jul-1997  cgd clean up bootinfo structure comments so they're more readable (to me,
at least 8-). Add structure offssets for structure members, so we
know how much space we're using. Make the version in the bootinfo
structure be a u_long, so there's no implicit padding in the structure.
Add a few more pointers to the bootinfo v1 structure, which will all
be set to NULL for now.
 1.8 25-Jul-1997  thorpej Define the bootinfo magic number and bootinfo (version 1) structure.
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 13-Nov-1996  cgd branches: 1.6.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 14-Jul-1996  cgd (1) Clean up interrupt handling slightly.
(2) Clean up badaddr() definition.
 1.4 13-Jun-1996  cgd clean up copyright notices
 1.3 13-Jun-1996  cgd boot device autodetection, using PROM's boot device environment variable.
This is a bit of a hack, as-is, since there's a lot of code that's
outright duplicated between the various files and because it doesn't
support detection of a network device as the root device. The
latter's not a problem yet, because NetBSD/Alpha can't load the kernel
from the network to begin with.
 1.2 23-Nov-1995  cgd branches: 1.2.4;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>clean up copyright notices
 1.2.4.1 13-Jun-1996  cgd pull up from trunk:
>boot device autodetection, using PROM's boot device environment variable.
>This is a bit of a hack, as-is, since there's a lot of code that's
>outright duplicated between the various files and because it doesn't
>support detection of a network device as the root device. The
>latter's not a problem yet, because NetBSD/Alpha can't load the kernel
>from the network to begin with.
 1.6.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.16.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.20.2.1 02-Nov-2004  skrll Sync with HEAD.
 1.22.116.1 18-Feb-2012  mrg merge to -current.
 1.22.112.1 17-Apr-2012  yamt sync with head
 1.23.84.1 02-Aug-2025  perseant Sync with HEAD
 1.2 21-Aug-1999  simonb Include <sys/bswap.h> for function prototypes. i386, pc532 and vax
still include <machine/byte_swap.h> and define macros for some of
the bswap*() functions.
 1.1 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.55 13-Jul-2011  dyoung On alpha, good-bye <machine/bus.h>.
 1.54 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.53 04-Mar-2007  christos branches: 1.53.40; 1.53.42; 1.53.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 21-Feb-2007  mrg add a pair of new bus_dma(9) functions:
int _bus_dmatag_subregion(bus_dma_tag_t tag,
bus_addr_t min_addr,
bus_addr_t max_addr,
bus_dma_tag_t *newtag,
int flags)
void _bus_dmatag_destroy(bus_dma_tag_t tag)

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

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

XXX: bus_dma(9) needs an update still.
 1.51 11-Dec-2005  christos branches: 1.51.26;
merge ktrace-lwp.
 1.50 09-Mar-2005  matt branches: 1.50.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.49 15-Jun-2003  fvdl branches: 1.49.2; 1.49.10; 1.49.12;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
 1.48 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.47 26-Apr-2002  thorpej Keep track of which DMA window was actually used to map the
request (not always the passed in DMA tag if we try direct-map
and then fall back to sgmap-mapped). Use the actual window
when performing dmamap_sync and dmamap_unload operations.

Fixes DMA resource leak on systems with 2G+ RAM. Thanks to
Matt Thomas for help debugging this.
 1.46 04-Sep-2001  thorpej Implement bus_space_mmap().
 1.45 19-Jul-2001  thorpej branches: 1.45.2;
Add BUS_DMA_READ and BUS_DMA_WRITE flags, that hint the back-end
at dmamap load time that the mapping will be used for a unidirectional
transfer of the specified direction.
 1.44 19-Jul-2001  thorpej Simplify the SGMAP code a bit, and move SGVA allocation out of a
common routine into the individual load routines, since each load
routine needs to muddle with the "internals" of this operation.

Add a `prefetch threshold' member to the bus_dma_tag_t, so that
eventually we can determine whether or not to allocate a spill
page on a per-mapping basis.
 1.43 21-Jun-2001  wiz branches: 1.43.2;
constraint, not contraint.
 1.42 07-Mar-2001  thorpej Add the BUS_DMA_STREAMING flag.
 1.41 31-Jul-2000  briggs branches: 1.41.2;
Define bus_space_*_stream_N functions as their non-stream counterparts.
 1.40 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.39 08-Jun-2000  thorpej branches: 1.39.2;
And more ANSI'ification!
 1.38 17-Apr-2000  drochner branches: 1.38.2;
implement bus_space_vaddr()
 1.37 15-Mar-2000  drochner explicitely #include <sys/systm.h> #if BUS_SPACE_DEBUG to get a printf()
prototype
 1.36 26-Feb-2000  thorpej Pull in <sys/types.h> for the benefit of those things which include
<machine/sysarch.h> but don't pull in <sys/types.h>.
 1.35 26-Feb-2000  thorpej - Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.34 25-Feb-2000  thorpej Protect a few things from userland with _KERNEL.
 1.33 25-Feb-2000  thorpej Add an internal bus space method alpha_bus_space_translate(), which
provides a method to translate an address on an I/O bus into a sysBus
address, along with acccess method information.
 1.32 06-Feb-2000  thorpej Implement an internal DMA map flag which prevents coalescing of
adjacent DMA segments.
 1.31 25-Jan-2000  drochner define a "BUS_SPACE_MAP_PREFETCHABLE" flag which basically means that
device accesses are idempotent (but should not be cached by the CPU)
 1.30 08-Dec-1999  thorpej Slight changes so that bounce buffers can be implemented for the Jensen.
 1.29 18-Jun-1999  cgd branches: 1.29.2; 1.29.8;
nuke current definitions provided by __BUS_SPACE_COMPAT_OLDDEFS.
I'll do what I can to make new ones soon. 8-)
 1.28 23-Mar-1999  drochner branches: 1.28.2; 1.28.4;
Add a macro to check for sufficient pointer alignment in bus.h context,
"BUS_SPACE_ALIGNED_POINTER()".
Equal to the param.h "ALIGNED_POINTER()" normally, but obeys additional
requirements of the bus_space_xxx_n() macros. (BUS_SPACE_DEBUG)
 1.27 04-Mar-1999  mjacob Well, sizeof needs to be printed with a %lu- I guess not many people build
debug kernels!
 1.26 30-Aug-1998  cgd don't define __BUS_SPACE_COMPAT_OLDDEFS by default. As stated in
bus_space(9), if drivers want it (they shouldn't; easy to convert) they
can define it right before including bus.h. There's been a release since
the interfaces were (slightly) changed, and no code in the source tree
uses the old interfaces as far as I can tell.
 1.25 31-Jul-1998  thorpej Provide a hook for bypassing space accounting, needed to support ISA PnP
for now.
 1.24 08-Jun-1998  thorpej branches: 1.24.2;
Add debugging support to the bus_space macros. If BUS_SPACE_DEBUG (or DEBUG)
is defined, the bus_space macros will check to ensure that the bus address
and the target buffer (if applicable) are aligned properly for the size
of the type being used. If they are not, a message will be displayed on
the console.

Strict alignment is required by the Alpha architecture, and a trap will
occur of unaligned access is performed. These changes will aid debugging
of broken device drivers.
 1.23 03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.22 13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.21 07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.20 04-Feb-1998  thorpej The _dmamap_sync method is no longer optional.
 1.19 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.18 04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.17 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.16 17-Jan-1998  thorpej Put SGMAP-related stuff in the DMA map structure directly, rather than
indirecting through a pointer.
 1.15 13-Aug-1997  cgd branches: 1.15.2;
don't define __BUS_SPACE_COMPAT_OLDDEFS if it's already been defined
 1.14 23-Jul-1997  cgd branches: 1.14.2;
when i was documenting the bus_space interfaces (the document
was sent to developers, but will eventually become a man page or
something), i noticed a few in various names:
(1) _map and _alloc should take a flags argument, rather than a
'cacheable' boolean.
(2) BUS_BARRIER_* flags should be BUS_SPACE_BARRIER_*.
(3) bus_space_copy_* should be bus_space_copy_region_* for consistency
with other region ops.
Fix all of these (in a backward-compatible way, at least for now). Redefine
internal usees of those names to use the new names. Also, while at it,
clean up the copy functions (remove unnecessary variables) and make sure
that they and other functions conform to the spec.
 1.13 07-Jun-1997  thorpej bus_dmamap_t's always have a pointer to an sgmap cookie. (oops, forgot
to commit this to the branch!)
 1.12 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.11 06-Apr-1997  cgd branches: 1.11.2;
clean up NetBSD RCS ID strings
 1.10 02-Dec-1996  cgd branches: 1.10.2;
implement bus_space_copy_*().
 1.9 02-Dec-1996  cgd move barrier operation definition closer to the top of the bus space ops
structure. In the implementations, allow the barrier op to be inlined.
 1.8 02-Dec-1996  cgd implement bus_space_set_multi_* and bus_space_set_region_* operations.
 1.7 27-Nov-1996  cgd #ifdef DEBUG, check {read,write}_{multi,region} ops' pointer arg for alignment.
 1.6 22-Oct-1996  cgd clean up the recent reimplementation, and kill several bogons in the new
definitions.
 1.5 22-Oct-1996  cgd update alpha bus.h for new bus space interfaces. chipsets haven't
been updated yet, and the hacked DMA vto(busphys) macro is gone and
hasn't yet been replaced.
 1.4 11-Jun-1996  cgd implement bus_mem_subregion() and bus_io_subregion().
 1.3 03-Jun-1996  cgd gross hack to get around the fact that there are currently devices with
common back-ends that live on multiple very-different busses (e.g. PCI and
TC), which need bus-specific DMA mapping support. As a nice side effect,
this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
to go away in favor of less nasty bus-specific function calls.
 1.2 18-Apr-1996  cgd branches: 1.2.4;
define bus_io_{read,write}_multi_{1,2,4,8} functions, which read/write
multiple values from a single I/O port in to/out of an array of values.
 1.1 12-Apr-1996  cgd the Alpha implementation of <machine/bus.h>
 1.2.4.2 13-Jun-1996  cgd pull up from trunk:
>implement bus_mem_subregion() and bus_io_subregion().
 1.2.4.1 03-Jun-1996  cgd pull up from trunk:
>gross hack to get around the fact that there are currently devices with
>common back-ends that live on multiple very-different busses (e.g. PCI and
>TC), which need bus-specific DMA mapping support. As a nice side effect,
>this will allow the especially nasty (vtophys(va) | 0x40000000) expressions
>to go away in favor of less nasty bus-specific function calls.
 1.10.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.10.2.3 07-Jun-1997  cgd sync syng thorpej-bus-dma changes with alpha-nwscons branch (pass 2)
 1.10.2.2 07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.10.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.2.2 06-Jun-1997  thorpej Right, that's a bonk on the head! Zero-length arrays aren't legal
in C. Make the bus_dmamap_t variable-length array size 1, and compensate
for the size screw in _bus_dmamap_create(). Pointed out by Chris Demetriou.
 1.11.2.1 23-May-1997  thorpej Add constants, types, and methods for alpha bus dma support.
 1.14.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.2.2 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.15.2.1 13-Aug-1997  thorpej file bus.h was added on branch marc-pcmcia on 1997-09-01 20:00:20 +0000
 1.24.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.28.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.28.2.1 06-Feb-2000  he Pull up revision 1.32 (requested by thorpej):
Fix host->device DMA data corruption problem on DEC Miata
workstations.
 1.29.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.29.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.29.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.38.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.39.2.3 27-Apr-2002  he Pull up revision 1.47 (requested by thorpej):
Fix a DMA resource leak on Alpha systems with more than 1GB of
RAM.
 1.39.2.2 06-Aug-2000  briggs Pull up revision 1.41 -- Approved by thorpej --
Define bus_space_*_stream_N functions as their non-stream counterparts.
 1.39.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.41.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.43.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.43.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.43.2.1 03-Aug-2001  lukem update to -current
 1.45.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.45.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.45.2.1 19-Jul-2001  nathanw file bus.h was added on branch nathanw_sa on 2001-09-21 22:34:57 +0000
 1.49.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.49.10.1 29-Apr-2005  kent sync with -current
 1.49.2.1 01-Apr-2005  skrll Sync with HEAD.
 1.50.4.2 03-Sep-2007  yamt sync with head.
 1.50.4.1 26-Feb-2007  yamt sync with head.
 1.51.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.51.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.53.44.1 16-May-2008  yamt sync with head.
 1.53.42.1 18-May-2008  yamt sync with head.
 1.53.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.6 18-Jul-2021  thorpej Allow for the SGMAP implementation to specify a minimum alignment for
SGMAP DMA segments. If not specified, PAGE_SIZE will be used, as before.
 1.5 23-Sep-2019  skrll branches: 1.5.12;
Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.4 22-Jun-2017  flxd branches: 1.4.6;
spelling (DEC called it "TURBOchannel")
 1.3 06-Feb-2012  matt branches: 1.3.6; 1.3.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.2 12-Aug-2011  dyoung branches: 1.2.2; 1.2.6;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 1.1 01-Jul-2011  dyoung Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

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

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

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.2.6.1 18-Feb-2012  mrg merge to -current.
 1.2.2.1 17-Apr-2012  yamt sync with head
 1.3.24.1 28-Aug-2017  skrll Sync with HEAD
 1.3.6.1 03-Dec-2017  jdolecek update from HEAD
 1.4.6.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.3 11-Oct-2020  thorpej Add some bus_dma instrumentation.
 1.2 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.1 01-Jul-2011  dyoung branches: 1.1.2; 1.1.6;
Per discussion at
<http://mail-index.netbsd.org/tech-kern/2010/04/02/msg007941.html>,
divide each machine's bus.h into bus_defs.h (constants & data types)
and bus_funcs.h (macro implementations of bus_space(9) routines and MD
prototypes).

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

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

These #include files are not referenced by any (committed) Makefiles or
header files, yet. Changes to Makefiles, to <sys/bus.h>, and to some
more machine-dependent files will dribble in before I throw the switch.
 1.1.6.1 18-Feb-2012  mrg merge to -current.
 1.1.2.1 17-Apr-2012  yamt sync with head
 1.3 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.2 24-Jan-2016  christos branches: 1.2.18;
use __paddr_t since this is a userland API.
 1.1 12-Aug-2011  dyoung branches: 1.1.12; 1.1.30;
Straggler from last: add bus_user.h to the repository.
 1.1.30.1 19-Mar-2016  skrll Sync with HEAD
 1.1.12.1 03-Dec-2017  jdolecek update from HEAD
 1.2.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.6 28-Apr-2008  martin branches: 1.6.34; 1.6.38;
Remove clause 3 and 4 from TNF licenses
 1.5 16-Feb-2006  perry branches: 1.5.68; 1.5.70; 1.5.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.4 24-Dec-2005  perry branches: 1.4.2; 1.4.4; 1.4.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 08-Jun-2000  thorpej branches: 1.3.4; 1.3.44;
ANSI'ify.
 1.2 05-Mar-2000  thorpej branches: 1.2.2;
Use ANSI-style function declarations for the various inline functions
here. Addresses port-alpha/9056.
 1.1 02-Dec-1999  thorpej branches: 1.1.2;
Inline the BWX instructions.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.44.1 21-Jun-2006  yamt sync with head.
 1.3.4.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.4.1 08-Jun-2000  bouyer file bwx.h was added on branch thorpej_scsipi on 2000-11-20 22:35:40 +0000
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.4.2.1 18-Feb-2006  yamt sync with head.
 1.5.72.1 16-May-2008  yamt sync with head.
 1.5.70.1 18-May-2008  yamt sync with head.
 1.5.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.38.1 18-Feb-2012  mrg merge to -current.
 1.6.34.1 17-Apr-2012  yamt sync with head
 1.13 18-Mar-2014  christos Make all __ALIGNBYTES macros return the same type (size_t)
 1.12 20-Jan-2012  joerg branches: 1.12.6; 1.12.10;
Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.11 20-Mar-1999  thorpej branches: 1.11.182; 1.11.186;
Garbage-collect.
 1.10 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.9 22-Oct-1997  thorpej Implement __RENAME() in <machine/cdefs.h>
 1.8 07-Apr-1997  cgd branches: 1.8.8;
by default, provide RCS IDs for NetBSD/alpha kernel files in kernel binaries.
This can be disabled (to save a bit of space) with the NO_KERNEL_RCSIDS
options, which is present but commented out in the ALPHA config file.
In ELF-format kernels, these strings are present in the kernel binary but
are not loaded into memory. (In ECOFF-format kernels, there's no easy way
to keep them from being loaded, so they _are_ loaded into memory.)
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 16-Dec-1996  cgd disable weak aliases in libc until something actually uses them. When
using __weak_alias in libc, __indr_reference should probably be defined
to do nothing (but defined, so that duplicate functions/variables aren't
compiled). However, when not using __weak_alias, __indr_reference causes
them to be omitted completely, which is a lose. So, until weak aliases
are going to be used, don't define __weak_alias or __indr_reference.
 1.5 12-Oct-1996  cgd branches: 1.5.2;
don't forget to switch back to the .text after emitting warning
strings in their own sections.
 1.4 09-Oct-1996  cgd add support for ELF toolchain, including weak alias support (for upcoming
libc changes) and reference warnings.
 1.3 04-Oct-1996  cgd kill misnamed __indr_references() macro, that would have broken things
if it _had_ been properly named.
 1.2 03-May-1995  cgd make an __indr_references macro, that expands to nothing...
 1.1 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.5.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.1 24-Jan-1997  cgd sync with trunk
 1.8.8.2 04-Nov-1997  thorpej Pull up from trunk: bug fixes and cleaups.
 1.8.8.1 22-Oct-1997  thorpej Pull up from trunk: Implement __RENAME() in <machine/cdefs.h>
 1.11.186.1 18-Feb-2012  mrg merge to -current.
 1.11.182.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.182.1 17-Apr-2012  yamt sync with head
 1.12.10.1 18-May-2014  rmind sync with head
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4 03-Jun-2022  andvar remove reference to gatekeeper.dec.com ftp.
 1.3 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.2 06-Apr-1997  cgd branches: 1.2.206; 1.2.226;
clean up NetBSD RCS ID strings
 1.1 01-May-1996  cgd branches: 1.1.2;
Preliminary CFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap, cursor,
etc.) support. Digital UNIX does not support CFB frame buffers in the
Alpha, but they appear to work OK (with an appropriate monitor) in my
3000/300.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.226.1 28-Aug-2017  skrll Sync with HEAD
 1.2.206.1 03-Dec-2017  jdolecek update from HEAD
 1.3 09-May-1996  cgd remove redundant header, now that ECOFF_SEGMENT_ALIGNMENT macro for
<sys/exec_ecoff.h> is fixed.
 1.2 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5 06-Sep-2002  gehenna branches: 1.5.2;
Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.4 10-Apr-2000  chs branches: 1.4.6; 1.4.8; 1.4.20;
add decls for fd driver.
 1.3 24-Mar-1998  thorpej branches: 1.3.14;
cdev_decl the "zs" device (which is really zstty).
 1.2 02-Mar-1998  ross branches: 1.2.2;
Centralize cdev_decl() for these MI drivers + a12dc in machine/conf.h (cgd)
(This does not introduce any config or option dependencies.)
 1.1 07-Apr-1997  cgd branches: 1.1.2;
add machine/conf.h, right now a minimal placeholder
 1.1.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.2.2.2 02-Mar-1998  ross Centralize cdev_decl() for these MI drivers + a12dc in machine/conf.h (cgd)
(This does not introduce any config or option dependencies.)
 1.2.2.1 02-Mar-1998  ross file conf.h was added on branch alpha-nwscons on 1998-03-02 07:44:19 +0000
 1.3.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.20.1 16-May-2002  gehenna Get rid of port-dependent conf.h.
 1.4.8.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.6.1 17-Sep-2002  nathanw Catch up to -current.
 1.5.2.2 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.5.2.1 06-Sep-2002  gehenna file conf.h was added on branch bouyer-scsipi on 2002-09-06 13:19:05 +0000
 1.106 31-Mar-2024  thorpej Add machdep.rpb_type and machdep.rpb_variation sysctl nodes.
 1.105 22-Nov-2023  thorpej If not _KERNEL, include <stddef.h> to make sure we have offsetof().
 1.104 14-Aug-2021  ryo Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU.

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

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
For compatibility, if the -c option is not specified, the entire system can be
operated as before, and the -p option will get the total profiling data for
all CPUs.
 1.103 22-Jul-2021  thorpej Various minor cleanups and bug fixes to the FP software completion code:
- Use __CTASSERT() instead of rolling our own compile-time assertion
using cpp.
- Use __BIT() &c instead of rolling our own.
- Improve some comments.
- Define a default FP_C and FPCR value that is self-consistent, and
initialize it properly at process creation time.
- Fix signal information when the trap shadow cannot be resolved.
- Use defined constants rather than magic numbers for the exception
summary bits.
- Add a machdep sysctl to enable FP software-completion debugging.
 1.102 26-Jun-2021  skrll Fix typo in comment
 1.101 20-Apr-2021  thorpej branches: 1.101.2;
Slight tweak to previous changes:

Rather than simply increment the interrupt depth for the clock interrupt,
we add 0x10. Why? Because while we only use a single Alpha IPL (4) for
IPL_{BIO,NET,TTY,VM}, technically the architecture specification suports
two in the OSF/1 PALcode (3 [low-pri] and 4 [high-pri]), meaning we could
conceiveably have intrdepth > 1 just for device interrupts.

Adding 0x10 here means that cpu_intr_p() can check for "intrdepth != 0" for
"in interrupt context" and CLKF_INTR() can check "(intrdepth & 0xf) != 0" for
"was processing interrupts when the clock interrupt happened".
 1.100 15-Apr-2021  rin Fix fallout from alpha/interrupt.c rev 1.93:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/alpha/alpha/interrupt.c#rev1.93

by which interrupts *seem* to occupy 100% CPU time.

Now, we bump ci_intrdepth for clock interrupt. Therefore, if ci_intrdepth > 1
is observed in statclock(), CPU is actually occupied by interrupts.

Thanks jklos and thorpej for notice!
 1.99 15-Oct-2020  thorpej branches: 1.99.4;
Expose a bunch of CPU details, including implementation version and
architecture extensions, via sysctl:

hw.cpu0.model = 21264A-0 (EV67)
hw.cpu0.major = 11
hw.cpu0.minor = 0
hw.cpu0.implver = 2
hw.cpu0.amask = 0x1307
hw.cpu0.bwx = 1
hw.cpu0.fix = 1
hw.cpu0.cix = 1
hw.cpu0.mvi = 1
hw.cpu0.pat = 1
hw.cpu0.pmi = 1
hw.cpu0.vax_fp = 1
hw.cpu0.ieee_fp = 1
hw.cpu0.primary_eligible = 1
hw.cpu0.primary = 1
hw.cpu0.cpu_id = 0
hw.cpu0.pcc_freq = 239990688

as well as some potentially interesting system-level variables:

machdep.cctr = 0
machdep.is_qemu = 1

Should address the basic concern in PR port-alpha/15835.
 1.98 29-Sep-2020  thorpej Improve time keeping and host CPU usage when running in Qemu:
- clockattach(): Allow multiple calls when running in Qemu. Anything
after this first one is ignored, but this gives us a change to use
a clock source provided by the VM directly, rather than relying on
a more expensive hardware emulation.
- Add cpu_initclocks_secondary(), to handle clock setup on secondary
CPUs, if needed.
- Allow us to use the WTINT PALcode call in cpu_idle() to idle in a lower
power state (Qemu's PALcode supports this).
- Use the Qemu per-cpu set-alarm-rel call as the hardclock interrupt
source. In Qemu environments, reduce hz to 50 (rather than the
default 1024) to give the clock a snowball's chance when running on
a host system with hz=100. XXX We have to manually re-calculate
tick and tickadj. There should be MI code to do this for us. Also
in Qemu environments, let hardclock() drive the sched clock by setting
schedhz=0.
 1.97 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.96 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.95 05-Sep-2020  thorpej Track the SSIR per-cpu, rather than globally.
 1.94 04-Sep-2020  thorpej Put the MI cpu_data at the beginning of cpu_info so that it is
cache line aligned.
 1.93 04-Sep-2020  thorpej Use SysValue to store curlwp rather than curcpu. curlwp is acceessed
much more frequently, and this makes curlwp preemption-safe.
 1.92 04-Sep-2020  thorpej Shuffle fields in cpu_info for better cache behavior.
XXX More changes to come after curlwp is overhauled.
 1.91 03-Sep-2020  thorpej Garbage-collect fpcurlwp -- it has been obsolete since FPU tracking
was converted over to PCU.
 1.90 03-Sep-2020  thorpej Garabage-collect curpcb / cpu_info::ci_curpcb.
 1.89 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.88 29-Aug-2020  thorpej - cpu_need_resched(): Explicitly cover each RESCHED_* case, and add a
comment explaining why we don't need to act on IDLE+REMOTE.
- cpu_signotify(): Move to machdep.c, and if we're asked to notify
an LWP running on another CPU, send an AST IPI to that CPU. Add some
assertions.
- cpu_need_proftick(): Move to machdep.c, add some assertions.
 1.87 17-Aug-2020  thorpej - Track the currently-activated pmap in struct cpu_info.
- Reserve some space in struct cpu_info for future pmap changes.
 1.86 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.85 24-Nov-2019  ad Make ci_want_resched a u_int.
 1.84 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.83 17-Dec-2016  flxd branches: 1.83.14; 1.83.16;
Fix typo "one the" and architecture where appropriate.
 1.82 22-Jan-2014  christos branches: 1.82.6; 1.82.10;
undo rump workaround
 1.81 21-Jan-2014  christos rumpkernel needs ci_pcc_freq
 1.80 10-Nov-2013  christos use __unused instead of __USE and void cast to mark iterator variable unused
where needed (from phone)
 1.79 03-Nov-2013  christos use __USE() in the iterator variable
 1.78 21-Jan-2012  matt branches: 1.78.6; 1.78.10;
cpu_uarea_free returns bool, not void
 1.77 14-Jun-2011  matt branches: 1.77.2; 1.77.6;
Add latent support for __HAVE_CPU_UAREA_ROUTINES
 1.76 08-Feb-2011  rmind branches: 1.76.2;
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.75 26-Dec-2010  he branches: 1.75.2; 1.75.4;
Since struct cpu_data isn't the first member in struct cpu_info, instead
expose the initial portion of struct cpu_info if _KMEMUSER is defined.
 1.74 28-Apr-2008  martin branches: 1.74.22;
Remove clause 3 and 4 from TNF licenses
 1.73 27-Feb-2008  xtraeme branches: 1.73.2; 1.73.4;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.72 17-Oct-2007  garbled branches: 1.72.12; 1.72.16;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.71 21-Jul-2007  tsutsui branches: 1.71.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.70 19-May-2007  mhitch branches: 1.70.2; 1.70.4;
Fix multiprocessor operation: move a couple of fields in struct cpu_info
to the beginning so they can still be accessed in assymbly code using 8 bit
offsets. The addition of a big structure in cpu_data moved these outside
the range of the addq instruction. Gas should have complained that the
immediate value was too large, but just silently truncated it. I can now
run multiprocessor again.
 1.69 18-May-2007  mhitch Fix alpha MP for idlelwp: ci_idle_lwp was added to cpu_info
structure, but never initialized. There's already a cpu_idlelwp
in ci_data, which appears to be the same thing, so use that instead.
 1.68 17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.67 16-Feb-2007  ad branches: 1.67.2; 1.67.6; 1.67.8; 1.67.12; 1.67.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.66 09-Feb-2007  ad Merge newlock2 to head.
 1.65 24-Dec-2005  perry branches: 1.65.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.64 11-Dec-2005  christos merge ktrace-lwp.
 1.63 22-Sep-2004  yamt branches: 1.63.12;
move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.62 04-Jan-2004  jdolecek Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

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

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

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

g/c now unneeded routines and variables, including the reaper kernel thread
 1.61 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.60 05-Feb-2003  nakayama branches: 1.60.2;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.59 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.58 30-May-2001  mrg branches: 1.58.4;
use _KERNEL_OPT
 1.57 27-May-2001  sommerfeld Assorted microtime fixes (similar to fixes I made yesterday when
porting this code to i386mp branch):

- call microset() early on each cpu so that calls to microtime()
before the first clock interrupt don't return trash. this manifested
itself as garbage runtimes in "ps" for kernel threads.
- avoid races between hardclock updating "time" and microset on a
different cpu reading it by adding a "microset_time" global which is
initialized from "time" on the primary cpu.
- call microset every hz ticks, not every hz+1 (cosmetic)
 1.56 28-Apr-2001  thorpej Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.55 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.54 21-Apr-2001  thorpej Adjust the way the cpu_info[] array works (array of pointers
rather than array of structures). Keep a list of active
CPUs and define a CPU_INFO_FOREACH to traverse them.

This fixes cpustates statistics tracking.
 1.53 20-Apr-2001  thorpej Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.52 27-Feb-2001  mjacob branches: 1.52.2;
revert previous commit while the longbeards ponder
 1.51 27-Feb-2001  mjacob Remove cpu_wait #define because it's now prototyped in <sys/proc.h> which
means it has to really exist.
 1.50 19-Jan-2001  thorpej Make ASTs per-process.
 1.49 13-Dec-2000  mycroft Oops; add PROC_PC().
 1.48 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.47 20-Nov-2000  thorpej Make ci_ipis volatile.
 1.46 25-Aug-2000  thorpej Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.
 1.45 21-Aug-2000  thorpej Add experimental code for pausing other CPUs upon a CPU's
entry into the debugger. While I'm here, add splsched()
as per spl(9).
 1.44 08-Jun-2000  thorpej And more ANSI'ification!
 1.43 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.42 04-Jun-2000  thorpej Increment an interrupt depth counter in non-clock interrupt cases
so that we can get time spent in interrupt statistics.
 1.41 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.40 31-May-2000  thorpej - In the MULTIPROCESSOR case, initialize p_cpu before a process is
marked SONPROC.
- Always make curproc, fpcurproc, astpending, and want_resched per-CPU
variables in struct cpu_info. Restructure code accordingly, and trim
a few instructions from a few spots in various places in locore.
 1.39 26-May-2000  thorpej branches: 1.39.2;
First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

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

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

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

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

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.38 03-Apr-2000  thorpej Print any architecture extensions present on the primary CPU.
 1.37 29-Feb-2000  thorpej Put machine check info in cpu_info in the multiprocessor case, and
just have one statically allocate machine check info structure in the
single processor config case.
 1.36 16-Dec-1999  thorpej - Remove a misguided attempt to use procs as idle contexts for secondary
processors. Instead, allocate separate idle PCBs for them (including
the primary -- don't use proc0's for its idle context).
- Use SysValue to store the cpu_info for each processor.
 1.35 17-Sep-1999  thorpej branches: 1.35.2; 1.35.8;
Centralize the declaration and clearing of `cold'.
 1.34 16-Aug-1999  thorpej Pull in <machine/alpha_cpu.h>.
 1.33 15-Aug-1999  thorpej Protect userland from the vast majority of this file.
 1.32 10-Aug-1999  thorpej Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.31 10-Aug-1999  thorpej Define cpu_number() as discussed on tech-smp.
 1.30 19-Nov-1998  ross Rip out 70 lines of (all of) the port-alpha-specific decls and prototypes.
They should not be visible to the MI kernel and the MI kernel shouldn't
depend on this junk. Most of it moves to new module <machine/alpha.h>.

Leave badaddr() here, though, because it's used so widely.
 1.29 11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.28 07-Oct-1998  thorpej Oops, back out a buglet I didn't intend to commit in the last change.
 1.27 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.26 29-Sep-1998  thorpej Prototype cpu_halt_secondary().
 1.25 24-Sep-1998  thorpej First-cut at code to spin up secondary processors on a multiprocessor
Alpha system, conditional on MULTIPROCESSOR.

NOTE: This does not yet work completely. The secondary CPU begins the
boot process, but never makes it into the cpu spinup trampoline. This
is merely a snapshot of a work-in-progress.
 1.24 13-Jul-1998  ross Kill the old extern mchkinfo pointer and prototype cpu_mchkinfo().
This file has been collecting prototypes and other things used in the MD
code...that's bad...because this is exported to the MI kernel.
 1.23 08-Jul-1998  mjacob stale beer- place structure in right file
 1.22 08-Jul-1998  mjacob Add machine check type definitions. Structure the expected/received
machine check items.
 1.21 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.20 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.19 12-Feb-1998  cgd clean up the way bootinfo information is passed and used: move the version
number passed by the boot block into a register, change the kernel's
bootinfo handing so that it always uses bootinfo to get bootinfo-ish values
(filling them in if the boot blocks didn't pass them), and make versioning
a small bit more sane.
 1.18 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.17 25-Jul-1997  thorpej branches: 1.17.2;
Update alpha_init() prototype; takes two more args.
 1.16 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.15 24-Jan-1997  cgd astpending and want_resched are kernel-only
 1.14 07-Dec-1996  cgd add a "machdep.booted_kernel" sysctl, which is the name of the booted
kernel as supplied by the SRM console's BOOTED_FILE variable.
 1.13 13-Nov-1996  cgd branches: 1.13.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.12 14-Jul-1996  cgd (1) Add unaligned access fixup code to fix unaligned quad, long,
and IEEE S and T floating datum loads and stores. VAX floating data
types not yet supported, and in the future will only be supported if
FIX_UNALIGNED_VAX_FP is defined. (No point in wasting the space when
most of the time there will never be VAX FP loads and stores.) Right
now, these features can be controlled only by sysctl. The (boolean)
integer sysctls machdep.unaligned_print, machdep.unaligned_fix, and
machdep.unaligned_sigbus control printing about unaligned accesses
(defaults on), fixing up of unaligned accesses (defaults on), and
forcing a SIGBUS on unaligned accesses (defaults off). If an access
is not fixed up (for lack of method or explicit decision), a SIGBUS is
always generated to keep programs from using bogus data. At some point,
these three choices should be controlled by per-process flags, as well.
 1.11 11-Jul-1996  cgd Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.10 11-Jul-1996  cgd update to use new definitions in alpha_cpu.h
 1.9 09-Jul-1996  cgd various cleanup, move setsoft* and spl* into intr.h.
 1.8 14-Jun-1996  cgd add a new machine-dependent sysctl, machdep.root_device, which is the
(string) name of the root device. It's a string so that it can
be used before dev_mkdb has been run.
 1.7 21-Dec-1995  mycroft branches: 1.7.4;
Remove deprecated cpu_setstack().
 1.6 28-Jun-1995  cgd remove unused cpu_exec() definitions. moved "broken swap" markers, for
ports that still need it, to types.h.
 1.5 28-Jun-1995  cgd update for various (old) NetBSD changes
 1.4 05-May-1995  cgd define BROKEN_SWAP and/or cpu_swapout as appropriate.
 1.3 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.2 24-Mar-1995  cgd remove support for double-mapping the user area/kernel stack
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.7.4.1 14-Jun-1996  cgd pull up from trunk:
>add a new machine-dependent sysctl, machdep.root_device, which is the
>(string) name of the root device. It's a string so that it can
>be used before dev_mkdb has been run.
 1.13.2.4 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.13.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.13.2.2 24-Jan-1997  cgd sync with trunk
 1.13.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.17.2.1 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.35.2.7 23-Apr-2001  bouyer Sync with HEAD.
 1.35.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.35.2.5 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.35.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.35.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.35.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.35.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.39.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.52.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.58.4.4 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

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

Problem noted by Gregory McGarry.
 1.58.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.58.4.1 30-May-2001  nathanw file cpu.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.60.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.60.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1 03-Aug-2004  skrll Sync with HEAD
 1.63.12.4 17-Mar-2008  yamt sync with head.
 1.63.12.3 03-Sep-2007  yamt sync with head.
 1.63.12.2 26-Feb-2007  yamt sync with head.
 1.63.12.1 21-Jun-2006  yamt sync with head.
 1.65.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.67.14.2 03-Oct-2007  garbled Sync with HEAD
 1.67.14.1 22-May-2007  matt Update to HEAD.
 1.67.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.67.8.1 11-Jul-2007  mjf Sync with head.
 1.67.6.2 20-Aug-2007  ad Sync with HEAD.
 1.67.6.1 27-May-2007  ad Sync with head.
 1.67.2.1 20-Mar-2007  yamt adapt alpha.
 1.70.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.70.2.1 07-Aug-2007  matt Sync with HEAD.
 1.71.6.2 23-Mar-2008  matt sync with HEAD
 1.71.6.1 06-Nov-2007  matt sync with HEAD
 1.72.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.72.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.72.12.1 24-Mar-2008  keiichi sync with head.
 1.73.4.1 16-May-2008  yamt sync with head.
 1.73.2.1 18-May-2008  yamt sync with head.
 1.74.22.1 05-Mar-2011  rmind sync with head
 1.75.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.75.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.76.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.77.6.1 18-Feb-2012  mrg merge to -current.
 1.77.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.77.2.1 17-Apr-2012  yamt sync with head
 1.78.10.1 18-May-2014  rmind sync with head
 1.78.6.2 03-Dec-2017  jdolecek update from HEAD
 1.78.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.82.6.1 05-Feb-2017  skrll Sync with HEAD
 1.83.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.83.16.1 10-Jun-2019  christos Sync with HEAD
 1.83.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.99.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.101.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.7 10-Oct-2020  thorpej Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 17-Oct-2007  garbled branches: 1.5.16; 1.5.18; 1.5.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.4 21-Jul-2007  tsutsui branches: 1.4.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.3 16-Feb-2006  perry branches: 1.3.24; 1.3.32; 1.3.36; 1.3.38;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.2 24-Dec-2005  perry branches: 1.2.2; 1.2.4; 1.2.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.1 05-Feb-2003  nakayama branches: 1.1.18;
Share alpha/microtime.c with i386 and sparc64 as kern_microtime.c.
(approved by martin)
 1.1.18.1 03-Sep-2007  yamt sync with head.
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 18-Feb-2006  yamt sync with head.
 1.3.38.1 15-Aug-2007  skrll Sync with HEAD.
 1.3.36.1 07-Aug-2007  matt Sync with HEAD.
 1.3.32.1 03-Oct-2007  garbled Sync with HEAD
 1.3.24.1 20-Aug-2007  ad Sync with HEAD.
 1.4.6.1 06-Nov-2007  matt sync with HEAD
 1.5.20.1 16-May-2008  yamt sync with head.
 1.5.18.1 18-May-2008  yamt sync with head.
 1.5.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.17 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.16 28-Sep-2020  thorpej Remove a no-longer-accurate comment.
 1.15 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.14 14-Jun-2011  matt branches: 1.14.2; 1.14.6;
struct device * -> device_t
 1.13 27-Jul-2001  thorpej branches: 1.13.2; 1.13.160;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.12 08-Jun-2000  thorpej branches: 1.12.6;
And more ANSI'ification!
 1.11 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.10 01-Jun-2000  thorpej Rearrange things a little so we can deal with systypes that aren't
densely packed.
 1.9 29-Mar-2000  simonb branches: 1.9.2;
Don't declare a variable in the 'struct platform' declaration - we declare
an extern for 'struct platform platform' further down this file anyway,
and this would have declared a 'platform' variable in any userland code
including this file.
 1.8 06-Jun-1998  thorpej branches: 1.8.14;
Clean up a little, and add a `powerdown' hook in the platform structure.
 1.7 06-Nov-1997  thorpej Clean up the messages displayed when either platform support is not
configured into the kernel, or when the platform is not supported.
Use the defopt'ed options, rather than NDEC_... and remove the needs-flag
hack that's existed for a while.
 1.6 23-Sep-1997  mjacob branches: 1.6.2;
Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.5 02-Sep-1997  thorpej branches: 1.5.2;
Oops, wrap cpu_decl()s inside #ifdef _KERNEL/#endif.
 1.4 02-Sep-1997  thorpej Clean this up a bit; defopt has rendered the #undef hacks unnecessary.
Also, put the cpu_decl()s in cpuconf.h, so that platform support files
can pull in the prototypes from there, and pull in options for those
systems for which there is code in the source tree.
 1.3 02-Sep-1997  thorpej Ressurect from the Attic.
 1.2 10-Apr-1997  cgd reorganize cpu configuration and device configuration tables. Now all macro
definitions and prototypes are in machine/conf.h, and all tables are in
alpha/conf.c.
 1.1 12-Nov-1996  cgd branches: 1.1.2;
convert cpu-dependent routine selection to use a centralized CPU switch, thus
deleting (and cleaning up) N pages of #ifdefs in machdep.c. While we're
at it, make the cpu type options generate flags, and check them instead of
kernel Makefile defines.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.2.1 02-Sep-1997  thorpej file cpuconf.h was added on branch marc-pcmcia on 1997-09-04 00:53:08 +0000
 1.6.2.1 06-Nov-1997  thorpej Pull up from trunk: clean up "not configured"/"not supported" messages.
 1.8.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.9.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.12.6.1 03-Aug-2001  lukem update to -current
 1.13.160.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.2.2 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.13.2.1 27-Jul-2001  thorpej file cpuconf.h was added on branch nathanw_sa on 2001-07-27 00:25:20 +0000
 1.14.6.1 18-Feb-2012  mrg merge to -current.
 1.14.2.1 17-Apr-2012  yamt sync with head
 1.6 15-Oct-2020  thorpej Expose a bunch of CPU details, including implementation version and
architecture extensions, via sysctl:

hw.cpu0.model = 21264A-0 (EV67)
hw.cpu0.major = 11
hw.cpu0.minor = 0
hw.cpu0.implver = 2
hw.cpu0.amask = 0x1307
hw.cpu0.bwx = 1
hw.cpu0.fix = 1
hw.cpu0.cix = 1
hw.cpu0.mvi = 1
hw.cpu0.pat = 1
hw.cpu0.pmi = 1
hw.cpu0.vax_fp = 1
hw.cpu0.ieee_fp = 1
hw.cpu0.primary_eligible = 1
hw.cpu0.primary = 1
hw.cpu0.cpu_id = 0
hw.cpu0.pcc_freq = 239990688

as well as some potentially interesting system-level variables:

machdep.cctr = 0
machdep.is_qemu = 1

Should address the basic concern in PR port-alpha/15835.
 1.5 14-Jun-2011  matt Major cleanup of alpha device drivers.
Switch to CFATTACH_DECL_NEW.
struct device * -> device_t
struct cfdata * -> cfdata_t
Use of device_xname. No direct access to struct device members.
Use aprint* (not complete).
 1.4 28-Apr-2008  martin branches: 1.4.32;
Remove clause 3 and 4 from TNF licenses
 1.3 23-Jun-2003  martin branches: 1.3.104; 1.3.106; 1.3.108;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.2 18-Nov-2000  thorpej branches: 1.2.2;
Count individual interprocessor interrupts -- it's good to know where
they all come from.
 1.1 05-Jun-2000  thorpej branches: 1.1.4;
Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 05-Jun-2000  minoura file cpuvar.h was added on branch minoura-xpg4dl on 2000-06-22 16:58:27 +0000
 1.2.2.3 22-Nov-2000  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 18-Nov-2000  bouyer file cpuvar.h was added on branch thorpej_scsipi on 2000-11-20 22:35:40 +0000
 1.3.108.1 16-May-2008  yamt sync with head.
 1.3.106.1 18-May-2008  yamt sync with head.
 1.3.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.23 22-Nov-2023  thorpej Changes to let the Alpha DDB code build in user-space for crash(8).
 1.22 21-Nov-2023  thorpej Adjust proc/lwp access for user-space (crash(8)).
 1.21 21-Nov-2023  thorpej Refactor the special symbol handling out of db_trace.c into
db_interface.c, and abstract it away from having to read kernel
symbols directly.
 1.20 21-Nov-2023  riastradh ddb: New db_stack_trace_print_ra.

Takes an optional extra argument for the return address so that the
stack parser has a chance to use instruction-dependent interpretation
of the frame to find parent frames.

Implemented only on Alpha for now, which needs it. Other
architectures just ignore the extra argument.

PR port-alpha/57716

XXX pullup-10
XXX pullup-9
XXX pullup-8
 1.19 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.18 26-May-2011  joerg branches: 1.18.14;
Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.17 21-Feb-2007  thorpej branches: 1.17.68; 1.17.74;
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.16 17-May-2006  drochner branches: 1.16.14;
remove a typecast in a macro which is used on the LHS. gcc4 doesn't like it
 1.15 01-Apr-2006  cherry closes: PR kern/32359

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

Patch from cherry@mahiti.org
 1.14 29-Apr-2003  scw branches: 1.14.18; 1.14.32; 1.14.34; 1.14.36; 1.14.38; 1.14.40;
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.13 19-Apr-2001  thorpej branches: 1.13.4;
Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.12 22-Nov-2000  thorpej branches: 1.12.2;
Just access the trapframe directly for DDB registers.
 1.11 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.10 08-Jun-2000  thorpej ANSI'ify.
 1.9 20-Apr-1999  thorpej branches: 1.9.2; 1.9.10;
After reviewing the Green Book, BPT traps do indeed leave the PC pointing
to the instruction _after_ the `call_pal bpt' instruction.
 1.8 20-Apr-1999  thorpej Prototype alpha_debug(), and add some definitions for KGDB.
 1.7 14-Aug-1998  thorpej branches: 1.7.8;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.6 06-Sep-1997  thorpej Prototype db_register_value().
 1.5 25-Jul-1997  thorpej branches: 1.5.2;
More DDB support:
- Add support for software single-stepping (Alpha does not have hardware
support for single-stepping)
- Alpha uses Elf64 symbols.
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 06-Feb-1997  gwr FIXUP_PC_AFTER_BREAK now takes an arg of type db_regs_t *
 1.2 11-Jul-1996  cgd branches: 1.2.2;
Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.9.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.12.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.4.2 19-Apr-2001  thorpej Glue in KGDB. Needs some more work -- KGDB currently renders
DDB disabled, but it's a start.
 1.13.4.1 19-Apr-2001  thorpej file db_machdep.h was added on branch nathanw_sa on 2001-04-19 17:48:48 +0000
 1.14.40.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.14.38.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.14.36.2 24-May-2006  yamt sync with head.
 1.14.36.1 11-Apr-2006  yamt sync with head
 1.14.34.2 01-Jun-2006  kardel Sync with head.
 1.14.34.1 22-Apr-2006  simonb Sync with head.
 1.14.32.1 09-Sep-2006  rpaulo sync with head
 1.14.18.2 26-Feb-2007  yamt sync with head.
 1.14.18.1 21-Jun-2006  yamt sync with head.
 1.16.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.17.74.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.68.1 31-May-2011  rmind sync with head
 1.18.14.1 03-Dec-2017  jdolecek update from HEAD
 1.11 30-Aug-2011  bouyer Add getlabelusesmbr(), as proposed in
http://mail-index.netbsd.org/tech-userlevel/2011/08/25/msg005404.html
This is used by disk tools such as disklabel(8) to dynamically decide is
the undelyling platform uses a disklabel-in-mbr-partition or not
(instead of using a compile-time list of ports).
getlabelusesmbr() reads the sysctl kern.labelusesmbr, takes its value from the
machdep #define LABELUSESMBR.
For evbmips, make LABELUSESMBR 1 if the platform uses pmon
as bootloader, and 0 (the previous value) otherwise.
 1.10 23-Nov-2009  pooka If cpu_disklabel includes struct dkbad, define __HAVE_DISKLABEL_DKBAD.
This allows use of subr_disk_mbr on all archs. Default to it for
the rump disk component. No functional change for regular kernels.
(The other option would've been to include dkbad in disklabels
everywhere, but arguably this approach has less possible side-effects,
especially given that wedges and related magic will take over the
world any second now).
 1.9 11-Dec-2005  christos branches: 1.9.78;
merge ktrace-lwp.
 1.8 12-Jun-2005  dyoung Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/. That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such. I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
 1.7 03-Apr-2002  lukem branches: 1.7.10;
remove boot_block stuff from include/disklabel.h, and migrate to
alpha_boot_block stuff in dev/dec/dec_boot.h
 1.6 13-Mar-2000  soren branches: 1.6.6; 1.6.8;
Fix doubled 'the's in comments.
 1.5 05-Apr-1999  cgd branches: 1.5.2; 1.5.8;
clean up slightly, do a little #define trick to make checksumming
the boot block a little easier/more 'clean', and provide a macro to
checksum the boot block.
 1.4 02-Apr-1999  cgd define 'struct boot_block' which is the alpha (SRM) boot block
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 03-Feb-1997  cgd add bad sector information to cpu disklabel
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.2 05-Apr-1999  cgd clean up slightly, do a little #define trick to make checksumming
the boot block a little easier/more 'clean', and provide a macro to
checksum the boot block.
 1.5.2.1 05-Apr-1999  cgd file disklabel.h was added on branch netbsd-1-4 on 1999-04-05 02:45:48 +0000
 1.6.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.6.1 17-Apr-2002  nathanw Catch up to -current.
 1.7.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.78.1 11-Mar-2010  yamt sync with head
 1.4 26-Sep-1996  cgd rename <machine/ecoff.h> to <machine/ecoff_machdep.h> for clarity and
consistency with the way machdep headers for other things are done.
(the creation of the ecoff_machdep.h files was done on the CVS server, to
keep the RCS logs intact.)
 1.3 09-May-1996  cgd change structure member names to be in line with what various ECOFF
documentation I have calls them, and update for new definitions in
sys/exec_ecoff.h. Also, fix ECOFF_SEGMENT_ALIGNMENT macro so that it
actually returns the right alignment.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5 27-Apr-1999  cgd Alpha ECOFF object type definitions
 1.4 06-Apr-1997  cgd branches: 1.4.16; 1.4.18; 1.4.20;
clean up NetBSD RCS ID strings
 1.3 09-May-1996  cgd branches: 1.3.2;
change structure member names to be in line with what various ECOFF
documentation I have calls them, and update for new definitions in
sys/exec_ecoff.h. Also, fix ECOFF_SEGMENT_ALIGNMENT macro so that it
actually returns the right alignment.
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.20.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.4.18.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.16.1 21-Jun-1999  cgd pull up rev(s) 1.5 from trunk. (cgd)
 1.13 25-Sep-2021  thorpej Make all of the EISA chipset functions call through real functions,
rather the macros.
 1.12 29-Mar-2014  christos make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.11 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.10 14-Jun-2011  matt branches: 1.10.2; 1.10.12; 1.10.16;
struct device * -> device_t
 1.9 17-Oct-2007  garbled branches: 1.9.52;
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.8 22-Jul-2007  tsutsui branches: 1.8.6;
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
 1.7 11-Aug-2000  thorpej branches: 1.7.40; 1.7.76; 1.7.82; 1.7.90; 1.7.92; 1.7.94; 1.7.96;
Add functions to read EISA configuration data for MEM, IRQ, DMA, and IO.

XXX Just error stubs on the i386 right now -- someone needs to write
XXX EISA BIOS code for i386.
 1.6 29-Jul-2000  thorpej Add code to read the EISA configuration NVRAM as set up by
an EISA Configuration Utility. Code to access this data
is forthcoming.

XXX This could probably be made MI at some point.
 1.5 04-Jun-2000  cgd branches: 1.5.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.4 01-Jun-2000  cgd kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.3 19-Mar-1999  cgd branches: 1.3.8; 1.3.16;
move eisa/eisa_machdep.h to include/eisa_machdep.h. (can't do it via
repository copy because alpha already had an include/eisa_machdep.h in
the attic.)
 1.2 12-Apr-1996  cgd these have moved elsewhere
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 11-Aug-2000  thorpej Pullup from trunk:
Add EISA configuration readining infrastructure.
 1.7.96.1 15-Aug-2007  skrll Sync with HEAD.
 1.7.94.1 07-Aug-2007  matt Sync with HEAD.
 1.7.92.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.7.90.1 03-Oct-2007  garbled Sync with HEAD
 1.7.82.1 20-Aug-2007  ad Sync with HEAD.
 1.7.76.1 21-Aug-2007  liamjfoy Pull up following revision(s) (requested by tsutsui in ticket #815):
sys/arch/alpha/pci/sio.c: revision 1.41
sys/arch/alpha/eisa/eisa_machdep.c: revision 1.6
sys/arch/alpha/jensenio/jensenio.c: revision 1.14
sys/arch/alpha/jensenio/jensenio_intr.c: revision 1.6
sys/arch/alpha/include/eisa_machdep.h: revision 1.8
sys/arch/alpha/alpha/dec_2000_300.c: revision 1.14
sys/arch/alpha/jensenio/lpt_jensenio.c: revision 1.6
Avoid NULL pointer dereference in MD device_register() function.
Fixes a part of PR port-alpha/36628.
Backout changes on lpt_jensenio.c rev 1.2.
lpt at jensenio doesn't seem to have a specific interrupt vector
but uses a normal EISA interrupt.
Fixes another part of PR port-alpha/36628 and PR port-alpha/20386.
More fixes for Jensen, reported and tested by Christoph Franzen
in PR port-alpha/36628:
- make jensenio_eisa_maxslots() return 8 (instead of 16) since
EISA config for slot 8-15 on jensen could return invalid values
- pass eisa_chipset_tag_t to eisa_init() and check eisa_maxslots()
on probing EISA config space
- pass M_ZERO to malloc(9) and make sure malloc(9) doesn't fail
- fix typo in a debug printf, add more debug printfs, and
use #ifdef EISA_DEBUG to enable them
- cast uint8_t value to uint32_t before shift more than 8 bits
- check buffer region on reading compressed data from EISA config space
Check a correct value on a sanity check in jensenio_eisa_intr_map().
Fixes yet another bug on Jensen found on tracking PR port-alpha/36628.
 1.7.40.1 03-Sep-2007  yamt sync with head.
 1.8.6.1 06-Nov-2007  matt sync with HEAD
 1.9.52.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.10.16.1 18-May-2014  rmind sync with head
 1.10.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.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.16 18-Apr-2025  riastradh ld.elf_so on alpha: Add support for secureplt.

ok thorpej

PR port-alpha/57511: ld.elf_so(1) does not support secure PLT for alpha
PR port-alpha/57717: Alpha linker generates LOAD segments (and
generates warnings about them)
 1.15 10-Oct-2020  thorpej branches: 1.15.26;
Rename:
- EM_ALPHA (41) -> EM_OLD_ALPHA
- EM_ALPHA_EXP (36902) -> EM_ALPHA

36902 has been the value in common usage for a long time, and this naming
aligns with binutils, etc.

PR port-alpha/51926
 1.14 08-Apr-2019  thorpej Add the R_ALPHA_BRSGP relocation type.
 1.13 06-Nov-2017  christos branches: 1.13.4;
Cleanup and clarify the ELFSIZE mess:

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

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

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

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.
 1.12 30-Sep-2010  skrll branches: 1.12.18;
Introduce a new type Elf_Symindx for use in decoding the symbol hash table
section and allow this type to be overridden.

The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.

Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.

Fixes ld.elf_so after Herculean effort from me and martin.
 1.11 30-May-2009  skrll branches: 1.11.2; 1.11.4;
Add TLS relocation definitions.
 1.10 09-Dec-2001  thorpej branches: 1.10.122;
Add support for dumping ELF-cormat core files.
 1.9 01-Nov-2001  drochner protect against multiple inclusion
 1.8 31-Oct-2001  thorpej Rather than using a NetBSD-specific header file <machine/int_types.h>
and non-standard inttype-like types, pull in <sys/types.h> if
_KERNEL or _STANDALONE and <inttypes.h> otherwise, and use standard
inttype types.

Discussed with and OK'd by Christos.
 1.7 31-Oct-2001  thorpej Use <machine/elf_machdep.h> to override Elf64_Word and Elf64_Sword
on the Alpha (which uses a non-standard definitions for historical
reasons), rather than #ifdef __alpha__ (which is not cross-tool safe).
 1.6 02-Apr-2000  minoura branches: 1.6.6; 1.6.8; 1.6.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.5 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.4 03-Oct-1998  christos branches: 1.4.12; 1.4.14; 1.4.16;
Add em_alpha_exp
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 14-Dec-1996  cgd add endianness constants, relocation types
 1.1 26-Sep-1996  cgd branches: 1.1.2;
add and use a machine-dependent header, which currently defines some
macros to use to remove #ifdefs from the machine ID case check.
Eventually, these headers will contain other information, e.g.
machine-dependent relocation information, etc.
 1.1.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.1 24-Jan-1997  cgd sync with trunk
 1.4.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.14.1 14-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.6.12.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.6.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.10.122.2 09-Oct-2010  yamt sync with head
 1.10.122.1 20-Jun-2009  yamt sync with head
 1.11.4.1 05-Mar-2011  rmind sync with head
 1.11.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.12.18.1 03-Dec-2017  jdolecek update from HEAD
 1.13.4.1 10-Jun-2019  christos Sync with HEAD
 1.15.26.1 02-Aug-2025  perseant Sync with HEAD
 1.11 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.10 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.9 21-Aug-1999  simonb branches: 1.9.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.8 24-Jan-1999  mycroft Mark [hn]to[nh][ls]() with __const__, so they are subject to CSE.
 1.7 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.6 31-Jul-1998  mycroft (Always) (practice) (safe) (macro expansion).
 1.5 09-Oct-1997  bouyer branches: 1.5.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.4 06-Apr-1997  cgd branches: 1.4.4;
clean up NetBSD RCS ID strings
 1.3 13-Oct-1996  cgd branches: 1.3.2;
typedef, not typeded
 1.2 13-Oct-1996  christos in_addr_t and in_port_t changes
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.4.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.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 22:35:40 +0000
 1.2 08-Oct-1996  cgd moved to aout_machdep.h (via repository copy)
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5 19-Sep-2001  thorpej Remove alpha/include/fbio.h -- it hasn't been used for a Long Time.
 1.4 06-Apr-1997  cgd branches: 1.4.34; 1.4.36; 1.4.38;
clean up NetBSD RCS ID strings
 1.3 23-Aug-1996  cgd branches: 1.3.2;
define a new frame buffer type code for the TGA2
 1.2 01-May-1996  cgd add an entry for the SFB+, and clean up entries some
 1.1 12-Apr-1996  cgd keyboard and frame buffer interface include files, grabbed from the
sparc with minimal modifications, to make X go. Should really be
trimmed down to include only the relevant information.
 1.3.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.4.38.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.36.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.34.1 21-Sep-2001  nathanw Catch up to -current.
 1.4 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

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

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.3 27-Oct-2019  christos branches: 1.3.32;
elide gcc-8 shadow warnings.
 1.2 24-Aug-2016  christos branches: 1.2.2; 1.2.4; 1.2.18; 1.2.22;
restore the constants to the old values to match what the kernel expects
internally.
 1.1 23-Aug-2016  christos fenv.h for alpha
 1.2.22.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.18.2 03-Dec-2017  jdolecek update from HEAD
 1.2.18.1 24-Aug-2016  jdolecek file fenv.h was added on branch tls-maxphys on 2017-12-03 11:35:46 +0000
 1.2.4.2 05-Oct-2016  skrll Sync with HEAD
 1.2.4.1 24-Aug-2016  skrll file fenv.h was added on branch nick-nhusb on 2016-10-05 20:55:23 +0000
 1.2.2.2 14-Sep-2016  pgoyette Sync with HEAD
 1.2.2.1 24-Aug-2016  pgoyette file fenv.h was added on branch pgoyette-localcount on 2016-09-14 03:04:16 +0000
 1.3.32.1 02-Aug-2025  perseant Sync with HEAD
 1.11 12-May-2003  kleink Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.10 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.9 08-Jun-2000  thorpej And more ANSI'ification!
 1.8 18-Feb-1998  mycroft branches: 1.8.14; 1.8.22;
Minor changes to make all the float.h files match.
 1.7 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.6 17-Jul-1997  thorpej branches: 1.6.6;
Turn the extern declaration of __flt_rounds() into a proper prototype.
 1.5 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4 20-Jun-1995  jtc branches: 1.4.4;
Wrap with #ifndef _XXX_FLOAT_H_/#define _XXX_FLOAT_H_/ ... /#endif.
 1.3 20-Jun-1995  jtc #include <sys/cdefs.h>.
Wrap __flt_rounds() declaration with __BEGIN_DECLS/__END_DECLS.
 1.2 29-Apr-1995  cgd make FLT_ROUNDS call __flt_rounds, so dynamic rounding mode is grabbed.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.4.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.6.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.8.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.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.9 24-Feb-2025  andvar s/architecure/architecture/ and few other typos in comments.
 1.8 22-Jul-2021  thorpej branches: 1.8.16;
Various minor cleanups and bug fixes to the FP software completion code:
- Use __CTASSERT() instead of rolling our own compile-time assertion
using cpp.
- Use __BIT() &c instead of rolling our own.
- Improve some comments.
- Define a default FP_C and FPCR value that is self-consistent, and
initialize it properly at process creation time.
- Fix signal information when the trap shadow cannot be resolved.
- Use defined constants rather than magic numbers for the exception
summary bits.
- Add a machdep sysctl to enable FP software-completion debugging.
 1.7 17-Oct-2017  maya branches: 1.7.20;
Explain our implementation choice for implementation-defined values
 1.6 10-May-2008  martin branches: 1.6.42;
Backout previous: the license sweep touched these files in error, so
restore the old license.
 1.5 28-Apr-2008  martin branches: 1.5.2;
Remove clause 3 and 4 from TNF licenses
 1.4 26-Apr-2001  ross branches: 1.4.2; 1.4.6;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.3 25-Apr-1999  ross Never used, and work-in-progress uses a different header.
 1.2 18-Jan-1999  ross branches: 1.2.2;
NetBSD RCS id.
 1.1 18-Jan-1999  ross branches: 1.1.1;
Initial revision
 1.1.1.1 18-Jan-1999  ross FreeBSD's fpu.h.
 1.2.2.1 26-Apr-1999  perry removed at ross's request
 1.4.6.2 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.4.6.1 26-Apr-2001  ross file fpu.h was added on branch nathanw_sa on 2001-04-26 03:10:47 +0000
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.42.1 03-Dec-2017  jdolecek update from HEAD
 1.7.20.1 01-Aug-2021  thorpej Sync with HEAD.
 1.8.16.1 02-Aug-2025  perseant Sync with HEAD
 1.11 25-Apr-2025  riastradh alpha: Align signal pointer on entry to signal handler.

PR kern/59327: user stack pointer is not aligned properly
 1.10 25-Mar-2019  maxv branches: 1.10.36;
Remove compat_osf1, discussed on tech-kern@.
 1.9 06-Feb-2012  matt branches: 1.9.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.8 24-Apr-2008  he branches: 1.8.36; 1.8.40;
This file needs <sys/signal.h> included, so that siginfo_t and
ucontext_t are properly defined before they're used.
 1.7 11-Dec-2005  christos branches: 1.7.74; 1.7.76;
merge ktrace-lwp.
 1.6 20-Jan-2005  drochner expose struct sigcontext* just as much as necessary
 1.5 07-Oct-2003  skd branches: 1.5.8;
Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.4 06-Apr-1997  cgd branches: 1.4.56;
clean up NetBSD RCS ID strings
 1.3 11-Jul-1996  cgd branches: 1.3.2;
Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers,
treat it like one big array of registers, for easier and prettier
access. Update everything to deal with that.
 1.2 11-Jul-1996  cgd update to use new definitions in alpha_cpu.h
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.56.4 24-Jan-2005  skrll Sync with HEAD.
 1.4.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.56.1 03-Aug-2004  skrll Sync with HEAD
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.7.76.1 18-May-2008  yamt sync with head.
 1.7.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.40.1 18-Feb-2012  mrg merge to -current.
 1.8.36.1 17-Apr-2012  yamt sync with head
 1.9.48.1 10-Jun-2019  christos Sync with HEAD
 1.10.36.1 02-Aug-2025  perseant Sync with HEAD
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 15-Apr-2005  kleink Push back the descriptions of NaN formats, and descriptions of the
distinction between signalling NaNs and quiet NaNs back into the
machine-dependent headers; treat the implementation of __nanf in the
same spirit.

IEEE 754 leaves the distinction between signalling NaNs and quiet NANs
to the implementation, and unlike our headers used to suggest they're
not identical in the interpretation of the fraction's MSb; in due
course, make those of hppa, mips, sh3, and sh5 reflect reality.
 1.4 26-Oct-2003  kleink branches: 1.4.8; 1.4.14;
Use <sys/ieee754.h> where applicable.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.56.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.14.1 19-Apr-2005  tron Pull up revision 1.5 (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.4.8.1 29-Apr-2005  kent sync with -current
 1.10 25-Aug-2016  christos match the name with the FE_ constant from fenv.h
 1.9 23-Aug-2016  christos fenv.h for alpha
 1.8 06-Feb-2012  matt branches: 1.8.6; 1.8.24;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 06-Aug-2008  matt branches: 1.7.28; 1.7.32;
Fix typo FP_ -> FE_
 1.6 05-Aug-2008  matt 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 17-Jan-2003  thorpej branches: 1.5.104; 1.5.108; 1.5.110; 1.5.114;
Merge the nathanw_sa branch.
 1.4 26-Apr-2001  ross branches: 1.4.4;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.3 29-Apr-1999  ross branches: 1.3.14;
#ifdef _KERNEL, define the machine FPCR bits and a rounding mode macro
 1.2 06-Apr-1997  cgd branches: 1.2.16;
clean up NetBSD RCS ID strings
 1.1 29-Apr-1995  cgd branches: 1.1.4;
first cut of the alpha version.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.16.1 29-Apr-1999  perry branches: 1.2.16.1.2;
pullup 1.2->1.3 (ross)
 1.2.16.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.14.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.4.4.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.4.4.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.4.4.1 26-Apr-2001  nathanw file ieeefp.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.5.114.1 19-Oct-2008  haad Sync with HEAD.
 1.5.110.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.108.1 04-May-2009  yamt sync with head.
 1.5.104.1 28-Sep-2008  mjf Sync with HEAD.
 1.7.32.1 18-Feb-2012  mrg merge to -current.
 1.7.28.1 17-Apr-2012  yamt sync with head
 1.8.24.1 05-Oct-2016  skrll Sync with HEAD
 1.8.6.1 03-Dec-2017  jdolecek update from 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.8; 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.8.2 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
 1.1.8.1 14-Apr-2001  kleink file int_const.h was added on branch nathanw_sa on 2001-04-14 22:38:34 +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:04 +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.5 13-Aug-2014  matt include <sys/common_int_fmtio.h> if __INTPTR_FMTd__ is defined
 1.4 28-Apr-2008  martin branches: 1.4.44;
Remove clause 3 and 4 from TNF licenses
 1.3 19-Sep-2001  simonb branches: 1.3.120; 1.3.122; 1.3.124;
Fix typo in PRId64.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
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:04 +0000
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 26-Apr-2001  nathanw file int_fmtio.h was added on branch nathanw_sa on 2001-09-21 22:34:57 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.124.1 16-May-2008  yamt sync with head.
 1.3.122.1 18-May-2008  yamt sync with head.
 1.3.120.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.9 13-Aug-2014  matt Include <sys/common_init_limits.h> if __SIG_ATOMIC_MAX__ is defined.
 1.8 06-Feb-2012  matt branches: 1.8.6;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 28-Apr-2008  martin branches: 1.7.34; 1.7.38;
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.6; 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:05 +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.6.2 26-Apr-2001  kleink Add definitions for C99 fastest minimum-width integer types.
 1.2.6.1 26-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-26 16:25:20 +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.38.1 18-Feb-2012  mrg merge to -current.
 1.7.34.1 17-Apr-2012  yamt sync with head
 1.8.6.1 03-Dec-2017  jdolecek update from HEAD
 1.6 13-Aug-2014  matt include <sys/common_int_mwgwtypes.h> if __UINT_FAST64_TYPE__ is defined.
 1.5 28-Apr-2008  martin branches: 1.5.44;
Remove clause 3 and 4 from TNF licenses
 1.4 24-Dec-2005  perry branches: 1.4.74; 1.4.76; 1.4.78;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 22-Sep-2001  simonb branches: 1.3.34;
*int_fast64_t should be "long", not "long long".
From Klaus Klein.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
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:05 +0000
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.6.1 26-Apr-2001  nathanw file int_mwgwtypes.h was added on branch nathanw_sa on 2001-09-26 19:54:41 +0000
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.34.1 21-Jun-2006  yamt 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.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 25-May-2005  kleink branches: 1.7.2;
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.6 07-Aug-2003  agc branches: 1.6.6; 1.6.14;
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.4; 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 22:35:41 +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.4.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.4.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.14.1 28-May-2005  tron Pull up revision 1.7 (requested by klein in ticket #346):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.6.6.1 29-May-2005  riz Pull up revision 1.7 (requested by kleink in ticket #1555):
Include <sys/cdefs.h> for __signed; related to lib/30072.
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.9.122.1 03-Dec-2017  jdolecek update from HEAD
 1.85 16-Jul-2021  thorpej The Alpha AXP Architecture Reference Manual is explcit that the only
valid bits in the PSL are the IPL and USER bits, the latter of which
will always be clear when in the kernel, and that all other bits MBZ.
So, when reading the PSL to get the current IPL, don't bother masking
with ALPHA_PSL_IPL_MASK.
 1.84 04-Jul-2021  thorpej Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.83 10-Oct-2020  thorpej branches: 1.83.6;
Fix cycle counter-based time keeping on Alpha in MP environments by using
a simpler calibration algorithm for the CC timecounter. Proposed in 2018
by Naruaki Etomi:

https://mail-index.netbsd.org/tech-kern/2018/01/14/msg022940.html

This patch is largely based on the proposed change, but avoids changing
any other timecounter logic, and re-factors things a bit to keep them
as MI as possible.
 1.82 26-Sep-2020  thorpej Implement cpu_intr_redistribute() for Tusnami/Titan systems.
 1.81 25-Sep-2020  thorpej Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.80 23-Sep-2020  thorpej Use a wrapper to acquire the kernel lock for non-MPSAFE interrupts,
rather than doing it in alpha_shared_intr_establish() directly.
 1.79 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.78 19-Sep-2020  thorpej Move softintr bits into <machine/intr.h> and define ALPHA_ALL_SOFTINTS
for locore.s
 1.77 17-Sep-2020  thorpej Reduce the __HAVE_FAST_SOFTINTS #ifdef perimeter.
 1.76 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.75 05-Sep-2020  thorpej Track the SSIR per-cpu, rather than globally.
 1.74 05-Sep-2020  thorpej - Document all of the various interrupt levels in the Processor Stataus
register, and provide symbolic names for them as well.
- Use ALPHA_PSL_IPL_* values directly for IPL_*.
 1.73 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.72 14-Jan-2017  christos fix types.
 1.71 19-May-2014  rmind branches: 1.71.4; 1.71.8;
Implement MI IPI interface with cross-call support.
 1.70 06-Feb-2012  matt branches: 1.70.6; 1.70.20;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.69 07-Jun-2011  matt branches: 1.69.2; 1.69.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.68 22-Jun-2010  rmind branches: 1.68.6;
Implement high priority (XC_HIGHPRI) xcall(9) mechanism - a facility
to execute functions from software interrupt context, at SOFTINT_CLOCK.
Functions must be lightweight. Will be used for passive serialization.

OK ad@.
 1.67 26-Oct-2009  thorpej branches: 1.67.2; 1.67.4;
Garbage-collect pmap_do_reactivate() and the associated IPI -- nothing has
used them for a long time.
 1.66 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.65 24-Apr-2008  he branches: 1.65.2;
This file needs <machine/cpu.h> included, for the ALPHA_PSL_IPL_*
constants it uses.
 1.64 10-Mar-2008  ad branches: 1.64.2;
Finish moving alpha over to the MI atomic ops.
 1.63 04-Jan-2008  ad branches: 1.63.2; 1.63.6;
More header file cleanup.
 1.62 03-Dec-2007  ad branches: 1.62.6;
Interrupt handling changes, in discussion since February:

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

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.60 18-May-2007  mhitch branches: 1.60.8; 1.60.10;
Fix alpha build after idlelwp merge. I don't know why machine/cpu.h was
added here, but it does not seem to be needed now, and was resulting in a
circular dependency when sys/sched.h was changed in the yamt-idlelpw branch.
 1.59 16-Feb-2007  ad branches: 1.59.6; 1.59.8; 1.59.12; 1.59.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.58 09-Feb-2007  ad Merge newlock2 to head.
 1.57 12-Jan-2007  ad Define ipl_cookie_t._psl as uint8_t so that it can be packed into a
word with other seldomly written fields.
 1.56 21-Dec-2006  yamt merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.
 1.55 16-Feb-2006  perry branches: 1.55.14; 1.55.16;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.54 24-Dec-2005  perry branches: 1.54.2; 1.54.4; 1.54.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.53 11-Dec-2005  christos merge ktrace-lwp.
 1.52 03-Nov-2005  yamt - use sys/spl.h.
- add some IPL_ definitions.
 1.51 29-Oct-2005  yamt pull splraiseipl() from newlock branch.
 1.50 29-Mar-2005  thorpej branches: 1.50.2; 1.50.4;
- Add a alpha_shared_intr_reset_strays() function that resets the stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the interrupt
vector. Idea taken from pci_kn300.c (which was changed to use the new
alpha_shared_intr_reset_strays() function).
 1.49 27-Jul-2001  thorpej branches: 1.49.2; 1.49.10; 1.49.22; 1.49.28; 1.49.30; 1.49.36;
Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.48 15-Jul-2001  thorpej - Tweak the pmap locking protocol slightly -- require that a pmap must
be locked before it can be marked as `active' on a processor.
- Require that pmaps other than the kernel pmap be locked when they
are passed to pmap_tlb_shootdown(). This, combined with the locking
protocol tweak, allow us to get a consistent view of `activeness' of
a pmap, which means we can optmize away a lot of TLB shootdown traffic
for user pmaps.
- Borrow an idea from the i386mp branch; use the normal SHOOTDOWN IPI
to deal with hitting the entire TLB, and garbage-collect the TBIA
and TBIAP IPIs.
 1.47 28-Apr-2001  thorpej branches: 1.47.2;
Add a microtime() implementation that interpolates between ticks
using the cycle counter. MP-safeness is achieved by giving each
CPU its own PCC frequency variables, and kicking the non-primary
processors via an IPI once per second.

Based on the sample code from David Mills' "A Kernel Model for
Precision Timekeeping".
 1.46 20-Apr-2001  thorpej Add splipi() to block interprocessor interrupts (which come in at IPL 5).
 1.45 20-Apr-2001  thorpej pmap_asn_alloc(): In a multiprocessor configuration, it's possible
to arrive here referencing the kernel_lev1map without having the
RESERVED ASN -- another CPU may have caused pmap_lev1map_destroy()
to be called, and that routine only invalidates the ASN for the
CPU that called it. So, in the MULTIPROCESSOR case, simply assign
the RESERVED ASN if we reference the kernel_lev1map rather than
asserting that we already have the RESERVED ASN. Thanks to Bill
Sommerfeld for helping me track down the problem.

Also add a new IPI that causes a CPU to re-activate its address
space if the pmap it's using changes level 1 maps (this probably
won't happen very often, but it's correct to have it).

This makes Alpha MP kernels boot multiuser. In fact, this commit
is being made from my dual-CPU AlphaServer 1200 running an MP kernel.
 1.44 15-Apr-2001  thorpej In splx(), don't call spl0() unless the ssir != 0.
 1.43 15-Apr-2001  thorpej Clean up soft interrupt related stuff a bit.
 1.42 14-Apr-2001  thorpej Change the softintr implementation to be a bit more cache friendly
(though, sigh, slightly more expensive at softintr_schedule() time).
 1.41 13-Apr-2001  thorpej Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.40 15-Jan-2001  thorpej branches: 1.40.2;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.39 14-Jan-2001  thorpej Rename __GENERIC_SOFT_INTERRUPTS to __HAVE_GENERIC_SOFT_INTERRUPTS,
and place the definition in <machine/types.h>. This can now be used
as a flag to indicate whether or not <machine/intr.h> can be included
to get the generic soft interrupt API.
 1.38 14-Jan-2001  thorpej Make sure everybody has an splvm() and equate it with splimp() (splimp()
is the historical name for this interrupt level, and the historical name
is going to go away in the near future).
 1.37 22-Nov-2000  thorpej Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.36 20-Nov-2000  thorpej Move IPI processing into a separate function.
 1.35 18-Nov-2000  thorpej Count individual interprocessor interrupts -- it's good to know where
they all come from.
 1.34 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.33 21-Aug-2000  thorpej Add experimental code for pausing other CPUs upon a CPU's
entry into the debugger. While I'm here, add splsched()
as per spl(9).
 1.32 15-Aug-2000  thorpej Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.31 13-Aug-2000  thorpej Add alpha_multicast_ipi().
 1.30 13-Jul-2000  thorpej Whitespace police.
 1.29 09-Jun-2000  cgd make spl0() and spllowersoftclock() return void. Also, move spl0()
prototype from param.h to intr.h. (there were some big XXXs in param.h
that said to do that, and intr.h is included by param.h, so...)
 1.28 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.27 04-Jun-2000  thorpej Un-__P'ify kernel prototypes.
 1.26 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.25 23-May-2000  thorpej branches: 1.25.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.24 19-Mar-2000  thorpej Point back to the alpha_shared_intr in the intrhand structure. This
allows platform-specific code to access the `intr_private' data via
the intrhand structure.
 1.23 02-Dec-1999  thorpej Move atomic operations into <machine/atomic.h>, and make them in-line
assembly, rather than function calls.

...except alpha_atomic_testset_l(), which will go away completely once
I commit the new <machine/lock.h>.
 1.22 29-Nov-1999  thorpej - Fix a botch in the IPI bitmasks (they were right-shifted by 1), and
add an IPI which causes the target CPU to perform AST processing when
it returns to userspace.
- Add a way to get/set a private pointer in the shared interrupt header.
 1.21 10-Aug-1999  thorpej branches: 1.21.2; 1.21.8;
Use atomic operations to manipulate the SSIR, and fix a problem introduced
with the spllowersoftclock() changes where more interrupts than necessary
were blocked while software interrupts were being processed.
 1.20 05-Aug-1999  thorpej Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

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

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.19 24-Feb-1999  thorpej Restructure the IPI code a little, allowing multiple IPIs to be sent at
once. Add a way to broadcast an IPI to all processors (except the sender,
obviously). Add an IPI for TLB shootdown.
 1.18 26-Sep-1998  thorpej Add basic interprocessor interrupt sending and receiving code. Current
IPI functions: HALT, IMB, TBIA, TBIAP.

XXX HALT is not yet implemented, it's just a stub.
 1.17 25-Sep-1998  thorpej Minor style tweaks.
 1.16 21-Sep-1998  matt Add softserial to the alpha port. This significantly improved PPP
throughput on com ports.
 1.15 01-Aug-1998  thorpej Implement alpha_shared_intr_disestablish(). Simply removes the handler
fromthe list, allowing the caller to manipulate the sharing type,
if appropriate.
 1.14 18-Jul-1998  is Switching dev/ic/lpt.c to use spllpt() instead of spltty(). It doesn't use
tty structures, and on some machines (namely the DraCo internal lpt, and some
multi-i/o boards for Amigas and DraCos), tying spltty to the pretty high printer
interupt level would hurt serial performance.

On all affected ports but Amiga, spllpt() has been defined in machine/intr.h
to be spltty(), thus preserving old behaviour. Portmasters are encouraged to
change is, if they feel something else is better (e.g., one of its own were
possible).
 1.13 07-Jul-1998  thorpej On second thought, call that like the rest of the shared intr functions.
 1.12 07-Jul-1998  thorpej Define a macro to test if a shared interrupt should be disabled after
a stray has occurred.
 1.11 10-Nov-1997  mjacob Protect userland applications from the inline splraise function.
 1.10 07-Jul-1997  cgd branches: 1.10.6;
mark prototypes for static inline functions as possibly unused
(with __attribute__ ((unused))), to avoid generating warnings when
compiling without optimization but with the default warning flags.
 1.9 05-Jun-1997  cgd two more slight bogons
 1.8 05-Jun-1997  cgd actually, declare _splraise() as an inline function, because:
(1) it was using 'max', and some functions use a variable
of that name (*sigh*), and
(2) that makes it easier to be a bit trickier, and only call
swpipl if changing the IPL.
 1.7 05-Jun-1997  cgd parens around macro arg (this is an old one)
 1.6 05-Jun-1997  cgd make sure that splnet(), splbio(), splimp(), spltty(), splclock(),
splstatclock(), and splhigh() all _raise_ the IPL. (splhigh() is _not_
the highest possible IPL; mcheck is...)
 1.5 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.4 03-Dec-1996  cgd branches: 1.4.2;
kill siroff() and resturcture do_sir() to be cleaner and more correct.
 1.3 17-Nov-1996  cgd implement a (hack-ish) set of routines to do common chained-interrupt
handler management. It's nasty, but three slightly different copies of
the code is worse.
 1.2 09-Jul-1996  cgd various cleanup, move setsoft* and spl* into intr.h.
 1.1 12-Apr-1996  cgd the Alpha implementation of <machine/intr.h>
 1.4.2.3 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.4.2.2 06-Jun-1997  cgd sync nwscons with trunk
 1.4.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.10.6.1 11-Nov-1997  mellon Pull rev 1.11 up from trunk (mjacob)
 1.21.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.21.2.6 23-Apr-2001  bouyer Sync with HEAD.
 1.21.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.21.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.21.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.21.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.21.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.25.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.40.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.47.2.1 03-Aug-2001  lukem update to -current
 1.49.36.1 30-Mar-2005  tron Pull up revision 1.50 (requested by thorpej in ticket #76):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.49.30.1 29-Apr-2005  kent sync with -current
 1.49.28.1 11-May-2005  riz Pull up revision 1.50 (requested by thorpej in ticket #1373):
- Add a alpha_shared_intr_reset_strays() function that resets the
stray
interrupt counter for a given shared interrupt descriptor.
- When an interrupt is successfully handled, reset the strays counter,
thus preventing a "slow leak" from eventually shutting off the
interrupt
vector. Idea taken from pci_kn300.c (which was changed to use
the new
alpha_shared_intr_reset_strays() function).
 1.49.22.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.49.22.1 01-Apr-2005  skrll Sync with HEAD.
 1.49.10.2 11-Mar-2002  thorpej Add IPL_VM. (Other ports call this IPL_IMP, and that will be changed
in short order.)
 1.49.10.1 10-Mar-2002  thorpej Adjustments for new mutex routines:
* Make all the IPL_* constants meaningful within a single number domain.
* Use new SI_* constants to number the soft interrupt queues, rather than
IPL_SOFT*.
* Add splraiseipl() for use by kern_mutex.c. Usage is e.g.
splraiseipl(IPL_BIO).
 1.49.2.2 27-Jul-2001  thorpej Rework the interrupt code, shaving some cycles off in the process.
Rather than an "iointr" routine that decomposes a vector into an
IRQ, we maintain a vector table directly, hooking up each "iointr"
routine at the correct vector. This also allows us to hook device
interrupts up to specific vectors (c.f. Jensen).

We can shave even more cycles off, here, and I will, but it requires
some changes to the alpha_shared_intr stuff.
 1.49.2.1 27-Jul-2001  thorpej file intr.h was added on branch nathanw_sa on 2001-07-27 00:25:20 +0000
 1.50.4.1 02-Nov-2005  yamt sync with head.
 1.50.2.7 17-Mar-2008  yamt sync with head.
 1.50.2.6 21-Jan-2008  yamt sync with head
 1.50.2.5 07-Dec-2007  yamt sync with head
 1.50.2.4 03-Sep-2007  yamt sync with head.
 1.50.2.3 26-Feb-2007  yamt sync with head.
 1.50.2.2 30-Dec-2006  yamt sync with head.
 1.50.2.1 21-Jun-2006  yamt sync with head.
 1.54.6.1 22-Apr-2006  simonb Sync with head.
 1.54.4.1 09-Sep-2006  rpaulo sync with head
 1.54.2.1 18-Feb-2006  yamt sync with head.
 1.55.16.3 21-Sep-2006  yamt rename splraiseipl argument to match with the rest of ports.
 1.55.16.2 18-Sep-2006  yamt correct a header.
 1.55.16.1 18-Sep-2006  yamt implement new api for alpha.
 1.55.14.2 01-Feb-2007  ad Header file cleanup.
 1.55.14.1 12-Jan-2007  ad Sync with head.
 1.59.14.1 22-May-2007  matt Update to HEAD.
 1.59.12.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.59.8.1 11-Jul-2007  mjf Sync with head.
 1.59.6.5 03-Dec-2007  ad Sync with HEAD.
 1.59.6.4 03-Dec-2007  ad Sync with HEAD.
 1.59.6.3 18-Oct-2007  ad More interrupt changes; collapse the symbolic levels down to the ones
that we actually need (none, soft, vm, sched, high) but retain aliases
like IPL_BIO for now.
 1.59.6.2 18-Oct-2007  ad Interrupt stuff for alpha (but no fast softints yet).
 1.59.6.1 27-May-2007  ad Sync with head.
 1.60.10.3 23-Mar-2008  matt sync with HEAD
 1.60.10.2 09-Jan-2008  matt sync with HEAD
 1.60.10.1 06-Nov-2007  matt sync with HEAD
 1.60.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.61.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.61.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.62.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.63.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.63.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.63.2.1 24-Mar-2008  keiichi sync with head.
 1.64.2.1 18-May-2008  yamt sync with head.
 1.65.2.3 11-Aug-2010  yamt sync with head.
 1.65.2.2 11-Mar-2010  yamt sync with head
 1.65.2.1 16-May-2008  yamt sync with head.
 1.67.4.2 12-Jun-2011  rmind sync with head
 1.67.4.1 03-Jul-2010  rmind sync with head
 1.67.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.68.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.69.6.1 18-Feb-2012  mrg merge to -current.
 1.69.2.1 17-Apr-2012  yamt sync with head
 1.70.20.1 10-Aug-2014  tls Rebase.
 1.70.6.2 03-Dec-2017  jdolecek update from HEAD
 1.70.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.71.8.1 20-Mar-2017  pgoyette Sync with HEAD
 1.71.4.1 05-Feb-2017  skrll Sync with HEAD
 1.83.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.21 05-Jun-2000  thorpej Switch to the new `evcnt' mechanism for counting interrupts. Maintain
a per-CPU interrupt counter for clock, device, and interprocessor
interrupts.
 1.20 21-Mar-2000  thorpej branches: 1.20.2;
Fix INTRCNT_DEC_550_IRQ_LEN. From Nathan Williams.
 1.19 04-Dec-1999  thorpej Actually, the 2100_A500 has 64 interrupts, not 16.
 1.18 29-Jun-1999  ross branches: 1.18.2; 1.18.8;
Minor Tsunami-related changes.
 1.17 19-Nov-1998  ross branches: 1.17.4; 1.17.6; 1.17.8;
Nuke the giant ugly-as-sin per-platform INTRNAMES masterpiece.
I just cannot add one more platform without getting sick.
Instead, we do just one table for all platforms. More-or-less,
it was only the A12 that even named it's individual interrupts anyway.

Also, prototype set_iointr() here. It's a slightly odd place, but 10*
better than the old place it was, and this file is included by exactly
the perfect set of .c files for set_iointr() visibility.
 1.16 27-Jun-1998  thorpej Take a stab at EB66 support. An EB66 is basically an EB64+ with a
21066 LCA instead of a 21064 + APECS.
 1.15 26-Jun-1998  ross Add AlphaServer 1000 interrupts.
 1.14 24-Jun-1998  ross Add dec_1000a interrupts.
 1.13 05-Jun-1998  thorpej Support for the Digital Personal Workstation [456]xx, a.k.a. Miata (systype
DEC_550). Mostly cloned from the EB164 systype, with some modifications
from myself, and a few more from Andrew Gellatin.
 1.12 29-Apr-1998  thorpej Add interrupt counter space for the DEC EB64+, and fix a misplaced
counter comment in the kn300 interrupt counters.
 1.11 15-Apr-1998  mjacob add Alpha 4100 support
 1.10 02-Mar-1998  ross Update interrupt name table for a12 crossbar.
 1.9 29-Jan-1998  ross branches: 1.9.2;
Define the A12 names.
 1.8 07-Apr-1997  cgd branches: 1.8.2;
clean up NetBSD RCS ID strings
 1.7 16-Nov-1996  cgd branches: 1.7.2;
add names and space for eb164 interrupt request counters
 1.6 05-Jun-1996  cgd avoid lots of upper-case letters in interrupt names. prettier that way.
 1.5 05-Jun-1996  cgd interrupt counters for TurboChannel systems.
 1.4 13-Apr-1996  cgd branches: 1.4.4;
capitalize IRQ names here, to match what's reported on boot
 1.3 12-Apr-1996  cgd clean up copyrights and RCS IDs
 1.2 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.4.4.2 05-Jun-1996  cgd Pull up from trunk:
>avoid lots of upper-case letters in interrupt names. prettier that way.
 1.4.4.1 05-Jun-1996  cgd Pull up from trunk:
>interrupt counters for TurboChannel systems.
 1.7.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.8.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.9.2.2 29-Jan-1998  ross Define the A12 names.
 1.9.2.1 29-Jan-1998  ross file intrcnt.h was added on branch bouyer-scsipi on 1998-01-29 22:26:25 +0000
 1.17.8.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.17.6.1 01-Jul-1999  thorpej Sync w/ -current.
 1.17.4.1 02-Jul-1999  perry pullup 1.17->1.18 (ross)
 1.18.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.20.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15 18-Oct-2016  jdolecek add isa_intr_establish_xname() to MD isa headers so that it can be used
by MI drivers
 1.14 06-Feb-2012  matt branches: 1.14.6; 1.14.24; 1.14.28;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.13 14-Jun-2011  matt branches: 1.13.2; 1.13.6;
struct device * -> device_t
 1.12 19-Aug-2009  dyoung branches: 1.12.10;
(Re-)define isa_detach_hook(), and define isa_dmadestroy(). Update
some isa_chipset_tag_t->ic_detach_hook() definitions.
 1.11 19-Aug-2009  dyoung isa_detach_hook() needs two arguments, the first an isa_chipset_tag_t.
 1.10 19-Aug-2009  dyoung Define isa_dmadestroy and isa_detach_hook. Hook up a couple of
isa_detach_hook implementations.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 09-May-2003  fvdl branches: 1.8.104; 1.8.106; 1.8.108;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.7 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.6 01-Jun-2000  thorpej ISA DMA bounce buffer code, needed for a couple of SGMAP-less
systems, support for which will be hitting the tree soon.
 1.5 01-Jun-2000  cgd kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.4 07-Feb-2000  thorpej branches: 1.4.2;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.3 19-Mar-1999  cgd branches: 1.3.8;
move isa/isa_machdep.h to include/isa_machdep.h. (can't do it via
repository copy because alpha already had an include/isa_machdep.h in
the attic.)
 1.2 12-Apr-1996  cgd these have moved elsewhere
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.108.2 19-Aug-2009  yamt sync with head.
 1.8.108.1 16-May-2008  yamt sync with head.
 1.8.106.1 18-May-2008  yamt sync with head.
 1.8.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.6.1 18-Feb-2012  mrg merge to -current.
 1.13.2.1 17-Apr-2012  yamt sync with head
 1.14.28.1 04-Nov-2016  pgoyette Sync with HEAD
 1.14.24.1 05-Dec-2016  skrll Sync with HEAD
 1.14.6.1 03-Dec-2017  jdolecek update from HEAD
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 01-Jun-2000  cgd branches: 1.5.128; 1.5.130; 1.5.132;
kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.4 19-Mar-1999  cgd branches: 1.4.8; 1.4.16;
Moved from arch/alpha/isa/isapnp_machdep.h,v
 1.3 05-Sep-1998  christos Assign copyright to TNF.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 31-Jul-1998  thorpej branches: 1.1.2;
Machine-dependent ISA PnP goo for NetBSD/alpha.
 1.1.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.4.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.132.1 16-May-2008  yamt sync with head.
 1.5.130.1 18-May-2008  yamt sync with head.
 1.5.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 07-Jul-2004  drochner branches: 1.1.2;
also add <machine/joystick.h> to alpha and amd64, to allow compilation
of certain multimedia applications
 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 07-Jul-2004  skrll file joystick.h was added on branch ktrace-lwp on 2004-08-03 10:31:19 +0000
 1.5 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.4 11-Dec-2005  christos branches: 1.4.122; 1.4.142;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
keyboard and frame buffer interface include files, grabbed from the
sparc with minimal modifications, to make X go. Should really be
trimmed down to include only the relevant information.
 1.1.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.142.1 22-Sep-2015  skrll Sync with HEAD
 1.4.122.1 03-Dec-2017  jdolecek update from HEAD
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 14-Feb-1998  cgd branches: 1.3.188; 1.3.192;
replace the single phys_ram_seg_t with a count. an array of segment
descriptors will be placed after this structure in the core file.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 01-Oct-1996  cgd branches: 1.1.2;
first cut at alpha machdep kernel coredump header
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.192.1 18-Feb-2012  mrg merge to -current.
 1.3.188.1 17-Apr-2012  yamt sync with head
 1.17 21-Jan-2019  dholland Fix wrong scoping of {U,}LLONG_MAX. More cases, not just amd64.
PR 53298 from Roberto E. Vargas Caballero.
 1.16 21-Apr-2014  matt branches: 1.16.26; 1.16.28;
Since all our compilers support __DBL_* and __FLT_*, use them to define
{DBL,FLT}_{DIG,MIN,MAX}
 1.15 11-Apr-2013  christos branches: 1.15.4; 1.15.8;
add missing SSIZE_MIN
 1.14 28-Mar-2012  christos branches: 1.14.2;
- Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.13 07-Jun-2010  tnozaki branches: 1.13.8; 1.13.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.12 17-Oct-2007  garbled branches: 1.12.20; 1.12.40; 1.12.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.11 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.10 11-Dec-2005  christos branches: 1.10.30; 1.10.38; 1.10.44; 1.10.48; 1.10.50;
merge ktrace-lwp.
 1.9 07-Aug-2003  agc branches: 1.9.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 28-Apr-2003  bjh21 branches: 1.8.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.7 08-Aug-2000  tshiozak 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.6 07-Mar-2000  kleink branches: 1.6.2; 1.6.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.5 06-Aug-1998  kleink branches: 1.5.12;
_POSIX_SOURCE -> _POSIX_C_SOURCE
 1.4 09-Jan-1998  perry multiple include protect machine/limits.h, fixes pr 4473 (from Mika Nystrom)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 12-Apr-1996  cgd branches: 1.2.2;
add XOPEN constants, clean up
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.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.6.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.6.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 03-Sep-2007  yamt sync with head.
 1.10.50.1 06-Nov-2007  matt sync with HEAD
 1.10.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.10.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.10.38.1 03-Oct-2007  garbled Sync with HEAD
 1.10.30.1 09-Oct-2007  ad Sync with head.
 1.12.42.1 03-Jul-2010  rmind sync with head
 1.12.40.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.12.20.1 11-Aug-2010  yamt sync with head.
 1.13.12.1 05-Apr-2012  mrg sync to latest -current.
 1.13.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.13.8.1 17-Apr-2012  yamt sync with head
 1.14.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.2.1 23-Jun-2013  tls resync from head
 1.15.8.1 10-Aug-2014  tls Rebase.
 1.15.4.1 18-May-2014  rmind sync with head
 1.16.28.1 10-Jun-2019  christos Sync with HEAD
 1.16.26.1 26-Jan-2019  pgoyette Sync with HEAD
 1.6 06-Aug-2014  joerg Consistently define WARN in a way that passes format string checks, i.e.
always uses the same number of arguments as given in the format string.
 1.5 28-Apr-2008  martin branches: 1.5.44; 1.5.60;
Remove clause 3 and 4 from TNF licenses
 1.4 25-Jan-2006  christos branches: 1.4.72; 1.4.74; 1.4.76;
free -> dealloc
unsigned -> size_t for alloc/dealloc
 1.3 31-Oct-2001  thorpej branches: 1.3.32; 1.3.44;
Split elf32 vs. elf64 handling in loadfile(), including support for
each separately and explicitly. BOOT_ELF is now BOOT_ELF32 and
BOOT_ELF64, and ELFSIZE should no longer be defined in loadfile_machdep.h.
 1.2 08-Jun-2000  thorpej branches: 1.2.4; 1.2.6; 1.2.10;
And more ANSI'ification!
 1.1 10-Sep-1999  ross branches: 1.1.2; 1.1.10;
This is required by libsa/loadfile.c.
 1.1.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.10.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.3.44.1 01-Feb-2006  yamt sync with head.
 1.3.32.1 21-Jun-2006  yamt sync with head.
 1.4.76.1 16-May-2008  yamt sync with head.
 1.4.74.1 18-May-2008  yamt sync with head.
 1.4.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.60.1 10-Aug-2014  tls Rebase.
 1.5.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33 13-Feb-2022  riastradh alpha: __cpu_simple_lock audit.

Add missing "cc" and "memory" asm clobbers to the compiler can't
reorder memory access around these. The necessary memory barrier
instructions, mb, already appear in all the right places.
 1.32 12-Feb-2022  riastradh __cpu_simple_lock(9): Omit needless barriers in init.

It is, and always has been, the caller's responsibility to ensure the
lock is initialized before it can be used -- otherwise the memory
could hold garbage; it is nonsensical to even attempt locking
operations on it before initialization.

So there's no need to issue explicit barriers here. The barrier
seems to have been introduced in sys/arch/alpha/alpha/lock_machdep.c
rev. 1.1 (since moved to inline asm in alpha/include/lock.h) and then
copied & pasted into several other architectures.
 1.31 03-Apr-2021  thorpej Fix an IPI deadlock scenario that resulted in a TLB shootdown timeout
panic reported by John Klos on port-alpha:

- pmap_tlb_shootnow(): If we acquire a pmap's activation lock, we will
have raised the IPL on the current CPU to IPL_SCHED until we drop
the tlb_lock (due to how nested spin mutexes work). As such, when
we release the activation lock, forcibly lower our IPL back to IPL_VM
so that we can receive and process IPIs while waiting for other CPUs
to process the shootdowns.
- mutex_vector_enter(): Invoke SPINLOCK_SPIN_HOOK while spinning to acquire
a spin mutex. This is a nop on most platforms, but it's important on
the Alpha. Without this, IPIs (and thus TLB shootdowns) cannot be
processed if trying to acquire an IPL_SCHED spin mutex such as those
used by the scheduler.

...and while we're poking around in here:

- Rework the Alpha SPINLOCK_SPIN_HOOK to only check curcpu()->ci_ipis
if the current CPU's IPL is >= IPL_CLOCK (thus ensuring that preemption
is disabled and thus guaranteeing that curcpu() is stable). (Alpha does
not yet support kernel preemption, but this is now one less thing that
would need to be fixed.)
 1.30 29-Nov-2019  riastradh branches: 1.30.8; 1.30.10;
Nix mb_* on alpha.
 1.29 17-Sep-2017  christos branches: 1.29.4;
more const.
 1.28 25-Nov-2009  rmind branches: 1.28.22;
Remove IPL_LPT and IPL_IPI aliases, use the actual IPLs.
Fix some broken comments.
 1.27 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.26 17-Oct-2007  garbled branches: 1.26.16; 1.26.18; 1.26.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.25 10-Sep-2007  skrll Merge nick-csl-alignment.
 1.24 11-Feb-2007  ad branches: 1.24.6; 1.24.14; 1.24.18; 1.24.22; 1.24.24;
inline -> __inline
 1.23 09-Feb-2007  ad Merge newlock2 to head.
 1.22 28-Dec-2005  perry branches: 1.22.20;
inline -> __inline
 1.21 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.20 11-Dec-2005  christos merge ktrace-lwp.
 1.19 26-Sep-2003  nathanw branches: 1.19.16;
Move __cpu_simple_lock_t and __SIMPLELOCK_{UN,}LOCKED to machine/types.h
so that they can be used in a namespace-friendly way.
 1.18 28-Jun-2003  he branches: 1.18.2;
#ifdef _KERNEL_OPT police.
 1.17 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.16 17-Dec-2001  thorpej Fix constraints in __asm statements (err, again). Kernels compiled
with GCC 2.95.3 work now.
 1.15 20-Apr-2001  thorpej branches: 1.15.2; 1.15.4;
SPINLOCK_INTERLOCK_RELEASE_HOOK should actually be
SPINLOCK_SPIN_HOOK, so that we actually check for
pending IPIs on the Alpha more than once. Also,
when we call alpha_ipi_process(), make sure to go
to splipi().
 1.14 16-Apr-2001  thorpej Oops, properly mark a memory operand as both an input and an
output as necessary.
 1.13 22-Nov-2000  thorpej branches: 1.13.2;
Add a debugging printf, commented out by default.
 1.12 20-Nov-2000  thorpej Ooops, do the last only if MULTIPROCESSOR.
 1.11 20-Nov-2000  thorpej On the Alpha, interprocessor interrupts come in at the same priority
as normal device interrupts. Because of this, we won't get IPIs while
servicing such interrupts. This can lead to the following deadlock
scenario as reported by Bill Sommerfeld:
- Process runs on cpu1, but has FP state on cpu0.
- Process executes FP-using insn, causing an FP trap, which causes
the kernel lock to be acquired.
- At roughly the same time, cpu0 receives a device interrupt, and attempts
to acquire the kernel lock, which blocks since cpu1 already has it.
- cpu1 sends cpu0 a SYNCH FPU IPI, and waits for cpu0 to release its
FP state.
- Since cpu0 cannot notice the IPI until it has processed the device
interrupt, which it cannot do because it cannot acquire the kernel
lock, we have deadlock.

Solve the problem by adding a spinlock interlock release hook which
checks for pending IPIs and processes them.

Idea from Bill Sommerfeld.
 1.10 14-Aug-2000  thorpej Remove an unnecessary MB in __cpu_simple_unlock(), per sections
5.3.3 and 5.3.4 of the Green Book, and a discussion w/ cgd@netbsd.org.
 1.9 14-Aug-2000  thorpej Issue a memory barrier before clearing a lock, as per section 5.5.3
of the Green Book and a discussion on tech-smp and port-alpha.
 1.8 08-Jun-2000  thorpej And more ANSI'ification!
 1.7 07-Jun-2000  simonb In __cpu_simple_lock_try(), use "return (v0 != 0);" instead of
"return (v0);" where v0 is an unsigned long and the function return
type is int. Stops lint warnings when this file is included.

Fix from Jason Thorpe.
 1.6 02-May-2000  thorpej branches: 1.6.2;
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.5 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.4 03-Dec-1999  thorpej Rewrite the atomic locking primitives using in-line assembly.
 1.3 27-Jul-1999  thorpej branches: 1.3.2; 1.3.8;
Prepend `cpu_' to the machine-dependent atomic locking primitivies.
 1.2 04-Nov-1998  chs branches: 1.2.8;
LOCKDEBUG enhancements for non-MP:
keep a list of locked locks.
use this to print where the lock was locked
when we either go to sleep with a lock held
or try to free a locked lock.
 1.1 24-Sep-1998  thorpej Machine-dependent spin lock operations for Alpha, included if MULTIPROCESSOR
is specified.
 1.2.8.1 02-Aug-1999  thorpej Update from trunk.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.2.5 23-Apr-2001  bouyer Sync with HEAD.
 1.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.3.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.15.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.15.4.1 20-Apr-2001  nathanw file lock.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.15.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.16.3 27-Oct-2007  yamt sync with head.
 1.19.16.2 26-Feb-2007  yamt sync with head.
 1.19.16.1 21-Jun-2006  yamt sync with head.
 1.22.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.24.24.1 06-Nov-2007  matt sync with HEAD
 1.24.22.1 02-Oct-2007  joerg Sync with HEAD.
 1.24.18.1 15-Aug-2007  skrll Provide __SIMPLELOCK_{UN,}LOCKED_P and __cpu_simple_lock_{set,clear}
for all architectures.
 1.24.14.1 03-Oct-2007  garbled Sync with HEAD
 1.24.6.1 09-Oct-2007  ad Sync with head.
 1.26.20.2 11-Mar-2010  yamt sync with head
 1.26.20.1 16-May-2008  yamt sync with head.
 1.26.18.1 18-May-2008  yamt sync with head.
 1.26.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.22.1 03-Dec-2017  jdolecek update from HEAD
 1.29.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.30.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.7 07-Oct-2010  hans branches: 1.7.8; 1.7.12;
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
 1.6 11-Dec-2005  christos branches: 1.6.78; 1.6.98; 1.6.100;
merge ktrace-lwp.
 1.5 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.4 29-Sep-2002  wiz branches: 1.4.6;
"definitions" has lots of 'i's, but that's not reason to leave one out.
 1.3 25-Mar-2001  nathanw branches: 1.3.2; 1.3.4;
Verbose display of machine check errors on AS200/400 boxes.
 1.2 08-Jun-2000  thorpej branches: 1.2.4;
And more ANSI'ification!
 1.1 08-Jul-1998  mjacob branches: 1.1.14; 1.1.22;
common logout structure definitions, or a start thereof
 1.1.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.14.2 27-Mar-2001  bouyer Sync with HEAD.
 1.1.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.2.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.3.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.4.1 25-Mar-2001  nathanw file logout.h was added on branch nathanw_sa on 2002-10-18 02:34:12 +0000
 1.3.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.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.100.1 05-Mar-2011  rmind sync with head
 1.6.98.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.6.78.1 09-Oct-2010  yamt sync with head
 1.7.12.1 18-Feb-2012  mrg merge to -current.
 1.7.8.1 17-Apr-2012  yamt sync with head
 1.2 04-Nov-2024  christos Undo previous lwp.h change.
 1.1 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.1 30-Nov-2024  christos branches: 1.1.4;
Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 30-Nov-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:55:22 +0000
 1.4 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.3 05-Feb-2000  kleink branches: 1.3.6; 1.3.8; 1.3.10;
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.10.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.8.1 28-Feb-2002  nathanw Catch up to -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 22:35:41 +0000
 1.15 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.14 04-Nov-2024  christos Undo previous lwp.h change.
 1.13 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.12 18-May-2024  thorpej branches: 1.12.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.11 24-May-2021  thorpej Add _UC_SETSTACK / _UC_CLRSTACK handling. Fixes the t_sigaltstack test
on alpha.
 1.10 27-Dec-2019  kamil branches: 1.10.12; 1.10.14;
Harmonize the namespace of fast TLS base pointer getter functions

Protect __lwp_getprivate_fast() with _RTLD_SOURCE, _LIBC_SOURCE and
__LIBPTHREAD_SOURCE__.

Include in this namespace <sys/tcl.h> and use __BEGIN_DECLS/__END_DECLS
for the sake of consistency.
 1.9 15-Feb-2018  kamil branches: 1.9.4;
Introduce _UC_MACHINE_FP() as a macro

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

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


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

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

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

Once ia64 will mature, this should be revisited.

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


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

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

Proposed on tech-userlevel@.

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

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

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

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

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

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

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

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.5 28-Apr-2008  martin branches: 1.5.22; 1.5.28; 1.5.30;
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 08-Oct-2003  thorpej Add some accessor macros for the ucontext:
* _UC_MACHINE_PC() - access the program counter
* _UC_MACHINE_INTRV() - access the integer return value register
* _UC_MACHINE_SET_PC() - set the program counter (this requires
special handling on some platforms).
 1.2 17-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 30-Aug-2001  nathanw branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.6 14-Jan-2003  nathanw Add a MD flag, _UC_UNIQUE, that indicates that the "process-unique value"
has been stashed in the r31 (zero) slot.
 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 17-Dec-2001  nathanw A little whitespace cleanup.
 1.1.2.3 17-Dec-2001  nathanw Switch from my Tru64-inspired mcontext to Klaus's simpler one.
 1.1.2.2 25-Sep-2001  nathanw We don't need our own definition of mcontext_t; following Tru64, it's
identical to struct sigcontext, which is already defined in signal.h.
 1.1.2.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.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.30.1 05-Mar-2011  bouyer Sync with HEAD
 1.5.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.5.22.1 05-Mar-2011  rmind sync with head
 1.7.4.1 30-Oct-2012  yamt sync with head
 1.8.32.3 21-Mar-2018  martin Pull up the following, requested by kamil in ticket #552:

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

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

Add a dummy implementation of _UC_MACHINE_INTRV() for ia64.

Implement _UC_MACHINE_INTRV() for hppa.

Make the t_ucontext.c test more portable.

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

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

XXX pullup-10
 1.11 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 14-Jul-2021  thorpej Disable the mutex_spin_{enter,exit}() fast-path stubs while I investigate
some an odd IPL-related panic that seems to be related (that I can fairly
reliabily reproduce on an LCA45).
 1.9 12-Jul-2021  thorpej Optimized fast-paths for mutex_spin_enter() and mutex_spin_exit().
 1.8 23-Sep-2020  thorpej branches: 1.8.6;
Move the compile-time assert outside of the __MUTEX_PRIVATE guard.
 1.7 23-Sep-2020  thorpej Move the simple lock used for spin mutexes into the sub-structure that
contains the spin lock IPL field. This shrinks kmutex_t to sizeof(uintptr_t)
on Alpha.

This should have been done in rev 1.3 when the lock ID field was removed,
but better late than never, I guess.
 1.6 29-Nov-2019  riastradh Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.5 29-Nov-2019  riastradh Nix mb_* on alpha.
 1.4 28-Apr-2008  martin branches: 1.4.88;
Remove clause 3 and 4 from TNF licenses
 1.3 21-Nov-2007  yamt branches: 1.3.14; 1.3.16; 1.3.18;
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.14; 1.2.24; 1.2.26; 1.2.30; 1.2.32;
Merge newlock2 to head.
 1.1 11-Jan-2007  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.3 01-Feb-2007  ad Header file cleanup.
 1.1.2.2 12-Jan-2007  ad Sync with head.
 1.1.2.1 11-Jan-2007  ad Checkpoint work in progress.
 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.14.1 18-Apr-2007  thorpej G/C _lock_cas().
 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 mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:05:37 +0000
 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.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8.6.1 01-Aug-2021  thorpej Sync with HEAD.
 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.1 10-Mar-2002  thorpej branches: 1.1.2;
file mutex_impl.h was initially added on branch newlock.
 1.1.2.7 22-Mar-2002  thorpej Wrap the stuff that manipulates the guts of a mutex in __MUTEX_PRIVATE.
 1.1.2.6 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.5 19-Mar-2002  thorpej Add comments describing the size of the mutex structure.
 1.1.2.4 17-Mar-2002  thorpej Don't need <machine/atomic.h>
 1.1.2.3 14-Mar-2002  thorpej Add a comment in some inline asm.
 1.1.2.2 11-Mar-2002  thorpej Fix two bugs pointed out by Bill Sommerfeld:
* MUTEX_RELEASE(): memory barrier goes *before* lock release.
* Fix race condition between mutex_exit() and MUTEX_SET_WAITERS().
 1.1.2.1 10-Mar-2002  thorpej Alpha support routines for kernel mutexes.
 1.2 02-Sep-1997  thorpej branches: 1.2.2; 1.2.4;
Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.1 06-Apr-1997  cgd branches: 1.1.2;
add <machine/options.h>, to allow 'defopt' option headers to be easily
included.
 1.1.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.2.4.2 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2.4.1 02-Sep-1997  thorpej file options.h was added on branch bouyer-scsipi on 1997-09-02 13:18:54 +0000
 1.2.2.2 02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.2.2.1 02-Sep-1997  thorpej file options.h was added on branch alpha-nwscons on 1997-09-02 13:18:54 +0000
 1.3 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.2 19-May-2002  nathanw branches: 1.2.148; 1.2.152;
Add missing common or OSF/1 PALcode instructions from the AARM: wtint,
clrfen, urti.
 1.1 06-Sep-1997  thorpej branches: 1.1.2; 1.1.32; 1.1.34; 1.1.46;
Split off PALcode functions into their own header file.
 1.1.46.1 30-May-2002  gehenna Catch up with -current.
 1.1.34.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.32.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.32.1 19-May-2002  nathanw Add missing common or OSF/1 PALcode instructions from the AARM: wtint,
clrfen, urti.
 1.1.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Sep-1997  thorpej file pal.h was added on branch marc-pcmcia on 1997-09-06 17:59:50 +0000
 1.2.152.1 18-Feb-2012  mrg merge to -current.
 1.2.148.1 17-Apr-2012  yamt sync with head
 1.50 19-Jul-2021  christos Remove definitions for CACHE_LINE_SIZE and COHERENCY_UNIT which are the same
as the default.
 1.49 06-Jul-2021  thorpej - Define STACK_ALIGNBYTES to override the default and ensure that
stacks are 16-byte aligned, an assumption made by the compiler
and recommended by the Alpha Architecture Handbook.
- cpu_lwp_fork(): Ensure 16-byte stack alignment if the caller specified
one.

Addresses root casue of PR port-alpha/54307 and PR toolchain/56153.

Many thanks to rin@ for performing the root cause analysis and testing
changes.
 1.48 31-May-2021  simonb Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.47 10-Oct-2020  thorpej branches: 1.47.6;
G/C alpha_XXX_dmamap() / alpha_XXX_dmamap_or. They haven't been needed
for a long time.
 1.46 03-Sep-2020  thorpej Define COHERENCY_UNIT and CACHE_LINE_SIZE as 64, which is the primary cache
line size on EV6 / EV7. This is also the default MI fallback definition,
but now we're not relying on that value.
 1.45 07-Jan-2019  jdolecek move DEV_BSIZE, DEV_BSHIFT out of MD param.h, they are same on all ports

also move BLKDEV_IOSIZE, MAXPHYS, but allow override since some ports
have different value (powerpc uses NBPG for BLKDEV_IOSIZE, sun2/sun3
have lower MAXPHYS)
 1.44 20-Jan-2016  jklos branches: 1.44.16; 1.44.18;
Change base address to account for later Alpha models with later firmware
which require more space for SRM.
 1.43 14-Jan-2013  he branches: 1.43.14;
Copy the ALPHA_PGSHIFT value into the non-_KERNEL branch.
Fixes the build.
 1.42 07-Jan-2013  dsl Only include machine/cpu.h if _KERNEL is defined.
Fixes alpha userspace build (esp. pstat).
NFI why it worked before at all.
 1.41 10-Feb-2012  para branches: 1.41.6;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.40 24-Jan-2012  christos Use and define ALIGN() ALIGN_POINTER() and STACK_ALIGN() consistently,
and avoid definining them in 10 different places if not needed.
 1.39 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.38 08-Feb-2011  rmind branches: 1.38.4; 1.38.8;
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.37 08-Feb-2010  joerg branches: 1.37.2; 1.37.4; 1.37.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.36 28-Aug-2006  yamt branches: 1.36.60; 1.36.80;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.35 11-Dec-2005  christos branches: 1.35.4; 1.35.8;
merge ktrace-lwp.
 1.34 06-Apr-2004  simonb branches: 1.34.12;
Bump NMBCLUSTERS to something a little more modern - 2048 for the
normal case and 4096 for the "options GATEWAY" case.
 1.33 07-Aug-2003  agc branches: 1.33.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.32 26-Feb-2002  simonb branches: 1.32.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.31 30-May-2001  mrg branches: 1.31.2; 1.31.4;
use _KERNEL_OPT
 1.30 09-Jun-2000  thorpej branches: 1.30.4;
Only include <machine/intr.h> if _KERNEL. Noted by enami tsugutomo.
 1.29 09-Jun-2000  cgd make spl0() and spllowersoftclock() return void. Also, move spl0()
prototype from param.h to intr.h. (there were some big XXXs in param.h
that said to do that, and intr.h is included by param.h, so...)
 1.28 08-Jun-2000  thorpej And more ANSI'ification!
 1.27 11-Feb-2000  thorpej branches: 1.27.2;
Update for the NKMEMPAGES changes.
 1.26 04-Dec-1999  ragge CL* discarding.
 1.25 19-Nov-1998  ross branches: 1.25.10; 1.25.16;
Stop including <machine/alpha_cpu.h>; we already export <machine/cpu.h>.
 1.24 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.23 29-Apr-1998  thorpej Pull in opt_gateway.h as appropriate.
 1.22 12-Mar-1998  thorpej Garbage-collect a bunch of constants that were inherited, but are no
longer necessary or make sense.
 1.21 10-Feb-1998  thorpej Bump KNMEMCLUSTERS slightly, and make it more obvious how to tune it
(lifted from i386 port).
 1.20 19-Sep-1997  leo Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
 1.19 15-May-1997  mjacob branches: 1.19.4;
Allow MAXPHYS to be specified as a config file option.
 1.18 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.17 27-Feb-1997  jonathan Protect MCLSHIFT definition so users can customize MCLBYTES.
 1.16 24-Feb-1997  fvdl Define ALIGNED_POINTER
 1.15 13-Nov-1996  cgd branches: 1.15.2; 1.15.8;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.14 25-Oct-1996  cgd prototype alpha_XXX_dmamap(), the alpha DMA mapping hack.
 1.13 09-Jul-1996  cgd various cleanup, move setsoft* and spl* into intr.h.
 1.12 04-Mar-1996  cgd add _MACHINE and _MACHINE_ARCH, which are like MACHINE and MACHINE_ARCH,
execpt without quotes. meant to be __CONCAT()ted for easy #includes
of machine-dependent headers for MI code (e.g. for the MI ISA/EISA/PCI/TC
bus code).
 1.11 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.10 20-Dec-1995  cgd move DELAY's functionality into delay()
 1.9 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.8 13-Aug-1995  mycroft Add splsoftnet().
 1.7 03-Aug-1995  cgd bump NKMEMCLUSTERS up to 4M (increase of 4x)
 1.6 28-Jun-1995  cgd kill user-land DELAY macro, as suggested by gwr.
 1.5 26-Jun-1995  cgd clean up definitions of ctod(), dtoc(), ctob(), btoc(), btodb(), and
dbtob(). remove unused definitions of ctos(), stoc(), and dtob().
 1.4 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.3 24-Mar-1995  cgd remove support for double-mapping the user area/kernel stack
 1.2 18-Mar-1995  cgd don't be so quick to cast macro arguments to unsigned; if the
arguments are really off_t's (e.g. to btodb), then you can lose
information. This was the "> 4G file systems don't work" bug; physio
uses btodb, which was broken.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.15.8.1 11-Mar-1997  is Merge in latest Trunk.
 1.15.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.19.4.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.16.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.16.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.25.10.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.27.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.30.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.31.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.31.4.1 30-May-2001  nathanw file param.h was added on branch nathanw_sa on 2002-02-28 04:06:14 +0000
 1.31.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.32.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.32.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.32.16.1 03-Aug-2004  skrll Sync with HEAD
 1.33.2.1 14-Jul-2004  tron Pull up revision 1.34 (requested by mhitch in ticket #645):
Bump NMBCLUSTERS to something a little more modern - 2048 for the
normal case and 4096 for the "options GATEWAY" case.
 1.34.12.1 30-Dec-2006  yamt sync with head.
 1.35.8.1 03-Sep-2006  yamt sync with head.
 1.35.4.1 09-Sep-2006  rpaulo sync with head
 1.36.80.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.36.60.1 11-Mar-2010  yamt sync with head
 1.37.6.1 17-Feb-2011  bouyer Sync with HEAD
 1.37.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.37.2.1 05-Mar-2011  rmind sync with head
 1.38.8.1 18-Feb-2012  mrg merge to -current.
 1.38.4.2 23-Jan-2013  yamt sync with head
 1.38.4.1 17-Apr-2012  yamt sync with head
 1.41.6.2 03-Dec-2017  jdolecek update from HEAD
 1.41.6.1 25-Feb-2013  tls resync with head
 1.43.14.1 19-Mar-2016  skrll Sync with HEAD
 1.44.18.1 10-Jun-2019  christos Sync with HEAD
 1.44.16.1 18-Jan-2019  pgoyette Synch with HEAD
 1.47.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.47.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.22 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.21 06-Feb-2012  matt branches: 1.21.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 07-Jun-2011  matt branches: 1.20.2; 1.20.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.19 24-May-2011  rmind branches: 1.19.2;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.18 04-Jan-2008  ad branches: 1.18.32; 1.18.38;
More header file cleanup.
 1.17 17-Oct-2007  garbled branches: 1.17.2; 1.17.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.16 17-May-2007  yamt branches: 1.16.10;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.15 24-Dec-2005  perry branches: 1.15.26; 1.15.30; 1.15.32; 1.15.38;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 28-Jul-2005  thorpej - Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.12 29-Jun-2003  fvdl branches: 1.12.2; 1.12.8; 1.12.16; 1.12.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11 29-Jun-2003  martin #ifdef _KERNEL_OPT police
 1.10 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.9 30-Nov-2002  simonb Add multiple-inclusion protection.
 1.8 20-Apr-2001  thorpej branches: 1.8.4;
Eliminate race conditions in the FP-switch code. MP kernels get
much further on the way to multi-user now.
 1.7 15-Aug-2000  thorpej branches: 1.7.2;
Implement MP-safe lazy FP context switching, modeled on the
way Bill Sommerfeld implemented it for x86 (and bug fixes
fed back to Bill :-)
 1.6 06-Apr-1997  cgd branches: 1.6.22;
clean up NetBSD RCS ID strings
 1.5 13-Nov-1996  cgd branches: 1.5.2;
update copyright dates
 1.4 07-Oct-1996  cgd change md_coredump struct to actually reflect the machine-dependent stuff
that's dumped. use it, rather than a hack, to export the info to user-land
(gdb).
 1.3 14-Jul-1996  cgd (1) Add machinery to make [fs]uswintr be a bit more careful when
determining if a fault was actually their fault. (Unfortunately, they're
not actually implemented now, anyway.)
(2) Minor cleanup.
 1.2 11-Jul-1996  cgd update to use new definitions in alpha_cpu.h
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.6.22.2 23-Apr-2001  bouyer Sync with HEAD.
 1.6.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.4.2 11-Dec-2002  thorpej Sync with HEAD.
 1.8.4.1 20-Apr-2001  thorpej file pcb.h was added on branch nathanw_sa on 2002-12-11 05:51:58 +0000
 1.12.18.3 21-Jan-2008  yamt sync with head
 1.12.18.2 03-Sep-2007  yamt sync with head.
 1.12.18.1 21-Jun-2006  yamt sync with head.
 1.12.16.1 30-Jul-2005  tron Pull up revision 1.13 (requested by thorpej in ticket #629):
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.12.8.1 29-Aug-2005  tron Pull up following revision(s) (requested by riz in ticket #5623):
sys/arch/alpha/alpha/machdep.c: revision 1.287
sys/arch/alpha/alpha/trap.c: revision 1.98
sys/arch/alpha/include/pcb.h: revision 1.13
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
 1.12.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.38.1 22-May-2007  matt Update to HEAD.
 1.15.32.1 11-Jul-2007  mjf Sync with head.
 1.15.30.1 27-May-2007  ad Sync with head.
 1.15.26.1 20-Mar-2007  yamt adapt alpha.
 1.16.10.2 09-Jan-2008  matt sync with HEAD
 1.16.10.1 06-Nov-2007  matt sync with HEAD
 1.17.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.17.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.18.38.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.32.2 12-Jun-2011  rmind sync with head
 1.18.32.1 31-May-2011  rmind sync with head
 1.19.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.21.48.1 10-Jun-2019  christos Sync with HEAD
 1.25 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.24 04-Jul-2021  thorpej branches: 1.24.16;
Reduce code duplication when setting up the interrupt handler data
structures:
- alpha_shared_intr_alloc() no longer takes a "string length" argument,
and just uses kmem_asprintf() to create an "irq %u" string by default.
This is suitable for nearly every caller.
- Add a alpha_shared_intr_set_string() that allows callers to override
the default IRQ description string.
- Related: make alpha_shared_intr_string() return a const char *, since
no callers should need to modify the string directly now.
- Re-factor PCI shared interrupt structure allocation / initialization
into a new alpha_pci_intr_alloc(), which is suitable for nearly every
Alpha PCI platform. Callers are expected to first have initialized
the interrupt hardware to the quiescent state.

Adjust various call sites of above functions to account for changes,
even if they are not able to use the newly re-factored code.
 1.23 19-Jun-2021  thorpej Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine. Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().
 1.22 27-May-2021  thorpej The Tsunami / Typhoon chipsets have a static "monster window" for DMA
that allows for up to 32GB of RAM to be direct-mapped if the PCI device
can issue a 64-bit address (the monster window lives at 0x10000000000).
Enable this window and provide this to the PCI bus as a "dmat64".
 1.21 26-Sep-2020  thorpej branches: 1.21.6; 1.21.8;
Implement cpu_intr_redistribute() for Tusnami/Titan systems.
 1.20 26-Sep-2020  thorpej Add support for CPU interrupt affinity for PCI interrupts:
- Keep a bitmap of eligible interrupt-handling CPUs in the pci_chipset_tag_t.
If this bitmap is 0, then we assume that all PCI interrupts should be
routed to the primary CPU.
- Add an optional PCI chipset callback for setting the CPU affinity of
an interrupt.
- When an establishing an interrupt handler, select the CPU that will
handle this irq using the following algorithm:
==> If the irq already has a CPU assignment, keep it.
==> Otherwise, find the CPU with the fewest registered handlers that
is eligible from both a hardware (based on the pci_chipset_tag_t)
and software (based on cpu_info::ci_schedstate.spc_flags) perspectives.
==> Fall back to the primary CPU failing all else.
 1.19 22-Sep-2020  thorpej Changes to make MPSAFE interrupts work on Alpha:

- Remove the ipl argument to scb_set() and the associated array of
"mpsafe" booleans initialized based on the ipl. It was bogus
anyway; all IPL_{BIO,NET,TTY}, etc. values are aliases of IPL_VM,
and for all practical purposes, there is really only one device
interrrupt level on Alpha anyway. Intead, we now treat all dispatches
from the SCB vector table as MP-safe, and it is now the handler for
that vector who is responsible for acquiring the KERNEL_LOCK if needed.

- Update the direct interrupt vector handlers in jensenio and TURBOchannel
to acquire the KERNEL_LOCK.

- Introduce a new ALPHA_INTR_MPSAFE flag, and add a flags argument to
alpha_shared_intr_establish(). When it is set, indicate that the
handler is MP-safe. Update alpha_shared_intr_dispatch() to pay
attention and acquire the KERNEL_LOCK (or not) as indicated.

- Re-factor all of the PCI interrupt handling, providing "generic PCI"
"PCI interrupts through ISA IRQs" implementations to significantly
reduce code duplication. Supplement the PCI chipset tag with more
info to facilitate this, and make the PCI interrupt-related routines
take a pci_chipset_tag_t argument rather than a void * argument.

- Because PCI interrupts on KN8AE are dispatched directly from the
SCB, provide a wrapper for non-MPSAFE interrupt handlers that
acquires the KERNEL_LOCK.

- Change the pci_intr_handle_t type to be a struct rather than an
integer type in order to catch any direct use of it as a value.
Add a set of functions to interact with pci_intr_handle_t, including
setting interrupt flags.

- Implement pci_intr_setattr() so that the PCI_INTR_MPSAFE attribute
can be set on a pci_intr_handle_t.

- While I'm here, make all of the MI PCI back-end operations call
through real functions rather than hopping directly through function
pointers in the chipset tag.

This change looks a lot bigger than it really is because of the re-factor
in the plethora of model-specific PCI interrupt back-ends. The KN8AE,
KN300, and T2/T3/T4 (Sable) are largely un-changed.
 1.18 29-Mar-2014  christos make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.17 21-Mar-2014  christos gc sprintf; reduce local static usage of interrupt strings that are only
used once for autoconf printing.
 1.16 20-Jan-2014  tsutsui Check and set "is_console" property to PCI displays for framebuffer drivers.

Tested on DS15 with radeonfb(4) and XP1000 with vga(4)
by Naruaki Etomi in PR/48431.
 1.15 06-Feb-2012  matt branches: 1.15.6; 1.15.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.14 14-Jun-2011  matt branches: 1.14.2; 1.14.6;
struct device * -> device_t
 1.13 04-Apr-2011  dyoung branches: 1.13.2;
Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

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

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

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

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

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

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

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

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

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

### evbmips-el GDIUM

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

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

### ia64 GENERIC

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

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
 1.12 11-Dec-2005  christos branches: 1.12.100; 1.12.106;
merge ktrace-lwp.
 1.11 29-Jul-2004  drochner remove now unnecessary "pci_enumerate_bus" definitions
 1.10 15-May-2002  thorpej branches: 1.10.10;
Let machine-dependent code specify how to enumerate the bus.
Currently, everyone uses pci_enumerate_bus_generic().
 1.9 15-May-2002  thorpej (*pc_decompose_tag)() is no longer alpha specific. Move it as appropriate.
 1.8 15-May-2002  thorpej Rename alpha_pci_decompose_tag() to pci_decompose_tag(). There *is*
some MI PCI code that uses it, and soon there will be more. (The rationale
for not making it available previously was that it could be mis-used, but
that's true of a lot of things.)
 1.7 08-Jun-2001  simonb branches: 1.7.2; 1.7.4;
For ports that wire up pciide in compatibility mode, have
them define __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH
in pci_machdep.h and pciide_map_compat_intr() only calls
pciide_machdep_compat_intr_establish() if that preprocessor
define exists.

Ports that don't need to do this no longer need to supply a
dummy function.
 1.6 28-Dec-2000  sommerfeld branches: 1.6.2;
Change pci_intr_map to get interrupt source information from a "struct
pci_attach_args *" instead of from four separate parameters which in
all cases were extracted from the same "struct pci_attach_args".

This both simplifies the driver api, and allows for alternate PCI
interrupt mapping schemes, such as one using the tables described in
the Intel Multiprocessor Spec which describe interrupt wirings for
devices behind pci-pci bridges based on the device's location rather
the bridge's location.

Tested on alpha and i386; welcome to 1.5Q
 1.5 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.4 01-Jun-2000  cgd kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.3 19-Mar-1999  cgd branches: 1.3.8; 1.3.16;
move pci/pci_machdep.h to include/pci_machdep.h. (can't do it via
repository copy because alpha already had an include/pci_machdep.h in
the attic.)
 1.2 12-Apr-1996  cgd this file is no longer used
 1.1 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.4.2 20-Jun-2002  nathanw Catch up to -current.
 1.7.4.1 08-Jun-2001  nathanw file pci_machdep.h was added on branch nathanw_sa on 2002-06-20 03:37:38 +0000
 1.7.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.10.1 03-Aug-2004  skrll Sync with HEAD
 1.12.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.100.1 21-Apr-2011  rmind sync with head
 1.13.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.14.6.1 18-Feb-2012  mrg merge to -current.
 1.14.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.2.1 17-Apr-2012  yamt sync with head
 1.15.10.1 18-May-2014  rmind sync with head
 1.15.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.8.1 31-May-2021  cjep sync with head
 1.21.6.2 01-Aug-2021  thorpej Sync with HEAD.
 1.21.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.24.16.1 02-Aug-2025  perseant Sync with HEAD
 1.10 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.9 12-Aug-2011  dyoung branches: 1.9.2; 1.9.6;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 1.8 13-Jul-2011  dyoung #include <machine/bus_defs.h> instead of <machine/bus.h>.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 07-Jan-2001  thorpej branches: 1.6.126; 1.6.128; 1.6.130;
Make this C++ safe.
 1.5 19-Jun-2000  simonb branches: 1.5.2;
s/ouwl/outl/ in macro definition.
 1.4 08-Jun-2000  thorpej And more ANSI'ification!
 1.3 26-Feb-2000  thorpej branches: 1.3.2;
x86-style PIO ops for USERLAND ONLY! Requires -lalpha.
 1.2 23-Nov-1995  cgd branches: 1.2.4;
wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 28-Jun-1995  cgd Support for ISA programmed I/O functions.
 1.2.4.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 25-Jan-2001  jhawk Pull up revision 1.6 (requested by thorpej):
Make this file safe for inclusion in C++ programs.
 1.6.130.1 16-May-2008  yamt sync with head.
 1.6.128.1 18-May-2008  yamt sync with head.
 1.6.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 18-Feb-2012  mrg merge to -current.
 1.9.2.1 17-Apr-2012  yamt sync with head
 1.100 15-Jul-2025  andvar Fix various typos in comments.
 1.99 19-Jul-2022  riastradh branches: 1.99.10;
alpha: Fix missing includes in pmap.h.
 1.98 31-May-2021  thorpej Additional comment about the range (0-1025) that's needed for the PT page
reference count, and thus now many bits we need to scare up.
 1.97 31-May-2021  thorpej After a comment by joerg@, go back to using a dedicated field for the
PT page reference count, but add an XXX comment stating the desire to
find a safely-unused field in the vm_page structure when pages are in-
use as PT pages, so that we can save the 8 bytes per page needed for
this.
 1.96 30-May-2021  thorpej Implement pmap_remove_all().
 1.95 30-May-2021  thorpej When removing mappings, hang PV entries to be freed off of the
pmap_tlb_context structure, and free them back in bulk after we
release all of our locks (as we do with PT pages that are freed).
 1.94 30-May-2021  thorpej Keep track of a pmap's PV entries with a list hanging off the pmap.
 1.93 30-May-2021  thorpej Store the modified / referenced attribute bits in the lower 2 bits of
the PV entry list pointer in struct vm_page_md. This reduces the size
of that structure from 16 bytes to 8, and will go a fair way to making
up for increasing the size of struct pv_entry in a future commit.
 1.92 30-May-2021  thorpej Define a macro, VM_MDPAGE_PVS(), for fetching the first pv entry
for a page.
 1.91 30-May-2021  thorpej Pages that are in-use as page table pages should never be part of a
UVM loan transaction, so use the vm_page::loan_count field as the PT
page reference count.
 1.90 30-May-2021  thorpej Track the PT pages allocated to a pmap in the pmap itself.
 1.89 30-May-2021  thorpej Define a pmap_pagelist LIST_HEAD and use it where we used ad hoc LIST_HEADs
of vm_page structures. Define and use a generic routine to free such a list
back to UVM.

In pmap_remove_internal(), KASSERT that no PT pages are queued up to be
freed when removing mappings from the kernel pmap.
 1.88 29-May-2021  thorpej Move the pointer to the pmap's lev1map out of the shared pmap structure
and into each CPU's pmap_percpu area. This pointer is constant for the
life of the pmap, and moving it gives us an additional 8 bytes in the
shared pmap structure.

Because the kernel pmap does not have per-CPU data, all places where we
need the kernel pmap's lev1map now just reference kernel_lev1map directly.
 1.87 29-May-2021  thorpej Rather than tracking "needs I-sync on return to userspace" in a bitmap,
track it with a separate field in the pmap_percpu. Not only does this
reduce cache line contention ever so slightly, it also frees up a field
in the shared portion of the pmap structure.
 1.86 29-May-2021  thorpej Rename pmap_asn_info to pmap_percpu, and pmap::pm_asni to pmap::pm_percpu.
No functional change.
 1.85 24-May-2021  thorpej pmap_tlb_shootdown_all_user() can be called in the PV scenario as well
as the forward scenario, for example if a pmap_page_protect() to remove
all mappings results in the freeing of a PT page. It therefore needs
to do the same reference counting dance as pmap_tlb_shootdown_pv().

Also fix a use-after-free error in pmap_page_protect().

Add / tweak some assertions, and shrink the pmap::pm_count field from
long to unsigned int (which gave me a spare unsigned int field for
debugging purposes).

PR port-alpha/56201.
 1.84 03-Sep-2020  thorpej branches: 1.84.6; 1.84.8;
Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.83 29-Aug-2020  thorpej - Centralize per-CPU pmap initialization into a new pmap_init_cpu()
function. Call in from pmap_bootstrap() for the boot CPU, and
from cpu_hatch() for secondaary CPUs.
- Eliminiate the dedicated I-stream memory barrier IPI; handle it all from
the TLB shootdown IPI. Const poison, and add some additional memory
barriers and a TBIA to the PAUSE IPI.
- Completly rewrite TLB management in the alpha pmap module, borrowing
somoe ideas from the x86 pmap and adapting them to the alpha environment.
See the comments for theory of operation. Add a bunch of stats that
can be reported (disabled by default).
- Add some additional symbol decorations to improve cache behavior on
MP systems. Ensure coherency unit alignment for several structures
in the pmap module. Use hashed locks for pmap structures.
- Start out all new processes on the kernel page tables until their
first trip though pmap_activate() to avoid the potential of polluting
the current ASN in TLB with cross-process mappings.
 1.82 23-Jul-2020  skrll unifdef -U_LKM
 1.81 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.80 19-May-2018  thorpej branches: 1.80.2;
Implement PMAP_DIRECT / pmap_direct_process() in support of experimental
UBC optimizations.
 1.79 01-Jan-2014  matt branches: 1.79.28;
Fix PMAP_SIZEOF() to deal with that the pmap has 0 pmap_asn_info now.
Addresses PR/48488.
 1.78 04-Nov-2013  christos convert to flex array
 1.77 06-Feb-2012  matt branches: 1.77.6; 1.77.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.76 14-Nov-2010  uebayasi branches: 1.76.8; 1.76.12;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.75 26-Oct-2009  thorpej branches: 1.75.2; 1.75.4;
Garbage-collect pmap_do_reactivate() and the associated IPI -- nothing has
used them for a long time.
 1.74 15-Mar-2009  cegger ansify function definitions
 1.73 09-Dec-2008  pooka branches: 1.73.2;
In case of no _KERNEL_OPT, always define _PMAP_MAY_USE_PROM_CONSOLE
 1.72 09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

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

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.71 28-Apr-2008  martin branches: 1.71.6; 1.71.8;
Remove clause 3 and 4 from TNF licenses
 1.70 10-Mar-2008  ad branches: 1.70.2; 1.70.4;
Finish moving alpha over to the MI atomic ops.
 1.69 02-Jan-2008  ad branches: 1.69.2; 1.69.6;
Merge vmlocking2 to head.
 1.68 21-Feb-2007  thorpej branches: 1.68.10; 1.68.22; 1.68.28; 1.68.30; 1.68.34;
Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.67 02-Apr-2006  thorpej branches: 1.67.14;
Static'ify.
 1.66 16-Feb-2006  perry branches: 1.66.2; 1.66.4; 1.66.6;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.65 24-Dec-2005  perry branches: 1.65.2; 1.65.4; 1.65.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.64 11-Dec-2005  christos merge ktrace-lwp.
 1.63 24-Aug-2003  chs branches: 1.63.16;
add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.62 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.61 02-Aug-2003  matt Make this compile with gcc3. Change kernel_pmap_store to array of struct
pmap instead of array u_long. A bit of space is wasted but it supresses
the -Wcast-align warning.
 1.60 09-Apr-2003  nathanw branches: 1.60.2;
POOL_VTOPHYS: Cast argument to ALPHA_K0SEG_TO_PHYS() to vaddr_t to
prevent gcc complaining about bitwise operations on pointers.
 1.59 09-Apr-2003  thorpej Add the ability for pool caches to cache the physical address of
objects. Clients of the pool_cache API must consistently use
the "paddr" variants or not, otherwise behavior is undefined.

Enable this on Alpha, ARM, MIPS, and x86. Other platforms must
define POOL_VTOPHYS() in the appropriate manner in order to enable
the feature.

Part 1 of a series of simple patches contributed by Wasabi Systems
to improve network performance.
 1.58 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.57 24-Sep-2002  ad Remove the TCWSCONS config now that zstty can do flow control on IOASIC
machines.
 1.56 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.55 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.54 10-Sep-2001  chris Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

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

Reviewed by Jason.
 1.53 15-Jul-2001  thorpej branches: 1.53.2; 1.53.4;
Defer sending shootdown IPIs a bit longer. Reduces traffic a fair
bit more.
 1.52 15-Jul-2001  thorpej - Tweak the pmap locking protocol slightly -- require that a pmap must
be locked before it can be marked as `active' on a processor.
- Require that pmaps other than the kernel pmap be locked when they
are passed to pmap_tlb_shootdown(). This, combined with the locking
protocol tweak, allow us to get a consistent view of `activeness' of
a pmap, which means we can optmize away a lot of TLB shootdown traffic
for user pmaps.
- Borrow an idea from the i386mp branch; use the normal SHOOTDOWN IPI
to deal with hitting the entire TLB, and garbage-collect the TBIA
and TBIAP IPIs.
 1.51 30-May-2001  mrg branches: 1.51.2;
use _KERNEL_OPT
 1.50 26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.49 01-May-2001  thorpej Delete the pmap_copy() calls.
 1.48 01-May-2001  thorpej Use a single linked list for PV entries. This saves 1MB of space
on my 1G RAM AlphaServer.
 1.47 01-May-2001  thorpej Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.46 29-Apr-2001  thorpej Add a VM_MDPAGE_MEMBERS macro that defines pmap-specific data for
each vm_page structure. Add a VM_MDPAGE_INIT() macro to init this
data when pages are initialized by UVM. These macros are mandatory,
but ports may #define them to nothing if they are not needed/used.

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

Use all this stuff to eliminate a lot of extra work in the Alpha
pmap module (it's smaller and faster now). Changes to other pmap
modules will follow.
 1.45 29-Apr-2001  thorpej Add glue for page zero'ing in the idle loop.
 1.44 24-Apr-2001  thorpej Delete a couple of statistics that are not really worth keeping.
 1.43 24-Apr-2001  thorpej Gather ASN info into a single structure, and place a variable-length
array of those structures at the end of the pmap structure. We compute
the size of the pmap structure based on the maximum CPU ID for a
particular machine. This gives us better cache behavior and better
memory footprint for the ASN info.
 1.42 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.41 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.40 21-Apr-2001  thorpej #define away pmap_update() in <machine/pmap.h> so that no function
call overhead is incurred as we start sprinkling pmap_update() calls
throughout the source tree (no pmaps currently defer operations, but
we are adding the infrastructure to allow them to do so).
 1.39 20-Apr-2001  thorpej pmap_asn_alloc(): In a multiprocessor configuration, it's possible
to arrive here referencing the kernel_lev1map without having the
RESERVED ASN -- another CPU may have caused pmap_lev1map_destroy()
to be called, and that routine only invalidates the ASN for the
CPU that called it. So, in the MULTIPROCESSOR case, simply assign
the RESERVED ASN if we reference the kernel_lev1map rather than
asserting that we already have the RESERVED ASN. Thanks to Bill
Sommerfeld for helping me track down the problem.

Also add a new IPI that causes a CPU to re-activate its address
space if the pmap it's using changes level 1 maps (this probably
won't happen very often, but it's correct to have it).

This makes Alpha MP kernels boot multiuser. In fact, this commit
is being made from my dual-CPU AlphaServer 1200 running an MP kernel.
 1.38 22-Nov-2000  thorpej branches: 1.38.2;
Several changes, which get us generally further along with
multiprocessor support:
- Implement MP-safe halt.
- Make the FPU saving code more like Bill's on the i386 MP branch.
XXX This code will no doubt be revisited again.
- Pass the cpu_info and trapframe to IPI handlers, saving some work
in the handlers themselves, and also making it possible for the
"pause" handler to reference register state for DDB.
- Add "machine cpu" to DDB, making it possible to reference other
CPUs registers (and thus get e.g. a traceback) from whichever
CPU is actually running the debugger.
- Garbage-collect "machine halt" and "machine reboot" DDB commands.
They don't have a prayer of working properly in multiprocessor
kernels, and didn't really work all that well in uniprocessor kernels.
 1.37 19-Nov-2000  thorpej Implement pmap_growkernel().
 1.36 26-Aug-2000  thorpej Snapshot of TLB shootdown bugfixes.
 1.35 08-Jun-2000  thorpej And more ANSI'ification!
 1.34 23-May-2000  thorpej branches: 1.34.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.33 01-Mar-2000  thorpej Infrastructure for lazy istream sync in the pmap module:
- Add a bitmask for the CPUs which need an isync before this pmap returns
to userspace on that CPU.
- Define PMAP_USERRET(), a utility macro for userret() to use to process
the deferred isync, and call it as appropriate in userret().
 1.32 28-Nov-1999  thorpej - Use alpha_atomic_{add,sub}_q() to update the pmap statistics. We now no
longer need to lock the kernel pmap in pmap_kenter_pa() and pmap_kremove().
- Since locking the kernel pmap in interrupt context is no longer required,
don't go to splimp() when locking the kernel pmap.
- Implement a new pmap_remove() function, not yet enabled by default. It
is structured like pmap_protect, and should be *much* faster. This was
actually written quite some time ago, but never committed because it
didn't work properly. Given the recent bugfix to pmap_protect(), "duh,
of course it didn't work properly before...". It seems to work fine now
(have done several builds and run the UVM regression tests using the new
code), but it is currently run-time optional so that some performance
measurements can be easily run against the old and new code.
 1.31 24-May-1999  thorpej branches: 1.31.2; 1.31.8;
The kernel pmap can be accessed (and locked!) while in an interrupt
context, so we must block interrupts which may cause memory allocation
before asserting the kernel pmap's lock. Put this all in PMAP_LOCK()
and PMAP_UNLOCK() macros to make it easier.
 1.30 23-May-1999  thorpej Make the list of all pmaps LRU-ordered, and update a comment regarding
locking.
 1.29 23-May-1999  thorpej Save ourselves some work in some pv list traversal functions; keep a pointer
to the PTE that maps the page in the pv_entry so that we don't have to
compute it from the pmap/va.
 1.28 21-May-1999  thorpej Use the pool allocator for pv_entry structures. Set a (patchable/config'able)
low water mark on the pool, so we have some chance of crawling along in
extreme memory shortages.
 1.27 15-Apr-1999  thorpej DEC_KN300 no longer uses PROM console.
 1.26 24-Feb-1999  thorpej branches: 1.26.2;
First-cut at multiprocessor TLB shootdown. This simple implementation can
probably be improved somewhat, but an attempt to be efficient has been
made.

Note: TLB shootdowns are NOT YET ENABLED.
 1.25 04-Feb-1999  thorpej Define a macro which has human readable strings corresponding to PGU_*
constants.
 1.24 22-Sep-1998  thorpej Add some support for multiple processors to the pmap module. Still left
to do: TLB shootdown code, but that will be much easier to write once
the code to spin up the additional CPUs is working.
 1.23 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.22 24-Jul-1998  thorpej Provide PMAP_{,UN}MAP_POOLPAGE().
 1.21 11-Jun-1998  thorpej Define a macro to test PG_EXEC.
 1.20 20-May-1998  thorpej Add fine-grained locking, using a locking protocol modeled after the i386
UVM pmap's locking protocol, written by Chuck Cranor. Not all of the
support for multiple processors is here yet, but the kernel does run
under moderate loads with LOCKDEBUG (all locking operations are no-ops
unless LOCKDEBUG is turned on).

This is by no means complete... there are still some possible snares
to take a look at.
 1.19 19-May-1998  thorpej Make PT page reference counting more generic so it can be used for other
special use page types.
 1.18 19-May-1998  thorpej The Alpha architecture has a variable page size; don't hardwire the
number of PV entries per page at compile time.
 1.17 19-May-1998  thorpej Make the page attribute manifest constant names have similar form to
page usage manifest constant names.
 1.16 19-May-1998  thorpej Keep track of page usage inside the pmap (pvent, l{1,2,3}pt page, "normal").
 1.15 27-Apr-1998  thorpej Increase the efficiency of pmap_l{2,3}pte() somewhat, by allowing the
caller to pass an optional 3rd argument, which is the previous level
PTE corresponding the virtual address. If this argument is non-NULL,
the table walk otherwise necessary will be bypassed.
 1.14 15-Apr-1998  mjacob oops- add missing include
 1.13 15-Apr-1998  mjacob add Alpha 4100 support
 1.12 26-Mar-1998  thorpej if NEW_SCC_DRIVER, 3000/300 and 3000/500 aren't PROM console candidates.
 1.11 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.10 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.9 20-Aug-1996  cgd branches: 1.9.2;
OLD_PMAP -> NEW_PMAP
 1.8 09-Jul-1996  cgd temporarily move new pmap code into a seperate header, so changes to
one version won't spam people compiling with the option to get the other.
 1.7 02-Jul-1996  cgd minor cleanups to fit into the NetBSD source tree better (e.g. remove
RCS Log messages). Haven't even tried to compile it yet.
 1.6 02-Jul-1996  cgd pull in the Mach3 alpha pmap, as a base for the new pmap module. Modified
from the mach3 versions only as much as necessary to allow the old
NetBSD/Alpha pmap code to compile. THESE WILL NOT WORK AS-IS, and at
minimum will require code to implement reference- and modified-bit
emulation.
 1.5 02-Jul-1996  cgd if OLD_PMAP defined, pull in <machine/pmap.old.h> and ignore the other
contents of this file.
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.9.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.26.2.1 16-Apr-1999  thorpej branches: 1.26.2.1.2;
Pull up 1.26 -> 1.27.
 1.26.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.31.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.31.2.4 23-Apr-2001  bouyer Sync with HEAD.
 1.31.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.31.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.31.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.34.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.38.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.51.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.51.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.51.2.1 03-Aug-2001  lukem update to -current
 1.53.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.53.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.53.2.3 21-Sep-2001  nathanw Catch up to -current.
 1.53.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.53.2.1 15-Jul-2001  nathanw file pmap.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.60.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.2.1 03-Aug-2004  skrll Sync with HEAD
 1.63.16.4 17-Mar-2008  yamt sync with head.
 1.63.16.3 21-Jan-2008  yamt sync with head
 1.63.16.2 26-Feb-2007  yamt sync with head.
 1.63.16.1 21-Jun-2006  yamt sync with head.
 1.65.6.1 22-Apr-2006  simonb Sync with head.
 1.65.4.1 09-Sep-2006  rpaulo sync with head
 1.65.2.1 18-Feb-2006  yamt sync with head.
 1.66.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.66.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.66.2.1 11-Apr-2006  yamt sync with head
 1.67.14.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.68.34.1 02-Jan-2008  bouyer Sync with HEAD
 1.68.30.1 30-Dec-2007  ad Locking changes for alpha.
 1.68.28.1 18-Feb-2008  mjf Sync with HEAD.
 1.68.22.2 23-Mar-2008  matt sync with HEAD
 1.68.22.1 09-Jan-2008  matt sync with HEAD
 1.68.10.1 18-Apr-2007  thorpej Convert to the new atomic op API.
 1.69.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.69.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.69.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.69.2.1 24-Mar-2008  keiichi sync with head.
 1.70.4.3 11-Mar-2010  yamt sync with head
 1.70.4.2 04-May-2009  yamt sync with head.
 1.70.4.1 16-May-2008  yamt sync with head.
 1.70.2.1 18-May-2008  yamt sync with head.
 1.71.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.71.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.71.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.73.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.75.4.1 05-Mar-2011  rmind sync with head
 1.75.2.2 15-Nov-2010  uebayasi Sync with HEAD.
 1.75.2.1 25-Feb-2010  uebayasi Use VM_PAGE_TO_MD(). Only compile tested.
 1.76.12.1 18-Feb-2012  mrg merge to -current.
 1.76.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.76.8.1 17-Apr-2012  yamt sync with head
 1.77.10.1 18-May-2014  rmind sync with head
 1.77.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.28.1 21-May-2018  pgoyette Sync with HEAD
 1.80.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.84.8.1 31-May-2021  cjep sync with head
 1.84.6.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.99.10.1 02-Aug-2025  perseant Sync with HEAD
 1.9 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.8 03-Jan-1998  thorpej Now that all ports have pmap_activate(), and it has an identical interface,
prototype it in <vm/pmap.h>
 1.7 14-Oct-1997  mjacob Remove __VM_PMAP_HACK.
 1.6 02-Sep-1997  thorpej Make the pmap_activate() and pmap_deactivate() interfaces consistent my
passing them a proc *, which encapsulates all of the information necessary
to activate an address space.
 1.5 16-May-1997  gwr branches: 1.5.4;
Add #define __VM_PMAP_HACK as a temporary measure.
 1.4 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.3 20-Aug-1996  cgd branches: 1.3.2;
add cached dirbase PFN, protos for pmap_{,de}activate()
 1.2 10-Jul-1996  cgd it compiles, but DEFINITELY does not run
 1.1 09-Jul-1996  cgd temporarily move new pmap code into a seperate header, so changes to
one version won't spam people compiling with the option to get the other.
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.4.2 15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33 26-Mar-1998  thorpej Remove the Mach 3 pmap from the tree, replacing it with the contents of
pmap.old.<whatever>. To see the history, look at the corresponding
pmap.old.<whatever> file.
 1.32 22-Mar-1998  thorpej Replace PMAP_ASNGEN_INVALID with PMAP_ASN_RESERVED.
 1.31 18-Mar-1998  thorpej Add ASN housekeeping and a CPU mask to the pmap.
 1.30 18-Mar-1998  thorpej Move the "are we active" macros out of the header file.
 1.29 18-Mar-1998  thorpej Pass the max ASN from the HWRPB to pmap_boostrap().
 1.28 18-Mar-1998  thorpej Add a macro to test if PG_ASM (Address Space Match) is set in a PTE.
 1.27 17-Mar-1998  thorpej Add a software PTE bit that indicates that a va -> pa mapping was entered
in the physical->virtual list.
 1.26 12-Mar-1998  thorpej Garbage-collect this a bit.
 1.25 12-Mar-1998  thorpej Massive cleanup and partial rewrite of the NetBSD/alpha pmap module.

Major change is that page table page management has been completely
rewritten. Page tables are now accessed via K0SEG (no more KVA space
wasted on user page tables), and a much larger user address space is
supported.

Many thanks to Chris Demetriou and Ross Harvey for helpful insight and
debugging assistance.
 1.24 07-Mar-1998  thorpej Export a pointer to the Virtual Page Table.
 1.23 06-Mar-1998  thorpej pmap_ste() -> pmap_l2pte(), pmap_pte() -> pmap_l3pte()
 1.22 06-Mar-1998  thorpej Move pmap_pte*() macros into the header file, nuke pmap_ste_v(), add
pmap_lev1pte().
 1.21 01-Mar-1998  ross Remove the A12 from the rogue's gallery of the promcons-addicted.
 1.20 27-Feb-1998  thorpej Revamp pv_table management:
- Make pv_table an array of struct pv_head's, which contain LIST_HEADs
for the pv_entry's, as well as page attributes (mod, ref, ptpage).
- Use <sys/queue.h> to manipulate pv_entry lists.
- Fix several obvious bugs in pmap_collect_pv().
- Use K0SEG to access pv_page's.
 1.19 27-Feb-1998  thorpej Step 1 of the Grand Alpha Pmap Rototill:
- Clean up pmap_bootstrap() some, and make a slight change to how the
PROM mappings are saved.
- Give each pmap its own level 1 page table, rather than sharing a global
level 1 page table. This will eventually allow for Very Large user
address spaces.
- Keep a list of all pmaps, so that when kernel level 2 page tables are
allocated, all level 1 tables may be updated.
- Add a couple of functions for allocating and freeing page table pages.
- Add a few comments about ASN allocation.
 1.18 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.17 13-Feb-1998  cgd Clean up kernel initialization. Use the bootinfo structure (or innate
knowledge) earlier, and gather all information needed earlier. Mark the
init code carefully re: when it can print stuff out, when it can expect
the firmware to stop working, etc. Be more careful about using the PROM
console and other PROM facilities, and hint that in the future all use
of firmware/boot program callbacks by the kernel should go away (since
the world may not be mapped the way the firmware/boot program wants!).
 1.16 09-Jan-1998  thorpej If MACHINE_NEW_NONCONTIG is defined, activate the pmap_steal_memory()
interface.
 1.15 09-Jan-1998  thorpej Get rid of some old cruft.
 1.14 09-Jan-1998  thorpej Gather pv_table and pmap_attributes things togther, and macro'ize
access to them a little better.

Also, improve the performance of pmap_is_{referenced,modified}() and
pmap_clear_{reference,modify}() somewhat.
 1.13 03-Jan-1998  thorpej Now that all ports have pmap_activate(), and it has an identical interface,
prototype it in <vm/pmap.h>
 1.12 17-Nov-1997  ross Put in Jason's recommended fix for the null-curproc-in-pmap.old.c problem.
 1.11 03-Sep-1997  thorpej branches: 1.11.4;
From hp300 pmap: use mycroft's pv_entry allocator (from i386 port).
 1.10 03-Sep-1997  thorpej Update from hp300 pmap: define an active_user_pmap() macro and use it.
 1.9 02-Sep-1997  thorpej branches: 1.9.2;
PMAP_{,DE}ACTIVATE() are no longer exported from the Utah-derived pmap.
 1.8 02-Sep-1997  thorpej - Make the pmap_activate() and pmap_deactivate() interfaces consistent my
passing them a proc *, which encapsulates all of the information necessary
to activate an address space.
- Garbage-collect pmap->pm_stchanged; it's not really used for anything.
 1.7 06-Apr-1997  cgd branches: 1.7.2;
clean up NetBSD RCS ID strings
 1.6 13-Nov-1996  cgd branches: 1.6.2;
compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.5 09-Jul-1996  cgd redefine lots of things in terms of definitions in alpha_cpu.h
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.9.2.2 02-Sep-1997  thorpej PMAP_{,DE}ACTIVATE() are no longer exported from the Utah-derived pmap.
 1.9.2.1 02-Sep-1997  thorpej file pmap.old.h was added on branch bouyer-scsipi on 1997-09-02 23:52:56 +0000
 1.11.4.1 17-Nov-1997  thorpej Sync w/ trunk (ross).
 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:31:33 +0000
 1.1.4.2 30-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-30 00:18:51 +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 01:02:38 +0000
 1.23 22-Jul-2021  thorpej Use __BITS() to define MDLWP_FP_C.
 1.22 16-May-2014  matt branches: 1.22.44;
Cleanup and simplify PCU FP support. Nuke MDLWP_FPUSED.
 1.21 06-Feb-2012  matt branches: 1.21.6; 1.21.10; 1.21.20;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.20 07-Jun-2011  matt branches: 1.20.2; 1.20.6;
Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.19 14-Jan-2011  rmind branches: 1.19.6;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.18 21-Nov-2009  rmind branches: 1.18.4;
- Use lwp_getpcb() on Alpha.
- Replace and clean struct user usage, slightly simplify some code parts.
- Include sys/user.h in MD proc.h .
 1.17 09-Feb-2007  ad branches: 1.17.48;
Merge newlock2 to head.
 1.16 24-Dec-2005  perry branches: 1.16.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.15 11-Dec-2005  christos merge ktrace-lwp.
 1.14 21-Sep-2003  skd branches: 1.14.16;
Backed out single step emulation.
Approved by thorpej@netbsd.org.
 1.13 18-Sep-2003  skd Added kernel support for single stepping, adapted from FreeBSD.
Approved by christos.
 1.12 17-Jan-2003  thorpej branches: 1.12.2;
Merge the nathanw_sa branch.
 1.11 14-Jul-2001  thorpej branches: 1.11.2;
Cosmetic change.
 1.10 26-Apr-2001  ross branches: 1.10.2;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.9 19-Jan-2001  thorpej branches: 1.9.2;
Make ASTs per-process.
 1.8 14-Dec-2000  mycroft Do the previous with a forwarding declaration of struct proc instead.
 1.7 14-Dec-2000  mycroft Wrap mdproc in #ifdef _KERNEL.
 1.6 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.5 10-Aug-1999  thorpej branches: 1.5.2;
Move cpu_info and related info into <machine/cpu.h>, and implement the
other MP API components discussed on tech-smp.
 1.4 23-Feb-1999  thorpej Now that we have the kthread mechanism, massively clean up the way
additional processors are spun up on multiprocessor Alpha systems.
Now, each processor gets its own idle thread (the primary processor
uses proc0). This idle thread is used in switch_exit(), rather than
explicitly referencing proc0.

Also, make `curproc', `fpcurproc', and `curpcb' per-cpu values. This
required some data structure rearrangement; cpu info is now statically
allocated in the BSS, rather than via malloc(), and cpu_softc is gone.
(Modeled somewhat after NetBSD/sparc's multiprocessor info structures.)
 1.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 24-Mar-1995  cgd branches: 1.2.4;
remove support for double-mapping the user area/kernel stack
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.5.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.5.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.5.2.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.1 03-Aug-2001  lukem update to -current
 1.11.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.11.2.1 14-Jul-2001  nathanw file proc.h was added on branch nathanw_sa on 2001-08-30 23:43:43 +0000
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.16.2 26-Feb-2007  yamt sync with head.
 1.14.16.1 21-Jun-2006  yamt sync with head.
 1.16.20.1 11-Jan-2007  ad Checkpoint work in progress.
 1.17.48.1 11-Mar-2010  yamt sync with head
 1.18.4.2 12-Jun-2011  rmind sync with head
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.19.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.21.20.1 10-Aug-2014  tls Rebase.
 1.21.10.1 18-May-2014  rmind sync with head
 1.21.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.44.1 01-Aug-2021  thorpej Sync with HEAD.
 1.11 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.10 05-Sep-2000  thorpej branches: 1.10.164; 1.10.168;
Move the Alpha _mcount() into a .S file so that it can be
pre-processed, like other Alpha assembly files.
 1.9 06-Apr-1997  cgd branches: 1.9.22;
clean up NetBSD RCS ID strings
 1.8 19-Dec-1996  cgd __asm rather than asm, to make lint happy without -g
 1.7 13-Nov-1996  cgd branches: 1.7.2;
update copyright dates
 1.6 15-Sep-1996  cgd save and restore registers symmetrically. don't forget to restore PV (t12).
 1.5 21-Aug-1996  cgd PSL_IPL_HIGH -> ALPHA_PSL_IPL_HIGH
 1.4 09-Jul-1996  cgd profile_swpipl() -> _alpha_pal_swpipl()
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.7.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.2.1 24-Jan-1997  cgd sync with trunk
 1.9.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.168.1 18-Feb-2012  mrg merge to -current.
 1.10.164.1 17-Apr-2012  yamt sync with head
 1.17 02-Mar-2024  thorpej Add the basic framework for the DEC KN7AA ("Ruby") systems -- DEC 7000
and DEC 10000.

This is a work-in-progress, but this should be sufficient for the system
to boot, using the PROM console routines (and then proceed to not find any
devices because we don't yet support the "Laser System Bus").
 1.16 03-Oct-2020  thorpej Qemu loads the kernel directly, and so there's no bootloader to provide
a "bootinfo" structure for us. Qemu does, however, place a Linux kernel
parameter block at kernel_text[] - 0x6000 that contains Linux-style kernel
command line arguments. So, add a prom_qemu_getenv() that allows us to
look for specific things passed along to the kernel from there, and use
them as follows:

- Support specifying the root device in the forms "root=/dev/wd0a",
"root=wd0a", or "rootdev=wd0".
- Support SRM-like -flags ... in the form of "flags=AD". In the case of
Qemu, we also assume that no flags=... is the same as "flags=A", i.e.
perform an auto-boot.

Also allow an alternate delay() function to be specified, if the platform
wishes to provide one.
 1.15 03-Sep-2020  thorpej Clean up all of the _PMAP_MAY_USE_PROM_CONSOLE crapola, centralizing the
logic in prom.c, and rename it _PROM_MAY_USE_PROM_CONSOLE in a few places
it's still needed.
 1.14 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.13 24-May-2011  rmind branches: 1.13.4; 1.13.8;
Convert some simple_lock uses to mutex(9).
Tested by: jak@, mhitch@
 1.12 08-Jun-2000  thorpej branches: 1.12.154; 1.12.160;
And more ANSI'ification!
 1.11 15-Oct-1998  ross branches: 1.11.12; 1.11.20;
1. STANDALONE -> _STANDALONE
2. Key raw prom interfaces defes on ENABLEPROM
3. Define the prom "ioctl" magtape functions.
 1.10 06-Oct-1998  thorpej Split hwrpb_restart_setup(), putting the code that initializes the vtpb
and primary hwpcb into hwrpb_primary_init(). Call the latter before
performing autoconfiguration().
 1.9 24-Sep-1998  thorpej Make prom_enter() and prom_leave() public.
 1.8 25-May-1998  thorpej Add "SCSIID" and "SCSIFAST" environment variables present on the
DEC 3000 systems.
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 13-Nov-1996  cgd branches: 1.6.2;
update copyright dates
 1.5 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.4 15-Oct-1996  cgd define and call a new function, hwrbp_restart_setup(). It's called after
autoconfiguration to clear the RPB's per-cpu-slot BIP flag and to set up the
RPB's restart function pointers, etc.
 1.3 26-Sep-1996  cgd add support for the prom 'write' operation.
 1.2 23-Apr-1996  cgd prom_halt doesn't return; give it a noreturn attribute
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.11.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 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.160.1 06-Jun-2011  jruoho Sync with HEAD.
 1.12.154.1 31-May-2011  rmind sync with head
 1.13.8.1 18-Feb-2012  mrg merge to -current.
 1.13.4.1 17-Apr-2012  yamt sync with head
 1.7 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.6 09-Jul-1996  cgd branches: 1.6.2;
Everything which would be defined here is defined in
alpha_cpu.h, and this file is no longer necessary for the
Alpha. However, some machine-independent code (e.g.
/sys/compat/common/kern_exit_43.c) still wants a file with
this name to be around.
 1.5 23-Apr-1996  cgd pal_halt doesn't return; give it a noreturn attribute.
Mark assembly that uses 'mb' as clobbering memory (pthreads does, and
it can't hurt).
 1.4 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.3 03-Aug-1995  cgd rename MB to wbflush, make it inline
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.6.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.31 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.30 28-Apr-2008  martin branches: 1.30.34; 1.30.38;
Remove clause 3 and 4 from TNF licenses
 1.29 11-Dec-2005  christos branches: 1.29.74; 1.29.76; 1.29.78;
merge ktrace-lwp.
 1.28 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.27 14-Oct-2002  chs branches: 1.27.6;
eliminate PT_ENTRY_NULL in favor of plain old NULL.
 1.26 09-Apr-1999  thorpej branches: 1.26.14;
Fix a bug in TBI optimization uncovered by the "access_type" changes. Thanks
to Bernd Ernesti for providing crash dumps to Charles Hannum who tracked
it down.
 1.25 14-Aug-1998  thorpej branches: 1.25.6;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.24 01-Aug-1998  thorpej Remove some lint.
 1.23 08-Jul-1998  thorpej Define a macro that returns the mask of PALcode PTE bits that we care
about when determining if a TBI is necessary (i.e. the PALcode bits minus
the FOx bits, since we always track those).
 1.22 11-Jun-1998  thorpej Define a software PTE bit to track VM_PROT_EXEC.
 1.21 19-May-1998  thorpej Argh, finish renaming Lev1map to kernel_lev1map.
 1.20 25-Mar-1998  thorpej Keep a few things that reference kernel variables out of the namespace.
Add a check to see if libkvm is using this file.
 1.19 17-Mar-1998  thorpej Add a software PTE bit that indicates that a va -> pa mapping was entered
in the physical->virtual list.
 1.18 12-Mar-1998  thorpej Move PTE-related constants here, and make them not depend on a hard-coded
page size (i.e. use the one initialized from the HWRPB at boot time).

Do a bit of cleanup while here, rendering old inherited constants obsolete.
 1.17 12-Mar-1998  thorpej Nuke ALPHA_STSIZE and ALPHA_MAX_PTSIZE. Add macros to compute and operate
on segments mapped by L1 and L2 PTEs.
 1.16 09-Mar-1998  thorpej Define VPT_INDEX(), which computes the index into the Virtual Page Table
of the PTE that maps the specified virtual address.

Thanks to Chris Demetriou and Ross Harvey for clarifying the VPT.
 1.15 07-Mar-1998  thorpej Clean up a comment.
 1.14 07-Mar-1998  thorpej Clean this up a bit.
 1.13 07-Mar-1998  thorpej Nuke kvtopte() and ptetokv().
 1.12 07-Mar-1998  thorpej Nuke the vatopa() macro.
 1.11 02-Mar-1998  thorpej Rename a few macros to better describe what they are:
- kvtol1pte() -> l1pte_index()
- vatoste() -> l2pte_index()
- vatopte() -> l3pte_index()
 1.10 02-Sep-1997  thorpej branches: 1.10.2;
Garbage-collect loadustp(); the functionality has moved to pmap.old.c
 1.9 07-Apr-1997  cgd branches: 1.9.2;
clean up NetBSD RCS ID strings
 1.8 13-Nov-1996  cgd branches: 1.8.2;
update copyright dates
 1.7 01-Oct-1996  cgd move kvtol1pte outside of _KERNEL
 1.6 14-Jul-1996  cgd rename translation buffer invalidation macros to start with ALPHA_,
like all other macros defined in alpha_cpu.h.
 1.5 09-Jul-1996  cgd redefine lots of things in terms of definitions in alpha_cpu.h
 1.4 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.3 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.2 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.8.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.9.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.10.2.2 02-Sep-1997  thorpej Garbage-collect loadustp(); the functionality has moved to pmap.old.c
 1.10.2.1 02-Sep-1997  thorpej file pte.h was added on branch bouyer-scsipi on 1997-09-02 19:07:23 +0000
 1.25.6.1 09-Apr-1999  thorpej branches: 1.25.6.1.2;
Pull up 1.25 -> 1.26; fix TBI optimization bug.
 1.25.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.26.14.1 18-Oct-2002  nathanw Catch up to -current.
 1.27.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.6.1 03-Aug-2004  skrll Sync with HEAD
 1.29.78.1 16-May-2008  yamt sync with head.
 1.29.76.1 18-May-2008  yamt sync with head.
 1.29.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.30.38.1 18-Feb-2012  mrg merge to -current.
 1.30.34.1 17-Apr-2012  yamt sync with head
 1.11 24-Dec-2019  kamil Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

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

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

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

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

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

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

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.
 1.10 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.9 12-Apr-2017  kamil branches: 1.9.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.8 25-Sep-2015  christos branches: 1.8.2; 1.8.4;
For processors that have memory breakpoints, add macros for them to help
libproc
 1.7 15-Sep-2015  christos Provide access to pc/sp/syscall-return registers like we have for mcontext
 1.6 25-Jan-2008  skrll branches: 1.6.54; 1.6.74;
Define PT_MACHDEP_STRINGS
 1.5 11-Dec-2005  christos branches: 1.5.50; 1.5.56;
merge ktrace-lwp.
 1.4 21-Sep-2003  skd branches: 1.4.16;
Backed out single step emulation.
Approved by thorpej@netbsd.org.
 1.3 18-Sep-2003  skd Added kernel support for single stepping, adapted from FreeBSD.
Approved by christos.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 04-Feb-2008  yamt sync with head.
 1.5.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.50.1 23-Mar-2008  matt sync with HEAD
 1.6.74.3 28-Aug-2017  skrll Sync with HEAD
 1.6.74.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.6.74.1 22-Sep-2015  skrll Sync with HEAD
 1.6.54.1 03-Dec-2017  jdolecek update from HEAD
 1.8.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.8.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.9.12.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.12.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 08-Jun-2000  thorpej branches: 1.4.166; 1.4.170;
And more ANSI'ification!
 1.3 06-Apr-1997  cgd branches: 1.3.22; 1.3.30;
clean up NetBSD RCS ID strings
 1.2 28-Mar-1995  jtc branches: 1.2.4;
KERNEL -> _KERNEL
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.30.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.170.1 18-Feb-2012  mrg merge to -current.
 1.4.166.1 17-Apr-2012  yamt sync with head
 1.2 05-Feb-2003  nakayama Replace machine/rnd.h with more appropriate name to share it
with cycle counter based microtime in kern/kern_microtime.c.
 1.1 08-Jun-2000  thorpej branches: 1.1.4; 1.1.6;
Add cpu_counter() for rnd(4), using the rpcc insn.
 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 08-Jun-2000  bouyer file rnd.h was added on branch thorpej_scsipi on 2000-11-20 22:35:41 +0000
 1.1.4.2 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 08-Jun-2000  minoura file rnd.h was added on branch minoura-xpg4dl on 2000-06-22 16:58:33 +0000
 1.45 31-Mar-2024  thorpej In dec_6600_device_register(): If we're running on a DS10, set the
"pciide-disable-dma" property on the on-board "aceride" to true. This
is intended to be a temporary measure until the issue that makes it not
work correctly is found and fixed.
 1.44 03-Oct-2020  thorpej Add a comment describing the rpb::rpb_vptb field.
 1.43 08-Apr-2019  thorpej Add some additional CPU and system types.
 1.42 06-Feb-2012  matt branches: 1.42.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.41 25-Jul-2002  simonb branches: 1.41.146; 1.41.150;
Use "#define<tab>".
 1.40 25-Jul-2002  he Add identifiers for newer 21264 CPUs (B, C and D), EV68 variants.
Information gleaned from corresponding code in FreeBSD.
 1.39 03-May-2001  thorpej branches: 1.39.2; 1.39.4; 1.39.16; 1.39.18;
Add systype for "Titan" systems (systype 38).
 1.38 06-Jul-2000  thorpej branches: 1.38.2;
Oops, g/c some stuff from previous.
 1.37 06-Jul-2000  thorpej Define some more CTB formats.
 1.36 03-Jul-2000  thorpej The `rpb_phys_address_size' field is really 2 32-bit fields,
`rpb_phys_address_size' and `rpb_extended_va_size', per Brown Book.
 1.35 03-Jun-2000  thorpej branches: 1.35.2;
Add EV57 and EV67 processor variants.
cvs: ----------------------------------------------------------------------
 1.34 31-May-2000  thorpej Add a few systypes.
 1.33 29-Mar-2000  simonb branches: 1.33.2;
Extern declaration of cputype.
 1.32 29-Jun-1999  ross branches: 1.32.2;
Minor Tsunami-related changes.
 1.31 14-Apr-1999  thorpej Slight braino in previous.
 1.30 14-Apr-1999  thorpej Add macros to decode the `turboslot' member of the Console Terminal Block.
 1.29 17-Mar-1999  drochner branches: 1.29.2;
add ST_DEC_6600, clean up some comments
 1.28 19-Nov-1998  ross "extern struct rpb *hwrpb" belongs here (duhhh)
 1.27 22-Sep-1998  thorpej Define the inter-console communication buffer portion of the per-cpu
info structure.
 1.26 14-Aug-1998  thorpej Change the "vm_offset_t"s to "u_long"s for now; eventually, we can make
them vaddr_t and paddr_t, as appropriate (after scouring the RPB docs
to know which are phys and virt addresses).
 1.25 26-Jun-1998  ross Note ST_DEC_1000 as PCI/EISA.
 1.24 24-Jun-1998  ross Identify ST_DEC_1000A as PCI/EISA.

New macros:

LOCATE_PCS(struct rpb *hwrpb, int cpu_number)
PCS_PROC_MAJORTYPE(struct pcs *)
PCS_PROC_MINORTYPE(struct pcs *)

Define LOCATE_PCS() to map (hwrpb, cpu_number) -> Per-Cpu-Slot structure.

Replace the PCS_PROC_{MAJOR,MINOR}{,SHIFT} stuff with macros that simply
return the major and minor cpu type codes.
 1.23 05-Jun-1998  thorpej Add system variation for Miata 1.5.
 1.22 03-Jun-1998  thorpej Define a bunch more system variations.
 1.21 29-Apr-1998  thorpej Define the DEC 550 Personal Workstation (Miata) systype.
 1.20 15-Apr-1998  mjacob add Alpha 4100 support
 1.19 20-Mar-1998  thorpej Add a few more systypes.
 1.18 02-Mar-1998  ross Second part of cdev_decl() migration. Declare cputype variable.
Add config info for a12 switch driver and console driver.
 1.17 13-Feb-1998  thorpej Define the structure of the HWRPB's Dynamic System Recognition area.
 1.16 12-Feb-1998  cgd rename struct rob's "rpb" element to "rpb_phys" for clarity. also,
change its type from a pointer to a never-defined structure to a
u_int64_t.
 1.15 29-Jan-1998  ross Correct a number of apparent errors in a few reboot paramemter block fields.
 1.14 12-Jan-1998  thorpej Add "non-volatile" memory cluster usage bit.
 1.13 23-Sep-1997  mjacob Redo the platform specific identification and initialization, making
it more explicit where platform specific functions (like machine check
handling) should go.
 1.12 06-Apr-1997  cgd branches: 1.12.4; 1.12.6;
clean up NetBSD RCS ID strings
 1.11 13-Nov-1996  cgd branches: 1.11.2;
clean up cpu type descriptions, in line with rev. 3 of the AARM
 1.10 13-Nov-1996  cgd update copyright dates
 1.9 13-Nov-1996  cgd compile cleanly with:
-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual
 1.8 11-Nov-1996  cgd add system type numbers up to 28, add the EV56 processor type number.
 1.7 29-Apr-1996  cgd fix definition of the "Primary Eligible" RPB PCS processor variation field.
 1.6 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.5 28-Jun-1995  cgd update to make current state of knowledge
 1.4 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.3 24-Mar-1995  cgd fill in sysnames for the 300 family
 1.2 08-Mar-1995  cgd update from my local tree; better CPU configuration, support for 3000/300.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.11.2.2 12-Aug-1997  cgd sync with -current as of August 11, 1997
 1.11.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.12.6.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.6.1 01-Sep-1997  thorpej Repair marc-pcmcia branch.
 1.12.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.29.2.2 02-Jul-1999  perry pullup 1.31->1.32 (ross)
 1.29.2.1 16-Apr-1999  thorpej branches: 1.29.2.1.2; 1.29.2.1.4;
Pull up 1.29 -> 1.31. (Console Terminal Block `turboslot' definitions.)
 1.29.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.29.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.29.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.32.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.33.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.35.2.3 06-Jul-2000  thorpej G/c part of previous.
 1.35.2.2 06-Jul-2000  thorpej Pull up rev. 1.37:
Define some more CTB formats.
 1.35.2.1 03-Jul-2000  thorpej Pull up rev. 1.36:
The `rpb_phys_address_size' field is really 2 32-bit fields,
`rpb_phys_address_size' and `rpb_extended_va_size', per Brown Book.
 1.38.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.39.18.1 29-Jul-2002  lukem Pull up revision 1.40 (requested by he in ticket #552):
Add identifiers for newer 21264 CPUs (B, C and D), EV68 variants.
Information gleaned from corresponding code in FreeBSD.
 1.39.16.1 30-Aug-2002  gehenna catch up with -current.
 1.39.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.39.4.1 03-May-2001  nathanw file rpb.h was added on branch nathanw_sa on 2002-08-01 02:41:03 +0000
 1.39.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.41.150.1 18-Feb-2012  mrg merge to -current.
 1.41.146.1 17-Apr-2012  yamt sync with head
 1.42.48.1 10-Jun-2019  christos Sync with HEAD
 1.6 11-Jul-2021  thorpej Optimized fast-paths for rw_enter() / rw_tryenter() / rw_exit().
 1.5 29-Nov-2019  riastradh branches: 1.5.12;
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.4 28-Apr-2008  martin branches: 1.4.88;
Remove clause 3 and 4 from TNF licenses
 1.3 21-Nov-2007  yamt branches: 1.3.14; 1.3.16; 1.3.18;
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.14; 1.2.24; 1.2.26; 1.2.30; 1.2.32;
Merge newlock2 to head.
 1.1 29-Dec-2006  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 29-Dec-2006  ad Checkpoint work in progress.
 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.14.1 18-Apr-2007  thorpej G/C _lock_cas().
 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:05:38 +0000
 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.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.1 14-Mar-2002  thorpej branches: 1.1.2;
file rwlock_impl.h was initially added on branch newlock.
 1.1.2.5 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.4 17-Mar-2002  thorpej Change RWLOCK_ACQUIRE() and RWLOCK_RELEASE() to evaluate to true
or false depending on the success of the "compare and swap" operation.

This makes them a lot easier to implement on IA32.
 1.1.2.3 17-Mar-2002  thorpej Note two more rwlock primitives MD code must provide, for use in
direct-handoff, and provide those additional primitives on the Alpha.
 1.1.2.2 17-Mar-2002  thorpej Fix a couple of brain-o's in the rwlock primitives.
 1.1.2.1 14-Mar-2002  thorpej Alpha rwlock primitives implementation.
 1.4 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.3 14-Sep-1998  thorpej branches: 1.3.186; 1.3.190;
Need 83 longs for a jmp_buf now.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 13-Feb-1995  cgd branches: 1.1.4;
preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.1.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.3.190.1 18-Feb-2012  mrg merge to -current.
 1.3.186.1 17-Apr-2012  yamt sync with head
 1.3 26-Mar-2000  nisimura Remove local implementation switching to accelerated MI sfb.c.
 1.2 06-Apr-1997  cgd branches: 1.2.22;
clean up NetBSD RCS ID strings
 1.1 01-May-1996  cgd branches: 1.1.2;
preliminary SFB support. Does not work as machine's console (for two
reasons: it won't attach as console, and there's currently no way to do
keyboard input on TC machines), and has no real RAMDAC (colormap,
cursor, etc.) support.
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2.22.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 17-Oct-2014  uebayasi Fix build of RAWHIDE kernel.
 1.1 27-Dec-2000  sommerfeld branches: 1.1.2; 1.1.176;
Let COMPAT_LINUX build with DEBUG
 1.1.176.1 03-Dec-2017  jdolecek update from HEAD
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 27-Dec-2000  bouyer file sigdebug.h was added on branch thorpej_scsipi on 2001-01-05 17:33:46 +0000
 1.19 29-Oct-2021  thorpej Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility.
 1.18 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.17 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.16 06-Feb-2012  matt branches: 1.16.48;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.15 19-Nov-2008  ad branches: 1.15.16; 1.15.20;
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.14 11-Dec-2005  christos branches: 1.14.74; 1.14.78; 1.14.84; 1.14.86;
merge ktrace-lwp.
 1.13 20-Jan-2005  drochner expose struct sigcontext* just as much as necessary
 1.12 10-May-2004  drochner branches: 1.12.4;
SIGTRAMP_VALID() should not pollute the user namespace
 1.11 26-Mar-2004  drochner nothing cares about __HAVE_SIGINFO anymore, so nuke it
 1.10 25-Nov-2003  christos bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa.
 1.9 18-Oct-2003  christos define SIGTRAMP_VALID()
 1.8 07-Oct-2003  skd Siginfo changes for alpha kernel. Approved by thorpej@netbsd.org.
 1.7 28-Apr-2003  bjh21 branches: 1.7.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.6 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.5 13-Sep-1998  thorpej branches: 1.5.24;
Make signal delivery work again.
 1.4 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.3 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.2 16-Feb-1995  cgd branches: 1.2.4;
update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.2.4.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.24.1 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.7.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.4.1 29-Apr-2005  kent sync with -current
 1.14.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.78.1 04-May-2009  yamt sync with head.
 1.14.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.15.20.1 18-Feb-2012  mrg merge to -current.
 1.15.16.1 17-Apr-2012  yamt sync with head
 1.16.48.1 10-Jun-2019  christos Sync with HEAD
 1.20 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.19 07-Jul-2011  mrg port to GCC 4.5.
 1.18 11-Dec-2005  christos merge ktrace-lwp.
 1.17 11-Jan-2005  he In the __lint__ version of va_arg(), apply the cast the user specified.
Fixes build problem; vfprintf.c from libc fails to lint otherwise.
 1.16 02-Jan-2005  christos Try one more time to pacify lint.
 1.15 02-Jan-2005  christos Simplify the lint case by providing simple versions of the va_ macros,
instead of defining the buildin macros used to construct them.
 1.14 31-Dec-2004  christos Define builtin va start differently for lint, so that it does not produce
a warning.
 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 10-May-2000  thorpej Make stdarg/varargs work with GCC 2.96.
 1.10 03-Feb-2000  kleink Add a C99-style va_copy macro.
 1.9 03-May-1999  christos branches: 1.9.2;
Define __builtin_*() for lint
 1.8 27-Jul-1998  mycroft branches: 1.8.10;
Delint.
 1.7 06-Apr-1997  cgd branches: 1.7.8;
clean up NetBSD RCS ID strings
 1.6 04-Apr-1997  mycroft Make the names of the member of struct __va_list namespace-clean.
 1.5 22-Dec-1996  cgd if __lint__ is defined, #define __builtin_saveregs() and
__builtin_classify_type() into harmless values, so that lint doesn't
get confused, think they're real functions, and that they're being
invoked in the wrong ways.
 1.4 09-Oct-1996  cgd branches: 1.4.2;
change __va_list's "offset" field to be a 'int' to match what gcc now
uses, plus add a compatibility hack so that code compiled with old
versions of gcc (e.g. libraries) can work with code compiled with
new versions.
 1.3 26-Dec-1995  mycroft Stylistic changes.
 1.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.4.2.2 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 24-Jan-1997  cgd sync with trunk
 1.7.8.1 01-Feb-1999  cgd pull up rev 1.8 from trunk (PR#6862). (mycroft)
 1.8.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.12.2.4 17-Jan-2005  skrll Sync with HEAD.
 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 06-Feb-2012  matt Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.19 12-Aug-2011  dyoung branches: 1.19.2; 1.19.6;
Pull the bus_space(9) definitions needed by alpha userland into
bus_user.h and include that from pio.h, sysarch.h, bus_defs.h. Fixes
the alpha build.
 1.18 02-Aug-2011  uebayasi Define struct alpha_pci_conf_readwrite_args only once; fix build.
 1.17 28-Jul-2011  dyoung Put libalpha back.
 1.16 17-Jul-2011  dyoung Oops, add back struct alpha_pci_conf_readwrite_args.
 1.15 17-Jul-2011  dyoung Don't #include <machine/bus_defs.h> from this header unless _KERNEL
is #defined. While this header is installed in the alpha userland,
however, <machine/bus_defs.h> is not.

Don't declare any of the alpha_bus_ or alpha_pci_ symbols unless _KERNEL
is #defined. I cannot find anything but libarch in the base system
that uses the symbols. Anything using alpha_pci_ symbols ought to use
pci(3), instead. Up next: don't use those symbols in libarch.
 1.14 13-Jul-2011  dyoung #include <machine/bus_defs.h> instead of <machine/bus.h>.
 1.13 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.12 04-Mar-2007  christos branches: 1.12.40; 1.12.42; 1.12.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 11-Sep-2003  kleink branches: 1.10.16;
__{BEGIN,END}_DECLS-wrap prototypes.
 1.9 14-Jan-2002  thorpej branches: 1.9.16;
Add sysarch calls to read and write the full fp_c.
 1.8 26-Apr-2001  ross branches: 1.8.2; 1.8.4;
o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.7 20-Apr-2001  ross Nonfunctional change split out from pending functional commit.
 1.6 30-Jun-2000  simonb branches: 1.6.2;
Pass the abst to alpha_pci_mem_unmap() so that the real size of the
mapped area can be unmapped.
 1.5 08-Jun-2000  thorpej branches: 1.5.2;
And more ANSI'ification!
 1.4 26-Feb-2000  thorpej branches: 1.4.2;
- Add a bus space method for getting the translation for a window.
- Add sysarch methods for "get bus window count", "get bus window",
and "pci conf read/write".

These are a hack, but they're what's necessary in order to make
XFree86 work in its current state.
 1.3 30-Apr-1999  ross branches: 1.3.2; 1.3.8;
* New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha. (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.
 1.2 09-Jul-1996  cgd this file should not exist, for now
 1.1 12-Apr-1996  cgd alpha sysarch header. right now, only defines (inline) alpha_rpcc()
 1.3.8.2 23-Apr-2001  bouyer Sync with HEAD.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.2 30-Apr-1999  ross * New MI man page for fp{set,get}{round,sticky,mask}(3).
* Implement fpgetsticky() for alpha.
* Direct fpsetsticky() and fp{get,set}mask() into alpha kernel via sysarch(2).
* Define new sysarch(2) stub for above and install and distribute sysarch.h
for alpha. (The fpcr IS user mode r/w, but for reasons beyond the scope
of a commit message kernel calls are needed.) And much kernel Magick is
required before these do anything, but this way programs compiled under
1.4 will DTRT on future snapshots and releases.
 1.3.2.1 30-Apr-1999  ross file sysarch.h was added on branch netbsd-1-4 on 1999-04-30 00:58:33 +0000
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 03-Jul-2000  thorpej Pull up rev. 1.6:
Pass the abst to alpha_pci_mem_unmap() so that the real size of the
mapped area can be unmapped.
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.4.1 26-Apr-2001  nathanw file sysarch.h was added on branch nathanw_sa on 2002-02-28 04:06:15 +0000
 1.8.2.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.9.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.16.1 03-Aug-2004  skrll Sync with HEAD
 1.10.16.1 03-Sep-2007  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.44.1 16-May-2008  yamt sync with head.
 1.12.42.1 18-May-2008  yamt sync with head.
 1.12.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.6.1 18-Feb-2012  mrg merge to -current.
 1.19.2.1 17-Apr-2012  yamt sync with head
 1.9 09-Mar-2025  thorpej Re-factor the boot device and consinit routines into common functions
per platform type (PCI vs TC), eliminating a bunch of copy-pasta.
 1.8 20-Jul-2022  thorpej branches: 1.8.10;
In the Alpha tc_syncbus(), we need to issue a MB because WMB does not
order reads with respect to writes. Remove now-redundant tc_wmb()
calls before tc_syncbus().

NFC on MIPS other than removing a redundant wbflush() (tc_wmb() followed
by tc_syncbus()).
 1.7 22-Jun-2017  flxd spelling (DEC called it "TURBOchannel")
 1.6 04-Nov-2013  christos branches: 1.6.6;
make volatile variable as __USED()
 1.5 06-Feb-2012  matt branches: 1.5.6; 1.5.10;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.4 01-Jun-2000  cgd branches: 1.4.166; 1.4.170;
kill __P in these files. (I had to look at them anyway with an eye for
adding some protos... and adding them with __P seems wrong, but mixing
__P and not __P in the same file seems wrong too, so...)
 1.3 19-Mar-1999  cgd branches: 1.3.8; 1.3.16;
move tc/tc_machdep.h to include/tc_machdep.h. (can't do it via
repository copy because alpha already had an include/tc_machdep.h in
the attic.)
 1.2 17-May-1996  cgd moved to ../tc
 1.1 20-Dec-1995  cgd portability definitions for machine-independent TC configuration code.
 1.3.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.170.1 18-Feb-2012  mrg merge to -current.
 1.4.166.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.166.1 17-Apr-2012  yamt sync with head
 1.5.10.1 18-May-2014  rmind sync with head
 1.5.6.2 03-Dec-2017  jdolecek update from HEAD
 1.5.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.6.1 28-Aug-2017  skrll Sync with HEAD
 1.8.10.1 02-Aug-2025  perseant Sync with HEAD
 1.3 26-Apr-1998  drochner Oops, forgot to delete. It's in dev/pci now.
 1.2 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
TGA reg defns, moved here from ../pci for X. doesn't really belong here
 1.1.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.2 14-Jul-1996  cgd (1) Remove old trap definitions, define trap and interrupt handling
more naturally in terms of way the OSF/1 PALcode delivers traps and
interrupts. Clean up fault/exception handling code and system entry
points. Seperate ASTs into a seperate C function.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.61 23-Jan-2021  christos Document via __HAVE_BUS_SPACE_8 platforms that implement bus_space_*_8
 1.60 25-Sep-2020  thorpej branches: 1.60.2;
Changes to make interrupt {,dis}establish MP-safe on Alpha:
- Protect all of the system interrupt linkage with the cpu_lock mutex.
- Re-order some of the stores to the SCB vector table to make it safe
in the face of lockless interrupt dispatch.
- Add a framework for routing interrupts to specific CPUs. Interrupts
are still funneled only to the primary CPU, but that will change for
some systems soon. Ensure that interrupt handler lists are manipulated
only on the CPUs that handle that specific interrupt source. This required
a re-factor of the alpha_shared_intr_*() family of functions.
- Enable __HAVE_INTR_CONTROL, although interrupt redistribution is still
a no-op.
- Reduce code duplication in the Jenson direct-SCB interrupt handlers.
 1.59 19-Sep-2020  thorpej Enable __HAVE_FAST_SOFTINTS and garbage-collect the #ifdefs.
 1.58 16-Sep-2020  thorpej Implement fast soft interrupts for Alpha. It's not yet enabled, because
there is a bug lurking that causes problems when user space starts up,
so we'll stick with the slow path for now.
 1.57 04-Sep-2020  thorpej Put the MI cpu_data at the beginning of cpu_info so that it is
cache line aligned.
 1.56 30-Apr-2020  skrll G/C __HAVE_AST_PERPROC
 1.55 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.54 24-Jan-2016  christos branches: 1.54.18;
use __paddr_t since this is a userland API.
 1.53 23-Jan-2016  christos expose the kernel types for standalone code.
 1.52 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.51 28-Aug-2015  pooka Convert to __cpu_simple_lock_nv_t. Somehow missed alpha in the earlier
commit. Thanks to uebs for pointing it out.
 1.50 08-Jan-2015  riastradh Introduce membar_datadep_consumer.

Discussed briefly on tech-kern without objection:

https://mail-index.netbsd.org/tech-kern/2014/11/20/msg018054.html
https://mail-index.netbsd.org/tech-kern/2015/01/07/msg018326.html
 1.49 25-Jan-2012  matt branches: 1.49.6; 1.49.22; 1.49.24;
Enable direct-mapped uareas for alpha.
 1.48 13-Jul-2011  dyoung branches: 1.48.2; 1.48.6;
Switch alpha to new-style <sys/bus.h>.

While I'm here, get rid of outdated __HAVE_DEVICE_REGISTER.
 1.47 12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

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

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

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

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

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

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.46 07-Jun-2011  matt Switch alpha to use PCU to manage the FPU.
Tested by mhitch and review by rmind.
 1.45 31-Mar-2011  skrll branches: 1.45.2;
Enable TLS for alpha - a 2nd class^Wtier system in pookaBSD^WNetBSD

alpha_reloc.c diff from joerg on port-alpha.
 1.44 24-Feb-2011  joerg Allow storing and receiving the LWP private pointer via ucontext_t
on all platforms except VAX and IA64. Add fast access via register for
AMD64, i386 and SH3 ports. Use this fast access in libpthread to replace
the stack based pthread_self(). Implement skeleton support for Alpha,
HPPA, PowerPC, SPARC and SPARC64, but leave it disabled.

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

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.43 07-Jul-2010  chs branches: 1.43.2; 1.43.4;
implement cpu_lwp_setprivate() on several platforms.
 1.42 11-Dec-2009  matt branches: 1.42.2; 1.42.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.41 20-Aug-2009  matt Add print format specifiers for {p,v}{addr,size}_t and register_t,
PRTx{P,V}{ADDR,SIZE} and PRTxREGISTER, respectively.
 1.40 20-Jan-2008  joerg branches: 1.40.10;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.39 29-Nov-2007  ad branches: 1.39.6;
__HAVE_ATOMIC64_OPS
 1.38 17-Oct-2007  garbled branches: 1.38.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.37 21-Jul-2007  tsutsui branches: 1.37.4; 1.37.6;
Add MI todr(9) support and timercounter(9) support with kern_cctr.c to alpha:
- use todr(9) API with MI mc146818(4) driver and remove homegrown
todr stuff from MD alpha/clock.c and alpha/mcclock.c
- also remove obsolete cc_microtime stuff from MD code
- add ci_pcc_freq member in struct cpu_info for cpu_frequency(), and
calibrate it with mc146818 interval clock in mcclock attachment
- call cc_init() in cpu_initclocks(9) because all alpha cpus have
a pcc counter

Tested on DEC 3000/300 and AlphaPC 164, but not on any SMP machines yet.
 1.36 14-Jul-2007  ad branches: 1.36.2; 1.36.4;
Generic soft interrupts are mandatory.
 1.35 03-Sep-2006  bjh21 branches: 1.35.12; 1.35.18; 1.35.20;
Nothing in the kernel now tests __HAVE_NWSCONS, so stop defining it everywhere.
 1.34 24-Dec-2005  perry branches: 1.34.4; 1.34.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.33 11-Dec-2005  christos merge ktrace-lwp.
 1.32 18-Jan-2004  martin branches: 1.32.16;
Do not export __HAVE_RAS to userland. Applications are supposed to try
rasctl() and detect failure with EOPNOTSUPP.
 1.31 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.30 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.29 28-Apr-2003  bjh21 branches: 1.29.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.28 08-Jan-2003  thorpej Use the MI setrunqueue()/remrunqueue().
 1.27 22-Sep-2002  simonb Use "#define\t" instead of "#define ".
 1.26 22-Sep-2002  gmcgarry Add __HAVE_MD_RUNQUEUE flag for MD code to override MI run queue primitives.
 1.25 18-Sep-2002  thorpej Add support for restartable atomic sequences. Rearragne the tail
of cpu_switch() slightly so we can reenable interrupts a little
earlier.
 1.24 03-May-2002  thorpej Revert revision 1.23.
 1.23 03-May-2002  eeh Provide _LP64 definition if we are generating LP64 binaries.
 1.22 28-Feb-2002  simonb Use "#define<tab>".
 1.21 28-Apr-2001  kleink branches: 1.21.2; 1.21.4;
* 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.20 19-Jan-2001  thorpej branches: 1.20.2;
Make ASTs per-process.
 1.19 14-Jan-2001  thorpej Rename __GENERIC_SOFT_INTERRUPTS to __HAVE_GENERIC_SOFT_INTERRUPTS,
and place the definition in <machine/types.h>. This can now be used
as a flag to indicate whether or not <machine/intr.h> can be included
to get the generic soft interrupt API.
 1.18 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.17 13-Dec-2000  mycroft Do the md_syscall, __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN thangs.
 1.16 08-Jun-2000  thorpej Add cpu_counter() for rnd(4), using the rpcc insn.
 1.15 23-May-2000  thorpej branches: 1.15.2;
Rename the atomic operations to have generic machine-independent
names, and define __HAVE_ATOMIC_OPERATIONS to indicate their
existence.
 1.14 05-Feb-2000  cgd clean up (group, sort) __HAVE_* defines
 1.13 01-Feb-2000  danw #define __HAVE_DEVICE_REGISTER on ports that have it, and check for
that, rather than a list of architecture defines, in config_attach
 1.12 14-Aug-1998  thorpej branches: 1.12.12;
vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.11 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.10 14-Jun-1998  kleink branches: 1.10.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.9 15-Apr-1998  drochner tell drivers that this port knows about the mi wscons stuff
 1.8 06-Apr-1997  cgd clean up NetBSD RCS ID strings
 1.7 07-Dec-1996  cgd kill __BROKEN_INDIRECT_CONFIG
 1.6 05-Dec-1996  cgd First step inn removing config_scan() and the hacks that gave devices
on indirect-config busses a (permanent) softc that they could share
between 'match' and 'attach' routines:

Define __BROKEN_INDIRECT_CONFIG so that old autoconfiguration
interfaces are used, until drivers are converted to use the new
interfaces (actually, converted back to use the _older_ interfaces)
which prohibit indirect configuration devices from receiving a softc
in their match routine that they can share with their attach routine.
 1.5 01-Oct-1996  cgd branches: 1.5.2;
kill __BDEVSW_DUMP_OLD_TYPE
 1.4 06-Jul-1995  cgd add <sys/cdefs.h> inclusions. namsspace-protect physadr, label_t
def'ns against _POSIX_SOURCE and _ANSI_SOURCE.
 1.3 26-Jun-1995  cgd define __BDEVSW_DUMP_OLD_TYPE for ports where it's true. clean up
some m68k ports inclusion of common header.
 1.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.5.2.2 07-Dec-1996  cgd sync with changes in trunk.
 1.5.2.1 07-Dec-1996  cgd mostly sync with changes on the trunk
 1.10.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.10.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.6 11-Feb-2001  bouyer Sync with HEAD.
 1.12.12.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.12.12.4 05-Jan-2001  bouyer Sync with HEAD
 1.12.12.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.12.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.12.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.15.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.21.4.5 08-Jan-2003  thorpej Sync with HEAD.
 1.21.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.21.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.21.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.21.4.1 28-Apr-2001  nathanw file types.h was added on branch nathanw_sa on 2002-04-01 07:38:51 +0000
 1.21.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.21.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.16.5 21-Jan-2008  yamt sync with head
 1.32.16.4 07-Dec-2007  yamt sync with head
 1.32.16.3 03-Sep-2007  yamt sync with head.
 1.32.16.2 30-Dec-2006  yamt sync with head.
 1.32.16.1 21-Jun-2006  yamt sync with head.
 1.34.8.1 14-Sep-2006  yamt sync with head.
 1.34.4.1 09-Sep-2006  rpaulo sync with head
 1.35.20.1 03-Oct-2007  garbled Sync with HEAD
 1.35.18.1 18-Apr-2007  thorpej - G/C the unused __HAVE_ATOMIC_OPERATIONS define.
- Set __HAVE_ATOMIC64_OPS to indicate 64-bit atomic op support.
 1.35.12.3 03-Dec-2007  ad Sync with HEAD.
 1.35.12.2 20-Aug-2007  ad Sync with HEAD.
 1.35.12.1 15-Jul-2007  ad Sync with head.
 1.36.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.36.2.1 07-Aug-2007  matt Sync with HEAD.
 1.37.6.3 23-Mar-2008  matt sync with HEAD
 1.37.6.2 09-Jan-2008  matt sync with HEAD
 1.37.6.1 06-Nov-2007  matt sync with HEAD
 1.37.4.1 03-Dec-2007  joerg Sync with HEAD.
 1.38.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.38.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.39.6.1 23-Jan-2008  bouyer Sync with HEAD.
 1.40.10.3 11-Aug-2010  yamt sync with head.
 1.40.10.2 11-Mar-2010  yamt sync with head
 1.40.10.1 16-Sep-2009  yamt sync with head
 1.42.4.4 12-Jun-2011  rmind sync with head
 1.42.4.3 21-Apr-2011  rmind sync with head
 1.42.4.2 05-Mar-2011  rmind sync with head
 1.42.4.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.42.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.43.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.43.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.45.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.48.6.1 18-Feb-2012  mrg merge to -current.
 1.48.2.1 17-Apr-2012  yamt sync with head
 1.49.24.3 19-Mar-2016  skrll Sync with HEAD
 1.49.24.2 22-Sep-2015  skrll Sync with HEAD
 1.49.24.1 06-Apr-2015  skrll Sync with HEAD
 1.49.22.1 18-Mar-2015  snj Pull up following revision(s) (requested by riastradh in ticket #600):
common/lib/libc/arch/alpha/atomic/membar_ops.S: revision 1.7
lib/libc/atomic/membar_ops.3: revision 1.4
sys/arch/alpha/include/types.h: revision 1.50
sys/sys/atomic.h: revision 1.13
Introduce membar_datadep_consumer.
Discussed briefly on tech-kern without objection:
https://mail-index.netbsd.org/tech-kern/2014/11/20/msg018054.html
https://mail-index.netbsd.org/tech-kern/2015/01/07/msg018326.html
 1.49.6.1 03-Dec-2017  jdolecek update from HEAD
 1.54.18.1 10-Jun-2019  christos Sync with HEAD
 1.60.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11 01-May-2021  thorpej Make sure preemption is disabled around PMAP_USERRET(); it uses
per-cpu information.

XXX mi_userret() also internally disables preemption. Should restructure
these to remove redundancies.
 1.10 06-Feb-2012  matt branches: 1.10.64;
Do a minor cleanup of alpha (this will make applying pullups post branching
easier).
u_int{8,16,32,64}_t -> uint{*}_t
Change all old-style definitions to C89 prototypes.
Whitespace cleanup.
Constification in db_disasm.c
 1.9 15-Dec-2010  matt branches: 1.9.8; 1.9.12;
rework <uvm/uvm_extern.h> includes.
 1.8 28-Apr-2008  martin branches: 1.8.22;
Remove clause 3 and 4 from TNF licenses
 1.7 05-Nov-2007  ad branches: 1.7.16; 1.7.18; 1.7.20;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.6 16-Feb-2006  perry branches: 1.6.24; 1.6.42; 1.6.44; 1.6.48;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.5 24-Dec-2005  perry branches: 1.5.2; 1.5.4; 1.5.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 31-Oct-2003  cl branches: 1.3.16;
Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.
 1.2 17-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 03-Jan-2001  thorpej branches: 1.1.2; 1.1.4;
ANSI'ify, and inline userret().
 1.1.4.4 26-Sep-2002  nathanw Change "if (l->l_flag & L_SA_UPCALL)" to "while (l->l_flag & L_SA_UPCALL)"
in userret() functions or equivalent, to permit delivery of multiple upcalls
in a single kernel entry.

XXX It's getting crowded in here. Collapsing posting signals, upcalls, and
XXX kernel-exit handling into one mechanism would be nice.
 1.1.4.3 17-Dec-2001  nathanw Call sa_upcall_userret() instead of cpu_upcall().
 1.1.4.2 17-Nov-2001  nathanw Check and obey user-return exit hook (replaces test for P_WEXIT).
 1.1.4.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 03-Jan-2001  bouyer file userret.h was added on branch thorpej_scsipi on 2001-01-05 17:33:46 +0000
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.1 15-Nov-2007  yamt sync with head.
 1.5.6.1 22-Apr-2006  simonb Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.5.2.1 18-Feb-2006  yamt sync with head.
 1.6.48.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.44.1 06-Nov-2007  matt sync with HEAD
 1.6.42.1 06-Nov-2007  joerg Sync with HEAD.
 1.6.24.1 03-Dec-2007  ad Sync with HEAD.
 1.7.20.1 16-May-2008  yamt sync with head.
 1.7.18.1 18-May-2008  yamt sync with head.
 1.7.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.22.1 05-Mar-2011  rmind sync with head
 1.9.12.1 18-Feb-2012  mrg merge to -current.
 1.9.8.1 17-Apr-2012  yamt sync with head
 1.10.64.1 13-May-2021  thorpej Sync with HEAD.
 1.12 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.11 11-Dec-2005  christos 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 12-May-2000  thorpej branches: 1.9.28;
Only use __builtin_va_alist_t if using GCC 2.96 or later. Fixes
pkg/10080, from Matthias Scheler.
 1.8 10-May-2000  thorpej Make stdarg/varargs work with GCC 2.96.
 1.7 06-Apr-1997  cgd branches: 1.7.22;
clean up NetBSD RCS ID strings
 1.6 04-Apr-1997  mycroft Make the names of the member of struct __va_list namespace-clean.
 1.5 09-Oct-1996  cgd branches: 1.5.2;
change __va_list's "offset" field to be a 'int' to match what gcc now
uses, plus add a compatibility hack so that code compiled with old
versions of gcc (e.g. libraries) can work with code compiled with
new versions.
 1.4 26-Dec-1995  mycroft Make the type of __builtin_va_list a long.
 1.3 26-Dec-1995  mycroft Stylistic changes.
 1.2 16-Feb-1995  cgd update for NetBSD's header standards, kill OSF/1 cc hacks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.5.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.7.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.28.1 03-Aug-2004  skrll Sync with HEAD
 1.40 14-Oct-2020  thorpej Add a mechanism to allow a platform to optionally shelter some region
of physical memory from random allocations from the default VM page
free list. Use this hook to shelter regions within 0-16MB of physical
RAM on Jensen and Irongate systems; those platforms do not have SGMAP
DMA, and so we need to shelter this range so that devices using ISA DMA
(e.g. floppy controller) have an opportunity to allocate DMA-safe memory.

PR port-alpha/27087
 1.39 29-Aug-2020  thorpej Bump UBC_WINSHIFT to 16 (64KB), and UBC_NWINS to 4096 (256MB total).
Alpha has plenty of KVA to use for this.
 1.38 10-Dec-2012  chs enable __USE_TOPDOWN_VM.
 1.37 10-Sep-2012  martin branches: 1.37.2;
Make this file idempotent
 1.36 08-Feb-2011  rmind branches: 1.36.4;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.35 14-Nov-2010  uebayasi branches: 1.35.2; 1.35.4;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.34 06-Nov-2010  uebayasi Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.33 06-Mar-2009  joerg branches: 1.33.2; 1.33.4;
Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
 1.32 10-Mar-2008  ad branches: 1.32.4; 1.32.12; 1.32.18;
Use atomics to maintain the number of special page references. Should fix
locking problems including in revision 1.232.
 1.31 21-Feb-2008  ad branches: 1.31.2;
Use a hash of locks, instead of one per vm_page.
 1.30 02-Jan-2008  ad branches: 1.30.2;
Merge vmlocking2 to head.
 1.29 11-Dec-2005  christos branches: 1.29.50; 1.29.56; 1.29.60; 1.29.64;
merge ktrace-lwp.
 1.28 22-Mar-2004  matt branches: 1.28.16;
Change default data size to 256MB.
(A native NetBSD build will no longer with a limit of 128MB).
 1.27 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.26 08-Apr-2003  thorpej branches: 1.26.2;
Make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK compile time constants; we only
support 8K page models at the moment anyway.
 1.25 10-Dec-2002  thorpej Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
 1.24 15-Nov-2001  soren MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.23 01-May-2001  thorpej branches: 1.23.2; 1.23.4;
Use a single linked list for PV entries. This saves 1MB of space
on my 1G RAM AlphaServer.
 1.22 01-May-2001  thorpej Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.21 29-Apr-2001  thorpej Add a VM_MDPAGE_MEMBERS macro that defines pmap-specific data for
each vm_page structure. Add a VM_MDPAGE_INIT() macro to init this
data when pages are initialized by UVM. These macros are mandatory,
but ports may #define them to nothing if they are not needed/used.

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

Use all this stuff to eliminate a lot of extra work in the Alpha
pmap module (it's smaller and faster now). Changes to other pmap
modules will follow.
 1.20 18-Apr-2001  thorpej Remove an un-true comment regarding the location of the u-area.
 1.19 19-Nov-2000  thorpej branches: 1.19.2;
Make VM_MAX_KERNEL_ADDRESS end on a page boundary.
 1.18 22-May-2000  thorpej Remove the adjustment of VM_PHYS_SIZE for `large memory machines'. The
only adjustment that was really necessary was for VM_KMEM_SIZE, and that
is no longer necessary because there is now generic auto-sizing for
kmem_map.
 1.17 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.16 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.15 04-Dec-1999  ragge CL* discarding.
 1.14 26-Mar-1999  thorpej branches: 1.14.4; 1.14.8; 1.14.14;
Don't bother allocating mb_map on these systems. Mbuf clusters are
allocated from a pool, and the MIPS and Alpha use KSEG to map pool
pages. So, mb_map wasn't actually being used. Saves around 4MB of
kernel virtual address space in a typical configuration.

Garbage-collect the related VM_MBUF_SIZE constant.
 1.13 16-Jan-1999  chuck MNN is now the only option possible
 1.12 14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.11 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.10 12-Mar-1998  thorpej Increase the maximum userspace address to 4TB. Leave the stack at 8G
for now, but make a note that we might want to move it down to 4G later.
 1.9 27-Feb-1998  thorpej Revamp pv_table management:
- Make pv_table an array of struct pv_head's, which contain LIST_HEADs
for the pv_entry's, as well as page attributes (mod, ref, ptpage).
- Use <sys/queue.h> to manipulate pv_entry lists.
- Fix several obvious bugs in pmap_collect_pv().
- Use K0SEG to access pv_page's.
 1.8 16-Feb-1998  thorpej Add support for non-contiguous physical memory, using MACHINE_NEW_NONCONTIG.
These changes also recover memory that is located before the kernel in
the first system software segment on systems which do not use the PROM
for console I/O. Written by Chris Demetriou and myself.
 1.7 10-Feb-1998  thorpej Make it easier to keep the scaled VM_*_SIZE values in sync w/ the
constants.
 1.6 23-Sep-1997  mjacob A minor barely acceptable hack to handle having a kernel boot on a system
with large amounts of memory and not spew. This doesn't really replace
fixing this problem better later, but it works for now. Basically, if memory
is greater than 128MB, start upping the sizes of some maps.
 1.5 12-Jun-1997  mrg branches: 1.5.4;
bring mrg-vm-swap2 onto mainilne.
 1.4 06-Apr-1997  cgd branches: 1.4.2;
clean up NetBSD RCS ID strings
 1.3 09-Jul-1996  cgd branches: 1.3.2; 1.3.6;
delete cruft, clean up constants
 1.2 23-Nov-1995  cgd wholesale update from my NetBSD/Alpha source tree. Includes:
Support for AXPpci CPUs,
Support for AlphaStation 600 CPUs,
new boot block structure, which requires an 'installboot'
program and works a lot like the NetBSD/sparc boot blocks.
 1.1 13-Feb-1995  cgd preliminary Alpha support. note that NOT ALL OF THE MODIFICATIONS TO
THE REST OF THE KERNEL ARE IN THE TREE YET. Also, some of this is
_incredibly_ hack-ish, etc., but it works.
 1.3.6.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.3.2.2 22-Jul-1997  cgd sync nwscons branch with changes in -current as of July 21, 1997
 1.3.2.1 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.4.2.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.5.4.1 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.8.3 21-Apr-2001  bouyer Sync with HEAD
 1.14.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.14.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.4.1 04-Jul-1999  chs add UBC parameters.
 1.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.4.3 11-Dec-2002  thorpej Sync with HEAD.
 1.23.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.4.1 01-May-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:22:54 +0000
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.28.16.3 17-Mar-2008  yamt sync with head.
 1.28.16.2 27-Feb-2008  yamt sync with head.
 1.28.16.1 21-Jan-2008  yamt sync with head
 1.29.64.1 02-Jan-2008  bouyer Sync with HEAD
 1.29.60.1 30-Dec-2007  ad Locking changes for alpha.
 1.29.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.29.50.2 23-Mar-2008  matt sync with HEAD
 1.29.50.1 09-Jan-2008  matt sync with HEAD
 1.30.2.1 24-Mar-2008  keiichi sync with head.
 1.31.2.2 03-Apr-2008  mjf Sync with HEAD.
 1.31.2.1 21-Feb-2008  mjf file vmparam.h was added on branch mjf-devfs2 on 2008-04-03 12:42:10 +0000
 1.32.18.1 13-May-2009  jym Sync with HEAD.

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

(In the future, we should allocate struct vm_page [] on the added memory
segment for NUMA's sake.)
 1.33.2.1 23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.35.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.35.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.36.4.1 30-Oct-2012  yamt sync with head
 1.37.2.1 25-Feb-2013  tls resync with head
 1.6 28-Aug-2006  he Use the common <dev/sun/vuid_event.h> header file instead of maintaining
separate copies in port-specific directories. Add duplicate include
protection. Makes the alpha and atari ports build usr.bin/kdump/ again.
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.8;
merge ktrace-lwp.
 1.4 25-Apr-2004  fair branches: 1.4.12;
protect against multiple includes because the make procedures for
kdump, ktruss, etc., aren't smart enough to spot this as a duplicate
from both include/{alpha,machine}/vuid_event.h
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 06-Apr-1997  cgd branches: 1.2.56;
clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
keyboard and frame buffer interface include files, grabbed from the
sparc with minimal modifications, to make X go. Should really be
trimmed down to include only the relevant information.
 1.1.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.2.56.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.56.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.56.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.1 30-Dec-2006  yamt sync with head.
 1.5.8.1 03-Sep-2006  yamt sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.74; 1.2.76; 1.2.78;
merge ktrace-lwp.
 1.1 08-May-2004  kleink branches: 1.1.2;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 08-May-2004  skrll file wchar_limits.h was added on branch ktrace-lwp on 2004-08-03 10:31:19 +0000
 1.2.78.1 16-May-2008  yamt sync with head.
 1.2.76.1 18-May-2008  yamt sync with head.
 1.2.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 16-Apr-1999  ross Really say goodbye to old wscons.
 1.2 06-Apr-1997  cgd branches: 1.2.16;
clean up NetBSD RCS ID strings
 1.1 12-Apr-1996  cgd branches: 1.1.2;
header which defines 'workstation console glue' ioctls
 1.1.2.4 01-Jun-1997  cgd fix copyright; this file is entirely rewritten (by me), and shares no
source with the existing wsconsio.h.
 1.1.2.3 01-Jun-1997  cgd sync the nwscons branch up with yesterday's version of the trunk.
Lots of conflicts/changes because of the RCS Id format changes.
Also, a few cleanups and corrections.
 1.1.2.2 31-Jan-1997  cgd clean up some comments, add display mode swtich ioctls
 1.1.2.1 07-Dec-1996  cgd snapshot of work in progress (on private branch): first checkin of
reimplemented 'wscons' interfaces.
 1.2.16.1 16-Apr-1999  perry unneeded -- from old wscons. removal on branch requested by ross
 1.9 29-Mar-2008  tsutsui Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.8 07-Nov-2007  ad branches: 1.8.14;
Merge tty changes from the vmlocking branch.
 1.7 11-Dec-2005  christos branches: 1.7.30; 1.7.48; 1.7.50; 1.7.54; 1.7.56;
merge ktrace-lwp.
 1.6 07-Aug-2003  agc branches: 1.6.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 08-Dec-2000  nisimura branches: 1.5.24;
A forgotten commit that should be done at the time when zs_ioasic.c was
changed.
 1.4 09-Sep-2000  nisimura u_char -> u_int for function argument and return of Zilog register
manipulation helper functions; no loss, no gain, for Alpha processor.
 1.3 08-Jun-2000  thorpej And more ANSI'ification!
 1.2 03-Jun-2000  thorpej - Clean up clock interrupt code a bit, and provide a CPU_IS_PRIMARY()
macro in the MULTIPROCESSOR case (hardclock() wants it).
- Implement __GENERIC_SOFT_INTERRUPTS, and redefine the legacy
software interrupts in terms of it. Garbage-collect setsoftserial().
 1.1 24-Mar-1998  thorpej branches: 1.1.14; 1.1.22;
Initial mostly-working ioasic attachment for the MI 8530 SCC driver. It is
enough to use as a console on my DEC 3000/400 (connected to a VT-520
terminal).

XXX The MI SCC driver needs serious changes to handle platforms which
have muliple SCC attachments (e.g. the Alpha port, which has an ioasic
attachment for TurboChannel systems and a gbus attachment for TurboLaser
systems).

XXX The MI SCC driver also needs changes to deal with the wacky (to put
it mildly) way the chips are wired up on the ioasic (on both TC Alphas
and DECstations). These are going to come along later.
 1.1.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.14.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.14.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes)
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 15-Nov-2007  yamt sync with head.
 1.7.56.1 19-Nov-2007  mjf Sync with HEAD.
 1.7.54.1 13-Nov-2007  bouyer Sync with HEAD
 1.7.50.1 08-Nov-2007  matt sync with -HEAD
 1.7.48.1 11-Nov-2007  joerg Sync with HEAD.
 1.7.30.3 03-Dec-2007  ad Sync with HEAD.
 1.7.30.2 03-Dec-2007  ad Sync with HEAD.
 1.7.30.1 18-Oct-2007  ad Interrupt stuff for alpha (but no fast softints yet).
 1.8.14.1 03-Apr-2008  mjf Sync with HEAD.

RSS XML Feed