Home | History | Annotate | only in /src/sys/arch/sparc64/include
History log of /src/sys/arch/sparc64/include
RevisionDateAuthorComments
 1.34 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.33 19-Dec-2018  maxv branches: 1.33.36;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.32 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.31 29-Mar-2018  joerg branches: 1.31.2;
Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.
 1.30 23-Jul-2014  alnsn branches: 1.30.26;
Rename sljitarch.h to sljit_machdep.h.
 1.29 01-Feb-2014  nakayama branches: 1.29.2;
Make sljit usable on sparc64 32-bit kernels.
 1.28 17-Jul-2011  joerg branches: 1.28.2; 1.28.12; 1.28.16;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.27 09-Jul-2011  dyoung Don't install sparc64/bus.h any more.
 1.26 13-Apr-2011  mrg install <machine/intr.h> for crash(8).

(we could avoid this, but it would require a lot of contortions that
make the header files ugly. maybe someone else can figure out a less
ugly way of doing this later.)
 1.25 31-Jan-2011  christos fenv support for sparc64 from Stathis Kamperis
 1.24 09-Feb-2007  ad branches: 1.24.70; 1.24.76; 1.24.78;
Merge newlock2 to head.
 1.23 26-Jul-2006  drochner branches: 1.23.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.22 11-Dec-2005  christos branches: 1.22.4; 1.22.8;
merge ktrace-lwp.
 1.21 07-Jul-2004  drochner branches: 1.21.12;
also add <machine/joystick.h> to alpha and amd64, to allow compilation
of certain multimedia applications
 1.20 08-May-2004  kleink Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.19 26-Aug-2003  uwe Drop fbvar.h from INCS now that it's been cvs rm'ed here.
 1.18 18-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.16 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.15 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.14 19-Sep-2001  thorpej branches: 1.14.4; 1.14.8; 1.14.12;
Use <dev/sun/fbio.h>, not our own copy.
 1.13 15-Apr-2001  kleink branches: 1.13.2; 1.13.4;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.12 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.11 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.10 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.9 16-Aug-2000  mrg branches: 1.9.2;
backout previous; unintentional.
 1.8 16-Aug-2000  mrg include the sparc loadfile_machdep.h as-is; we can blow this header away
completely later.
 1.7 26-Jun-2000  kleink Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.6 29-Apr-2000  thorpej Oops, install <machine/lock.h> on these systems, too.
 1.5 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.4 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 27-Nov-1999  mrg these files were removed years ago (exec.h was not even installed).
 1.2 15-Jan-1999  bouyer branches: 1.2.8; 1.2.14;
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 15-Aug-1998  eeh Add a makefile.
 1.2.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.2 21-Apr-2001  bouyer Sync with HEAD
 1.2.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.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.13.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.13.2.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.13.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.13.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.12.2 31-Aug-2002  gehenna catch up with -current.
 1.14.12.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.14.8.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.14.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.14.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.14.4.3 13-Aug-2002  nathanw Catch up to -current.
 1.14.4.2 17-Nov-2001  martin Sparc64 *context routines, from Klaus Klein.
 1.14.4.1 19-Sep-2001  martin file Makefile was added on branch nathanw_sa on 2001-11-17 12:24:20 +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.21.12.2 26-Feb-2007  yamt sync with head.
 1.21.12.1 30-Dec-2006  yamt sync with head.
 1.22.8.1 11-Aug-2006  yamt sync with head
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.23.4.1 01-Feb-2007  ad Header file cleanup.
 1.24.78.1 08-Feb-2011  bouyer Sync with HEAD
 1.24.76.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.70.2 21-Apr-2011  rmind sync with head
 1.24.70.1 05-Mar-2011  rmind sync with head
 1.28.16.1 18-May-2014  rmind sync with head
 1.28.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.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.29.2.1 10-Aug-2014  tls Rebase.
 1.30.26.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.30.26.2 28-Jul-2018  pgoyette Sync with HEAD
 1.30.26.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.31.2.1 10-Jun-2019  christos Sync with HEAD
 1.33.36.1 02-Aug-2025  perseant Sync with HEAD
 1.19 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.18 17-Jun-2015  martin branches: 1.18.18;
Make clock_t unsigned
 1.17 17-Jul-2011  joerg branches: 1.17.12; 1.17.28; 1.17.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.16 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.15 11-Jan-2009  christos branches: 1.15.4; 1.15.6;
merge christos-time_t
 1.14 17-Oct-2007  garbled branches: 1.14.16; 1.14.18; 1.14.22; 1.14.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.13 03-Sep-2007  drochner clean up some definitions around rune_t which are not needed anymore
 1.12 04-Oct-2006  tnozaki branches: 1.12.8; 1.12.16; 1.12.22; 1.12.26; 1.12.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.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 20-Apr-2005  matt branches: 1.10.2;
For GCC3 and later, use the __builtin_va* constructs.
 1.9 07-Aug-2003  agc branches: 1.9.8; 1.9.14; 1.9.18;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 02-Mar-2003  tshiozak branches: 1.8.2;
add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.7 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.6 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.5 21-Dec-2000  itojun populate _BSD_MBSTATE_T_. add warning regarding to rune_t.
 1.4 27-Jun-2000  kleink G/c _BSD_INTPTR_T_ and _BSD_UINTPTR_T_.
 1.3 31-Jul-1998  ross branches: 1.3.12; 1.3.20;
Following discussions with eeh and mrg, change most of these types so
that they should make an ILP32 setup with an ILP32 compiler and an LP64
setup if run through an LP64 compiler. None of the data sizes actually
change right now, and any type errors that show up would have to be fixed
eventually anyway.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.3.20.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.3.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.18.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.9.14.1 30-Apr-2006  riz Pull up following revision(s) (requested by nakayama in ticket #1296):
sys/arch/sparc/include/stdarg.h: revision 1.22
sys/arch/sparc64/include/ansi.h: revision 1.10
sys/arch/sparc/include/ansi.h: revision 1.16
For GCC3 and later, use the __builtin_va* constructs.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.2.2 27-Oct-2007  yamt sync with head.
 1.10.2.1 30-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.12.28.1 06-Nov-2007  matt sync with HEAD
 1.12.26.1 02-Oct-2007  joerg Sync with HEAD.
 1.12.22.1 10-Sep-2007  skrll Sync with HEAD.
 1.12.16.1 03-Oct-2007  garbled Sync with HEAD
 1.12.8.1 09-Oct-2007  ad Sync with head.
 1.14.30.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.22.2 11-Aug-2010  yamt sync with head.
 1.14.22.1 04-May-2009  yamt sync with head.
 1.14.18.2 30-Mar-2008  christos time_t is now __int64_t
 1.14.18.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.14.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.15.6.1 30-May-2010  rmind sync with head
 1.15.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.30.1 22-Sep-2015  skrll Sync with HEAD
 1.17.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.17.12.1 03-Dec-2017  jdolecek update from HEAD
 1.18.18.1 10-Jun-2019  christos Sync with HEAD
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.22 17-Oct-2015  nakayama Move LP64 and ILP32 conversion macros COMBINE, SPLIT from locore.h
to asm.h, and provide SPLIT_RETL for the case SPLIT and then retl
immediately.
 1.21 28-Apr-2013  nakayama branches: 1.21.12;
Use macros in machine/asm.h instead of locally defined, and
introduce CASPTRA for casxa/casa.
 1.20 16-Mar-2013  christos move the useful macros somewhere where they can be used in userland.
 1.19 20-Jul-2002  mrg branches: 1.19.146; 1.19.156;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.18 24-Jun-2002  thorpej Add ENTRY_NOPROFILE().
 1.17 14-Jan-2002  eeh branches: 1.17.8;
Use a more efficient PIC_PROLOG().
 1.16 03-Nov-2001  thorpej branches: 1.16.2;
Changes from Martin Husemann and myself:
- Make the 32-bit SPARC profile support work with the GCC 2.95.3
SPARC ELF compiler, which uses a different name for mcount.
- Make the 64-bit SPARC profile support header look more like the 32-bit
SPARC header (no functional change -- 64-bit SPARC already used the
correct mcount name).
 1.15 02-Aug-2000  eeh branches: 1.15.4; 1.15.6;
Get kernel profiling to work. Now if only gprof worked....
 1.14 01-Aug-2000  eeh Pull in <machine/frame.h> to define BIAS and CC64FSZ.
 1.13 23-Jul-2000  eeh Include <machine/frame.h> to get the definition of BIAS and CC64FSZ.
 1.12 18-Jul-2000  eeh Fix PIC bugs.
 1.11 14-Jul-2000  eeh Add support for 64-bit PIC and dynamic linking.
 1.10 23-Jun-2000  kleink Add a WEAK_ALIAS() macro.
 1.9 05-Oct-1999  eeh branches: 1.9.2; 1.9.12;
Add RODATA() macro.
 1.8 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.7 02-Dec-1998  thorpej Argh, fix the ANSI CPP version of the a.out WARN_REFERENCES().
 1.6 02-Dec-1998  thorpej Implement WARN_REFERENCES().
 1.5 06-Oct-1998  eeh Fix PIC code initialization.
 1.4 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.9.12.4 07-Aug-2000  mrg pull up 1.15 (approved by thorpej):
>Get kernel profiling to work. Now if only gprof worked....
 1.9.12.3 07-Aug-2000  mrg pull up 1.14 (approved by thorpej):
>Pull in <machine/frame.h> to define BIAS and CC64FSZ.
 1.9.12.2 26-Jul-2000  mycroft Approved by thorpej:
Enable pulling this into user-level code to get some definitions (e.g. CC64FSZ).

syssrc/sys/arch/sparc64/include/asm.h 1.11 -> 1.13
syssrc/sys/arch/sparc64/include/frame.h 1.6 -> 1.7
 1.9.12.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 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.15.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.15.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.15.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.15.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.3 01-Aug-2002  nathanw Catch up to -current.
 1.16.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.16.2.1 03-Nov-2001  nathanw file asm.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.17.8.2 31-Aug-2002  gehenna catch up with -current.
 1.17.8.1 17-Jul-2002  gehenna catch up with -current.
 1.19.156.2 03-Dec-2017  jdolecek update from HEAD
 1.19.156.1 23-Jun-2013  tls resync from head
 1.19.146.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.21.12.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.33 11-Sep-2017  palle sun4v: Update code to retrieve CPU clock frequency so it can handle (future?) CPU clock frequencies above the 32-bit limit. ok mrg@
 1.32 26-Oct-2013  jdc Allow machine_banner and machine_model to be used outside autoconf.c, for
example, by drivers that need to match on model name. Suggested by mrg@.
 1.31 27-Oct-2012  chs branches: 1.31.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.30 01-Jul-2011  dyoung branches: 1.30.2; 1.30.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.29 12-Mar-2011  nakayama Remove implicit include <dev/sbus/sbusvar.h> from autoconf.h, and
add it explicitly in files depending on it.
 1.28 28-Apr-2008  martin branches: 1.28.22; 1.28.28;
Remove clause 3 and 4 from TNF licenses
 1.27 12-Feb-2008  joerg branches: 1.27.6; 1.27.8; 1.27.10;
Introduce device_find_by_xname and device_find_by_driver_unit to replace
alldevs iterations all over src.

Patch discussed with and improved on suggestioned from cube@.
 1.26 26-Sep-2006  martin branches: 1.26.28; 1.26.34;
Rework boot device matching to get rid of lots of special case code
and tables to map fimware names to driver names. Based on a suggestion
from Eduardo (quite some time ago).
Each device (on busses we can handle and care about) gets a device property
storing the devices OpenFirmware package handle. To match the boot device,
the phandle of the chosen bootpath is compared against this property,
plus some additional string matching for disk/cd devices (where OF only
provides a node for the device class, not each instance).
 1.25 20-Feb-2006  cdi branches: 1.25.14; 1.25.16;
Use ANSI-style function definitions and declarations.
 1.24 27-Jan-2006  cdi branches: 1.24.2; 1.24.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.23 11-Dec-2005  christos branches: 1.23.2;
merge ktrace-lwp.
 1.22 31-May-2005  christos branches: 1.22.2;
sprinkle const.
 1.21 21-Mar-2004  pk Switch to the sparc prom library.
 1.20 19-Mar-2004  pk Drop optionsnode, fbnode and stdinnnode.
 1.19 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.18 17-Mar-2004  pk Pass the buffer size to PROM_getpropstringA(), as in sparc.
 1.17 16-Mar-2004  pk For now, implement prom_getoption() in autoconf.c.
 1.16 16-Mar-2004  pk For now, implement prom_getidprom() and prom_getether() in autoconf.c
 1.15 27-Aug-2003  mrg change PROM_getprop() from taking a "void **" for the storage, to a
"void *", and do the extra de-reference directly in the function. this
avoids having to cast dozens of different types to "void **", which sets
of GCC3's strict-aliasing. testing by martin@
 1.14 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.13 20-Oct-2002  martin branches: 1.13.6;
We are not going to get a "upa at mainbus" autoconfig entity, since
UPA is just a physical incarnation of our mainbus0.

Evidence:

- There can only be one!
- The firmware node coresponding to it is the root of the OF tree

So: remove the unused (and uncompilable) upa.c, remove upavar.h after
moving the only declaration used from it to autoconf.h.
 1.12 05-Oct-2001  pooka branches: 1.12.4;
prototype rominterpret()
 1.11 26-Sep-2001  eeh getprop* -> PROM_getprop*
 1.10 24-Jul-2001  eeh branches: 1.10.2;
Garbage collect.
 1.9 14-Jan-2000  pk branches: 1.9.8;
Remove old-style boot device recognition.
 1.8 08-Nov-1999  eeh Fix boot device detection code.
 1.7 18-Mar-1999  eeh branches: 1.7.8; 1.7.10; 1.7.14;
Some devices don't have a `device-type' property we can use to allocate
an IPL. Check for those by name. Give the rest a default IPL of 2.
(Added `SUNW,CS4231' to the list.)
 1.6 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 05-Sep-1998  pk Nuke temporary `getpropA()'.
 1.3 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.7.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.10.1 15-Nov-1999  fvdl Sync with -current
 1.7.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.9.8.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.8.1 03-Aug-2001  lukem update to -current
 1.10.2.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.10.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.12.4.2 11-Nov-2002  nathanw Catch up to -current
 1.12.4.1 05-Oct-2001  nathanw file autoconf.h was added on branch nathanw_sa on 2002-11-11 22:04:50 +0000
 1.13.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.13.6.1 03-Aug-2004  skrll Sync with HEAD
 1.22.2.3 27-Feb-2008  yamt sync with head.
 1.22.2.2 30-Dec-2006  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.23.2.2 01-Mar-2006  yamt sync with head.
 1.23.2.1 01-Feb-2006  yamt sync with head.
 1.24.4.1 22-Apr-2006  simonb Sync with head.
 1.24.2.1 09-Sep-2006  rpaulo sync with head
 1.25.16.1 22-Oct-2006  yamt sync with head
 1.25.14.1 18-Nov-2006  ad Sync with head.
 1.26.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.26.28.1 23-Mar-2008  matt sync with HEAD
 1.27.10.1 16-May-2008  yamt sync with head.
 1.27.8.1 18-May-2008  yamt sync with head.
 1.27.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.28.22.1 21-Apr-2011  rmind sync with head
 1.30.12.3 03-Dec-2017  jdolecek update from HEAD
 1.30.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.30.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.30.2.1 30-Oct-2012  yamt sync with head
 1.31.2.1 18-May-2014  rmind sync with head
 1.9 08-Jan-2019  jdolecek remove explicit <machine/param.h> include, code including this already includes
<sys/param.h>
 1.8 15-Sep-2017  martin branches: 1.8.2; 1.8.4;
Add more details about the boot device as a new bootinfo record type.
From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.
 1.7 28-May-2012  martin branches: 1.7.2;
Ooops, remove definitions duplicated in <sparc/bootinfo.h>
 1.6 28-May-2012  martin Pass the "boothowto" from the bootloader to the kernel.
If (an old) bootloader did not pass the flags, check explicitly if we
missed RB_USERCONF and invoke userconf_prompt() in MD code, as MI code
already missed it.
This fixes PR 46466.
 1.5 02-Apr-2010  martin Add a bootinfo node to allow the loader to override the boot device
 1.4 28-Apr-2008  martin branches: 1.4.20; 1.4.22;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Feb-2006  cdi branches: 1.3.68; 1.3.70; 1.3.72;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.2 27-Jan-2006  cdi branches: 1.2.2; 1.2.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.1 20-Jul-2002  mrg branches: 1.1.2; 1.1.4; 1.1.6; 1.1.28; 1.1.40;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1.40.2 18-Feb-2006  yamt sync with head.
 1.1.40.1 01-Feb-2006  yamt sync with head.
 1.1.28.1 21-Jun-2006  yamt sync with head.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 20-Jul-2002  jdolecek file bootinfo.h was added on branch kqueue on 2002-09-06 08:41:32 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 20-Jul-2002  gehenna file bootinfo.h was added on branch gehenna-devsw on 2002-08-31 14:52:30 +0000
 1.1.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 20-Jul-2002  nathanw file bootinfo.h was added on branch nathanw_sa on 2002-08-01 02:43:40 +0000
 1.2.4.1 22-Apr-2006  simonb Sync with head.
 1.2.2.1 09-Sep-2006  rpaulo sync with head
 1.3.72.2 11-Aug-2010  yamt sync with head.
 1.3.72.1 16-May-2008  yamt sync with head.
 1.3.70.1 18-May-2008  yamt sync with head.
 1.3.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.22.1 30-May-2010  rmind sync with head
 1.4.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.7.2.1 03-Dec-2017  jdolecek update from HEAD
 1.8.4.1 10-Jun-2019  christos Sync with HEAD
 1.8.2.1 18-Jan-2019  pgoyette Synch with HEAD
 1.2 27-Nov-1999  mrg these files were removed years ago (exec.h was not even installed).
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 21-Mar-2004  pk Reach over to the sparc versions.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 23-Aug-2002  thorpej branches: 1.5.6;
Protect against multiple inclusion.
 1.4 23-Aug-2002  thorpej * Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.3 04-Dec-2001  darrenr branches: 1.3.8; 1.3.10;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.2 13-Mar-2000  soren branches: 1.2.8; 1.2.12;
Fix doubled 'the's in comments.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.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.12.2 27-Aug-2002  nathanw Catch up to -current.
 1.2.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.10.2 22-Nov-2002  tron Pull up revision 1.5 (requested by martin in ticket #948):
Protect against multiple inclusion.
 1.3.10.1 22-Nov-2002  tron Pull up revision 1.4 (requested by martin in ticket #948):
* Refine the comment describing openprom_addr.
* Add openprom_range and openprom_intr structures.
 1.3.8.1 31-Aug-2002  gehenna catch up with -current.
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.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.62 17-Jul-2011  dyoung Switch sparc and sparc64 to new-style <sys/bus.h>.
 1.61 04-Dec-2009  nakayama s/u_intN_t/uintN_t/ and whitespace nit. no functional change.
 1.60 04-Dec-2009  nakayama bus_space_handle_t:
- make _asi and _sasi unsigned to reduce superfluous codes by sign extension.
- remove unused member _virtual.
 1.59 01-Jun-2009  macallan #define BUS_SPACE_MAP_LARGE 0 so SBus framebuffer drivers compile again
 1.58 28-Apr-2008  martin branches: 1.58.10; 1.58.18;
Remove clause 3 and 4 from TNF licenses
 1.57 04-Mar-2007  christos branches: 1.57.40; 1.57.42; 1.57.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.56 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.55 16-Nov-2006  christos branches: 1.55.4;
__unused removal on arguments; approved by core.
 1.54 15-Oct-2006  martin __unused policy
 1.53 20-Feb-2006  cdi branches: 1.53.14; 1.53.16;
Use ANSI-style function definitions and declarations.
 1.52 16-Feb-2006  perry Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.51 24-Dec-2005  perry branches: 1.51.2; 1.51.4; 1.51.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.50 11-Dec-2005  christos merge ktrace-lwp.
 1.49 09-Mar-2005  matt branches: 1.49.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.48 30-Jun-2004  pk branches: 1.48.4; 1.48.6;
Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.
 1.47 28-Jun-2004  pk Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.
 1.46 28-Jun-2004  pk Add openprom range property to the bus space tag.
 1.45 15-Jun-2003  fvdl branches: 1.45.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
 1.44 05-May-2003  martin Make all non-trivial bus space functions "static __inline" (consistently)
and turn all macros with local blocks and declarations into functions.
This fixes PR 19975.
 1.43 30-Jan-2003  martin Sparc64 already had a BUS_DMA_NOCACHE - remove one of the two definitions.
Fortunately the old (local) one had the same semantics as the new one.
 1.42 28-Jan-2003  kent Introduce BUS_DMA_NOCACHE, and bus_dmamem_map() of i386 supports it.
 1.41 10-Dec-2002  pk Remove the `flags' argument from bus_intr_establish().
 1.40 10-Dec-2002  pk bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.
 1.39 21-Mar-2002  eeh Parenthesise macro arguments.
 1.38 20-Mar-2002  eeh Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.
 1.37 15-Mar-2002  eeh Get PCI working with the new bus_space*.
 1.36 14-Mar-2002  eeh Get rid of bus_space_map2().
 1.35 01-Mar-2002  martin For aesthetical reasons use bus_addr_t instead of paddr_t in the BUS_ADDR
makro. Requested by uwe.
 1.34 01-Mar-2002  martin Cast the "io" parameter of BUS_ADDR to paddr_t before it gets shifted.
This makes this makro work with smaller values passed for io. No functional
change.
 1.33 07-Feb-2002  eeh Make bus_space_barrier() an inline instead of a function vector.
 1.32 24-Sep-2001  eeh branches: 1.32.4;
Change bus_space_mmap() signature to the official one.
 1.31 21-Sep-2001  wiz Update copyright, fix typo and remove too many '/'.
Ok'd by eeh.
 1.30 21-Sep-2001  eeh Handle DMA boundaries a bit better.
 1.29 10-Sep-2001  eeh Change some debug printfs to make gcc happy.
 1.28 19-Jul-2001  thorpej branches: 1.28.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.27 07-Mar-2001  thorpej branches: 1.27.2;
Add the BUS_DMA_STREAMING flag.
 1.26 11-Feb-2001  eeh branches: 1.26.2;
Add some extra fields to a dmamap to track what's being mapped.
 1.25 22-Sep-2000  eeh Define __BUS_SPACE_HAS_STREAM_METHODS now we have them.
 1.24 16-Sep-2000  eeh Add bus_space*stream*() methods. I hope they work.
 1.23 14-Jul-2000  eeh Make all the inline functions static.
 1.22 13-Jul-2000  mrg remove old (bogus) comment.
 1.21 09-Jul-2000  pk Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.
 1.20 07-Jul-2000  eeh Handle bus_dma aligment properly.
 1.19 29-Jun-2000  pk Fix bus_space_read_region_{2,4,8}().
 1.18 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.17 12-Jun-2000  eeh branches: 1.17.2;
More debugging support.
 1.16 02-Jun-2000  eeh Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).
 1.15 22-Apr-2000  mrg branches: 1.15.2;
whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.
 1.14 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.13 07-Jun-1999  eeh branches: 1.13.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.12 05-Jun-1999  eeh Fix things up so they compile again.
 1.11 22-May-1999  eeh Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()
 1.10 23-Mar-1999  drochner branches: 1.10.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.9 31-Jan-1999  drochner make the last fix work as intended
 1.8 30-Jan-1999  eeh Fix problems with bus_space*() macros (thanks M.Drochner).
 1.7 06-Sep-1998  eeh 32-bit fixup.
 1.6 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.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.10.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.13.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.15.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.17.2.3 17-Oct-2000  tv Pullup 1.24 and 1.25 [eeh]:
Add bus_space*stream*() methods.
 1.17.2.2 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.17.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.26.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.27.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.27.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.27.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.27.2.1 03-Aug-2001  lukem update to -current
 1.28.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.32.4.4 11-Dec-2002  thorpej Sync with HEAD.
 1.32.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.32.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.32.4.1 24-Sep-2001  nathanw file bus.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.45.2.4 01-Apr-2005  skrll Sync with HEAD.
 1.45.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.45.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.45.2.1 03-Aug-2004  skrll Sync with HEAD
 1.48.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.48.4.1 29-Apr-2005  kent sync with -current
 1.49.4.4 03-Sep-2007  yamt sync with head.
 1.49.4.3 26-Feb-2007  yamt sync with head.
 1.49.4.2 30-Dec-2006  yamt sync with head.
 1.49.4.1 21-Jun-2006  yamt sync with head.
 1.51.6.1 22-Apr-2006  simonb Sync with head.
 1.51.4.1 09-Sep-2006  rpaulo sync with head
 1.51.2.2 01-Mar-2006  yamt sync with head.
 1.51.2.1 18-Feb-2006  yamt sync with head.
 1.53.16.2 10-Dec-2006  yamt sync with head.
 1.53.16.1 22-Oct-2006  yamt sync with head
 1.53.14.1 18-Nov-2006  ad Sync with head.
 1.55.4.2 12-Mar-2007  rmind Sync with HEAD.
 1.55.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.57.44.3 11-Mar-2010  yamt sync with head
 1.57.44.2 20-Jun-2009  yamt sync with head
 1.57.44.1 16-May-2008  yamt sync with head.
 1.57.42.1 18-May-2008  yamt sync with head.
 1.57.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.58.18.1 21-Apr-2010  matt sync to netbsd-5
 1.58.10.2 18-Oct-2009  bouyer Back out ticket 967
 1.58.10.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #967):
sys/arch/sparc64/include/bus.h: revision 1.59
again
 1.5 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.4 04-Nov-2016  macallan branches: 1.4.16;
add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.3 07-Jul-2016  msaitoh branches: 1.3.2;
KNF. Remove extra spaces. No functional change.
 1.2 17-Jul-2011  dyoung branches: 1.2.12; 1.2.30;
Switch sparc and sparc64 to new-style <sys/bus.h>.
 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.30.2 05-Dec-2016  skrll Sync with HEAD
 1.2.30.1 09-Jul-2016  skrll Sync with HEAD
 1.2.12.1 03-Dec-2017  jdolecek update from HEAD
 1.3.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5 27-Aug-2018  riastradh Expand to __nothing, not to empty.
 1.4 27-Aug-2018  riastradh Include some needful header files and forward declarations.
 1.3 14-Jul-2014  nakayama branches: 1.3.26; 1.3.28;
Make bus_space_barrier inline to avoid unnecessary argument handling.
 1.2 17-Jul-2011  dyoung branches: 1.2.12; 1.2.26;
Switch sparc and sparc64 to new-style <sys/bus.h>.
 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.26.1 10-Aug-2014  tls Rebase.
 1.2.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.28.1 10-Jun-2019  christos Sync with HEAD
 1.3.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 20-Mar-1999  thorpej branches: 1.3.22; 1.3.26; 1.3.34;
Garbage-collect.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.34.1 31-Aug-2002  gehenna catch up with -current.
 1.3.26.1 01-Aug-2002  nathanw Catch up to -current.
 1.3.22.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.12 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.11 16-Aug-2002  petrov Add sab.
 1.10 27-Feb-2002  christos branches: 1.10.8;
- define other DEV_ constants that the local port uses.
- delete cdev_decl(mm) since <sys/conf.h> does it.
 1.9 26-Mar-2001  lukem branches: 1.9.2; 1.9.8;
- add dev_noimpl(xxx,yyy) macro to replace "(dev_type_xxx((*))) yyy",
and use appropriately

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

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

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

- ensure that the comments are accurate WRT the behaviour of a given entry
 1.8 21-Sep-2000  eeh branches: 1.8.2;
Remove some unsupported devices and add support for the `com' device.
 1.7 19-May-2000  eeh Fix the sparc64 console.

Unlike the other Sun machines, UltraSPARCs can have consoles run on different
chips than zs, so we need to support them. So, here we go:

Add a new PROM console driver with a major number and everything.
This is the default driver if nothing else attaches. It does not
use the keyboard driver since the PROM translates keystrokes itself.
(Unfortunately it also swallows L1-A).

Have the keyboard driver take over the console when it attaches on a
serial port. When a serial port detects a keyboard and attaches the
keyboard driver, it needs to provide a set of consdev vectors. They
keyboard driver will use those to send I/O to the keyboard and mouse.
 1.6 14-Apr-2000  mrg add bpt and lpt. fixes final gcc warnings for GENERIC.
 1.5 05-Jun-1999  eeh branches: 1.5.2;
Fix things up so they compile again.
 1.4 13-Nov-1998  oster branches: 1.4.6;
Updating of bdev's and cdev's to support RAIDframe.
 1.3 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.2 05-Sep-1998  christos Assign copyright to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.2 27-Mar-2001  bouyer Sync with HEAD.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.9.8.4 17-Sep-2002  nathanw Catch up to -current.
 1.9.8.3 27-Aug-2002  nathanw Catch up to -current.
 1.9.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.9.8.1 26-Mar-2001  nathanw file conf.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.9.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.9.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.10.8.1 19-May-2002  gehenna Remove port-dependent conf.h.
 1.135 07-Sep-2024  andvar spelling and grammar fixes, mainly in comments.
 1.134 13-Jul-2023  riastradh branches: 1.134.6;
Break cycle by using `struct kmutex *' instead of `kmutex_t *'.

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

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

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

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

- Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers.
- Add ci_gmon member to struct cpu_info of each MP arch.
- Add kern.profiling.percpu node in sysctl tree.
- Add new -c <cpuid> option to kgmon(8) to specify the cpuid, like openbsd.
For compatibility, if the -c option is not specified, the entire system can be
operated as before, and the -p option will get the total profiling data for
all CPUs.
 1.132 05-Apr-2021  nakayama Fix build w/o options SUN4V.
 1.131 03-Apr-2021  palle Improve cpu_idle() by allowing a platform specific implementaion (same logic as the sparc implementation) - currently only used by sun4v
 1.130 10-Mar-2020  christos branches: 1.130.4; 1.130.6;
kill extra curproc/curlwp definitions that have no chance of working.
 1.129 29-Dec-2019  martin Simplify some macros: if we only ever use them on the local cpu,
there is no need to do another pointer derefernence to go via the global
address of our cpu info.
Pointed out by ad.
 1.128 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.127 23-Nov-2019  ad cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().
 1.126 08-Feb-2019  palle sun4v: initialize %stickcmpr properly when establishing interrupt - fixes issue seen on newer sun4v/SPARC-T5 system where the interrupt never fires.
 1.125 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.124 16-Jan-2018  mrg branches: 1.124.2; 1.124.4;
implement cpuctl identify for sparc and sparc64.

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

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

cpuctl:
- add identifycpu_bind() that returns false on !x86 as their
identify routines do not need to run on a particular CPU to
obtain its information, and use it to avoid trying to set
affinity when not needed.
- add sparc and sparc64 cpu identify support using the newly
exported values.
 1.123 10-Feb-2017  palle sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.122 25-Jun-2016  palle branches: 1.122.2; 1.122.4;
sun4v: fix previous fix - no need to protect "struct inthand" with "#if defined(_KERNEL)" + use proper include file name - sparc64/bus_defs.h -> machine/bus_defs.h
 1.121 23-Jun-2016  palle sun4v: Fix build issue introduced in previous commit - bus stuff is kernel only, so protect this with _KERNEL
 1.120 22-Jun-2016  palle sun4v: add cbus driver - from OpenBSD
 1.119 10-May-2016  palle sun4v: make device interrupts work. Introduce a new intrhand_alloc() function for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok martin@
 1.118 07-Sep-2015  palle Move function prototypes for cpu_ecache_associativity() and cpu_ecache_size() outside the MULTIPROCESSOR block so a GENERIC.UP kernel will build again
 1.117 06-Sep-2015  nakayama Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.116 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.115 15-Jun-2015  martin Slightly optimize the ITLB usage on secondary processors
 1.114 03-Jan-2015  palle smp_tlb_flush_pte(): Avoid run-time check for cpu type/implementation by installing correct function pointer in sparc64_ip_init(). sparc64_send_ipi() is changed to a function pointer as well to avoid run-time checks.
 1.113 24-Sep-2014  palle branches: 1.113.2;
sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.112 04-Sep-2014  palle sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.111 08-Jun-2014  palle branches: 1.111.2;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.110 21-Feb-2014  palle branches: 1.110.2;
sun4v: Rename TLB_ defines to SUN4U_TLB_ so entries created using TSB_DATA() are properly setup for sun4u and sun4v. Relocate the cputyp variable from autoconf.c to locore.s and make it const in param.h so optimized code can be generated. Parts from OpenBSD. Optimization suggested by nakayama@. OK martin@, mrg@, nakayama@
 1.109 09-Jan-2014  palle sun4v: Update description of the ci_mmfsa field in the cpu_info structure
 1.108 09-Jan-2014  macallan allow non-SUN4V kernels to build
 1.107 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.106 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.105 10-Nov-2013  christos use __unused instead of __USE and void cast to mark iterator variable unused
where needed (from phone)
 1.104 13-Sep-2013  martin Make CPU_INFO_FOREACH more gcc 4.8.1 friendly
 1.103 20-Aug-2013  macallan support UltraSPARC-IIe STICK counter as time base
 1.102 21-Jun-2013  nakayama branches: 1.102.2;
Avoid data_access_error trap panic when reading unused PCI
configuration space.

This method is described in UltraSPARC IIi User's Manual "16.2.1
Probing PCI during boot using deferred errors", and refer to the
implementation of OpenBSD.
 1.101 04-Feb-2013  macallan add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up
 1.100 09-Nov-2012  nakayama Make setstick() and getstick() to inline functions.
 1.99 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.98 30-Jul-2011  martin branches: 1.98.2; 1.98.8; 1.98.12;
Get rid of #ifdef __sparc__ in uvm code - as noted by cgd back 1996,
now that we have __HAVE_CPU_VMSPACE_EXEC/cpu_vmspace_exec().
 1.97 20-Jul-2011  macallan add per ivec event counters
 1.96 13-Apr-2011  mrg re-include sparc64/sparc64/intreg.h in kernel mode. it's necessary.
 1.95 13-Apr-2011  mrg export a bunch of things to _KMEMUSER as well.

XXX: should consolidate the curcpu/curlwp definitions.
 1.94 24-Jan-2011  martin Provide LWP_PC
 1.93 26-Dec-2010  martin branches: 1.93.2; 1.93.4;
Move ci_data first in struct cpu_info
 1.92 29-May-2010  martin Add a generic ipi to call arbitrary C functions on another (or all other)
cpu(s). Will be used in the near future by some code Mindaugas is working on.
 1.91 24-May-2010  martin Make C declarations match assembler reality: ipi functions get two arguments
(which most of them (partly) ignore, but anyway).
 1.90 28-Mar-2010  mrg - add a kmutex_t ci_ctx_lock to struct cpu_info, and initialise it in
cpu_pmap_init() and replace pmap_ctx_lock usage with this new ci_ctx_lock

- replace smp_dcache_flush_page_all() with smp_dcache_flush_page_cpuset(),
that flushes only on the set of CPUs not, everyone. add new
dcache_flush_page_cpuset() to flush this page from the D$ only
on the specified set of CPUs.

- add a cpuset to pmap_free_page() and use it when freeing PTE pages
when a pmap is destroyed

- introduce pmap_free_page_noflush(), and use it when we allocated a
page for PTEs but didn't use it and don't need to flush it

- don't bother with pmap_lock in pmap_extract(), the only potential
issue is pseg_get() which is already safe


tested on sb2000, sb2500 and ultra80 with a bunch of various heavy
workloads, and seems to give a clear 1-2% speed up for high-forking /
short lived processes, such as ./configure.
 1.89 06-Mar-2010  mrg branches: 1.89.2;
clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.88 02-Feb-2010  mrg branches: 1.88.2;
- split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.87 21-Oct-2009  rmind Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.
 1.86 30-May-2009  martin cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.85 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.84 05-Oct-2008  nakayama branches: 1.84.4; 1.84.10;
struct cpu_info: reorder member to avoid a padding.
 1.83 10-Jul-2008  nakayama Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.
 1.82 14-Jun-2008  nakayama branches: 1.82.2;
Remove declarations of unexist variables and functions.
 1.81 18-May-2008  martin branches: 1.81.2;
Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.
 1.80 29-Apr-2008  ad branches: 1.80.2;
Mirror sparc and provide sparc_softintr stuff. There is no functional
change, beyond renaming a function and putting back disestablish/schedule.
PR kern/37540.
 1.79 09-Apr-2008  nakayama branches: 1.79.2; 1.79.4;
Reorganize clock assignments on SMP kernel:
- don't use separate statintr on primary CPU.
- invoke clockintr instead of statintr on secondary CPUs.

This change fixes the problem setitimer(2) didn't work on secodary CPUs.
 1.78 03-Apr-2008  nakayama Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.
 1.77 17-Mar-2008  nakayama Make schedintr interrupt handler per-CPU.
While there rename tickintr interrupt handler and share initialization
code with schedintr.
 1.76 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.75 02-Mar-2008  nakayama - make interrupt pending list per-CPU.
- make tickintr() MP-safe.
- remove unused port-sparc derived interrupt code.

Ok by martin@.
 1.74 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.73 27-Feb-2008  xtraeme Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.72 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.71 18-Feb-2008  martin branches: 1.71.2; 1.71.6;
remove unused extern declarations
 1.70 18-Feb-2008  martin For non-mpsafe interrupt handlers, grab the kernel lock via a biglock
wrapper. Fixes PR port-sparc64/37468.
 1.69 15-Jan-2008  martin Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.68 09-Dec-2007  martin branches: 1.68.2;
Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.
 1.67 17-Oct-2007  garbled branches: 1.67.2; 1.67.4; 1.67.6;
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.66 11-Sep-2007  martin Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.
 1.65 09-Sep-2007  martin Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.64 25-Aug-2007  martin branches: 1.64.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.63 17-May-2007  yamt branches: 1.63.4; 1.63.8;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.62 04-Mar-2007  christos branches: 1.62.2; 1.62.4; 1.62.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.61 16-Feb-2007  ad branches: 1.61.2;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.60 09-Feb-2007  ad Merge newlock2 to head.
 1.59 16-Oct-2006  martin Remove obsolet kgdb parts
 1.58 02-Oct-2006  mrg remove some sparc v8 only definitions.
 1.57 18-Sep-2006  martin branches: 1.57.2;
Lazy FPU handling for the MULTIPROCESSOR case
 1.56 15-Sep-2006  martin Do not bother to save fpu state when we are about to get rid of it.
 1.55 13-Sep-2006  mrg SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.54 07-Jun-2006  kardel branches: 1.54.6;
convert to timecounters (from branch simonb-timecounters)
 1.53 20-Feb-2006  cdi branches: 1.53.2; 1.53.8;
Use ANSI-style function definitions and declarations.
 1.52 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.51 27-Jan-2006  cdi branches: 1.51.2; 1.51.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.50 24-Dec-2005  perry branches: 1.50.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.49 11-Dec-2005  christos merge ktrace-lwp.
 1.48 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.47 16-Jun-2005  briggs branches: 1.47.2; 1.47.4;
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
match i386 et al.
 1.46 22-Sep-2004  yamt move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.45 18-Jun-2004  martin Fix small glitches to make SMP kernels compile again.
 1.44 18-Jun-2004  petrov Define mp_pause(resume)_cpus needed for callprom.
 1.43 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.42 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.41 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.40 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 1.39 20-Nov-2003  petrov Set curcpu() for SMP.
 1.38 15-Nov-2003  petrov Compile GENERIC.MP.
 1.37 09-Nov-2003  tsutsui Use #if defined(_KERNEL_OPT) to protect #include "opt_xxx.h"
from building LKM etc. Suggested by mrg.
 1.36 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.35 05-Feb-2003  nakayama branches: 1.35.2;
Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.34 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.33 27-Nov-2002  pk Sync machdep sysctls with sparc.
 1.32 29-Sep-2002  chs remove some vestigial FPU and cache code that's not need on ultrasparcs.
misc tidiness.
 1.31 14-May-2002  eeh branches: 1.31.4;
Have CLKF_BASEPRI() always return false for now to prevent hardclock
from being blocked by softclock.
 1.30 09-Feb-2002  eeh Correctly take into account the satck bias in CLKF_INTR().
 1.29 03-Sep-2001  mrg branches: 1.29.6;
don't explicitly size the intrhand[] array; fixes PR#13859 from <martti.kuparinen@iki.fi>
 1.28 14-Jun-2001  thorpej branches: 1.28.2;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.27 15-Jan-2001  thorpej branches: 1.27.2;
Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.26 29-Sep-2000  eeh This seems to fix the interrupt lossage of non-debug kernels.
 1.25 28-Sep-2000  eeh probeget() actually handles 64-bit values so fix the prototype.
 1.24 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.23 03-Jul-2000  eeh Prevent interrupts from being posted if they are active and deprecate polled
interrupts. This seems to eliminate the spurious interrupts.
 1.22 02-Jul-2000  eeh Clean up interrupt handling some more.
 1.21 30-Jun-2000  eeh Fix interrupt delivery on UltraSPARC IIi machines.
 1.20 19-Jun-2000  eeh branches: 1.20.2;
Have separate data and text segments, make text read-only.
 1.19 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.18 12-Jun-2000  mrg ih_map & ih_clr are volatile.
 1.17 26-May-2000  thorpej branches: 1.17.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.16 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.15 30-Dec-1999  eeh Make CLKF_INTR() more intelligent.
 1.14 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.13 11-Oct-1999  eeh branches: 1.13.2; 1.13.4;
Update to post 1.4.
 1.12 10-Aug-1999  thorpej branches: 1.12.2;
Define cpu_number() as discussed on tech-smp.
 1.11 20-Jun-1999  eeh Move the DVMA mapin/mapout functions from the SBus driver to the iommu driver.
 1.10 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.9 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.8 05-Jun-1999  eeh Fix things up so they compile again.
 1.7 30-May-1999  eeh Add code to support using %tick as the system clock if no "counter-timer" node
is found.
 1.6 30-May-1999  mrg clone intr.h from the SPARC.
 1.5 24-Nov-1998  mrg branches: 1.5.6;
add protos for switchtoctx, fixalign and emulinstr. XXX should all these be here?
 1.4 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.3 05-Oct-1998  thorpej cpu_set_kpc() prototype is already in <sys/systm.h>.
 1.2 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.4.1 15-Nov-1999  fvdl Sync with -current
 1.13.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.2.2 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.20.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.27.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.28.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.28.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.28.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.28.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.29.6.8 11-Dec-2002  thorpej Sync with HEAD.
 1.29.6.7 18-Oct-2002  nathanw Catch up to -current.
 1.29.6.6 24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.29.6.5 20-Jun-2002  nathanw Catch up to -current.
 1.29.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.29.6.3 04-Jan-2002  eeh Cleanup.
 1.29.6.2 03-Jan-2002  petrov make kernel compile
 1.29.6.1 03-Sep-2001  petrov file cpu.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.31.4.1 24-Jun-2003  grant Apply patch (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.35.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.35.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.35.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.35.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.35.2.1 03-Aug-2004  skrll Sync with HEAD
 1.47.4.1 02-Nov-2005  yamt sync with head.
 1.47.2.8 17-Mar-2008  yamt sync with head.
 1.47.2.7 27-Feb-2008  yamt sync with head.
 1.47.2.6 21-Jan-2008  yamt sync with head
 1.47.2.5 27-Oct-2007  yamt sync with head.
 1.47.2.4 03-Sep-2007  yamt sync with head.
 1.47.2.3 26-Feb-2007  yamt sync with head.
 1.47.2.2 30-Dec-2006  yamt sync with head.
 1.47.2.1 21-Jun-2006  yamt sync with head.
 1.50.2.3 01-Mar-2006  yamt sync with head.
 1.50.2.2 18-Feb-2006  yamt sync with head.
 1.50.2.1 01-Feb-2006  yamt sync with head.
 1.51.4.2 02-Jun-2006  kardel - support timecounters
 1.51.4.1 22-Apr-2006  simonb Sync with head.
 1.51.2.1 09-Sep-2006  rpaulo sync with head
 1.53.8.1 19-Jun-2006  chap Sync with head.
 1.53.2.2 14-Sep-2006  yamt sync with head.
 1.53.2.1 26-Jun-2006  yamt sync with head.
 1.54.6.3 11-Jan-2007  ad Checkpoint work in progress.
 1.54.6.2 29-Dec-2006  ad Checkpoint work in progress.
 1.54.6.1 18-Nov-2006  ad Sync with head.
 1.57.2.2 22-Oct-2006  yamt sync with head
 1.57.2.1 18-Sep-2006  yamt file cpu.h was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.61.2.2 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.61.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.62.10.2 03-Oct-2007  garbled Sync with HEAD
 1.62.10.1 22-May-2007  matt Update to HEAD.
 1.62.4.1 11-Jul-2007  mjf Sync with head.
 1.62.2.2 09-Oct-2007  ad Sync with head.
 1.62.2.1 27-May-2007  ad Sync with head.
 1.63.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.63.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.63.4.2 10-Sep-2007  skrll Sync with HEAD.
 1.63.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.64.2.3 23-Mar-2008  matt sync with HEAD
 1.64.2.2 09-Jan-2008  matt sync with HEAD
 1.64.2.1 06-Nov-2007  matt sync with HEAD
 1.67.6.1 11-Dec-2007  yamt sync with head.
 1.67.4.1 26-Dec-2007  ad Sync with head.
 1.67.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.68.2.1 19-Jan-2008  bouyer Sync with HEAD
 1.71.6.5 05-Oct-2008  mjf Sync with HEAD.
 1.71.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.71.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.71.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.71.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.71.2.1 24-Mar-2008  keiichi sync with head.
 1.79.4.5 11-Aug-2010  yamt sync with head.
 1.79.4.4 11-Mar-2010  yamt sync with head
 1.79.4.3 20-Jun-2009  yamt sync with head
 1.79.4.2 04-May-2009  yamt sync with head.
 1.79.4.1 16-May-2008  yamt sync with head.
 1.79.2.3 17-Jun-2008  yamt sync with head.
 1.79.2.2 04-Jun-2008  yamt sync with head
 1.79.2.1 18-May-2008  yamt sync with head.
 1.80.2.3 10-Oct-2008  skrll Sync with HEAD.
 1.80.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.80.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.81.2.2 18-Jul-2008  simonb Sync with head.
 1.81.2.1 18-Jun-2008  simonb Sync with head.
 1.82.2.1 19-Oct-2008  haad Sync with HEAD.
 1.84.10.1 05-Jun-2009  snj branches: 1.84.10.1.2;
Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.84.10.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.84.4.1 05-Jun-2009  snj Pull up following revision(s) (requested by martin in ticket #786):
sys/arch/sparc64/include/cpu.h: revision 1.86
sys/arch/sparc64/sparc64/locore.s: revision 1.291
sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.89
cpu_setfunc() can not use lwp_trampoline, as that has additional lwp startup
semantics. Use a simpler setfunc_trampoline instead.
 1.88.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.88.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.89.2.3 21-Apr-2011  rmind sync with head
 1.89.2.2 05-Mar-2011  rmind sync with head
 1.89.2.1 30-May-2010  rmind sync with head
 1.93.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.93.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.98.12.5 03-Dec-2017  jdolecek update from HEAD
 1.98.12.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.98.12.3 23-Jun-2013  tls resync from head
 1.98.12.2 25-Feb-2013  tls resync with head
 1.98.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.98.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.98.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.98.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.102.2.2 18-May-2014  rmind sync with head
 1.102.2.1 28-Aug-2013  rmind sync with head
 1.110.2.1 10-Aug-2014  tls Rebase.
 1.111.2.1 20-Jul-2015  snj Pull up following revision(s) (requested by martin in ticket #842):
sys/arch/sparc/stand/ofwboot/loadfile_machdep.c: revision 1.14
sys/arch/sparc/stand/ofwboot/version: revision 1.21
sys/arch/sparc64/include/cpu.h: revision 1.115
sys/arch/sparc64/sparc64/autoconf.c: revision 1.203
sys/arch/sparc64/sparc64/mp_subr.S: revision 1.9 via patch
sys/arch/sparc64/sparc64/pmap.c: revisions 1.295, 1.295 via patch
Fix available length calculation in kvamap_extract when reusing existing
mappings.
--
Bump version now that we can load kernels with sizeof(.data)+sizeof(.bss)> 4 MB
--
Do not hardcode the assumption that .data and .bss fit together in a single
4 MB page. This allows booting kernels with options USB_DEBUG again.
--
Slightly optimize the ITLB usage on secondary processors
 1.113.2.5 28-Aug-2017  skrll Sync with HEAD
 1.113.2.4 09-Jul-2016  skrll Sync with HEAD
 1.113.2.3 29-May-2016  skrll Sync with HEAD
 1.113.2.2 22-Sep-2015  skrll Sync with HEAD
 1.113.2.1 06-Apr-2015  skrll Sync with HEAD
 1.122.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.122.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.124.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.124.4.1 10-Jun-2019  christos Sync with HEAD
 1.124.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.130.6.2 17-Apr-2021  thorpej Sync with HEAD.
 1.130.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.130.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.133.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.134.6.1 02-Aug-2025  perseant Sync with HEAD
 1.8 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 28-Mar-2008  martin branches: 1.6.2; 1.6.4;
Use the passed cpu info for returning the frequency, not the current
cpu
 1.5 17-Oct-2007  garbled branches: 1.5.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.4 09-Sep-2007  martin Make cpufrequency and friends per cpu values.
Prepare a hz tick interrupt on secondary CPUs via %tick, but do not
enable it yet, as it breaks ddb.
 1.3 16-Feb-2006  perry branches: 1.3.24; 1.3.32; 1.3.38; 1.3.42; 1.3.44;
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.2; 1.1.20;
Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.

This should fix PR port-sparc64/18452.
(approved by martin)
 1.1.20.1 27-Oct-2007  yamt sync with head.
 1.1.2.2 24-Jun-2003  grant Create new file from rev 1.1 (requested by nakayama in ticket #1329):

Switch to use cycle counter (%tick) based microtime().

This is derived from alpha/microtime.c and i386/tsc_microtime.c,
and will share with both ports.
 1.1.2.1 05-Feb-2003  grant file cpu_counter.h was added on branch netbsd-1-6 on 2003-06-24 09:31:35 +0000
 1.2.6.1 22-Apr-2006  simonb Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.2.2.1 18-Feb-2006  yamt sync with head.
 1.3.44.1 06-Nov-2007  matt sync with HEAD
 1.3.42.1 02-Oct-2007  joerg Sync with HEAD.
 1.3.38.1 10-Sep-2007  skrll Sync with HEAD.
 1.3.32.1 03-Oct-2007  garbled Sync with HEAD
 1.3.24.1 09-Oct-2007  ad Sync with head.
 1.5.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.5.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.4.2 20-Jun-2009  yamt sync with head
 1.6.4.1 16-May-2008  yamt sync with head.
 1.6.2.1 18-May-2008  yamt sync with head.
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 28-Feb-2008  martin branches: 1.7.2; 1.7.4;
Make TSBs and MMU contexts per-cpu.
 1.6 15-Jan-2008  martin branches: 1.6.2; 1.6.6;
Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.5 13-Sep-2006  mrg branches: 1.5.30; 1.5.36; 1.5.44;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.4 24-Dec-2005  perry branches: 1.4.8; 1.4.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 14-Mar-2004  simonb branches: 1.2.4; 1.2.18;
Use "#define<tab>" consistently.
 1.1 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.2.18.4 17-Mar-2008  yamt sync with head.
 1.2.18.3 21-Jan-2008  yamt sync with head
 1.2.18.2 30-Dec-2006  yamt sync with head.
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 14-Mar-2004  skrll file cpuset.h was added on branch ktrace-lwp on 2004-08-03 10:41:33 +0000
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.4.8.1 14-Sep-2006  yamt sync with head.
 1.5.44.1 19-Jan-2008  bouyer Sync with HEAD
 1.5.36.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.30.1 23-Mar-2008  matt sync with HEAD
 1.6.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.2.1 24-Mar-2008  keiichi sync with head.
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.71 10-Mar-2024  rillig sparc: fix snprintb formats for SFSR_BITS
 1.70 02-Feb-2024  andvar fix typos, mainly s/unsupport/unsupported/ in log messages.
 1.69 10-Aug-2023  andvar fix typos in comments.
 1.68 06-May-2023  andvar few more typos in the word "register", mainly s/resister/register/.
In one comment I assume that it was meant to be pull-up resistor.
 1.67 13-Nov-2019  nakayama Revert workarounds for clang.
In-tree clang can now handle the "r" asm constraint for 64-bit values properly.
 1.66 05-Apr-2019  nakayama Redo previous.
In the case of store variant, put dummy constraint in output
instead of input.

Suggested by joerg@ in source-changes-d@
 1.65 05-Apr-2019  nakayama Add dummy constraints to avoid excessive optimization in clang.
GENERIC kernel compiled with clang now boot at least on my Fire V100.
 1.64 28-Dec-2016  martin branches: 1.64.16;
Rename the "flush" macro to "sparc_flush_icache", the former is way too
generic for a macro name.
 1.63 03-Feb-2016  palle branches: 1.63.2;
sun4v: extend dmmu_set_secondary_context() to handle both sun4u and sun4v. ok martin@
 1.62 01-Apr-2015  palle sun4v: Implement handling of cpu_mondo trap - from OpenBSD - tested using the Legion simulator
 1.61 16-Jul-2014  palle branches: 1.61.4;
sun4v: Introduce SET_MMU_CONTEXTID macro for setting the mmu context id on both sun4u and sun4v
 1.60 16-Dec-2013  palle branches: 1.60.2;
Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.59 08-Nov-2012  nakayama branches: 1.59.2;
Rename ASR_IDSR to ASI_IDSR, which is ASI (Address Space Identifier),
not ASR (Ancillary State Register).
 1.58 08-Nov-2012  nakayama Move ASRs macro to more appropriate header.
While there remove useless macro.
 1.57 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.56 08-Oct-2011  nakayama branches: 1.56.2; 1.56.8; 1.56.12;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.
 1.55 16-Mar-2011  mrg add some control registers found on the Fire and Jupiter busses.
from openbsd.
 1.54 18-Dec-2010  mrg branches: 1.54.2;
add a bit for MCCR_RAW_EN -- enable read-after-write.
 1.53 10-Jul-2010  nakayama Clear the upper word explicitly before combining two 32-bit values to 64-bit
on 32-bit kernels.
 1.52 23-Feb-2010  mrg branches: 1.52.2;
add some bits to set to access all the cheetah dtlb/itlb's.
 1.51 21-Feb-2010  mrg s/D-cache/I-cache/ in some comments.
 1.50 13-Feb-2010  mrg add some defines for the sizes of TLBs in various CPUs.
 1.49 01-Feb-2010  mrg branches: 1.49.2;
for USIII, use the new "tlb demap all" operation in sp_tlb_flush_all()
 1.48 05-Dec-2009  nakayama Garbage collect unused or incomplete definitions.
 1.47 05-Dec-2009  nakayama Bring together similar inline asm codes of ld*a and st*a definitions
using macro, also remove unnecessary membar #Sync and %asi restore in
the case of 32-bit kernel.

While there, introduce an optimization case that asi is constant if
we are using gcc.
 1.46 28-Nov-2009  mrg add some ultrasparcIII defines, from openbsd.
 1.45 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.44 31-Mar-2007  hannken branches: 1.44.38;
Cleanup last by using a "n"umeric address space identifier.

Ok: Martin Husemann <martin@netbsd.org>
 1.43 30-Mar-2007  martin When invalidating a context, make sure to flush user windows upfront.
Do not set the DMMU secondary context to 0 (that would be kernel), and
add a few required membars after switching the secondary dmmu context.

This avoids SIRs caused by double kernel_data_faults, caused by spills
of obsolete user windows after the context for that user pmap is gone.
 1.42 20-Feb-2006  cdi branches: 1.42.18; 1.42.20; 1.42.24; 1.42.26;
Use ANSI-style function definitions and declarations.
 1.41 16-Feb-2006  perry Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.40 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.39 24-Dec-2005  perry branches: 1.39.2; 1.39.4; 1.39.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.38 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.37 11-Dec-2005  christos merge ktrace-lwp.
 1.36 01-Jul-2004  petrov branches: 1.36.12;
Added UPA_MID definitions and macros(similar to FreeBSD).
Added membar_store, membar_load macros.
No need to set %asi _after_ alternate space use in corresponding functions.
Enable(unifdef) casa functions for __arch64__.
 1.35 01-Jul-2004  heas typo in define name, littie -> little
 1.34 24-Jun-2004  martin Add missing ; in inline assembler for 32bit kernels
 1.33 17-Jun-2004  petrov clean-up, reformat __asm statements.
 1.32 22-Mar-2004  nakayama Eliminate cast 64-bit address to u_long.
 1.31 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.30 24-Apr-2002  eeh branches: 1.30.10;
Don't need to flush the d$ for MMU bypass accesses.
 1.29 14-Jan-2002  eeh Make PHYS_ASI() also recognize little-endian ASIs.
 1.28 06-Aug-2001  eeh branches: 1.28.6;
Add some alternate spellings for ASIs.
Make sure ASI_PRIMARY_NOFAULT is always restored.
Garbage collect some old code.
 1.27 19-Jul-2001  eeh Don't bother flushing cache lines for un-cached accesses.
 1.26 29-Jun-2001  eeh branches: 1.26.2;
Add the shorter version of block ASIs used by Sun.
 1.25 29-Dec-2000  eeh Fix some 32-bit assembly code.
 1.24 04-Dec-2000  fvdl Comment out caxsa, it's not used. Avoids 32 bit compile errors.
 1.23 31-Aug-2000  eeh Fix register sheduling bug in st?a() routines and add casxa().
 1.22 14-Jul-2000  eeh Tell gcc that stores clobber "memory". Probably makes no difference since
they should not be used to access normal memory anyway.
 1.21 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.20 24-Jun-2000  eeh More VM cleanup:

Move the cpu_info structure above the interrupt stack so it won't
get corrupted if the stack overflows.

Flush the D$ before and after all MMU bypass accesses since the
D$ latches all of those.
 1.19 20-Jun-2000  eeh lda is unsigned, ldswa is signed. Fixes a 32-bit sign extension bug.
 1.18 19-Jun-2000  eeh branches: 1.18.2;
Have separate data and text segments, make text read-only.
 1.17 10-Jun-2000  eeh Only use 32-bit addresses for all accesses that don't bypass the MMU.
Makes SBus work again.
 1.16 08-Jun-2000  eeh Fixup signed/unsigned issues so 32-bit addresses are not sign extended.
 1.15 07-Jun-2000  pk Add a couple of missing semi-colons.
 1.14 02-Jun-2000  eeh Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).
 1.13 10-Apr-2000  mrg branches: 1.13.2;
- IRSR_BUSY is bit 5 not bit 4.
- IRSR_MID(x) is &'d with 0x1f (5 bits) not 0xf.
 1.12 08-Jun-1999  mrg branches: 1.12.2;
mmm, missing return types make gcc unhappy.
 1.11 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.10 31-May-1999  eeh Fix some bugs in some more of those asm macros.
 1.9 30-May-1999  eeh Re-write ASI load/stores to use full 64-bit addresses so we can use device
register addresses with MMU bypass ASIs.
 1.8 22-May-1999  eeh Fixup argument confusion to __asm() statements. long long is two registers
wide in 32-bit mode. Doh!.
 1.7 11-May-1999  eeh Don't clobber any input regs in __asm statements.
 1.6 22-Mar-1999  eeh branches: 1.6.4;
Flush D$ on bypass accesses.
 1.5 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.4 13-Nov-1998  eeh Fix 32-bit gcc scheduling problems.
 1.3 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.13.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.18.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.26.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.26.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.26.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.26.2.1 03-Aug-2001  lukem update to -current
 1.28.6.3 20-Jun-2002  nathanw Catch up to -current.
 1.28.6.2 28-Feb-2002  nathanw Catch up to -current.
 1.28.6.1 06-Aug-2001  nathanw file ctlreg.h was added on branch nathanw_sa on 2002-02-28 04:12:12 +0000
 1.30.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.10.1 03-Aug-2004  skrll Sync with HEAD
 1.36.12.2 03-Sep-2007  yamt sync with head.
 1.36.12.1 21-Jun-2006  yamt sync with head.
 1.39.6.1 22-Apr-2006  simonb Sync with head.
 1.39.4.1 09-Sep-2006  rpaulo sync with head
 1.39.2.2 01-Mar-2006  yamt sync with head.
 1.39.2.1 18-Feb-2006  yamt sync with head.
 1.42.26.1 11-Jul-2007  mjf Sync with head.
 1.42.24.1 10-Apr-2007  ad Sync with head.
 1.42.20.1 02-Apr-2007  rmind Pull up to the branch:
cvs rdiff -r1.42 -r1.43 src/sys/arch/sparc64/include/ctlreg.h
cvs rdiff -r1.187 -r1.188 src/sys/arch/sparc64/sparc64/pmap.c
Requested by mrg@
 1.42.18.2 31-Mar-2007  bouyer Pull up following revision(s) (requested by hannken in ticket #548):
sys/arch/sparc64/include/ctlreg.h: revision 1.44
Cleanup last by using a "n"umeric address space identifier.
Ok: Martin Husemann <martin@netbsd.org>
 1.42.18.1 31-Mar-2007  bouyer Pull up following revision(s) (requested by martin in ticket #547):
sys/arch/sparc64/sparc64/pmap.c: revision 1.188
sys/arch/sparc64/include/ctlreg.h: revision 1.43
When invalidating a context, make sure to flush user windows upfront.
Do not set the DMMU secondary context to 0 (that would be kernel), and
add a few required membars after switching the secondary dmmu context.
This avoids SIRs caused by double kernel_data_faults, caused by spills
of obsolete user windows after the context for that user pmap is gone.
 1.44.38.3 11-Aug-2010  yamt sync with head.
 1.44.38.2 11-Mar-2010  yamt sync with head
 1.44.38.1 20-Jun-2009  yamt sync with head
 1.49.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.49.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.52.2.2 21-Apr-2011  rmind sync with head
 1.52.2.1 05-Mar-2011  rmind sync with head
 1.54.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.56.12.3 03-Dec-2017  jdolecek update from HEAD
 1.56.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.56.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.56.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.56.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.59.2.1 18-May-2014  rmind sync with head
 1.60.2.1 10-Aug-2014  tls Rebase.
 1.61.4.3 05-Feb-2017  skrll Sync with HEAD
 1.61.4.2 19-Mar-2016  skrll Sync with HEAD
 1.61.4.1 06-Apr-2015  skrll Sync with HEAD
 1.63.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.64.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.64.16.1 10-Jun-2019  christos Sync with HEAD
 1.36 10-Mar-2020  christos Don't provide things that don't make sense in userland. We don't provide
access to registers crash(8)...
 1.35 06-Nov-2017  christos branches: 1.35.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.34 31-Oct-2015  nakayama Remove #define SUN4U since machine/frame.h doesn't check SUN4U anymore.
 1.33 12-Jul-2011  mrg branches: 1.33.12; 1.33.30;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.32 20-Jun-2011  nakayama Remove frame32 hack with using the same trick in netbsd32_machdep.c.
 1.31 27-May-2011  nakayama branches: 1.31.2;
Fix 32-bit kernel build.
 1.30 26-May-2011  joerg Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD.
 1.29 13-Apr-2011  mrg this needs sys/types.h in userspace.
 1.28 11-Apr-2011  mrg remove DB_AOUT_SYMBOLS.
 1.27 14-Jan-2011  rmind branches: 1.27.2;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.26 25-Nov-2008  nakayama branches: 1.26.8;
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.25 10-Jul-2008  nakayama branches: 1.25.2; 1.25.4;
sparc64_ipi_save_fpstate:
- use primary MMU context for consistency with other trap/interrupt handlers.

sparc64_ipi_save_fpstate, savefpstate:
- avoid storing fp registers as we can.

sparc64_ipi_save_fpstate, savefpstate, loadfpstate:
- remove unaligned case since buffers allocated with pool_cache are ensured
64-byte aligned.

Ok by martin@.
 1.24 29-Feb-2008  martin branches: 1.24.4; 1.24.6; 1.24.8; 1.24.10;
Rearange ddb saved register values slightly.
While there fix completely bogus register access ops for < 64 bit values.
 1.23 22-Feb-2007  matt branches: 1.23.22; 1.23.38; 1.23.42;
More boolean_t -> bool
 1.22 21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.21 07-Oct-2006  rjs branches: 1.21.4;
Allow kernel to build with KGDB enabled.
 1.20 13-Sep-2006  mrg branches: 1.20.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.19 01-Apr-2006  cherry branches: 1.19.8;
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.18 20-Feb-2006  cdi branches: 1.18.2; 1.18.4; 1.18.6;
Use ANSI-style function definitions and declarations.
 1.17 11-Dec-2005  christos branches: 1.17.2; 1.17.4; 1.17.6;
merge ktrace-lwp.
 1.16 06-Jan-2004  petrov branches: 1.16.16;
Some cleanup and move ddb_regs declaration to db_interface.c
 1.15 18-May-2003  martin branches: 1.15.2;
My reading of the gdb code seems to indicate it expects 125 registers
from sparc64, not 72 (sparc value). Bump kgdb buffer size a bit too.
 1.14 29-Apr-2003  scw 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 09-Nov-2001  thorpej branches: 1.13.2;
Remove unneeded declarations of the db_machine_init() function. The
ARM ports are the only ones that actually have one, and it is about
to change.
 1.12 07-Jul-2001  eeh branches: 1.12.2; 1.12.6;
Also handle FPU registers.
 1.11 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.10 16-Mar-2000  eeh Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.9 10-Jan-2000  eeh Add debugger single-stepping and fix interrupt dispatch bugs.
 1.8 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.7 31-Jan-1999  mrg branches: 1.7.8; 1.7.10; 1.7.14;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.6 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.3 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.7.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.10.1 15-Nov-1999  fvdl Sync with -current
 1.7.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.12.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.12.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.2.2 09-Nov-2001  thorpej Remove unneeded declarations of the db_machine_init() function. The
ARM ports are the only ones that actually have one, and it is about
to change.
 1.13.2.1 09-Nov-2001  thorpej file db_machdep.h was added on branch nathanw_sa on 2001-11-09 06:52:26 +0000
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.16.4 17-Mar-2008  yamt sync with head.
 1.16.16.3 26-Feb-2007  yamt sync with head.
 1.16.16.2 30-Dec-2006  yamt sync with head.
 1.16.16.1 21-Jun-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 01-Mar-2006  yamt sync with head.
 1.18.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.18.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.18.2.2 14-Sep-2006  yamt sync with head.
 1.18.2.1 11-Apr-2006  yamt sync with head
 1.19.8.1 18-Nov-2006  ad Sync with head.
 1.20.2.1 22-Oct-2006  yamt sync with head
 1.21.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.23.42.3 17-Jan-2009  mjf Sync with HEAD.
 1.23.42.2 28-Sep-2008  mjf Sync with HEAD.
 1.23.42.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.38.1 24-Mar-2008  keiichi sync with head.
 1.23.22.1 23-Mar-2008  matt sync with HEAD
 1.24.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.24.10.1 19-Oct-2008  haad Sync with HEAD.
 1.24.8.1 18-Jul-2008  simonb Sync with head.
 1.24.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.4.1 04-May-2009  yamt sync with head.
 1.25.4.1 27-Nov-2008  snj Pull up following revision(s) (requested by nakayama in ticket #131):
sys/arch/sparc64/sparc64/db_disasm.c: revision 1.15
sys/arch/sparc64/sparc64/db_trace.c: revision 1.41
sys/arch/sparc64/sparc64/db_interface.c: revision 1.113
sys/ddb/db_command.c: revision 1.124
sys/arch/sparc64/include/db_machdep.h: revision 1.26
Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
 1.25.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.26.8.3 31-May-2011  rmind sync with head
 1.26.8.2 21-Apr-2011  rmind sync with head
 1.26.8.1 05-Mar-2011  rmind sync with head
 1.27.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.31.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.33.30.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.33.12.1 03-Dec-2017  jdolecek update from HEAD
 1.35.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 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.2 20-Jul-2002  mrg branches: 1.2.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 30-Dec-1999  eeh branches: 1.2.8; 1.2.12; 1.2.20;
Use absolute size structures for H/W registers.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.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.20.1 31-Aug-2002  gehenna catch up with -current.
 1.2.12.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14 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.13 12-Aug-2017  joerg Add sparc/sparc64 support for irelative relocations.
 1.12 31-Jan-2017  martin PR port-sparc64/51925: remove EM_SPARC32PLUS from the 64 bit ELF machine
ids we accept for our executables - that combination makes no sense
at all (probably copy&pasto).
 1.11 14-Nov-2013  martin branches: 1.11.6; 1.11.10; 1.11.14;
Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.
 1.10 30-May-2009  skrll branches: 1.10.12; 1.10.22; 1.10.26;
Add TLS relocation definitions.
 1.9 14-Mar-2006  cube branches: 1.9.68;
We really have EM_SPARC binaries in 32-bits mode, not EM_SPARC32PLUS.
And yes, we do have EM_SPARCV9 binaries in 64-bits mode.
 1.8 09-Dec-2001  thorpej branches: 1.8.32; 1.8.46; 1.8.48; 1.8.50; 1.8.52;
Add support for dumping ELF-cormat core files.
 1.7 11-Feb-2001  eeh branches: 1.7.4; 1.7.8;
Add some new gunk Sun uses.
 1.6 14-Jul-2000  eeh Add support for 64-bit PIC and dynamic linking.
 1.5 02-Apr-2000  minoura branches: 1.5.4;
Move dl* function definitions to libc on ELF.
Based on the patch supplied by Takuya Shiozaki <tshiozak@astec.co.jp>.
See http://mail-index.netbsd.org/tech-userlevel/2000/02/23/0000.html.
 1.4 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.3 02-Sep-1998  eeh branches: 1.3.12; 1.3.14; 1.3.16;
Periodic update: now starts probing devices.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.14.1 15-Nov-1999  fvdl Sync with -current
 1.3.12.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.7.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.7.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.52.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.8.50.1 01-Apr-2006  yamt sync with head.
 1.8.48.1 22-Apr-2006  simonb Sync with head.
 1.8.46.1 09-Sep-2006  rpaulo sync with head
 1.8.32.1 21-Jun-2006  yamt sync with head.
 1.9.68.1 20-Jun-2009  yamt sync with head
 1.10.26.1 18-May-2014  rmind sync with head
 1.10.22.2 03-Dec-2017  jdolecek update from HEAD
 1.10.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.11.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.11.6.2 28-Aug-2017  skrll Sync with HEAD
 1.11.6.1 05-Feb-2017  skrll Sync with HEAD
 1.1 29-Mar-2018  joerg branches: 1.1.2;
Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.
 1.1.2.2 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.1.2.1 29-Mar-2018  pgoyette file elf_support.h was added on branch pgoyette-compat on 2018-03-30 06:20:12 +0000
 1.7 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.6 16-Mar-2000  mycroft Foolish consistency. Mainly, always use underscores and sys/endian.h.
 1.5 21-Aug-1999  simonb branches: 1.5.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.4 24-Jan-1999  mycroft Mark [hn]to[nh][ls]() with __const__, so they are subject to CSE.
 1.3 15-Jan-1999  bouyer Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2 31-Jul-1998  mycroft (Always) (practice) (safe) (macro expansion).
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.1 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 17-Mar-2000  mycroft branches: 1.1.6;
In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 17-Mar-2000  bouyer file endian_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:26:47 +0000
 1.2 27-Nov-1999  mrg these files were removed years ago (exec.h was not even installed).
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2 19-Sep-2001  thorpej Use <dev/sun/fbio.h>, not our own copy.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.24; 1.1.1.1.26; 1.1.1.1.28;
Import of sparc64.
 1.1.1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.1.1.26.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.1.1.24.1 16-Aug-2001  tv Pullup [jdolecek]:

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

Use unsigned variable types to make bounds checking more correct.
 1.7 25-Aug-2003  uwe Framebuffer code common to sparc and sparc64 was merged and moved to
dev/sun 3 years ago. Remove these redundant and out-of-date copies.
All code now uses dev/sun/fbvar.h
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.5 26-Jun-2000  simonb branches: 1.5.24;
Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.4 13-Apr-1999  ad branches: 1.4.2; 1.4.12;
Bring sparc/sparc64 fb code and kernel configuration into line with
rcons changes.
 1.3 02-Sep-1998  eeh branches: 1.3.8;
Periodic update: now starts probing devices.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.1.1.1.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.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2 20-May-2011  nakayama branches: 1.2.4;
Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.1 31-Jan-2011  christos branches: 1.1.2; 1.1.4;
fenv support for sparc64 from Stathis Kamperis
 1.1.4.3 31-May-2011  rmind sync with head
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 31-Jan-2011  rmind file fenv.h was added on branch rmind-uvmplock on 2011-03-05 20:52:07 +0000
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 31-Jan-2011  bouyer file fenv.h was added on branch bouyer-quota2 on 2011-02-08 16:19:41 +0000
 1.2.4.2 06-Jun-2011  jruoho Sync with HEAD.
 1.2.4.1 20-May-2011  jruoho file fenv.h was added on branch jruoho-x86intr on 2011-06-06 09:06:52 +0000
 1.8 25-Oct-2008  mrg move the float definitions all into <sparc/float.h> and make that
version work in either 32 or 64 bit mode.
 1.7 11-Dec-2005  christos branches: 1.7.74; 1.7.78; 1.7.84;
merge ktrace-lwp.
 1.6 23-Oct-2003  kleink * Move the definitions for types other than single-precision and double-
precision back to machine-dependent headers. C99 has no strict
requirement which, if any, extended-precision type `long double' must
match, and even between 80-bit formats there are differences in
implementation (m68k vs. x86).
* On arm, consider __VFP_FP__.
 1.5 12-May-2003  kleink branches: 1.5.2;
Rename <sys/float_ieee.h> to <sys/float_ieee754.h>, following libc's
convention for these.
 1.4 19-Apr-2003  christos PR/3012: Greg A. Woods: Write all float.h files [except the vax of course]
in terms of float_ieee.h
 1.3 21-Sep-2001  eeh branches: 1.3.4;
Define proper constants for 128-bit floating point.
 1.2 27-Nov-1999  mrg branches: 1.2.6; 1.2.8;
merge cosmetic differences from sparc port.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.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.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.2 21-Sep-2001  eeh Define proper constants for 128-bit floating point.
 1.3.4.1 21-Sep-2001  eeh file float.h was added on branch nathanw_sa on 2001-09-21 20:48:03 +0000
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.84.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.78.1 04-May-2009  yamt sync with head.
 1.7.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.15 20-Nov-2008  martin remove duplicate prototype (sys/signalvar.h is authoritive)
 1.14 11-Dec-2005  christos branches: 1.14.74; 1.14.78; 1.14.84; 1.14.86;
merge ktrace-lwp.
 1.13 27-Oct-2003  christos remove buildcontext
 1.12 26-Oct-2003  christos more siginfo glue
 1.11 20-Jul-2002  mrg branches: 1.11.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.10 04-Dec-2001  darrenr branches: 1.10.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.9 04-Mar-2001  mrg branches: 1.9.4; 1.9.8;
oops; make this build with a 32 bit compiler again.
 1.8 02-Mar-2001  mrg clean up slightly; prepare to make this identical to sparc/frame.h.
 1.7 23-Jul-2000  mrg make this usable for for userland asm, which needs CC64FSZ
 1.6 11-Oct-1999  eeh branches: 1.6.2; 1.6.10;
Update to post 1.4.
 1.5 22-Sep-1998  eeh branches: 1.5.12;
More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.4 07-Sep-1998  eeh Make register32_t unsigned so we don't have sign extension problems.
 1.3 07-Sep-1998  eeh Fix problems copying in extended syscall arguments.
 1.2 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.12.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.10.1 26-Jul-2000  mycroft Approved by thorpej:
Enable pulling this into user-level code to get some definitions (e.g. CC64FSZ).

syssrc/sys/arch/sparc64/include/asm.h 1.11 -> 1.13
syssrc/sys/arch/sparc64/include/frame.h 1.6 -> 1.7
 1.6.2.2 12-Mar-2001  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.9.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.9.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.9.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.8.1 31-Aug-2002  gehenna catch up with -current.
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.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.4 08-Aug-2010  chs merge sparc and sparc64 fsr.h into one file.
add the missing FSR_TT_* definitions.
fix FSR_FTT_MASK. fix the V9 FCC fields.
 1.3 11-Dec-2005  christos branches: 1.3.78; 1.3.98; 1.3.100;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.48;
Import of sparc64.
 1.1.1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.3.100.1 05-Mar-2011  rmind sync with head
 1.3.98.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.78.1 11-Aug-2010  yamt sync with head.
 1.8 03-Jul-2021  palle sun4v: add support for hypervisor soft state - from OpenBSD
 1.7 27-Apr-2021  palle sun4v: add missing method to set hypervisor api version + add defintion for the interrupt hypervisor api group (to be used)
 1.6 10-Feb-2017  palle branches: 1.6.30;
sun4v: Added handling of trap type 0x034 (address alignment error) + fixed typo mmfsa -> mmufsa. Verified for both sun4u and sun4v using qemu.
 1.5 24-Sep-2014  palle branches: 1.5.2; 1.5.4; 1.5.6;
sun4v: add code to enable startup of secondary cpus on both sun4u and sun4v systems - ok martin@
 1.4 08-Jun-2014  palle branches: 1.4.4;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.3 05-Jun-2014  palle sun4v: ensure that it is possible to include the hypervisor.h file more than once
 1.2 07-Dec-2013  palle branches: 1.2.2; 1.2.4; 1.2.6;
Added missing $ to sun4v sypervisor API
 1.1 07-Dec-2013  palle sun4v hypervisor API - from OpenBSD
 1.2.6.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.6.1 07-Dec-2013  yamt file hypervisor.h was added on branch yamt-pagecache on 2014-05-22 11:40:09 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 07-Dec-2013  rmind file hypervisor.h was added on branch rmind-smpnet on 2014-05-18 17:45:26 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.4.4.3 03-Dec-2017  jdolecek update from HEAD
 1.4.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.4.1 08-Jun-2014  tls file hypervisor.h was added on branch tls-maxphys on 2014-08-20 00:03:25 +0000
 1.5.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.5.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.5.2.1 28-Aug-2017  skrll Sync with HEAD
 1.6.30.2 01-Aug-2021  thorpej Sync with HEAD.
 1.6.30.1 13-May-2021  thorpej Sync with HEAD.
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 04-Dec-2001  darrenr branches: 1.3.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.2 05-Sep-1998  eeh branches: 1.2.26; 1.2.30;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.30.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.30.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.26.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.8.1 31-Aug-2002  gehenna catch up with -current.
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 21-Sep-2001  eeh branches: 1.3.4; 1.3.12;
Correct values for different rounding modes.
 1.2 15-Feb-1999  hubertf branches: 1.2.20; 1.2.22;
RCS ID police
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.22.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.20.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.12.1 31-Aug-2002  gehenna catch up with -current.
 1.3.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.4.1 21-Sep-2001  nathanw file ieeefp.h was added on branch nathanw_sa on 2002-08-01 02:43:41 +0000
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 10-Jan-2000  eeh branches: 1.3.8; 1.3.12; 1.3.20;
Add debugger single-stepping and fix interrupt dispatch bugs.
 1.2 22-Sep-1998  eeh branches: 1.2.12;
More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.3.20.1 31-Aug-2002  gehenna catch up with -current.
 1.3.12.1 01-Aug-2002  nathanw Catch up to -current.
 1.3.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12; 1.1.20;
Add definitions of C99 integer constant macros.
 1.1.20.1 31-Aug-2002  gehenna catch up with -current.
 1.1.12.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.12.1 14-Apr-2001  nathanw file int_const.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.1.6.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_const.h was added on branch thorpej_scsipi on 2001-04-21 17:54:42 +0000
 1.4 29-Jul-2002  mrg merge with sparc.
 1.3 06-Oct-2001  thorpej branches: 1.3.4; 1.3.12;
Make this match int_mwgwtypes.h (not that that header is really
correct, but they should at least be in-sync -- a PR has been
filed against int_mwgwtypes.h).
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_fmtio.h was added on branch thorpej_scsipi on 2001-04-21 17:54:42 +0000
 1.2.6.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.2.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 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.12.1 31-Aug-2002  gehenna catch up with -current.
 1.3.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.4.1 06-Oct-2001  nathanw file int_fmtio.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.10; 1.2.18;
Add definitions for C99 fastest minimum-width integer types.
 1.1 15-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_limits.h was added on branch thorpej_scsipi on 2001-04-21 17:54:42 +0000
 1.2.18.1 31-Aug-2002  gehenna catch up with -current.
 1.2.10.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.10.1 26-Apr-2001  nathanw file int_limits.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.2.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.6 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.5 15-Oct-2001  kleink branches: 1.5.4; 1.5.12;
Unify sparc{,64} headers once again; restore 32-bit sparc64 ABI.
 1.4 14-Oct-2001  kleink Fix a pasto in the __COMPILER_INT64__-based definition of {u,}intmax_t.
 1.3 22-Sep-2001  eeh Correct the `fast' int types.
 1.2 26-Apr-2001  kleink branches: 1.2.2; 1.2.4; 1.2.6;
Add definitions for C99 fastest minimum-width integer types.
 1.1 14-Apr-2001  kleink branches: 1.1.2;
Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_mwgwtypes.h was added on branch thorpej_scsipi on 2001-04-21 17:54:42 +0000
 1.2.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 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.5.12.1 31-Aug-2002  gehenna catch up with -current.
 1.5.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.5.4.1 15-Oct-2001  nathanw file int_mwgwtypes.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.8 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.7 28-Apr-2001  kleink branches: 1.7.2; 1.7.8; 1.7.16;
* Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.6 17-Apr-2001  kleink Oops, intptrs are always long integers.
 1.5 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.4 03-Jan-2001  takemura branches: 1.4.2;
replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.3 27-Jun-2000  kleink branches: 1.3.2;
Typo.
 1.2 27-Jun-2000  kleink 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.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 27-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:26:48 +0000
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.16.1 31-Aug-2002  gehenna catch up with -current.
 1.7.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.7.8.1 28-Apr-2001  nathanw file int_types.h was added on branch nathanw_sa on 2002-08-01 02:43:42 +0000
 1.7.2.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.32 02-Sep-2023  jdc sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines
Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)
Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c
Add "socal" and "SUNW,bpp" to the interrupt map.
 1.31 27-Jul-2012  matt branches: 1.31.70;
Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).
 1.30 13-Apr-2011  mrg branches: 1.30.4;
install <machine/intr.h> for crash(8).

(we could avoid this, but it would require a lot of contortions that
make the header files ugly. maybe someone else can figure out a less
ugly way of doing this later.)
 1.29 24-May-2010  martin branches: 1.29.2;
Make C declarations match assembler reality: ipi functions get two arguments
(which most of them (partly) ignore, but anyway).
 1.28 06-Mar-2010  mrg branches: 1.28.2;
clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.27 01-Feb-2010  mrg branches: 1.27.2;
- add a PDB_CTX_FLUSHALL debug type to pmap.c, and also log the cpu_number()
in a bunch more cases

- make sparc64_ipi_halt_thiscpu() and sparc64_ipi_pause_thiscpu() return void,
their callers never checked anyway.

- remove prototypes for sparc64_ipi_flush_ctx() and sparc64_ipi_flush_all(),
there are no such functions
 1.26 30-Nov-2009  nakayama sparc64_ipi_flush_ctx and sparc64_ipi_flush_all have been removed,
so remove its event counters as well.
 1.25 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.24 22-Apr-2008  nakayama branches: 1.24.2;
#include "opt_multiprocessor.h"
#include <machine/psl.h>

Make sparc64 kernel build again.
 1.23 14-Apr-2008  nakayama branches: 1.23.2;
Remove sparc64_ipi_sync_tick.

Since we can use counter-timer as timecounter instead of %tick on SMP kernel,
it is not necessary to sync all CPUs %tick registers.
 1.22 14-Mar-2008  nakayama Improve IPI handling:
- make IPI takes two arguments.
- add IPI event counters per-CPU.
- implement IPI functions which were missing or broken.
- insert DELAY while halting primary CPU in IPI handler.
 1.21 02-Mar-2008  martin Make ddb's "mach cpu" command do the right thing: run ddb on the requested
cpu. There is a tiny bit of cheating involved, but I assume we won't run
parallel + recursive ddb scripts to play towers of hanoi.

This fixes the wrong prompt, and (more importantly) makes things like
"mach dtlb" display the registers of the right MMU.
 1.20 15-Jan-2008  martin branches: 1.20.2; 1.20.6;
Rename cpuset_t for now to sparc64_cpuset_t, to avoid a name clash with
<sys/pset.h>. Mid-term we should probably convert to the MI cpuset_t.
 1.19 03-Dec-2007  ad branches: 1.19.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.18 17-Oct-2007  garbled branches: 1.18.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.17 17-May-2007  yamt branches: 1.17.8; 1.17.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.16 06-Oct-2006  jnemeth branches: 1.16.4; 1.16.8; 1.16.10; 1.16.16;
Initial support for floppy drives on sparc64. This has been tested
on an Ultra 2 and works fine, apart from formatting which is known
to be broken. It failed to work on an ebus machine. The ebus
support compiles fine, but I don't have hardware for testing. This
code is based on the sparc driver with hints from OpenBSD on how
to do the sbus and ebus attachments, along with help from martin@
and mrg@.

Initial commit approved by martin@

TODO:
- fix ebus support
- fix XXX issues
- check resource deallocation
- fix formatting
- merge remaining differences from sparc driver
- split out back end chip support
- have sparc driver use new common back end chip support
- adapt to newlock when branch is ready
- adapt to "disk-info" property dictionary
 1.15 18-Sep-2006  martin branches: 1.15.2;
Lazy FPU handling for the MULTIPROCESSOR case
 1.14 13-Sep-2006  mrg SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages
 1.13 04-May-2006  yamt branches: 1.13.8;
pull splraiseipl() for sparc64 from newlock branch.
reviewed by Martin Husemann.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 20-May-2004  petrov branches: 1.11.12;
De-_P()fy, remove not MULTIPROCESSOR defines for sparc64_ipi_xxx.
 1.10 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.9 16-Jun-2003  thorpej branches: 1.9.2;
Rename IPL_IMP -> IPL_VM.
 1.8 14-Jan-2001  thorpej branches: 1.8.12;
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.7 03-Dec-2000  fvdl Make softintr_establish prototype match other ports, avoiding compile
warnings.
 1.6 23-Aug-2000  eeh Update the scheduler to the new locking scheme.
 1.5 26-Jun-2000  eeh Advertise we have __GENERIC_SOFT_INTERRUPTS.
 1.4 24-Jun-2000  eeh Make these interrupt levels reflect reality a bit better.
 1.3 02-Jun-2000  eeh branches: 1.3.2;
New softintr interface.
 1.2 16-Mar-2000  eeh branches: 1.2.2;
Revamp interrupts again:

Fix a bug causing interrmittent panics in interrupt dispatch.
Use interrupt vectors for softints.
Add a new send_softint interface.
Improved D$ flushing.
Improve traptrace and other debugging enhancements.
 1.1 30-May-1999  mrg branches: 1.1.2; 1.1.4;
clone intr.h from the SPARC.
 1.1.4.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.4.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.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.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.8.12.1 17-Mar-2002  thorpej IPL_IMP -> IPL_VM
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.12.6 17-Mar-2008  yamt sync with head.
 1.11.12.5 21-Jan-2008  yamt sync with head
 1.11.12.4 07-Dec-2007  yamt sync with head
 1.11.12.3 03-Sep-2007  yamt sync with head.
 1.11.12.2 30-Dec-2006  yamt sync with head.
 1.11.12.1 21-Jun-2006  yamt sync with head.
 1.12.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.12.10.1 11-May-2006  elad sync with head
 1.12.8.2 14-Sep-2006  yamt sync with head.
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.8.1 18-Nov-2006  ad Sync with head.
 1.15.2.2 22-Oct-2006  yamt sync with head
 1.15.2.1 18-Sep-2006  yamt file intr.h was added on branch yamt-splraiseipl on 2006-10-22 06:05:11 +0000
 1.16.16.1 22-May-2007  matt Update to HEAD.
 1.16.10.1 11-Jul-2007  mjf Sync with head.
 1.16.8.2 03-Dec-2007  ad Sync with HEAD.
 1.16.8.1 27-May-2007  ad Sync with head.
 1.16.4.1 28-Apr-2007  martin Add missing prototype for MP kernels
 1.17.10.3 23-Mar-2008  matt sync with HEAD
 1.17.10.2 09-Jan-2008  matt sync with HEAD
 1.17.10.1 06-Nov-2007  matt sync with HEAD
 1.17.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.18.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.18.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.19.6.1 19-Jan-2008  bouyer Sync with HEAD
 1.20.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.20.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.2.1 24-Mar-2008  keiichi sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.2.3 11-Aug-2010  yamt sync with head.
 1.24.2.2 11-Mar-2010  yamt sync with head
 1.24.2.1 16-May-2008  yamt sync with head.
 1.27.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.27.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.28.2.2 21-Apr-2011  rmind sync with head
 1.28.2.1 30-May-2010  rmind sync with head
 1.29.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.4.1 30-Oct-2012  yamt sync with head
 1.31.70.1 09-Sep-2023  martin Pull up following revision(s) (requested by jdc in ticket #360):

sys/arch/sparc64/dev/fdc.c: revision 1.52
sys/arch/sparc64/include/intr.h: revision 1.32
sys/arch/sparc64/sparc64/autoconf.c: revision 1.239
sys/arch/sparc64/include/psl.h: revision 1.64

sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines

Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)

Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c

Add "socal" and "SUNW,bpp" to the interrupt map.
 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:41:34 +0000
 1.4 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 04-Dec-2001  darrenr branches: 1.2.8;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.3 27-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.1.1.28.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.8.1 31-Aug-2002  gehenna catch up with -current.
 1.3 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 18-Jan-2008  martin branches: 1.6.6; 1.6.8; 1.6.10;
Extend the MD kernel core header, so that crashdumps record enough
information to recover all per-cpu mappings. This provides access to
the interrupt stack for example.
 1.5 05-Nov-2007  martin branches: 1.5.2; 1.5.8;
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.
 1.4 01-Aug-2000  eeh branches: 1.4.40; 1.4.76; 1.4.82; 1.4.92; 1.4.100; 1.4.102; 1.4.106;
Overhaul cache flush code and coredump code.
 1.3 13-Aug-1998  eeh branches: 1.3.12; 1.3.22;
Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.3.22.1 07-Aug-2000  mrg pull up 1.4 (approved by thorpej):
>Overhaul cache flush code and coredump code.
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.106.1 13-Nov-2007  bouyer Sync with HEAD
 1.4.102.2 23-Mar-2008  matt sync with HEAD
 1.4.102.1 06-Nov-2007  matt sync with HEAD
 1.4.100.1 06-Nov-2007  joerg Sync with HEAD.
 1.4.92.2 18-Jan-2008  skrll Backported version of martin's changes to:

Extend the MD kernel core header, so that crashdumps record enough
information to recover all per-cpu mappings. This provides access to
the interrupt stack for example.
 1.4.92.1 30-Dec-2007  skrll Apply changes from ticket #983.

Modified Files:
src/sys/arch/sparc64/include: kcore.h
src/sys/arch/sparc64/sparc64: pmap.c

Log Message:
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.

Modified Files:
src/lib/libkvm: kvm_sparc64.c

Log Message:
Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
 1.4.82.1 03-Dec-2007  ad Sync with HEAD.
 1.4.76.2 16-Sep-2008  bouyer Sync with the following revisions (requested by skrll in ticket #1196):
gnu/dist/gdb removed
gnu/usr.bin/gdb53 removed
distrib/cats/instkernel/Makefile 1.14.6.1
gnu/dist/gdb6/bfd/config.bfd 1.3.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.c 1.1.1.2.6.1
gnu/dist/gdb6/bfd/elfxx-sparc.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/Makefile.in 1.2.2.1.2.2
gnu/dist/gdb6/gdb/alpha-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alpha-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/alphabsd-nat.h 1.1.2.1
gnu/dist/gdb6/gdb/alphabsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphabsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/alphanbsd-nat.c 1.1.2.1
gnu/dist/gdb6/gdb/alphanbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/amd64nbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/amd64nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/arm-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/armbsd-tdep.c 1.1.2.1
gnu/dist/gdb6/gdb/armnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/armnbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure 1.1.1.2.6.1
gnu/dist/gdb6/gdb/configure.ac 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386bsd-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/i386nbsd-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/m68kbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/mipsnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/nbsd-thread.c 1.1.2.3
gnu/dist/gdb6/gdb/ppcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/ppcnbsd-tdep.c 1.3.6.1
gnu/dist/gdb6/gdb/sh-tdep.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/shnbsd-nat.c 1.1.1.2.6.3
gnu/dist/gdb6/gdb/shnbsd-tdep.c 1.1.1.2.6.4
gnu/dist/gdb6/gdb/shnbsd-tdep.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc-nat.c 1.1.1.2.6.1
gnu/dist/gdb6/gdb/sparc64nbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/sparcnbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/tramp-frame.h 1.1.1.2.6.1
gnu/dist/gdb6/gdb/vaxbsd-nat.c 1.1.1.2.6.2
gnu/dist/gdb6/gdb/config/alpha/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/arm/nbsd.mt 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/arm/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/i386/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/m68k/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/mips/nbsd.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/powerpc/nbsd.mh 1.1.1.2.6.1
gnu/dist/gdb6/gdb/config/sh/nbsd.mh 1.1.1.1.6.2
gnu/dist/gdb6/gdb/config/sh/tm-nbsd.h 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsd64.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/sparc/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/gdb/config/vax/nbsdelf.mh 1.1.1.1.6.1
gnu/dist/gdb6/opcodes/configure 1.1.1.2.6.1
gnu/dist/gdb6/opcodes/configure.in 1.1.1.2.6.1
gnu/usr.bin/Makefile 1.126.4.1
gnu/usr.bin/gdb6/arch/alpha/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/alpha/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/init.c 1.2.6.1
gnu/usr.bin/gdb6/arch/alpha/nm.h 1.2.6.1
gnu/usr.bin/gdb6/arch/arm/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/arm/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/defs.mk 1.1.6.3
gnu/usr.bin/gdb6/arch/armeb/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/armeb/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/i386/defs.mk 1.4.4.1
gnu/usr.bin/gdb6/arch/i386/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/m68000/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/m68k/defs.mk 1.1.4.1
gnu/usr.bin/gdb6/arch/m68k/init.c 1.1.4.1
gnu/usr.bin/gdb6/arch/mipseb/config.h 1.3.4.1
gnu/usr.bin/gdb6/arch/mipseb/defs.mk 1.2.6.2
gnu/usr.bin/gdb6/arch/mipseb/init.c 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/config.h 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/defs.mk 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/init.c 1.2.6.3
gnu/usr.bin/gdb6/arch/mipsel/tm.h 1.2.6.2
gnu/usr.bin/gdb6/arch/mipsel/version.c 1.2.6.2
gnu/usr.bin/gdb6/arch/powerpc/defs.mk 1.3.6.1
gnu/usr.bin/gdb6/arch/powerpc/init.c 1.3.6.1
gnu/usr.bin/gdb6/arch/sh3eb/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3eb/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3eb/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3eb/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3eb/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/config.h 1.2.2.2
gnu/usr.bin/gdb6/arch/sh3el/defs.mk 1.2.8.3
gnu/usr.bin/gdb6/arch/sh3el/init.c 1.1.8.3
gnu/usr.bin/gdb6/arch/sh3el/nm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/tm.h 1.1.8.2
gnu/usr.bin/gdb6/arch/sh3el/version.c 1.1.8.2
gnu/usr.bin/gdb6/arch/sparc/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/sparc64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/sparc64/init.c 1.1.6.1
gnu/usr.bin/gdb6/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/init.c 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/tm.h 1.1.6.2
gnu/usr.bin/gdb6/arch/vax/version.c 1.1.6.2
gnu/usr.bin/gdb6/arch/x86_64/defs.mk 1.2.6.1
gnu/usr.bin/gdb6/arch/x86_64/init.c 1.1.6.1
gnu/usr.bin/gdb6/bfd/arch/armeb/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3eb/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfd.h 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/sh3el/bfdver.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/bfd/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/bfd/arch/vax/bfd.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/bfdver.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/bfd/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/gdb/Makefile 1.5.2.1.2.2
gnu/usr.bin/gdb6/gdbtui/Makefile 1.2.6.1
gnu/usr.bin/gdb6/libiberty/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/libiberty/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/libiberty/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3eb/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/opcodes/arch/sh3el/defs.mk 1.1.8.3
gnu/usr.bin/gdb6/opcodes/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/opcodes/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/armeb/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/m68000/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/mipsel/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3eb/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/config.h 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/sh3el/defs.mk 1.1.8.2
gnu/usr.bin/gdb6/readline/arch/vax/config.h 1.1.6.2
gnu/usr.bin/gdb6/readline/arch/vax/defs.mk 1.1.6.2
gnu/usr.bin/gdb6/sim/arch/mipseb/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipseb/defs.mk 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/cconfig.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/config.h 1.1.2.1
gnu/usr.bin/gdb6/sim/arch/mipsel/defs.mk 1.1.2.1
lib/libkvm/kvm_sparc64.c 1.10.18.2
lib/libpthread/pthread.c 1.48.6.4
lib/libpthread/pthread_barrier.c 1.6.18.1
lib/libpthread/pthread_cond.c 1.18.12.2
lib/libpthread/pthread_debug.h 1.8.18.1
lib/libpthread/pthread_int.h 1.34.4.5
lib/libpthread/pthread_lock.c 1.14.6.1
lib/libpthread/pthread_mutex.c 1.22.4.2
lib/libpthread/pthread_run.c 1.18.12.4
lib/libpthread/pthread_rwlock.c 1.13.6.2
lib/libpthread/pthread_sa.c 1.37.6.5
lib/libpthread/pthread_sig.c 1.47.4.8
lib/libpthread/pthread_sleep.c 1.7.6.2
lib/libpthread/sem.c 1.9.6.2
lib/libpthread/arch/sh3/pthread_md.h 1.3.6.1
regress/lib/libpthread/resolv/Makefile 1.1.12.1
regress/lib/libpthread/sigrunning/Makefile 1.1.2.1
regress/lib/libpthread/sigrunning/sigrunning.c 1.1.2.1
share/mk/bsd.own.mk 1.489.4.3
sys/arch/amd64/amd64/locore.S 1.18.14.1
sys/arch/amd64/amd64/machdep.c 1.44.2.3.2.1
sys/arch/amd64/conf/kern.ldscript 1.1.70.1
sys/arch/cats/conf/Makefile.cats.inc 1.17.30.1
sys/arch/shark/conf/Makefile.shark.inc 1.6.30.1
sys/arch/sparc64/conf/kern.ldscript 1.7.26.2
sys/arch/sparc64/conf/kern32.ldscript 1.6.26.2
sys/arch/sparc64/include/kcore.h 1.4.92.2
sys/arch/sparc64/sparc64/locore.s 1.232.4.4
sys/arch/sparc64/sparc64/machdep.c 1.193.4.3
sys/arch/sparc64/sparc64/pmap.c 1.184.2.1.2.4
sys/conf/newvers.sh 1.42.26.2
sys/kern/kern_sa.c 1.87.4.11
sys/kern/kern_synch.c 1.173.4.2
sys/sys/savar.h 1.20.10.2
tools/gdb/Makefile 1.9.4.1
tools/gdb/mknative-gdb 1.1.6.1

pullup the wrstuden-fixsa CVS branch to netbsd-4:
toolchain/35540 - GDB 6 support for pthreads.
port-sparc64/37534 - ktrace firefox gives
kernel trap 30: data access expection
GDB changes:
- delete gdb53
- enable gdb6 on all architectures
- add support for amd64 crash dumps
- add support for sparc64 crash dumps
- add support for /proc pid to executable filename for all archs
- enable thread support for all architectures
- add a note section to kernels to all platforms
- support detection/unwinding of signals for most architectures.
- Fix PTHREAD_UCONTEXT_TO_REG / PTHREAD_REG_TO_UCONTEXT on sh3.
- Apply fix from binutils-current so that sparc gdb can be cross built
on a 64bit host.
SA/pthread changes:
Pre-allocate memory needed for event delivery. Eliminates dropped
interrupts under load.
Deliver intra-process signals to running threads
Eliminate some deadlock scenarios
Fix intra-process signal delivery when delivering to a thread waiting
for signals. Makes afs work again!
 1.4.76.1 01-Feb-2008  riz Pull up following revision(s) (requested by martin in ticket #983):
sys/arch/sparc64/include/kcore.h: revision 1.5
lib/libkvm/kvm_sparc64.c: revision 1.11
sys/arch/sparc64/sparc64/pmap.c: revision 1.201
Extend the sparc64 cpu kcore segment so that it records all kernel mappings
done via locked 4 MB pages. The old format could only record physically
continous kernel text mappings.
For compatibility reasons, just extend the structure and fill in all the
old fields as well.
Use the new sparc64 kcore cpu segment extensions to properly map VA/PAs
on kernels with more then 4 MB text/rodata segment.
 1.4.40.2 21-Jan-2008  yamt sync with head
 1.4.40.1 15-Nov-2007  yamt sync with head.
 1.5.8.1 19-Jan-2008  bouyer Sync with HEAD
 1.5.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.10.1 16-May-2008  yamt sync with head.
 1.6.8.1 18-May-2008  yamt sync with head.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.10 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.9 03-May-2002  thorpej branches: 1.9.2;
Don't define _LP64 here.
 1.8 08-Aug-2000  tshiozak branches: 1.8.4; 1.8.8;
Preparation for the future introduction of multibyte locale.
- MB_LEN_MAX is increased to 32.
- To ensure binary compatibility for old executables
under multibyte locale, versioned setlocale is added.
- __mb_len_cur definision is added in setlocale.c
and enable it in stdlib.h .
It is also important for multibyte locale stuffs,
but I just forgot.
 1.7 07-Mar-2000  kleink branches: 1.7.2; 1.7.4;
Define ISO C99 (unsigned) long long (min, max) symbols.
 1.6 27-Nov-1999  mrg make this idempotent (from sparc/include/limits.h)
 1.5 31-Jan-1999  mrg branches: 1.5.8; 1.5.14;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.4 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.3 11-Sep-1998  eeh Add support for 64-bit types if _LP64 is defined.
 1.2 06-Aug-1998  kleink _POSIX_SOURCE -> _POSIX_C_SOURCE
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.5.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 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.7.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.7.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.8.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.8.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.8.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.8.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.1 31-Aug-2002  gehenna catch up with -current.
 1.4 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.3 28-Apr-2008  martin branches: 1.3.44; 1.3.60;
Remove clause 3 and 4 from TNF licenses
 1.2 27-Jan-2006  cdi branches: 1.2.72; 1.2.74; 1.2.76;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.1 16-Aug-2000  mrg branches: 1.1.2; 1.1.4; 1.1.44; 1.1.56;
include the sparc loadfile_machdep.h as-is; we can blow this header away
completely later.
 1.1.56.1 01-Feb-2006  yamt sync with head.
 1.1.44.1 21-Jun-2006  yamt sync with head.
 1.1.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.1.4.1 16-Aug-2000  bouyer file loadfile_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:26:48 +0000
 1.1.2.2 26-Aug-2000  mrg pull up from trunk. approved by thorpej.
 1.1.2.1 16-Aug-2000  mrg file loadfile_machdep.h was added on branch netbsd-1-5 on 2000-08-26 01:00:25 +0000
 1.2.76.1 16-May-2008  yamt sync with head.
 1.2.74.1 18-May-2008  yamt sync with head.
 1.2.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.60.1 10-Aug-2014  tls Rebase.
 1.3.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9 20-Jul-2002  mrg branches: 1.9.52;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.8 05-May-2000  hannken branches: 1.8.8; 1.8.12; 1.8.16; 1.8.20;
Fix for lint during build of libc.
 1.7 02-May-2000  thorpej Let each platform typedef the new __cpu_simple_lock_t, which should
be the most efficient type used for the atomic operations in the
simplelock structure, and should also be __volatile.
 1.6 01-May-2000  thorpej Fix a declaration inside __ldstub().
 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 27-Jul-1999  thorpej branches: 1.4.2;
Make a slight rearrangement in how <machine/lock.h> is included.
 1.3 27-Jul-1999  thorpej Define apporpriate an value for SIMPLELOCK_LOCKED, based on the
semantics of ldstub.
 1.2 27-Jul-1999  thorpej Prepend `cpu_' to the machine-dependent atomic locking primitivies.
 1.1 30-May-1999  eeh branches: 1.1.2;
Grab real locks from the sparc port. I suppose we could use casa and casx
instead of ldstub, but since we aren't doing n-way locking it makes little
difference. N.B. Need to decide what to do with sparc64/sparc64/asm.h which
has name conflicts with sparc64/include/asm.h. So far most of
sparc64/sparc64/asm.h has been moved to ctlreg.h.
 1.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
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.20.1 31-Aug-2002  gehenna catch up with -current.
 1.8.16.1 19-Mar-2002  thorpej Change __cpu_simple_lock_t to a single byte.
 1.8.12.1 01-Aug-2002  nathanw Catch up to -current.
 1.8.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.52.2 06-Feb-2007  ad Test for the presence of 'membar' by checking for __sparc_v9__.
 1.9.52.1 29-Dec-2006  ad Checkpoint work in progress.
 1.9 17-Oct-2015  nakayama Move LP64 and ILP32 conversion macros COMBINE, SPLIT from locore.h
to asm.h, and provide SPLIT_RETL for the case SPLIT and then retl
immediately.
 1.8 23-Aug-2015  joerg Remove .proc 1, it has been ignored by gas for ages.
 1.7 23-Aug-2015  joerg .align ensures alignment, so replace .uaword with .word.
 1.6 16-Mar-2013  christos branches: 1.6.14;
move the useful macros somewhere where they can be used in userland.
 1.5 10-Jul-2010  nakayama branches: 1.5.8; 1.5.18;
Clear the upper word explicitly before combining two 32-bit values to 64-bit
on 32-bit kernels.
 1.4 23-May-2010  martin Split copy related functions out of locore.s into copy.S, move functions
only needed on multiprocessors into mp_subr.S.
 1.3 07-Mar-2010  mrg branches: 1.3.2; 1.3.4; 1.3.6;
need _ALIGN in locore.h as well, for DEBUG kernels.
 1.2 07-Mar-2010  mrg gas has supported SPARC ".empty" for a long while; get rid of an
ancient workaround.
 1.1 06-Mar-2010  mrg move the memcpy/memset implementations out into their own file, with the
block copy versions as well. move some of the definitions in locore.s
into a new locore.h.

locore.s is almost 2000 lines shorter with this change.
 1.3.6.3 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.6.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.6.1 07-Mar-2010  uebayasi file locore.h was added on branch uebayasi-xip on 2010-04-30 14:39:52 +0000
 1.3.4.2 05-Mar-2011  rmind sync with head
 1.3.4.1 30-May-2010  rmind sync with head
 1.3.2.3 11-Aug-2010  yamt sync with head.
 1.3.2.2 11-Mar-2010  yamt sync with head
 1.3.2.1 07-Mar-2010  yamt file locore.h was added on branch yamt-nfs-mp on 2010-03-11 15:03:00 +0000
 1.5.18.2 03-Dec-2017  jdolecek update from HEAD
 1.5.18.1 23-Jun-2013  tls resync from head
 1.5.8.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.14.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.6.14.1 22-Sep-2015  skrll Sync with HEAD
 1.2 30-Nov-2024  uwe branches: 1.2.4;
sparc64/lwp_private.h: just include the sparc version
 1.1 30-Nov-2024  christos Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 30-Nov-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:56:10 +0000
 1.7 15-Dec-2008  mrg merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.6 11-Dec-2005  christos branches: 1.6.74; 1.6.78; 1.6.86; 1.6.88; 1.6.92;
merge ktrace-lwp.
 1.5 28-Oct-2003  kleink #define __HAVE_LONG_DOUBLE on platforms which implement a distinct
`long double' type.
 1.4 19-Feb-2002  simonb branches: 1.4.16;
Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.3 05-Feb-2000  kleink branches: 1.3.6; 1.3.10; 1.3.14;
Improve namespace test macros a bit.
 1.2 04-Jan-2000  kleink const -> __const and include <sys/cdefs.h> earlier; fixes PR lib/9052
by Takahiro Kambe.
 1.1 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.3.14.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.10.1 16-Mar-2002  jdolecek Catch up with -current.
 1.3.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.6.1 05-Feb-2000  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:26:48 +0000
 1.4.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.16.1 03-Aug-2004  skrll Sync with HEAD
 1.6.92.1 11-May-2009  bouyer branches: 1.6.92.1.2;
Pull up following revision(s) (requested by mrg in ticket #750):
sys/arch/sparc64/include/math.h: revision 1.7
sys/arch/sparc/include/math.h: revision 1.5
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.6.92.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.6.88.1 11-May-2009  bouyer Pull up following revision(s) (requested by mrg in ticket #750):
sys/arch/sparc64/include/math.h: revision 1.7
sys/arch/sparc/include/math.h: revision 1.5
merge these two files, makes sparc64 sparc/libc work again.
only provide __HAVE_LONG_DOUBLE if _LP64.
 1.6.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.78.1 04-May-2009  yamt sync with head.
 1.6.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.11 18-May-2024  thorpej 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.10 19-Feb-2018  mrg fix _UC_MACHINE32_FP() -- use 32 bit pointer value so that [15] is
the right offset. do this by using __greg32_t, which is only in
the sparc64 version, and these are only useful there, so move them.
 1.9 12-Sep-2012  manu branches: 1.9.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.8 16-Mar-2006  cube branches: 1.8.102;
s/uint32_t/unsigned int/ because we don't always have the former defined.

Reported by Juergen Hannken-Illjes.

XXX I prefer uint32_t, but there might be some namespace issues so for now
it will do.
 1.7 14-Mar-2006  cube Under COMPAT_NETBSD32 emulation, pointers are not the same size as the
native ones... netbsd32_pointer_t can't be used here though, so uint32_t
is used instead, which is of course the same thing.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10;
merge ktrace-lwp.
 1.5 10-Jul-2005  martin Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 1.4 26-Oct-2003  christos branches: 1.4.14; 1.4.16;
more siginfo glue
 1.3 13-Oct-2003  christos Add mcontext32_t and friends. This is WIP.
 1.2 18-Jan-2003  thorpej branches: 1.2.2;
Merge the nathanw_sa branch.
 1.1 17-Nov-2001  martin branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.4 17-Dec-2002  thorpej Just include <sparc/mcontext.h>
 1.1.2.3 04-Jan-2002  eeh Cleanup.
 1.1.2.2 03-Jan-2002  petrov define _UC_MACHINE_SP
 1.1.2.1 17-Nov-2001  martin Sparc64 *context routines, from Klaus Klein.
 1.2.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 21-Jun-2006  yamt sync with head.
 1.4.14.1 11-Jul-2005  tron Pull up revision 1.5 (requested by martin in ticket #570):
Fix COMPAT_NETBSD32 ucontext padding and move the definition next to the
(sparc) original.
 1.6.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.6.8.1 01-Apr-2006  yamt sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.8.102.1 30-Oct-2012  yamt sync with head
 1.9.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.9.32.2 26-Feb-2018  snj revert ticket 552, which broke the build
 1.9.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.5 22-Jun-2016  palle branches: 1.5.16;
sun4v: add cbus driver - from OpenBSD
 1.4 06-Sep-2015  martin On SUN4V make the mdesc data available early in pmap_bootstrap, so we
can set up the uvm page colors correctly.
Based on code from palle@.
 1.3 22-Mar-2015  palle branches: 1.3.2;
sun4v: added new function mdesc_name_by_idx() for retrieving the name of a node
 1.2 19-Jan-2015  palle sun4v: Add two new functions to the mdesc api: mdesc_find_node_by_idx() and mdesc_next_node()
 1.1 10-Jan-2015  palle sun4v: add hypervisor machine description (mdesc) functions - from OpenBSD
 1.3.2.4 09-Jul-2016  skrll Sync with HEAD
 1.3.2.3 22-Sep-2015  skrll Sync with HEAD
 1.3.2.2 06-Apr-2015  skrll Sync with HEAD
 1.3.2.1 22-Mar-2015  skrll file mdesc.h was added on branch nick-nhusb on 2015-04-06 15:18:03 +0000
 1.5.16.2 03-Dec-2017  jdolecek update from HEAD
 1.5.16.1 22-Jun-2016  jdolecek file mdesc.h was added on branch tls-maxphys on 2017-12-03 11:36:45 +0000
 1.10 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.9 11-Jul-2023  martin Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE
 1.8 09-Jul-2023  riastradh machine/mutex.h: Sprinkle includes so this can be used by crash(8).

XXX pullup-10
 1.7 25-Aug-2021  thorpej branches: 1.7.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.6 29-Nov-2019  riastradh Nix now-unused definitions of MUTEX_GIVE/MUTEX_RECEIVE.
 1.5 29-Nov-2019  riastradh Nix mb_* on sparc and sparc64.
 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.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.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:08:24 +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.7.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 19-Mar-2002  thorpej branches: 1.1.2;
file mutex_impl.h was initially added on branch newlock.
 1.1.2.5 22-Mar-2002  thorpej Wrap the stuff that manipulates the guts of a mutex in __MUTEX_PRIVATE.
 1.1.2.4 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.3 20-Mar-2002  thorpej mtx_dummy needs to be unsigned.
 1.1.2.2 19-Mar-2002  thorpej Shuffle the mutex structure around and change types such that the
mutex now 8 bytes instead of 16.

Note we need a different layout for LP64 vs ILP32, since we want
one particular field to overlap with the LSB of the "mtx_owner"
field.
 1.1.2.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.29 19-Oct-2016  skrll PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.28 04-Jan-2014  dsl branches: 1.28.6; 1.28.10;
Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
 1.27 29-May-2008  mrg branches: 1.27.32; 1.27.42; 1.27.48;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.26 27-Jan-2008  dsl branches: 1.26.6; 1.26.8; 1.26.10; 1.26.12;
Remove NETBSD32_OFF_T_RETURN() netbsd32_lseek() now uses MI code to return
all 64 bits of the new position.
 1.25 17-Oct-2007  garbled branches: 1.25.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.24 16-Sep-2007  dsl Fix previous, 'long long' is 8 byte aligned on sparc32
 1.23 16-Sep-2007  dsl Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.
 1.22 16-Mar-2007  dsl branches: 1.22.4; 1.22.12; 1.22.14;
Use NETBSD32PTR64() and NETBSD32PTR32() throughout.
 1.21 14-Mar-2006  cube branches: 1.21.16; 1.21.20; 1.21.22; 1.21.24;
Add the sparc64 MD bits to get usable coredumps for COMPAT_NETBSD32
binaries.
 1.20 11-Feb-2006  cdi branches: 1.20.2; 1.20.4;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.19 11-Dec-2005  christos branches: 1.19.2; 1.19.4; 1.19.6;
merge ktrace-lwp.
 1.18 27-Sep-2005  chs remove unnecessary includes.
 1.17 12-Jul-2005  martin When returning 64bit values (from netbsd32_lseek) fix up the return
value vector (of 32bit values, most likely) via a MD macro.
 1.16 20-Feb-2004  drochner branches: 1.16.16;
provide a definition NETBSD32_MID_MACHINE which tells for the a.out MID
to look for in 32-bit emulation
 1.15 26-Sep-2003  christos move MI stuff to the MI include
 1.14 29-Jun-2003  fvdl branches: 1.14.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.13 29-Jun-2003  martin struct proc * -> struct lwp *
 1.12 16-Apr-2003  dsl change 'data' arg of fo_ioctl to void * to match file.h
 1.11 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.9 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.8 03-Jan-2002  mrg branches: 1.8.8;
clean up
 1.7 03-Jan-2002  mrg move sparc specific ioctl handling (fb & openprom) into arch/sparc64.
 1.6 09-May-2001  kleink branches: 1.6.2; 1.6.8;
Sync with native emul: rename sc_tstate to sc_psr.
 1.5 30-Dec-1999  eeh branches: 1.5.6;
Update 32-bit sigcontext structures.
 1.4 11-Oct-1999  eeh branches: 1.4.2;
Update to post 1.4.
 1.3 26-Mar-1999  eeh branches: 1.3.8;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.2 25-Mar-1999  mrg clean and up make compile
 1.1 25-Mar-1999  mrg move sparc32 MD bits here.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.8.6 11-Nov-2002  nathanw Catch up to -current
 1.6.8.5 01-Aug-2002  nathanw Catch up to -current.
 1.6.8.4 28-Feb-2002  nathanw Catch up to -current.
 1.6.8.3 11-Jan-2002  nathanw More catchup.
 1.6.8.2 04-Jan-2002  eeh Cleanup.
 1.6.8.1 09-May-2001  eeh file netbsd32_machdep.h was added on branch nathanw_sa on 2002-01-04 19:12:25 +0000
 1.6.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.8.1 17-Jul-2002  gehenna catch up with -current.
 1.14.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.16.4 04-Feb-2008  yamt sync with head.
 1.16.16.3 27-Oct-2007  yamt sync with head.
 1.16.16.2 03-Sep-2007  yamt sync with head.
 1.16.16.1 21-Jun-2006  yamt sync with head.
 1.19.6.1 22-Apr-2006  simonb Sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.19.2.1 18-Feb-2006  yamt sync with head.
 1.20.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.20.2.1 01-Apr-2006  yamt sync with head.
 1.21.24.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.21.22.1 11-Jul-2007  mjf Sync with head.
 1.21.20.2 09-Oct-2007  ad Sync with head.
 1.21.20.1 10-Apr-2007  ad Sync with head.
 1.21.16.1 24-Mar-2007  yamt sync with head.
 1.22.14.2 23-Mar-2008  matt sync with HEAD
 1.22.14.1 06-Nov-2007  matt sync with HEAD
 1.22.12.1 02-Oct-2007  joerg Sync with HEAD.
 1.22.4.1 03-Oct-2007  garbled Sync with HEAD
 1.25.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.26.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.10.1 04-May-2009  yamt sync with head.
 1.26.8.1 04-Jun-2008  yamt sync with head
 1.26.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.48.1 18-May-2014  rmind sync with head
 1.27.42.2 03-Dec-2017  jdolecek update from HEAD
 1.27.42.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.32.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.10.1 04-Nov-2016  pgoyette Sync with HEAD
 1.28.6.1 05-Dec-2016  skrll Sync with HEAD
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 21-Mar-2004  pk Reach over to the sparc versions.
 1.2 04-Dec-2001  darrenr branches: 1.2.16;
defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 21-Mar-2004  pk Reach over to the sparc openfirm & openprom implementation.
 1.11 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.10 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.9 05-Oct-2001  eeh branches: 1.9.4; 1.9.20;
Make OF_interpret() handle input and output arguments.
 1.8 20-Jul-2001  eeh branches: 1.8.2;
PCI overhaul.
 1.7 18-Nov-2000  mrg branches: 1.7.4;
sync with sparc port. add support for OF_setprop(), OF_nextprop(),
OF_interpret() and OF_milliseconds().
 1.6 31-Jan-1999  mrg branches: 1.6.8;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.5 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.4 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.6.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.7.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.4.1 03-Aug-2001  lukem update to -current
 1.8.2.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.9.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.20.1 03-Aug-2004  skrll Sync with HEAD
 1.9.4.2 05-Oct-2001  eeh Make OF_interpret() handle input and output arguments.
 1.9.4.1 05-Oct-2001  eeh file openfirm.h was added on branch nathanw_sa on 2001-10-05 21:52:44 +0000
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 10-Jan-2002  briggs branches: 1.2.8;
Add OPIOCFINDDEVICE to match dev/ofw/openfirmio.[ch].
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32;
Import of sparc64.
 1.1.1.1.32.3 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 11-Jan-2002  nathanw More catchup.
 1.1.1.1.28.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.1.1.28.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.8.1 31-Aug-2002  gehenna catch up with -current.
 1.63 24-Apr-2025  martin Add a STACK_ALIGNBYTES definition
 1.62 31-May-2021  simonb branches: 1.62.18;
Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.61 28-Sep-2019  christos branches: 1.61.12;
remove local version of mstohz() now that <sys/param.h> provides it.
 1.60 15-May-2019  christos From: Tobias Ulmer. Unbreak zfs module build on sparc{,64} by hiding DELAY.
ZFS has a conflicting definition of delay() and tries to hide it by
defining __HIDE_DELAY.
 1.59 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.58 13-Feb-2017  skrll branches: 1.58.12; 1.58.14;
G/C VM_MAX_KERNEL_BUF
 1.57 15-Apr-2016  martin branches: 1.57.2; 1.57.4;
If compiling with SUN4V support, bump MAXCPUS to 256.
 1.56 27-Oct-2015  mrg make sure MSGBUFSIZE can't expand strangely by using parens.
 1.55 08-Oct-2014  macallan branches: 1.55.2;
Ths has been sitting in my tree for years...
Allow the Xserver to map PCI IO space. Not needed for Sun-branded graphics
cards but Xorg can actually cold boot a few others, which will need it.
( if only to access standard VGA registers )
 1.54 10-Jul-2014  jdc Increase maximum MSGBUFSIZE to 248k.
While here, remove 2 sparc(32)-only entries (from mrg@).
 1.53 21-Feb-2014  palle branches: 1.53.2;
sun4v: Rename TLB_ defines to SUN4U_TLB_ so entries created using TSB_DATA() are properly setup for sun4u and sun4v. Relocate the cputyp variable from autoconf.c to locore.s and make it const in param.h so optimized code can be generated. Parts from OpenBSD. Optimization suggested by nakayama@. OK martin@, mrg@, nakayama@
 1.52 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.51 03-Jan-2013  martin branches: 1.51.2;
Rearange VA layout for 64 bit kernels, as suggested by Lars Heidieker:
move the dynamic kernel memory past 4GB (basically unlimiting it) and
use the now freed address range past kernel data upto 2GB for modules.
 1.50 10-Mar-2012  nakayama branches: 1.50.2;
Fix previous, which causes an integer overflow error in uvm_km.c on
32-bit kernels.
 1.49 09-Mar-2012  jdc Restrict NKMEMPAGES to 2.5GB, otherwise we will run out of space in the
kernel_map on machines with 8GB (or more) main memory.

XXX: Moving KERNBASE/KERNEND is a better long term solution, but this allows
those machines to boot now.
 1.48 04-Feb-2012  para branches: 1.48.2;
improve sizing of kmem_arena now that more allocations are made from it
don't enforce limits if not required

ok: riz@
 1.47 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.46 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.45 12-May-2011  mrg branches: 1.45.4; 1.45.8;
first steps towards fujitsu SPARC64 support:

- add CPU_SUN4US and CPU_SUN4V defines
- re-introduce "cputyp" and use it for sun4u/sun4us/sun4v
 1.44 08-Feb-2010  joerg branches: 1.44.2; 1.44.4;
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.43 26-Aug-2008  rjs branches: 1.43.14;
Set MACHINE to sparc for 32bit kernels.

Approved by martin.
 1.42 17-Oct-2007  garbled branches: 1.42.16; 1.42.20; 1.42.22; 1.42.26;
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.41 06-Sep-2007  martin Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.
 1.40 25-Aug-2007  martin branches: 1.40.2;
Remove INITSTACK completely - at the time we used to switch to it, we
already have access to all of lwp0 and it's uarea - so we can switch
to the correct lwp0 stack easily before calling main.
 1.39 17-May-2007  yamt branches: 1.39.4; 1.39.8;
merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.38 24-Jan-2007  hubertf branches: 1.38.2; 1.38.6; 1.38.8; 1.38.14;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
 1.37 17-Oct-2006  mrg allocate 128KB (as opposed to 64KB) per-cpu, and place the interrupt
stack, cpu_info structure, panicstack, idle uarea and normal kernel
stack in here. the idle uarea and kernel stack are in the 2nd 64KB
page. the interrupt stack and cpu_info structure are as the same
place in the 1st 64KB page, and the panicstack grows down from the
top of this page. update comments in param.h to suit (XXX: a lot
of these constants should move to a header file that will not pollute
the name space so much.) map these pages identically between
cpu_initialise() and cpu_mp_startup(), and deal with the two 64KB
pages in pmap_extract(). keep an unmapped 64KB page between them.

don't initialise the unused "ci_eintstack" member of the cpu_info
structure

use constants to initialise many addresses in the cpu_info structure,
consolidating these assignments from cpu0 and cpu>0

delete u0/estack0/panicstack from locore.s

clean up some wrong comments in locore.s

fix a 32bit-only bug in cpu_mp_startup().

delete 'u0' entirely.


this fixes recent random lossage seen on port-sparc64: processes
stuck in RUN state, data faults, and hangs.
 1.36 28-Aug-2006  yamt branches: 1.36.2; 1.36.4;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.35 20-Feb-2006  cdi branches: 1.35.2;
Use ANSI-style function definitions and declarations.
 1.34 11-Dec-2005  christos branches: 1.34.2; 1.34.4; 1.34.6;
merge ktrace-lwp.
 1.33 12-Dec-2004  abs branches: 1.33.10;
Fix comments slighly
 1.32 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.31 17-Jul-2002  thorpej branches: 1.31.6;
Remove CPU_ISSUN4MOR4U, CPU_ISSUN4OR4C, and CPU_ISSUN4COR4M.
 1.30 18-Apr-2002  eeh branches: 1.30.2;
Calculate NBPG from PGSHFT.
 1.29 08-Apr-2002  eeh Add a nice 64-bit mstohz() and clean out some cruft.
 1.28 26-Feb-2002  simonb Purge CLSIZE, CLSIZELOG2 and MCLOFSET.
Be consistant in the way that MSIZE, MCLSHIFT, MCLBYTES and NMBCLUSTERS
are defined.
Remove old VM constants from cesfic port.
Bump MSIZE to 256 on mipsco (the only one that wasn't already 256).
 1.27 09-Feb-2002  eeh Increase NMBCLUSTERS.
 1.26 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.25 30-May-2001  mrg branches: 1.25.2; 1.25.8;
use _KERNEL_OPT
 1.24 11-Feb-2001  eeh branches: 1.24.2;
Increase NKMEMPAGES to a more useful value.
 1.23 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.22 30-Jun-2000  itojun raise MSIZE from 128 to 256.
- for sizeof(void *) == 8 arch, this is mandatory. MHLEN is too small
already (less than 80) and there are chances for unwanted packet loss due
to m_pullup restriction.
- for other cases, the change should avoid allocating clusters in most cases
(even when you have IPv4 IPsec tunnel, or IPv6 with moderate amount of
extension header)

portmasters: if your arch chokes with the change (high memory usage or
whatever), please backout the change for your arch.
 1.21 24-Jun-2000  eeh Get rid of vaddrs.h.
 1.20 19-Jun-2000  eeh branches: 1.20.2;
Have separate data and text segments, make text read-only.
 1.19 13-Jun-2000  eeh Missing paren.
 1.18 12-Jun-2000  eeh Start reorganizing the kernel for MULTIPROCESSOR support.
 1.17 22-May-2000  mrg branches: 1.17.2;
add two new CPU_ISXXX versions: CPU_ISSUN4U, CPU_ISSUN4MOR4U
 1.16 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.15 04-Dec-1999  ragge CL* discarding.
 1.14 27-Nov-1999  mrg minor cosmetic merges; long way to go here.
 1.13 21-Nov-1999  eeh Move KERNBASE down from 0xf8000000 to 0xf1000000, just beyond the PROM.
 1.12 20-Nov-1999  eeh Limit buffers to 1/4 of the kernel address space.
 1.11 07-Jun-1999  eeh branches: 1.11.2; 1.11.8;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.10 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.9 31-Jan-1999  mrg branches: 1.9.4;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.8 06-Oct-1998  eeh It seems taht 64-bit kernels need bigger stacks.
 1.7 09-Sep-1998  thorpej If _LP64, set MID_MACHINE to MID_SPARC64, else MID_SPARC. This allows us
to uniquely identify ILP32 vs. LP64 core files, and prevents an LP64 kernel
from incorrectly choosing emul_netbsd when it should choose emul_sparc32.
 1.6 09-Sep-1998  eeh Change to MACHINE_ARCH=sparc64 for LP64 machines.
 1.5 06-Sep-1998  eeh 32-bit fixup.
 1.4 02-Sep-1998  eeh Periodic update: now starts probing devices.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 20-Jun-1998  mrg branches: 1.2.2;
pull in opt_gateway.h for options GATEWAY
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.8.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.8.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

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

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

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.11.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.20.2.2 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.20.2.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.24.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.25.8.6 01-Aug-2002  nathanw Catch up to -current.
 1.25.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.25.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.25.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.25.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.25.8.1 30-May-2001  nathanw file param.h was added on branch nathanw_sa on 2002-01-08 00:28:00 +0000
 1.25.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.25.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.25.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.2.1 21-Jul-2002  gehenna catch up with -current.
 1.31.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.31.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.31.6.1 03-Aug-2004  skrll Sync with HEAD
 1.33.10.5 27-Oct-2007  yamt sync with head.
 1.33.10.4 03-Sep-2007  yamt sync with head.
 1.33.10.3 26-Feb-2007  yamt sync with head.
 1.33.10.2 30-Dec-2006  yamt sync with head.
 1.33.10.1 21-Jun-2006  yamt sync with head.
 1.34.6.1 22-Apr-2006  simonb Sync with head.
 1.34.4.1 09-Sep-2006  rpaulo sync with head
 1.34.2.1 01-Mar-2006  yamt sync with head.
 1.35.2.1 03-Sep-2006  yamt sync with head.
 1.36.4.1 22-Oct-2006  yamt sync with head
 1.36.2.2 01-Feb-2007  ad Sync with head.
 1.36.2.1 18-Nov-2006  ad Sync with head.
 1.38.14.2 03-Oct-2007  garbled Sync with HEAD
 1.38.14.1 22-May-2007  matt Update to HEAD.
 1.38.8.1 11-Jul-2007  mjf Sync with head.
 1.38.6.2 09-Oct-2007  ad Sync with head.
 1.38.6.1 27-May-2007  ad Sync with head.
 1.38.2.1 28-Apr-2007  mrg port yamt-idlelwp to sparc64. this does not work yet, but others
have asked that i commit this work-in-progress.

currently it gets a double fault during a window save operation
and crashes to the prom. (it seems very much like the problem
that i see on SMP sparc64, but there is no real evidence it is
the same root cause.)
 1.39.8.2 02-Oct-2007  joerg Sync with HEAD.
 1.39.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.39.4.2 10-Sep-2007  skrll Sync with HEAD.
 1.39.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.40.2.1 06-Nov-2007  matt sync with HEAD
 1.42.26.1 19-Oct-2008  haad Sync with HEAD.
 1.42.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.42.20.2 11-Mar-2010  yamt sync with head
 1.42.20.1 04-May-2009  yamt sync with head.
 1.42.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.43.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.44.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.44.2.1 31-May-2011  rmind sync with head
 1.45.8.2 11-Mar-2012  mrg sync to latest -current
 1.45.8.1 18-Feb-2012  mrg merge to -current.
 1.45.4.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.45.4.2 23-Jan-2013  yamt sync with head
 1.45.4.1 17-Apr-2012  yamt sync with head
 1.48.2.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by martin in ticket #123):
sys/arch/sparc64/include/param.h: revision 1.49
sys/arch/sparc64/include/param.h: revision 1.50
Restrict NKMEMPAGES to 2.5GB, otherwise we will run out of space in the
kernel_map on machines with 8GB (or more) main memory.
XXX: Moving KERNBASE/KERNEND is a better long term solution, but this allows
those machines to boot now.
Fix previous, which causes an integer overflow error in uvm_km.c on
32-bit kernels.
 1.50.2.3 03-Dec-2017  jdolecek update from HEAD
 1.50.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.50.2.1 25-Feb-2013  tls resync with head
 1.51.2.1 18-May-2014  rmind sync with head
 1.53.2.1 10-Aug-2014  tls Rebase.
 1.55.2.3 28-Aug-2017  skrll Sync with HEAD
 1.55.2.2 22-Apr-2016  skrll Sync with HEAD
 1.55.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.57.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.57.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.58.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.58.14.1 10-Jun-2019  christos Sync with HEAD
 1.58.12.1 18-Jan-2019  pgoyette Synch with HEAD
 1.61.12.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.62.18.1 02-Aug-2025  perseant Sync with HEAD
 1.16 13-Oct-2009  pooka protect against multi-inclusion
 1.15 04-Mar-2007  christos branches: 1.15.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 11-Feb-2006  cdi branches: 1.14.20;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.13 11-Dec-2005  christos branches: 1.13.2; 1.13.4; 1.13.6;
merge ktrace-lwp.
 1.12 27-Mar-2004  eeh branches: 1.12.16;
License cleanup.
 1.11 25-Nov-2003  cdi Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.
 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 16-May-2002  eeh branches: 1.9.8;
Don't use smaller trapframes. Causes more problems that it's worth right now. CVS: ----------------------------------------------------------------------
 1.8 14-May-2002  eeh branches: 1.8.2;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.7 29-Dec-2000  eeh branches: 1.7.4; 1.7.8;
64-bit address values should be unsigned.
 1.6 18-Nov-2000  mrg struct pcb's lastcall is const char *
 1.5 24-Jun-2000  eeh With these changes the kernel seems almost stable again.
 1.4 30-Dec-1999  eeh branches: 1.4.4;
struct core32 is now in MI headers.
 1.3 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.2 11-Oct-1999  eeh branches: 1.2.2; 1.2.4;
Update to post 1.4.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.7.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.7.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.2.1 30-May-2002  gehenna Catch up with -current.
 1.9.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.8.1 03-Aug-2004  skrll Sync with HEAD
 1.12.16.2 03-Sep-2007  yamt sync with head.
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 18-Feb-2006  yamt sync with head.
 1.14.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.44.1 11-Mar-2010  yamt sync with head
 1.31 23-Jun-2024  riastradh pci: Pass cookie through pci_find_device, pci_enumerate_bus, take 2.

New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.

This will allow pci_find_device callers to pass a cookie through to
the match function so they can keep state or pass in extra parameters
like b/d/f numbers, which will allow us to nix some horrible kludges
in the Linux PCI API emulation for drm (and, perhaps, Intel wifi).

This change drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.

Take 2: Make sure to handle NULL match function.
 1.30 20-May-2024  riastradh Revert "pci: Pass cookie through pci_find_device, pci_enumerate_bus."

Evidently something is wrong with this, to be diagnosed and redone
once the builds and tests are in better shape.
 1.29 20-May-2024  riastradh pci: Pass cookie through pci_find_device, pci_enumerate_bus.

New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.

This drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.
 1.28 07-Jul-2016  msaitoh branches: 1.28.48;
KNF. Remove extra spaces. No functional change.
 1.27 29-Mar-2014  christos branches: 1.27.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.26 27-Oct-2012  chs branches: 1.26.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.25 04-Apr-2011  dyoung branches: 1.25.4; 1.25.14;
Neither pci_dma64_available(), pci_probe_device(), pci_mapreg_map(9),
pci_find_rom(), pci_intr_map(9), pci_enumerate_bus(), nor the match
predicate passed to pciide_compat_intr_establish() should ever modify
their pci_attach_args argument, so make their pci_attach_args arguments
const and deal with the fallout throughout the kernel.

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

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

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

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

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

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

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

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

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

### evbmips-el GDIUM

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

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

### ia64 GENERIC

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

### sgimips GENERIC32_IP3x

crmfb.o: In function `crmfb_attach':
crmfb.c:(.text+0x2304): undefined reference to `ddc_read_edid'
crmfb.c:(.text+0x2304): relocation truncated to fit: R_MIPS_26 against `ddc_read_edid'
crmfb.c:(.text+0x234c): undefined reference to `edid_parse'
crmfb.c:(.text+0x234c): relocation truncated to fit: R_MIPS_26 against `edid_parse'
crmfb.c:(.text+0x2354): undefined reference to `edid_print'
crmfb.c:(.text+0x2354): relocation truncated to fit: R_MIPS_26 against `edid_print'
 1.24 06-Jan-2010  mrg branches: 1.24.4; 1.24.6;
move the guts of pci_intr_map() into pci_machdep.c, and move the schizo
ign addition into a hook. also, don't double shift the ign in set_intr.

tested on U60 and SB2500.
 1.23 30-Nov-2009  mrg convert pci_intr_map() into a chipset tag function pointer, and implement
the schizo version slightly differently.

pull out the schizo's IGN from the upaid, not the apparently broken device
ID register. from openbsd.

with this i appear to have valid working interrupts on the SB2500.

tested on U60 and SB2500.


XXX: we can probably kill (*spc_find_ino)() now that pci_intr_map() itself
XXX: is no longer a first class function.
 1.22 10-Dec-2008  mrg ofpci_make_tag():
don't write PCI_COMMAND_STATUS_REG with
PCI_COMMAND_(MEM|MASTER|IO)_ENABLE, or it in.
sparc_pci_childspace():
move psycho.c:get_childspace() into pci_machdep.c but rename it
psycho_alloc_bus_tag():
use M_ZERO
 1.21 09-Dec-2008  nakayama Fix CardBus, PCI-PCI bridge support borked in previous commit.
 1.20 07-Dec-2008  mrg a few clean up/rearrange changes, somewhat inspired from openbsd's
schizo.c:

- rename pp_busnode{} -> spc_busnode{}, and move it to
sparc_pci_chipset{}

- move public pci functions pci_conf_read(), pci_conf_write() and
pci_intr_establish() into psycho.c, renaming them in the process,
and add pointers through sparc_pci_chipset{} to access them.
as part of this, add PDB_INTMAP and PDB_CONF debug options to
psycho.c

- move and rename sparc64 private pci_find_ino() into
sparc_pci_chipset{}, like the above

- update psycho_alloc_chipset() to set the new 4 function members


no functional change intended. XXX: not tested on cardbus.
 1.19 29-May-2008  mrg branches: 1.19.4; 1.19.6;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.18 11-Feb-2006  cdi branches: 1.18.68; 1.18.70; 1.18.72; 1.18.74;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.17 11-Dec-2005  christos branches: 1.17.2; 1.17.4; 1.17.6;
merge ktrace-lwp.
 1.16 17-Aug-2004  drochner branches: 1.16.12;
make PCI devices attachable/detachable (as far as the particular drivers
allow), and allow to rescan a bus selectively (ie only the device/
function I'm looking at)
 1.15 29-Jul-2004  drochner give the special PCI bus enumerator a sparc64_ prefix and make the
PCI_MACHDEP_ENUMERATE_BUS macro point to it
 1.14 16-May-2002  eeh branches: 1.14.8;
Make the PCI code actually work.
 1.13 16-May-2002  thorpej branches: 1.13.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.
 1.12 15-May-2002  thorpej Let machine-dependent code specify how to enumerate the bus.
Currently, everyone uses pci_enumerate_bus_generic().
 1.11 15-May-2002  thorpej Garbage-collect __PCI_DEV_FUNCORDER.
 1.10 15-May-2002  thorpej Implement pci_decompose_tag().
 1.9 26-Feb-2002  eeh Fix PR# port-sparc64/13811: PCITAG_SETNODE() is defined using `x' insted of `t'.
from URA Hiroshi
 1.8 18-Oct-2001  eeh branches: 1.8.4;
Disable __PCI_DEV_FUNCORDER since it's now badly borken.
 1.7 20-Jul-2001  eeh PCI overhaul.
 1.6 02-Mar-2001  mrg branches: 1.6.4;
use pci_bus_devorder() and pci_dev_funcorder()
 1.5 28-Dec-2000  sommerfeld 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.4 04-Jun-2000  cgd Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.3 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.2 24-May-2000  eeh branches: 1.2.2;
Use the PCI function code to distinguish simba bus A from bus B instead
of the current hack.
 1.1 04-Jun-1999  mrg branches: 1.1.2; 1.1.4;
PCI driver for the UltraSPARC. this only works on the Ultra5/10 machines
(`SUNW,sabre') for now, and it doesn't really quite work there yet anyway.
the bus space/dma code is cloned from the sbus driver. the IOMMU code also
is cloned from the sbus code, but separated out into iommu.c so that we can
share it with the sbus driver. hopefully, much of the bus space/dma code
can also be re-shared with the sbus driver and the ebus driver but for now
these copies will do.

support for the real UltraSPARC PCI (`SUNW,psycho') is unwritten, though
most of this code is shared with it.

we can probe PCI config space and try to configue devices, but interrupts
don't work yet...
 1.1.4.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.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.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.6.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.4.1 03-Aug-2001  lukem update to -current
 1.8.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.8.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.8.4.2 26-Feb-2002  eeh Fix PR# port-sparc64/13811: PCITAG_SETNODE() is defined using `x' insted of `t'.
from URA Hiroshi
 1.8.4.1 18-Oct-2001  eeh file pci_machdep.h was added on branch nathanw_sa on 2002-02-26 22:05:55 +0000
 1.13.2.2 30-May-2002  gehenna Catch up with -current.
 1.13.2.1 16-May-2002  gehenna file pci_machdep.h was added on branch gehenna-devsw on 2002-05-30 15:35:54 +0000
 1.14.8.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.8.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.8.2 25-Aug-2004  skrll Sync with HEAD.
 1.14.8.1 03-Aug-2004  skrll Sync with HEAD
 1.16.12.1 21-Jun-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.17.2.1 18-Feb-2006  yamt sync with head.
 1.18.74.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.72.2 11-Mar-2010  yamt sync with head
 1.18.72.1 04-May-2009  yamt sync with head.
 1.18.70.1 04-Jun-2008  yamt sync with head
 1.18.68.2 17-Jan-2009  mjf Sync with HEAD.
 1.18.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.24.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.24.4.1 21-Apr-2011  rmind sync with head
 1.25.14.3 03-Dec-2017  jdolecek update from HEAD
 1.25.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.25.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.25.4.1 30-Oct-2012  yamt sync with head
 1.26.2.1 18-May-2014  rmind sync with head
 1.27.6.1 09-Jul-2016  skrll Sync with HEAD
 1.28.48.1 04-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #928):

sys/external/bsd/drm2/dist/drm/drm_gem.c: revision 1.25
sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/priv.h: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_acpi.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/display/intel_opregion.h: revision 1.6
sys/external/bsd/drm2/dist/drm/i915/i915_drv.h: revision 1.49
sys/external/bsd/drm2/include/linux/mxm-wmi.h: revision 1.1
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_pcie.c: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c: revision 1.13
sys/external/bsd/common/include/linux/bitops.h: revision 1.17
sys/external/bsd/drm2/nouveau/files.nouveau: revision 1.40
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.30
sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/pci/nouveau_nvkm_subdev_pci_pcie.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_base.c: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c: revision 1.12
sys/external/bsd/drm2/dist/drm/radeon/radeon_rv770.c: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_sorgm200.c: revision 1.3
sys/external/bsd/common/include/linux/printk.h: revision 1.14
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_gk20a.c: revision 1.10
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vi.c: revision 1.4
sys/external/bsd/drm2/include/linux/acpi.h: revision 1.11
sys/external/bsd/drm2/drm/drm_cdevsw.c: revision 1.31
sys/external/bsd/drm2/dist/drm/radeon/radeon_si.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.c: revision 1.5
sys/external/bsd/drm2/dist/drm/i915/display/intel_acpi.h: revision 1.5
sys/external/bsd/drm2/include/acpi/video.h: revision 1.3
sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_acpi.h: revision 1.4
sys/arch/sparc64/include/pci_machdep.h: revision 1.31
sys/arch/sparc64/dev/pci_machdep.c: revision 1.83
sys/external/bsd/drm2/include/linux/kref.h: revision 1.14
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_pci.c: revision 1.12
sys/external/bsd/drm2/linux/linux_dma_buf.c: revision 1.17
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowacpi.c: revision 1.4
sys/external/bsd/drm2/drm/drm_module.c: revision 1.32
sys/external/bsd/drm2/dist/drm/i915/i915_gem.h: revision 1.8
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c: revision 1.7
sys/external/bsd/drm2/include/linux/smp.h: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_si.c: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.20
sys/arch/x86/x86/bus_dma.c: revision 1.91
sys/external/bsd/drm2/radeon/files.radeon: revision 1.40
sys/external/bsd/drm2/include/acpi/acpi_bus.h: revision 1.1
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drv.h: revision 1.5
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.21
sys/external/bsd/common/include/asm/barrier.h: revision 1.20
sys/external/bsd/drm2/include/linux/nbsd-namespace-acpi.h: revision 1.2
sys/external/bsd/common/include/asm/barrier.h: revision 1.21
sys/modules/drmkms/drmkms_pci.h: revision 1.1
sys/external/bsd/drm2/dist/drm/drm_dp_helper.c: revision 1.17
sys/external/bsd/drm2/radeon/radeon_pci.c: revision 1.23
sys/external/bsd/drm2/linux/linux_xa.c: revision 1.4
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.23
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.24
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.25
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.26
sys/dev/pci/pcivar.h: revision 1.120
sys/arch/xen/include/pci_machdep.h: revision 1.24
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.26
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.27
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.27
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.28
sys/external/bsd/drm2/dist/drm/radeon/radeon_cik.c: revision 1.8
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revision 1.28
sys/external/bsd/drm2/linux/linux_pci.c: revision 1.29
sys/external/bsd/drm2/include/linux/pci.h: revision 1.57
sys/external/bsd/drm2/include/linux/pci.h: revision 1.58
sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_display.c: revision 1.6
sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_hwmgr.c: revision 1.3
sys/external/bsd/drm2/dist/drm/amd/display/dc/core/amdgpu_dc_stream.c: revision 1.3
share/man/man9/bus_dma.9: revision 1.69
sys/external/bsd/drm2/drm/drm_gem_cma_helper.c: revision 1.15
sys/external/bsd/drm2/dist/drm/radeon/radeon_acpi.c: revision 1.6
sys/external/bsd/drm2/dist/drm/radeon/radeon.h: revision 1.12
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cik.c: revision 1.7
sys/dev/acpi/acpi_mcfg.c: revision 1.29
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c: revision 1.6
sys/external/bsd/drm2/dist/drm/radeon/radeon_r600.c: revision 1.7
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.13
sys/modules/amdgpu/Makefile: revision 1.9
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.14
sys/external/bsd/common/linux/linux_tasklet.c: revision 1.12
sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core/device.h: revision 1.10
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.23
sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h: revision 1.9
sys/external/bsd/drm2/include/linux/interval_tree.h: revision 1.14
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.26
sys/external/bsd/drm2/dist/drm/amd/powerplay/hwmgr/amdgpu_smu7_hwmgr.c: revision 1.5
sys/dev/pci/pci.c: revision 1.168
sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_mman.c: revision 1.27
sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c: revision 1.9
sys/external/bsd/drm2/pci/files.drmkms_pci: revision 1.18
sys/external/bsd/drm2/linux/linux_sync_file.c: revision 1.3
sys/external/bsd/drm2/amdgpu/files.amdgpu: revision 1.31
sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_tegra.c: revision 1.4
sys/external/bsd/drm2/dist/drm/drm_gem.c: revision 1.24
sys/arch/xen/xen/xpci_xenbus.c: revision 1.29

drm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html

linux asm/barrier.h: Fix !MULTIPROCESSOR build.

remove "nouveau" from a comment. noted by jmcneill.

drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B)
comment a function that has a clear overbounds read but it isn't used.
found by GCC 12.

nix the NetBSD specific GEM_BUG_ON().
avoids GCC 12 warnings, and matches upstream closer.
avoid uninitialised variable usage in drm_gem_cma_create_internal().
in the case nothing has returned 'error', 'nsegs' and the dma info
are (potentially) uninitialised, so consider this an error.
found by GCC 12.

avoid a GCC 12 warning.
there's a 1-element long array and a loop conditional that tries to see
if indexes for it are not identical. as these indexes will always both
be 0, the only valid index, the condition is always false. GCC 12
triggers a strange warning on this code that can never run (see below),
so simply assert the array size is 1 and comment the rest.
amdgpu_dc_stream.c:470:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
470 | stream->writeback_info[j] = stream->writeback_info[i];

convert a KASSERT() into an if () panic() sequence to appease GCC 12.
OK riastradh@.

drm: Fix conditionals around drmkms_pci and agp.
Kernel should build now with all pci drm drivers stripped out but
DRM_LEGACY still enabled. (Might not be very useful, but it'll
build. Maybe we should also have DRM_LEGACY_PCI so those drivers can
be modloaded later.)

drmkms: Fix module build.
avoid an unlikely array bounds issue picked up by GCC 12.
nvkm_pcie_speed() can return -1, which is then used as an array index,
so make this default return PCIe 1.0 speeds.

drm: enable almost all PCIe functionality
linux_pci.c revisions 1.24 and 1.25 implemented most of the remaining
missing PCIe backends, but only enabled them for some amdgpu portions.
this enables all code marked with "XXX amdgpu pcie", "XXX radeon pcie",
and "XXX pcie speed". for most of it, simply removing #ifndefs __NetBSD__
to enable compliation was required, once the new "bus->max_bus_speed"
member was added to struct pci_bus. add an "always fails" backend for
pci_enable_atomic_ops_to_root() which seems to only be necessary
for virtual GPU functionality (and could be implemented if needed.)
tested on radeon 5450, 7750, R7 240 [radeon], and RX 550 [amdgpu], and
nvidia 750 and 1030 [nouveau].
this still does not quite work on nvidia cards. there are two problems
that remain:
- the call to set the link speed is skipped because the speed is set
to the default value of "-1". nvkm_pcie_set_link() will actually
determine the right value for this and for some cards, calling this
function if the current speed is -1 helps set the link speed. it
may be that on linux other paths we don't have enabled properly
would set this (there's one via debugfs, and a jetson specific one,
though perhaps setting either AC or DC speed values as boot options
(after hooking up these for netbsd) would currently work.
- worse, cards newer than kepler - geforce 900, 1000, and newer, are
all lacking the backing support to set pcie link speed. the GT 1030
card i have been testing with remains at pcie 1.0.

radeon: fix and enable ACPI methods for getting ROM BIOS
The hacky way of getting the BIOS mapped only works on x86. ACPI
should be preferred if available. Makes BIOS reading though VFCT
work on aarch64 with EDK2. (But only if EDK2 has POSTed the GPU.)
XXX amdgpu should get the same treatment.

drm: put_cpu() should enable preemption, not disable it again

drm(4): make pr_debug equivalent to aprint_debug
significantly reduces the default spam from amdgpu(4).

drm: Set CONFIG_ACPI in linux/acpi.h and make it build.

Leave a little ACPI-related functionality disabled for now, like
getting EDID out of ACPI -- needs a bit more work to make this work,
and I don't have hardware to work on that.
Should help with failures of the forms:
- unable to locate a BIOS ROM
- bios: unable to locate usable image
on various machines.

radeon_acpi.c: ifdef out unused function on NetBSD.
Should fix syzkaller build.

drm(4): Fix st_rdev in stat.
dminor->index already has the 64*type adjustment, as allocated in
drm_minor_alloc.
PR kern/58180

linux_sync_file: Fix missing init/fini steps.
Noted by rjs@.
PR kern/58210

ttm: Sync ttm_bo_uvm_fault_idle better with Linux.
PR xsrc/58133
ttm: Undo mistake in previous.

PR xsrc/58133
linux: Add a few more cases to pci_get_class.
Should fix crash on boot with amdgpu now that the ACPI business is
enabled.

i915: Fix dmabuf mmap object.

drm: Fix missing bounds checks in dma buf mmap.

drm_gem.c: Fix sense of assertion.
This is the opposite of WARN_ON.
Noted by rjs@.

drm_gem.c: Enable drm_gem_fence_array_add now that we emulate xa.
linux_xa: Delete and replace collision in xa_store as intended.
Don't free the colliding node that's still in the tree.
Noted by rjs@.

i915_gem_mman.c: Apply mmap types via pmap flags.
This way, userland gets buffers mapped write-combining or uncached as
needed.
PR xsrc/58307

x86: Teach bus_dmamem_map about BUS_DMA_PREFETCHABLE.
PR port-amd64/58308

bus_dma(9): Document BUS_DMA_PREFETCHABLE.
Like BUS_DMA_NOCACHE. Doesn't absolve you of the need for
bus_dmamap_sync, but if you later pass the vaddr to bus_dmamap_load,
the DMA map might notice the mapping is write-combining and use this
to make bus_dmamap_sync cheaper.
PR kern/58309

nouveau_nvkm_subdev_instmem_gk20a.c: Use BUS_DMA_PREFETCHABLE.
Matches Linux's pgprot_writecombine.
Unclear where the appropriate bus_dmamap_sync happens, or is supposed
to happen -- not using it would be wrong, but asking for a
prefetchable mapping may paper over symptoms, at least!

ttm: Sync more with Linux.
Add the original copyright and attribution since this is now,
intentionally, a modified copy of the original and not just roughly
the same algorithm.

ttm: Respect PGO_ALLPAGES.
Not sure this is useful but it reduces XXX's and makes this match
udv_fault better so it's easier to understand.

ttm: Sync cacheability flag logic with Linux.

ttm: Add XXX about readahead fault failures.

pci: Pass cookie through pci_find_device, pci_enumerate_bus, take 2.
New functions pci_find_device1 and pci_enumerate_bus1 have the cookie
argument. Existing symbols pci_find_device and pci_enumerate_bus are
now wrappers for the cookieless version.
This will allow pci_find_device callers to pass a cookie through to
the match function so they can keep state or pass in extra parameters
like b/d/f numbers, which will allow us to nix some horrible kludges
in the Linux PCI API emulation for drm (and, perhaps, Intel wifi).
This change drops the symbol pci_probe_device, in favour of a new
pci_probe_device1 with the cookie argument. But I don't think that
requires a revbump because it's only called by MD pci_enumerate_bus1
implementations, which don't live in modules anyway.
Take 2: Make sure to handle NULL match function.
linux_pci: Nix pci enumeration kludges.
Now that we can pass a cookie through, this stuff will be a little
less fragile.

i915: Omit needless i915_gem_object_pin/unpin_pages cycle in fault.
vm_fault_cpu and vm_fault_gtt, called by i915_gem_fault, already do
the pinning and unpinning internally, so there is no need for
i915_gem_fault to do it.
No functional change intended, except that the transient pin count
will be one lower than before during the fault routine (but it will
still be positive).

i915: Match Linux fault routine return code actions.
Omit needless EINTR interception -- this is now handled by
i915_error_to_vmf_fault.
Earlier revert was over a false alarm -- bisection shows the new
warnings arose from linux_pci.c 1.29 here:
https://mail-index.netbsd.org/source-changes/2024/06/23/msg151929.html

linux_pci: Fix shifto in pci_get_class.
It looks like Linux's pci_get_class also matches the interface part
of the PCI class register (but not the revision part), and I hadn't
noticed that in the previous shim structured differently.

With GCC12 kernel ALL/amd64 triggers "'sor' may be used uninitialized".
If "sublinks & 3" is zero GCC is right and sor[1] may be returned unitialized.
Fix by initializing "sor" to zero to return -1 instead of uninitialized value.
Ok: Taylor R Campbell <riastradh@>

amdgpu: Map BAR 2, not BAR 5, on pre-bonaire chips.
PR kern/58384

amdgpu: Map consecutive pages, not the same one over and over again.
PR kern/58385

linux/bitops: Fix overestimate for BITS_TO_LONGS(9)
Fortunately, this seems harmless except for allocating
excessive buffer memory.
Pointed out by nonaka@, OK riastradh@.
 1.64 06-Sep-2020  mrg forward declare struct vm_page, and include uvm_prot.h and uvm_pmap.h.

fixes build, presumeably after uvm.h external rototill.
 1.63 15-Dec-2019  ad Merge from yamt-pagecache:

- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
 1.62 10-Jan-2019  mrg - move pmap_ctx() macro into pmap.h instead of duplicating it.
- fix description of some mach ddb commands.
 1.61 04-Nov-2016  macallan branches: 1.61.14; 1.61.16;
add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.60 06-Sep-2015  nakayama branches: 1.60.2;
Use <machine/*.h> instead of <sparc64/*.h> for consistency.
 1.59 04-Sep-2014  palle branches: 1.59.2;
sun4v: All cpus must be setup with a TSB descriptor, so pmap_setup_tsb_sun4v() must take a pointer to the TSB descriptor
 1.58 14-Apr-2014  martin Implement and enable TOPDOWN_VM. From Chuck Silvers.
 1.57 27-Dec-2013  palle branches: 1.57.2;
a) make the hunt through the cpus list more generic b) sun4v: ensure that the interrupt stack is mapped permanently and the TSB is setup properly - parts from OpenBSD. OK martin@
 1.56 11-Sep-2013  martin Disallow MAP_FIXED mmap's in the sparc64 VA hole (XXX - need to deal with
different variants of the hole for different CPU types)
 1.55 06-Oct-2011  mrg branches: 1.55.2; 1.55.12; 1.55.16;
make struct page_size_map consistent across DEBUG/!DEBUG kernels.
 1.54 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.53 14-Nov-2010  uebayasi branches: 1.53.6;
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.52 06-Mar-2010  mrg branches: 1.52.2;
clean up a bunch of MULTIPROCESSOR:

- always include ci_ipi_evcnt[] in cpuinfo
- #define sparc_ncpus 1 for !MULTIPROCESSOR
- make struct pmap::pm_list an pm_ctx always be an array, and simplify
several functions and lookups to always be the same

tested on U60 and SB2500 before and after with one and two cpus in an
MP kernel, and UP kernels, and i can't find anything besides noise for
benchmark issues. (infact, i can't really tell the difference between
GENERIC and GENERIC.MP on these systems...)
 1.51 04-Mar-2010  mrg - in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.
 1.50 24-Feb-2010  mrg move the tlb flush routines into cache.h to avoid machine/pmap.h polution.
 1.49 24-Feb-2010  mrg - re-introduce sp_tlb_flush_pte() and sp_tlb_flush_all() that call
the right USI/USIII version.
- define tlb_flush_pte() in terms of sp_tlb_flush_pte() for the
!MULTIPROCESSOR case

this centralises some CPU_IS_USIII_UP() tests.
 1.48 23-Feb-2010  mrg oops. don't call sp_tlb_flush_pte_usiii() on USI/USII.
 1.47 02-Feb-2010  mrg branches: 1.47.2;
- split sp_tlb_flush_pte() and switchtoctx() into sp_tlb_flush_pte_us()/
sp_tlb_flush_pte_usiii() and switchtoctx_us()/switchtoctx_usiii() and
implement the latter while i'm here. it works ... sometimes i think,
but also sometimes panics/hangs.
- fix a comment in sparc64_ipi_flush_pte_usiii()
 1.46 01-Feb-2010  mrg - sp_tlb_flush_all() becomes sp_tlb_flush_all_us() and sp_tlb_flush_all_usiii()
- sparc64_ipi_flush_pte() becomes sparc64_ipi_flush_pte_us() and
sparc64_ipi_flush_pte_usiii()
- add some commented out code to disable interrupts and raise the traplevel
in sparc64_ipi_flush_pte_usiii()
- cache_flush_phys() was missing a little of code in the cheetah case
 1.45 30-Nov-2009  mrg delete some no longer used code:
- smp_tlb_flush_ctx()
- smp_tlb_flush_all()
- sparc64_ipi_flush_ctx()
- sparc64_ipi_flush_all()
- sp_tlb_flush_ctx()
 1.44 12-Dec-2008  pooka this header needs machine/cpuset.h
 1.43 10-Dec-2008  martin Backout previous - Matt, you probably did a partial update and didn't
pick up the sys/uvm changes.
 1.42 10-Dec-2008  mrg fix sparc64 build: provide pmap_kernel(), re-provide pmap_t.

fixes builds for my U60.
 1.41 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.40 14-Mar-2008  nakayama branches: 1.40.4; 1.40.10; 1.40.12; 1.40.14; 1.40.20;
Complete per-CPU TSBs and MMU contexts changes.
 1.39 28-Feb-2008  martin Make TSBs and MMU contexts per-cpu.
 1.38 04-Mar-2007  christos branches: 1.38.20; 1.38.36; 1.38.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.37 20-Feb-2006  cdi branches: 1.37.20;
Use ANSI-style function definitions and declarations.
 1.36 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.35 27-Jan-2006  cdi branches: 1.35.2; 1.35.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.34 11-Dec-2005  christos branches: 1.34.2;
merge ktrace-lwp.
 1.33 25-Feb-2005  heas branches: 1.33.4;
Add a few comments wrt PTEs
 1.32 17-Jan-2005  atatat branches: 1.32.2;
Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
 1.31 14-Mar-2004  chs branches: 1.31.8;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.30 26-Feb-2004  petrov Correct VA_ALIAS_MASK. From Chuck Silvers.
 1.29 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.28 10-Aug-2003  chs remove some leftover cruft.
 1.27 14-Apr-2003  petrov branches: 1.27.2;
clean-up unused definition.
 1.26 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.25 31-Jan-2003  martin Make the pmap count resident/wired mappings on the fly instead of
walking the page tables whenever this information is needed.

Add an option PMAP_COUNT_DEBUG to assert the new counts and the
page table walk agree.

The old solution had very bad performance impact, for example
by the high CPU load when running top(1).

Thanks to Simon Burge for pointing at the cause of the problem and
to Valeriy E. Ushakov for optimizing my simple minded assembler code.
 1.24 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.23 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.22 16-Apr-2002  eeh We want pages modulo 16K not modulo 32K.
 1.21 24-Sep-2001  eeh branches: 1.21.4;
Change bus_space_mmap() signature to the official one.
 1.20 23-Sep-2001  chs implement pmap_wired_count().
 1.19 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.18 31-Aug-2001  martin branches: 1.18.2;
Move struct segmap declaration inside #ifndef _LOCORE to make locore.s
compilable again.
 1.17 30-Aug-2001  mrg add some sun4/sun4c/sun4m compat code so we can build 32 bit kvm. (these files are not even vaguely syncable.)
 1.16 22-Apr-2001  thorpej branches: 1.16.2;
Undo a misguided previous change to the pmap_update() API.
 1.15 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.14 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.13 29-Oct-2000  eeh branches: 1.13.2;
Add pmap_growkernel().
 1.12 11-Sep-2000  eeh Add locking to pmap operations and support multiple physical memory segments.
 1.11 30-Dec-1999  eeh branches: 1.11.4;
Implement PMAP_PREFER().
 1.10 07-Jun-1999  eeh branches: 1.10.2;
Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.9 28-Mar-1999  eeh branches: 1.9.4;
Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().
 1.8 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.7 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.6 09-Sep-1998  thorpej Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule
the reaper to free them for us, once it is safe to do so (i.e. we are
no longer running on the dead proc's vmspace and stack).
 1.5 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.4 27-Aug-1998  eeh Add 64-bit pmap support:

Moved from a two level 512/1024 entry setup mapping 32 (9/10/13) bits
respectively to a three level 1024/1024/1024 entry setup mapping 43
(10/10/10/13) bits. In 32-bit mode we waste about 1/12 pages mapping the high
11 bits. We also only manage 43 of the possible 44 bits of virtual address
space, wasting half of it. Oh well, maybe we'll do better next revision.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 07-Jul-1998  eeh branches: 1.2.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.2.4 09-Aug-1998  eeh General pmap and debug cleanup. Added PMAP_NEW support, but it doesn't work too well yet.
 1.2.2.3 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.2.2.2 02-Aug-1998  eeh Cleanup work:

Sync up with sys/dev/sbus
get cgsix to work right
 1.2.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.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.10.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.10.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.4.1 17-Oct-2000  tv Pullup 1.12 [eeh]:
Add locking to pmap operations and support multiple physical memory segments.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.16.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.16.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.16.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.18.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.21.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.21.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.21.4.3 04-Jan-2002  eeh Cleanup.
 1.21.4.2 03-Jan-2002  petrov make kernel compile
 1.21.4.1 24-Sep-2001  petrov file pmap.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.27.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.27.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1 03-Aug-2004  skrll Sync with HEAD
 1.31.8.1 29-Apr-2005  kent sync with -current
 1.32.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.33.4.3 17-Mar-2008  yamt sync with head.
 1.33.4.2 03-Sep-2007  yamt sync with head.
 1.33.4.1 21-Jun-2006  yamt sync with head.
 1.34.2.3 01-Mar-2006  yamt sync with head.
 1.34.2.2 18-Feb-2006  yamt sync with head.
 1.34.2.1 01-Feb-2006  yamt sync with head.
 1.35.4.1 22-Apr-2006  simonb Sync with head.
 1.35.2.1 09-Sep-2006  rpaulo sync with head
 1.37.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.38.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.38.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.38.36.1 24-Mar-2008  keiichi sync with head.
 1.38.20.1 23-Mar-2008  matt sync with HEAD
 1.40.20.1 21-Apr-2010  matt sync to netbsd-5
 1.40.14.1 17-Mar-2010  snj Apply patch (requested by mrg in ticket #1343):
- flush the dcache around pmap_{zero,copy}_page()
- convert all blast_dcache() / dcache_flush_page() calls to
properly handle flushes in all cpus as necessary
 1.40.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.40.4.2 11-Mar-2010  yamt sync with head
 1.40.4.1 04-May-2009  yamt sync with head.
 1.47.2.2 16-Nov-2010  uebayasi Sync with HEAD.
 1.47.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.52.2.2 05-Mar-2011  rmind sync with head
 1.52.2.1 16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.53.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.55.16.1 18-May-2014  rmind sync with head
 1.55.12.2 03-Dec-2017  jdolecek update from HEAD
 1.55.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.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.55.2.1 02-Dec-2011  yamt adapt sparc64. compile tested.
 1.57.2.1 10-Aug-2014  tls Rebase.
 1.59.2.2 05-Dec-2016  skrll Sync with HEAD
 1.59.2.1 22-Sep-2015  skrll Sync with HEAD
 1.60.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.61.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.61.16.1 10-Jun-2019  christos Sync with HEAD
 1.61.14.1 18-Jan-2019  pgoyette Synch with HEAD
 1.2 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

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

* Removes the PMC code of ARM XSCALE.

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

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

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

* Removes the pmc_evid_t and pmc_ctr_t types.

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

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.1.204.1 10-Jun-2019  christos Sync with HEAD
 1.1.202.1 28-Jul-2018  pgoyette Sync with HEAD
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 07-Aug-2002  jdolecek file pmc.h was added on branch kqueue on 2002-09-06 08:41:41 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 07-Aug-2002  gehenna file pmc.h was added on branch gehenna-devsw on 2002-08-31 14:52:34 +0000
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 07-Aug-2002  nathanw file pmc.h was added on branch nathanw_sa on 2002-08-13 02:18:56 +0000
 1.17 06-Dec-2020  christos don't expose register_t
 1.16 22-May-2016  christos branches: 1.16.30;
Account for the VA hole differently (simpler)
 1.15 19-May-2016  christos lose one more bit of ALSR to account for rounding in the VA hole.
 1.14 17-May-2016  christos Clamt the PAX_ASLR random value to the max bits we have for VA.
 1.13 14-Jan-2011  rmind branches: 1.13.18; 1.13.36;
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.12 21-Nov-2009  rmind branches: 1.12.4;
Include sys/proc.h for sparc/sparc64, which is required for now.
 1.11 17-Oct-2007  garbled branches: 1.11.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.10 14-Aug-2007  martin branches: 1.10.2;
Initialize lwp0.l_md.md_tf - it was NULL before. Spotted by tnn.
While there, g/c the unused md_pcbpaddr.
 1.9 11-Dec-2005  christos branches: 1.9.30; 1.9.38; 1.9.44; 1.9.48;
merge ktrace-lwp.
 1.8 27-Oct-2005  martin Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork
 1.7 12-Jul-2005  christos branches: 1.7.2;
change trapframe to trapframe64 in the md_syscall prototype to fix 32
bit kernel builds.
 1.6 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.5 02-Jan-2005  christos branches: 1.5.10;
add a linted comment.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 18-Jan-2003  thorpej branches: 1.3.2;
Merge the nathanw_sa branch.
 1.2 06-Nov-1999  eeh branches: 1.2.12;
Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.16; 1.1.1.1.20;
Import of sparc64.
 1.1.1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.1.1.16.1 15-Nov-1999  fvdl Sync with -current
 1.1.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.12.2 04-Jan-2002  eeh Cleanup.
 1.2.12.1 03-Jan-2002  petrov make kernel compile
 1.3.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.2 03-Sep-2007  yamt sync with head.
 1.5.10.1 21-Jun-2006  yamt sync with head.
 1.7.2.1 02-Nov-2005  yamt sync with head.
 1.9.48.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.9.44.1 15-Aug-2007  skrll Sync with HEAD.
 1.9.38.1 03-Oct-2007  garbled Sync with HEAD
 1.9.30.1 20-Aug-2007  ad Sync with HEAD.
 1.10.2.1 06-Nov-2007  matt sync with HEAD
 1.11.20.1 11-Mar-2010  yamt sync with head
 1.12.4.1 05-Mar-2011  rmind sync with head
 1.13.36.1 29-May-2016  skrll Sync with HEAD
 1.13.18.1 03-Dec-2017  jdolecek update from HEAD
 1.16.30.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.6 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.5 03-Nov-2001  thorpej branches: 1.5.2; 1.5.10;
Changes from Martin Husemann and myself:
- Make the 32-bit SPARC profile support work with the GCC 2.95.3
SPARC ELF compiler, which uses a different name for mcount.
- Make the 64-bit SPARC profile support header look more like the 32-bit
SPARC header (no functional change -- 64-bit SPARC already used the
correct mcount name).
 1.4 02-Aug-2000  eeh branches: 1.4.4; 1.4.6;
Get kernel profiling to work. Now if only gprof worked....
 1.3 08-Oct-1998  eeh branches: 1.3.12; 1.3.22;
Fix more syscall32 and signal breakage.
 1.2 07-Jul-1998  eeh General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.22.1 07-Aug-2000  mrg pull up 1.4 (approved by thorpej):
>Get kernel profiling to work. Now if only gprof worked....
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.10.1 31-Aug-2002  gehenna catch up with -current.
 1.5.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.5.2.1 03-Nov-2001  nathanw file profile.h was added on branch nathanw_sa on 2002-08-01 02:43:44 +0000
 1.1 20-Jul-2002  mrg branches: 1.1.2; 1.1.4; 1.1.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 20-Jul-2002  jdolecek file promlib.h was added on branch kqueue on 2002-09-06 08:41:42 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 20-Jul-2002  gehenna file promlib.h was added on branch gehenna-devsw on 2002-08-31 14:52:34 +0000
 1.1.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 20-Jul-2002  nathanw file promlib.h was added on branch nathanw_sa on 2002-08-01 02:43:44 +0000
 1.66 20-May-2025  macallan provide splsoftbio()
 1.65 07-Apr-2024  rillig branches: 1.65.2;
sparc: fix typos and omissions in PSTATE_BITS and ECC_AFR_BITS

Fixes PR 57869.
 1.64 02-Sep-2023  jdc sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines
Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)
Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c
Add "socal" and "SUNW,bpp" to the interrupt map.
 1.63 11-Jul-2023  martin Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.
 1.62 02-Nov-2021  ryo branches: 1.62.4;
In order to prevent _mcount() from being recursively called when built with COPTS=-O0,
sprinkle `__always_inline' to make _mcount() be generated as a single function.
 1.61 13-Nov-2019  nakayama Revert workarounds for clang.
In-tree clang can now handle the "r" asm constraint for 64-bit values properly.
 1.60 06-Apr-2019  nakayama The real cause for removing asm inline code on clang is that the
"r" constraint cannot handle 64-bit and is treated as 32-bit.

So code that refers to the upper 32-bit (manuf or impl) of the %ver
register is removed by optimization.

Use 32-bit kernel code as a workaround when referring to the %ver
register.
 1.59 05-Apr-2019  nakayama Put "memory" to asm inline reading privilege registers for clang to
prevent it from being removed by excessive optimization.
 1.58 08-Feb-2019  palle Introduce getstickcmpr() function
 1.57 18-May-2016  nakayama branches: 1.57.18;
Fix (unused) pstate mask bits in tstate and comment.
 1.56 25-Dec-2014  nakayama Put "memory" to asm inline for reading privilege registers on sun4v
to avoid issuing rdpr %ver before checking cputyp as a result of
code moving by compiler optimization.
 1.55 05-Dec-2014  nakayama Use GETVER_CPU_* macros.
 1.54 05-Dec-2014  nakayama Make getver() into a constant function since Version Register (%ver)
is read only and its value is constant.

This change reduces multipule %ver reads to one in the functions
which uses a number of CPU_IS_* macros.
 1.53 18-Aug-2013  martin branches: 1.53.4; 1.53.6;
Remove ancient spl* variants no longer used
 1.52 09-Nov-2012  nakayama branches: 1.52.2;
Make setstick() and getstick() to inline functions.
 1.51 08-Nov-2012  nakayama Move ASRs macro to more appropriate header.
While there remove useless macro.
 1.50 08-Nov-2012  macallan use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.49 12-Jul-2011  mrg branches: 1.49.2; 1.49.8; 1.49.12;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.48 25-May-2011  mrg define MANUF_FUJITSU (and fix CPU_IS_SPARC64_V_UP()) and MANUF_SUN.

use CPU_IS_SPARC64_V_UP() to choose some US-III versions of some
cache functions.
 1.47 12-May-2011  mrg first steps towards fujitsu SPARC64 support:

- add IMPL_* defines for fujitsu SPARC64 processors (mostly from openbsd)
- rename CPU_IS_JALAPENO() as CPU_IS_USIIIi()
- add GETVER_CPU_MANUF()
- add CPU_IS_SPITFIRE() and CPU_IS_SPARC64_V_UP()
 1.46 01-Feb-2010  mrg branches: 1.46.4; 1.46.6;
add some macros to check cpu type:
GETVER_CPU_IMPL()
CPU_IS_JALAPENO()
CPU_IS_USIII_UP()
and use them in a couple places to choose the right method/index
 1.45 15-Jan-2010  nakayama Add processor implementation codes, from OpenBSD.
 1.44 15-Jan-2010  nakayama Add function names defined by macro in comment for reference.
 1.43 04-Dec-2009  nakayama Bring together similar definitions of inline functions manipulating
privileged registers using macro. no functional change.
 1.42 25-Nov-2009  rmind Remove IPL_LPT and IPL_IPI aliases, use the actual IPLs.
Fix some broken comments.
 1.41 16-May-2009  nakayama - move definition of tick() from ctlreg.h to psl.h and rename to gettick()
for consistency with other functions for reading/writing ASRs.
- move definition of tl() from trap.c to psl.h as same as above.
- define settick() in psl.h and use it in clock.c.
- cosmetic chages in psl.h.
 1.40 02-Mar-2008  nakayama branches: 1.40.4;
Correct TSTATE_KERN and TSTATE_USER macros.
 1.39 25-Feb-2008  nakayama Fix macro to convert CCR field between PSR and TSTATE.
CCR filed in PSR starts from bit 20, not from bit 19.
 1.38 11-Dec-2007  martin branches: 1.38.4; 1.38.8;
Make sure the compiler does not reorder stores accross spl...() calls
[or, for completeness, calls changing the processor state]. The mutex
code has small race windows otherwise.
 1.37 03-Dec-2007  ad branches: 1.37.2; 1.37.4; 1.37.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.36 16-Feb-2007  ad branches: 1.36.6; 1.36.22; 1.36.24; 1.36.30;
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.35 26-Dec-2006  ad Define ipl_t as uint8_t so that it can be packed into a word with a lock
byte. Ok yamt@.
 1.34 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.33 04-May-2006  yamt branches: 1.33.8; 1.33.10;
pull splraiseipl() for sparc64 from newlock branch.
reviewed by Martin Husemann.
 1.32 20-Feb-2006  cdi branches: 1.32.2; 1.32.4; 1.32.6;
Use ANSI-style function definitions and declarations.
 1.31 16-Feb-2006  perry Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.30 24-Dec-2005  perry branches: 1.30.2; 1.30.4; 1.30.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.29 11-Dec-2005  christos merge ktrace-lwp.
 1.28 19-Jun-2005  thorpej branches: 1.28.2;
Small clean-ups before an overhaul.
 1.27 27-Jan-2005  martin Remove orphaned extern declaration.
 1.26 14-Mar-2004  chs branches: 1.26.8; 1.26.10;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.25 15-Nov-2003  petrov Compile GENERIC.MP.
 1.24 09-Nov-2003  petrov Lower PIL_AUD so /dev/audio will not interrupt and interfere with
scheduler. Fixes kern/23382.
 1.23 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.22 22-Mar-2003  nakayama branches: 1.22.2;
PCI-CardBus bridge support for sparc64:
- add splsoftserial.
 1.21 29-Sep-2002  chs avoid reading %pil in splx() if !SPLDEBUG.
misc tidiness.
 1.20 13-Apr-2001  thorpej branches: 1.20.2; 1.20.8; 1.20.12; 1.20.18;
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.19 02-Mar-2001  mrg branches: 1.19.2;
clean up slightly.
 1.18 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.17 29-Dec-2000  eeh Lower PIL_SCHED below the zs interrupt so we don't get silo overflows.
 1.16 23-Aug-2000  eeh Update the scheduler to the new locking scheme.
 1.15 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.14 21-Aug-2000  thorpej Make sure we provide splsched() as described in spl(9).
 1.13 23-Jul-2000  eeh Give 64-bit processes access to a full 64-bit address space (90% of which
they can't use anyway, but that's another issue.)
 1.12 09-Jul-2000  eeh Use TSO memory model for 32-bit userland.
 1.11 05-Aug-1999  thorpej branches: 1.11.2; 1.11.12;
Fix the raise/lower semantics of splsoftclock()/spllowersoftclock().
 1.10 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.9 18-Jul-1999  eeh Lower spl for softints.
 1.8 05-Jun-1999  eeh Fix things up so they compile again.
 1.7 26-Mar-1999  eeh branches: 1.7.4;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.6 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.5 05-Sep-1998  eeh It slices. It dices. It does everything except exec a sparc32_compat init.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 28-Jul-1998  eeh That last change to reduce warnings wasn't quite right.
 1.2 27-Jul-1998  mrg don't provide a static splx prototype if SPLDEBUG. avoids warnings...
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.7.4.2 02-Aug-1999  thorpej Update from trunk.
 1.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.12.2 31-Jul-2000  mrg pull up 1.13 (approved by thorpej):
>Give 64-bit processes access to a full 64-bit address space (90% of which
>they can't use anyway, but that's another issue.)
 1.11.12.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.11.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.11.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.11.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.11.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.20.18.1 14-Nov-2003  jmc Pullup rev 1.24 (requested by petrov in ticket #1559)

Lower PIL_AUD so /dev/audio will not interrupt and interfere with scheduler.
Fixes PR#23382
 1.20.12.1 19-Mar-2002  thorpej Implement splraiseipl(), as used by the new mutex code.
 1.20.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.20.8.1 13-Apr-2001  nathanw file psl.h was added on branch nathanw_sa on 2002-10-18 02:40:06 +0000
 1.20.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.22.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.26.10.1 12-Feb-2005  yamt sync with head.
 1.26.8.1 29-Apr-2005  kent sync with -current
 1.28.2.7 17-Mar-2008  yamt sync with head.
 1.28.2.6 27-Feb-2008  yamt sync with head.
 1.28.2.5 21-Jan-2008  yamt sync with head
 1.28.2.4 07-Dec-2007  yamt sync with head
 1.28.2.3 26-Feb-2007  yamt sync with head.
 1.28.2.2 30-Dec-2006  yamt sync with head.
 1.28.2.1 21-Jun-2006  yamt sync with head.
 1.30.6.2 01-Jun-2006  kardel Sync with head.
 1.30.6.1 22-Apr-2006  simonb Sync with head.
 1.30.4.1 09-Sep-2006  rpaulo sync with head
 1.30.2.2 01-Mar-2006  yamt sync with head.
 1.30.2.1 18-Feb-2006  yamt sync with head.
 1.32.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.32.4.1 11-May-2006  elad sync with head
 1.32.2.1 24-May-2006  yamt sync with head.
 1.33.10.1 19-Sep-2006  yamt implement new api for sparc64.
 1.33.8.1 12-Jan-2007  ad Sync with head.
 1.36.30.2 27-Dec-2007  mjf Sync with HEAD.
 1.36.30.1 08-Dec-2007  mjf Sync with HEAD.
 1.36.24.2 23-Mar-2008  matt sync with HEAD
 1.36.24.1 09-Jan-2008  matt sync with HEAD
 1.36.22.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.36.6.1 03-Dec-2007  ad Sync with HEAD.
 1.37.6.1 13-Dec-2007  bouyer Sync with HEAD
 1.37.4.1 11-Dec-2007  yamt sync with head.
 1.37.2.1 26-Dec-2007  ad Sync with head.
 1.38.8.1 03-Apr-2008  mjf Sync with HEAD.
 1.38.4.1 24-Mar-2008  keiichi sync with head.
 1.40.4.2 11-Mar-2010  yamt sync with head
 1.40.4.1 20-Jun-2009  yamt sync with head
 1.46.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.46.4.1 31-May-2011  rmind sync with head
 1.49.12.3 03-Dec-2017  jdolecek update from HEAD
 1.49.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.49.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.49.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by macallan in ticket #695):
sys/arch/sparc64/include/cpu.h: revision 1.99
sys/arch/sparc64/sparc64/cpu.c: revision 1.103
sys/arch/sparc64/include/psl.h: revision 1.50
sys/arch/sparc64/sparc64/clock.c: revision 1.107
sys/arch/sparc64/include/ctlreg.h: revision 1.57
sys/arch/sparc64/sparc64/locore.s: revision 1.342
use system tick timer instead of %tick on UltraSPARC-III-ish CPUs
review & fixes by Takeshi Nakayama
 1.49.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.49.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.52.2.1 28-Aug-2013  rmind sync with head
 1.53.6.2 29-May-2016  skrll Sync with HEAD
 1.53.6.1 06-Apr-2015  skrll Sync with HEAD
 1.53.4.1 13-Dec-2014  martin Pull up following revision(s) (requested by nakayama in ticket #318):
sys/arch/sparc64/include/psl.h: revision 1.54
sys/arch/sparc64/include/psl.h: revision 1.55
sys/arch/sparc64/sparc64/cpu.c: revision 1.121
Make getver() into a constant function since Version Register (%ver)
is read only and its value is constant.
This change reduces multipule %ver reads to one in the functions
which uses a number of CPU_IS_* macros.
Use GETVER_CPU_* macros.
 1.57.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.57.18.1 10-Jun-2019  christos Sync with HEAD
 1.62.4.3 28-May-2025  martin Pull up following revision(s) (requested by bouyer in ticket #1121):

sys/arch/ia64/include/intr.h: revision 1.9
sys/uvm/uvm_pdpolicy_clock.c: revision 1.41
sys/sys/spl.h: revision 1.11
sys/uvm/uvm_pdpolicy_clock.c: revision 1.42
sys/arch/sparc64/include/psl.h: revision 1.66

uvmpdpol_pagerealize(): ucpu->pdqhead is used by a single CPU; but

kpreempt_disable() isn't enough to guard against concurent access;
interrupts also need to be disabled.

If my analysis is correct, the only place using ucpu->pdqhead which
can be called from interrupt context it uvmpdpol_pagerealize(), and only
from softbio().

So:
- introduce splsoftbio() in sys/spl.h
- protect all accesses to ucpu->pdqhead with splsoftbio()
fixes pr kern/59412: uvmpdpol_pagerealize() queue index out of bound

Provide splsoftbio()

Remove the redundant kpreempt_disable/kpreempt_enable now that we're
running at splsoftbio. Pointed out by thorpej@
 1.62.4.2 09-Sep-2023  martin Pull up following revision(s) (requested by jdc in ticket #360):

sys/arch/sparc64/dev/fdc.c: revision 1.52
sys/arch/sparc64/include/intr.h: revision 1.32
sys/arch/sparc64/sparc64/autoconf.c: revision 1.239
sys/arch/sparc64/include/psl.h: revision 1.64

sparc64: fix interrupt level mapping for disk and and parallel devices
on SBUS-based machines

Change the mapping from PIL_SCSI to PIL_BIO, so that they interrupt above
the highest soft interrupt (softserial)

Remove unused PIL_SCSI, PIL_FDSOFT, PIL_AUSOFT and fix the printf in fdc.c

Add "socal" and "SUNW,bpp" to the interrupt map.
 1.62.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.65.2.1 02-Aug-2025  perseant Sync with HEAD
 1.29 07-Jan-2025  andvar s/bitfeilds/bitfields/ in comment.
 1.28 04-Nov-2016  macallan branches: 1.28.52;
add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE
 1.27 03-Apr-2015  palle branches: 1.27.2;
sun4v: There is no L-bit (Locked) in the sun4v tte
 1.26 03-Mar-2014  palle branches: 1.26.6;
sun4v: SUN4V_TLB_TSB_LOCK define should have the same LL (instead of UL) as the other defines
 1.25 21-Feb-2014  palle sun4v: Rename TLB_ defines to SUN4U_TLB_ so entries created using TSB_DATA() are properly setup for sun4u and sun4v. Relocate the cputyp variable from autoconf.c to locore.s and make it const in param.h so optimized code can be generated. Parts from OpenBSD. Optimization suggested by nakayama@. OK martin@, mrg@, nakayama@
 1.24 16-Dec-2013  palle Updates to pmap_bootstrap() for sun4v - parts from OpenBSD - OK martin@
 1.23 08-Dec-2013  palle Add support for running ofwboot on sun4v. Please note that the kernel on sun4v will be loaded properly but when the kernel takes over it will crash immediately since the kernel is not sun4v ready yet
 1.22 15-Jan-2010  nakayama branches: 1.22.12; 1.22.22; 1.22.26;
Fix typo in previous.
 1.21 05-Dec-2009  mrg - update the TLB_SOFT2_MASK and TLB_DIAG_MASK definitions for USIII. partly
from openbsd.
- rename TLB_DIAG_MASK to TLB_RESERVED_MASK. from openbsd.
- fix the TLB_PA_MASK definition to be correct. our old one was 4 bits
too wide.
- fix various errors in the #if 0 bitfield version of struct sun4u_tag_fields.

tested on U60 and SB2500.
 1.20 14-Mar-2008  nakayama branches: 1.20.4;
Complete per-CPU TSBs and MMU contexts changes.
 1.19 22-Feb-2008  martin Get rid of the IPI simple_lock.
 1.18 08-Sep-2006  mrg branches: 1.18.30; 1.18.50; 1.18.54;
make this idempotent.
 1.17 20-Feb-2006  cdi branches: 1.17.2; 1.17.14;
Use ANSI-style function definitions and declarations.
 1.16 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.15 11-Dec-2005  christos branches: 1.15.2; 1.15.4; 1.15.6;
merge ktrace-lwp.
 1.14 22-Feb-2005  martin branches: 1.14.4;
Cleanup: the PG_SZ macro was buggy (pointed out by Tim Newsham).
It was only used by (the also buggy/not ready for prime time) PMAP_PAGE_SIZE,
which in turn only was used in one place.

Get rid of all this and hardcode the result at the single place of use.
 1.13 14-Mar-2004  chs branches: 1.13.8; 1.13.10;
checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.12 06-Jan-2003  wiz branches: 1.12.2;
writable, not writeable.
 1.11 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.10 20-Mar-2002  eeh Add PTE_WIRED bit to keep track of wired pages.
 1.9 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.8 30-Aug-2001  mrg branches: 1.8.6;
add some sun4/sun4c/sun4m compat code so we can build 32 bit kvm. (these files are not even vaguely syncable.)
 1.7 31-Jul-2001  eeh Dump some enums that make lint unhappy and we never really use anyway.
 1.6 21-Jun-2001  eeh branches: 1.6.2;
Allow multiple 4MB pages for both kernel text and kernel data.

Note: DEBUG checks will not allow accesses to the hole between
text and data segments, so you may need to update programs that
use libkvm before relocating the start of kernel data.
 1.5 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.4 30-May-1999  eeh Make pmap_enter() handle little-endian mappings properly.
 1.3 05-Sep-1998  eeh branches: 1.3.8;
It slices. It dices. It does everything except exec a sparc32_compat init.
 1.2 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.3.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.6.2.1 03-Aug-2001  lukem update to -current
 1.8.6.5 07-Jan-2003  thorpej Sync with HEAD.
 1.8.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.8.6.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.6.1 30-Aug-2001  nathanw file pte.h was added on branch nathanw_sa on 2002-01-08 00:28:00 +0000
 1.12.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 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.13.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.14.4.4 17-Mar-2008  yamt sync with head.
 1.14.4.3 27-Feb-2008  yamt sync with head.
 1.14.4.2 30-Dec-2006  yamt sync with head.
 1.14.4.1 21-Jun-2006  yamt sync with head.
 1.15.6.1 22-Apr-2006  simonb Sync with head.
 1.15.4.1 09-Sep-2006  rpaulo sync with head
 1.15.2.2 01-Mar-2006  yamt sync with head.
 1.15.2.1 18-Feb-2006  yamt sync with head.
 1.17.14.1 18-Nov-2006  ad Sync with head.
 1.17.2.1 14-Sep-2006  yamt sync with head.
 1.18.54.1 03-Apr-2008  mjf Sync with HEAD.
 1.18.50.1 24-Mar-2008  keiichi sync with head.
 1.18.30.1 23-Mar-2008  matt sync with HEAD
 1.20.4.1 11-Mar-2010  yamt sync with head
 1.22.26.1 18-May-2014  rmind sync with head
 1.22.22.2 03-Dec-2017  jdolecek update from HEAD
 1.22.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.12.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.26.6.2 05-Dec-2016  skrll Sync with HEAD
 1.26.6.1 06-Apr-2015  skrll Sync with HEAD
 1.27.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.28.52.1 02-Aug-2025  perseant Sync with HEAD
 1.5 19-Oct-2016  skrll PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.4 28-Sep-2016  skrll Whitespace
 1.3 14-Mar-2006  cube branches: 1.3.112; 1.3.132; 1.3.136;
Add the sparc64 MD bits to get usable coredumps for COMPAT_NETBSD32
binaries.
 1.2 20-Jul-2002  mrg branches: 1.2.22; 1.2.36; 1.2.38; 1.2.40; 1.2.42;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.42.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.2.40.1 01-Apr-2006  yamt sync with head.
 1.2.38.1 22-Apr-2006  simonb Sync with head.
 1.2.36.1 09-Sep-2006  rpaulo sync with head
 1.2.22.1 21-Jun-2006  yamt sync with head.
 1.3.136.1 04-Nov-2016  pgoyette Sync with HEAD
 1.3.132.2 05-Dec-2016  skrll Sync with HEAD
 1.3.132.1 05-Oct-2016  skrll Sync with HEAD
 1.3.112.1 03-Dec-2017  jdolecek update from HEAD
 1.3 26-Jun-2008  nakayama Ansify and follow the recent cardbus changes:
- split device/softc
- avoid the use of i82365var.h
 1.2 31-May-2008  nakayama branches: 1.2.2;
Change my license to 2 clause.
 1.1 22-Mar-2003  nakayama branches: 1.1.104; 1.1.106; 1.1.108; 1.1.110;
PCI-CardBus bridge support for sparc64:
- add MD part of cardbus support.
 1.1.110.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.110.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.1.108.1 04-May-2009  yamt sync with head.
 1.1.106.1 04-Jun-2008  yamt sync with head
 1.1.104.2 29-Jun-2008  mjf Sync with HEAD.
 1.1.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.1 27-Jun-2008  simonb Sync with head.
 1.15 30-Dec-2016  christos - make fpreg{32,64} actually members of fsstate{32,64}.
- allocate fpstate if we did not have one and we need to write it.
 1.14 12-Jul-2011  mrg branches: 1.14.12; 1.14.30; 1.14.34;
rename sparc64 BLOCK_SIZE and BLOCK_ALIGN to have SPARC64_ prefixes.
for the assembler files, define the old names to the new names
since using the new names cause ugliness due to longer identifer
names, and reduces churn.

fixes build issues in dtv and vaguely makes <machine/psl.h> slightly
less name-space invasive.
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 27-Mar-2004  eeh License cleanup.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.10 16-May-2002  eeh branches: 1.10.8;
Don't use smaller trapframes. Causes more problems that it's worth right now. CVS: ----------------------------------------------------------------------
 1.9 14-May-2002  eeh branches: 1.9.2;
Trapframes only have locals or ins if the kernel is compiled DEBUG.
 1.8 19-Jun-2001  wiz branches: 1.8.2; 1.8.8;
`accessible' only has one `a'.
 1.7 08-Jul-2000  eeh branches: 1.7.2;
gdb requires a `struct fpstate' so provide one.
 1.6 10-Jan-2000  eeh branches: 1.6.4;
Add debugger single-stepping and fix interrupt dispatch bugs.
 1.5 30-Dec-1999  eeh Add the %gsr to our fpstate structure.
 1.4 06-Nov-1999  eeh Provide explicit 64-bit and 32-bit types for compatibility with sparc
userland.
 1.3 11-Oct-1999  eeh branches: 1.3.2; 1.3.4;
Update to post 1.4.
 1.2 12-May-1999  eeh branches: 1.2.2;
Add some more 32-bit emulation support.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.10;
Import of sparc64.
 1.1.1.1.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.4.1 15-Nov-1999  fvdl Sync with -current
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.8.1 19-Jun-2001  nathanw file reg.h was added on branch nathanw_sa on 2002-06-20 03:41:25 +0000
 1.8.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.1 30-May-2002  gehenna Catch up with -current.
 1.10.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.8.1 03-Aug-2004  skrll Sync with HEAD
 1.14.34.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.14.30.1 05-Feb-2017  skrll Sync with HEAD
 1.14.12.1 03-Dec-2017  jdolecek update from HEAD
 1.4 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.3 25-Aug-2001  mrg branches: 1.3.6; 1.3.14;
update a comment about R_UA_32 relocs.
 1.2 14-Jul-2000  eeh branches: 1.2.4;
Add support for 64-bit PIC and dynamic linking.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14; 1.1.1.1.24;
Import of sparc64.
 1.1.1.1.24.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.1.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.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.3.14.1 31-Aug-2002  gehenna catch up with -current.
 1.3.6.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.6.1 25-Aug-2001  nathanw file reloc.h was added on branch nathanw_sa on 2002-08-01 02:43:45 +0000
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch 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 07-Oct-2002  martin branches: 1.1.2; 1.1.4;
All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.1.4.2 07-Dec-2002  he Pull up revision 1.1 (new, requested by martin in ticket #907):
All sparc64 CPUs do __HAVE_CPU_COUNTER (aka %tick).
 1.1.4.1 07-Oct-2002  he file rnd.h was added on branch netbsd-1-6 on 2002-12-07 21:52:25 +0000
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 07-Oct-2002  nathanw file rnd.h was added on branch nathanw_sa on 2002-10-18 02:40:06 +0000
 1.6 29-Nov-2019  riastradh Largely eliminate the MD rwlock.h header file.

This was full of definitions that have been obsolete for over a
decade. The file still remains for __HAVE_RW_STUBS but that's all.
Used only internally in kern_rwlock.c now, not by <sys/rwlock.h>.
 1.5 28-Apr-2008  martin branches: 1.5.88;
Remove clause 3 and 4 from TNF licenses
 1.4 05-Jan-2008  martin branches: 1.4.6; 1.4.8; 1.4.10;
Include lock.h, as we are using memory barrier macros defined there.
 1.3 21-Nov-2007  yamt branches: 1.3.6;
make kmutex_t and krwlock_t smaller by killing lock id.
ok'ed by Andrew Doran.
 1.2 09-Feb-2007  ad branches: 1.2.4; 1.2.8; 1.2.24; 1.2.26; 1.2.30; 1.2.32;
Merge newlock2 to head.
 1.1 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.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.32.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.30.1 21-Nov-2007  bouyer Sync with HEAD
 1.2.26.1 09-Jan-2008  matt sync with HEAD
 1.2.24.1 21-Nov-2007  joerg Sync with HEAD.
 1.2.8.1 03-Dec-2007  ad Sync with HEAD.
 1.2.4.4 21-Jan-2008  yamt sync with head
 1.2.4.3 07-Dec-2007  yamt sync with head
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file rwlock.h was added on branch yamt-lazymbuf on 2007-02-26 09:08:25 +0000
 1.3.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.4.10.1 16-May-2008  yamt sync with head.
 1.4.8.1 18-May-2008  yamt sync with head.
 1.4.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 19-Mar-2002  thorpej branches: 1.1.2;
file rwlock_impl.h was initially added on branch newlock.
 1.1.2.2 22-Mar-2002  thorpej Add debug info structures if MUTEX_DEBUG or RWLOCK_DEBUG is
defined.

XXX Revisit, so that the structure doesn't change when debugging
is turned on; do it out-of-band?
 1.1.2.1 19-Mar-2002  thorpej First draft of mutex and rwlock implementation for sparc64.
 1.3 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.2 22-Sep-1998  eeh branches: 1.2.26; 1.2.30; 1.2.38;
More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.38.1 31-Aug-2002  gehenna catch up with -current.
 1.2.30.1 01-Aug-2002  nathanw Catch up to -current.
 1.2.26.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11 09-Jan-2003  thorpej Merge sparc and sparc64 <machine/signal.h>.
 1.10 09-May-2001  kleink branches: 1.10.8;
Sync sc_psr comments with reality.
 1.9 09-May-2001  kleink In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.
 1.8 26-Mar-1999  eeh branches: 1.8.20;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.7 31-Jan-1999  mrg retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.6 08-Oct-1998  eeh Fix more syscall32 and signal breakage.
 1.5 22-Sep-1998  eeh More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.
 1.4 17-Sep-1998  thorpej For _LP64, sigcontext must contain longs!
 1.3 17-Sep-1998  thorpej Minor cosmetic change.
 1.2 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.8.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.8.2 09-Jan-2003  thorpej Sync with HEAD.
 1.10.8.1 09-May-2001  thorpej file signal.h was added on branch nathanw_sa on 2003-01-09 23:33:14 +0000
 1.1 23-Jul-2014  alnsn branches: 1.1.2; 1.1.6;
Rename sljitarch.h to sljit_machdep.h.
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 23-Jul-2014  tls file sljit_machdep.h was added on branch tls-maxphys on 2014-08-20 00:03:25 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 23-Jul-2014  tls file sljit_machdep.h was added on branch tls-earlyentropy on 2014-08-10 06:54:08 +0000
 1.2 23-Jul-2014  alnsn Rename sljitarch.h to sljit_machdep.h.
 1.1 01-Feb-2014  nakayama branches: 1.1.2; 1.1.4; 1.1.6;
Make sljit usable on sparc64 32-bit kernels.
 1.1.6.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 01-Feb-2014  yamt file sljitarch.h was added on branch yamt-pagecache on 2014-05-22 11:40:09 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 01-Feb-2014  rmind file sljitarch.h was added on branch rmind-smpnet on 2014-05-18 17:45:26 +0000
 1.1.2.1 10-Aug-2014  tls Rebase.
 1.15 10-Jan-2022  palle sun4v: add function to retrieve hypervisor api version
 1.14 03-Jul-2021  palle sun4v: add support for hypervisor soft state - from OpenBSD
 1.13 06-Sep-2014  palle branches: 1.13.36;
sun4v: New function prom_startcpu_by_cpuid() necessary for starting cpus on sun4v
 1.12 07-Jan-2014  palle sun4v: trap table setup - currently populated with dummy entries which will be properly implemented later - parts from OpenBSD - OK martin@
 1.11 20-Feb-2010  martin branches: 1.11.10; 1.11.20; 1.11.24;
Select the shutdown method for secondary CPUs by available firmware
methods, not properties of the CPU.
Inspired by OpenSolaris, pointed out by eeh.
 1.10 18-May-2009  nakayama branches: 1.10.2;
Using OpenFirmware calls properly about 64-bit physical address handling.
Old code trancate a physical address to 32-bit width. Idea from OpenBSD.
 1.9 11-Feb-2006  cdi branches: 1.9.72;
ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.8 11-Dec-2005  christos branches: 1.8.2; 1.8.4; 1.8.6;
merge ktrace-lwp.
 1.7 21-Mar-2004  pk branches: 1.7.16;
Switch to the sparc prom library.
 1.6 14-Mar-2004  chs checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.
 1.5 06-Jan-2004  petrov Spinup secondary cpus. Based on codes sent to me by Dennis Chernoivanov
and Chuck Silvers.
 1.4 08-Dec-2003  petrov Remove prototypes of non-existant functions, ansify and knf.
 1.3 20-Oct-2000  mrg branches: 1.3.24;
fix a comment.
 1.2 13-Aug-1998  eeh branches: 1.2.12;
Merge paddr_t changes into the main branch.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.2;
Import of sparc64.
 1.1.1.1.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.2.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.3.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.24.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.8.2.1 18-Feb-2006  yamt sync with head.
 1.9.72.2 11-Mar-2010  yamt sync with head
 1.9.72.1 20-Jun-2009  yamt sync with head
 1.10.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.24.1 18-May-2014  rmind sync with head
 1.11.20.2 03-Dec-2017  jdolecek update from HEAD
 1.11.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.10.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.13.36.1 01-Aug-2021  thorpej Sync with HEAD.
 1.14 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.13 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.12 18-Aug-2001  eeh branches: 1.12.6; 1.12.14;
Make lint happier.
 1.11 23-Jul-2000  mycroft branches: 1.11.4;
Fix multiple problems with floating point and structure handling.
 1.10 29-Jun-2000  eeh This seems to fix the problem in __semctl13.c without breaking anyghing else.
 1.9 03-Feb-2000  kleink branches: 1.9.4;
Add a C99-style va_copy macro.
 1.8 04-May-1999  christos branches: 1.8.2;
clean up old GCC.1 stuff; move common definitions to the top.
 1.7 03-May-1999  christos Define __extension__ if __GNUC__ < 2
Define __builtin_*() for lint
 1.6 31-Jan-1999  mrg branches: 1.6.4;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.5 09-Jan-1999  eeh Don't use `long' instead of `int64_t' since the latter may not be in scope.
 1.4 13-Sep-1998  eeh Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)
 1.3 11-Sep-1998  eeh A (slightly modified) version of tv's fix for va_args for kern_printf.
 1.2 27-Jul-1998  mycroft Delint.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.6.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.4.2 26-Jul-2000  mycroft Approved by thorpej:
Fix multiple problems with floating point and structure handling.

syssrc/sys/arch/sparc64/include/stdarg.h 1.10 -> 1.11
 1.9.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.11.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.12.14.1 31-Aug-2002  gehenna catch up with -current.
 1.12.6.2 01-Aug-2002  nathanw Catch up to -current.
 1.12.6.1 18-Aug-2001  nathanw file stdarg.h was added on branch nathanw_sa on 2002-08-01 02:43:45 +0000
 1.2 20-Jun-1998  mrg moved <machine/sun_disklabel.h> to <dev/sun/disklabel.h>
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2 11-Dec-2005  christos branches: 1.2.18;
merge ktrace-lwp.
 1.1 11-Jul-2005  christos branches: 1.1.6;
new file
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file sunos_machdep.h was added on branch ktrace-lwp on 2005-11-10 13:59:18 +0000
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file sunos_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:47 +0000
 1.10 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.9 28-Apr-2008  martin branches: 1.9.86; 1.9.88;
Remove clause 3 and 4 from TNF licenses
 1.8 20-Feb-2006  cdi branches: 1.8.68; 1.8.70; 1.8.72;
Use ANSI-style function definitions and declarations.
 1.7 11-Feb-2006  cdi ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.
 1.6 11-Dec-2005  christos branches: 1.6.2; 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.4 18-Jan-2003  thorpej branches: 1.4.2; 1.4.18;
Merge the nathanw_sa branch.
 1.3 11-May-2001  kleink branches: 1.3.8;
* Fix remaining 32-bit vs. native pointer problems in data structures;
reviewed by Eduardo.
* Define the size of uc_pad, so ucontext32_t will have the correct size.
 1.2 11-May-2001  kleink svr4_32_mcontext.gwin is a pointer 32 bits wide.
 1.1 11-Feb-2001  eeh branches: 1.1.2; 1.1.4;
Add support for COMPAT_SVR4_32.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 11-Feb-2001  bouyer file svr4_32_machdep.h was added on branch thorpej_scsipi on 2001-02-11 19:12:32 +0000
 1.3.8.2 04-Jan-2002  eeh Cleanup.
 1.3.8.1 11-May-2001  eeh file svr4_32_machdep.h was added on branch nathanw_sa on 2002-01-04 19:12:25 +0000
 1.4.18.1 21-Jun-2006  yamt sync with head.
 1.4.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.2 01-Mar-2006  yamt sync with head.
 1.6.2.1 18-Feb-2006  yamt sync with head.
 1.8.72.1 16-May-2008  yamt sync with head.
 1.8.70.1 18-May-2008  yamt sync with head.
 1.8.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.88.1 10-Jun-2019  christos Sync with HEAD
 1.9.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.13 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.12 28-Apr-2008  martin branches: 1.12.86; 1.12.88;
Remove clause 3 and 4 from TNF licenses
 1.11 20-Feb-2006  cdi branches: 1.11.68; 1.11.70; 1.11.72;
Use ANSI-style function definitions and declarations.
 1.10 11-Dec-2005  christos branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.
 1.9 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.8 18-Jan-2003  thorpej branches: 1.8.2; 1.8.18;
Merge the nathanw_sa branch.
 1.7 22-Feb-2001  eeh branches: 1.7.8;
Somehow this didn't get checked in with the rest of the SVR4 64-bit fixes.
 1.6 11-Feb-2001  eeh A register is 64-bits unless we're emulating 32-bit.
 1.5 04-Dec-2000  mrg remove duplicate function prototypes.
 1.4 21-Jan-1999  christos branches: 1.4.8;
move prototypes to mi locations and add the xrs gunk.
 1.3 13-Sep-1998  mycroft Update these for signal handling changes.
XXX Not tested yet.
 1.2 05-Sep-1998  christos Assign copyright to TNF.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.4.8.3 12-Mar-2001  bouyer Sync with HEAD.
 1.4.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.8.1 08-Dec-2000  bouyer Sync with HEAD.
 1.7.8.1 04-Jan-2002  eeh Cleanup.
 1.8.18.1 21-Jun-2006  yamt sync with head.
 1.8.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 01-Mar-2006  yamt sync with head.
 1.11.72.1 16-May-2008  yamt sync with head.
 1.11.70.1 18-May-2008  yamt sync with head.
 1.11.68.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.88.1 10-Jun-2019  christos Sync with HEAD
 1.12.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.12 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.11 01-Apr-2015  palle branches: 1.11.16; 1.11.18;
sun4v: Implement handling of cpu_mondo trap - from OpenBSD - tested using the Legion simulator
 1.10 08-Jun-2014  palle branches: 1.10.4;
sun4v: make tlb_flush_pte() work on sun4v - parts from OpenBSD - ok martin@
 1.9 27-Mar-2011  martin branches: 1.9.14; 1.9.28;
On second thought do not use bit 13 as a flag for syscall numbers, userland
typically sets those from a 13bit signed integer immediate field in the
instruction, so would need to jump through hoops (ok, small hoops) to
avoid sign extension.
Use a combination of the existing syscall flags instead.
 1.8 23-Mar-2011  martin Add a syscall variant passing the return address in %g5 (we need %g7 for
pthread_self and %g2 is an application register, so we can not use those
anymore).
 1.7 13-Dec-2010  mrg branches: 1.7.2;
add definitions for T_DATA_MMU_MISS, T_FAST_ECC_ERROR, T_DC_PAR_ERR
and T_IC_PAR_ERR, all are >= USIII only.
 1.6 19-Sep-2006  mrg branches: 1.6.78;
normalise case in some macro values to be all the same (lower case)
 1.5 21-Jan-2003  martin branches: 1.5.18; 1.5.48; 1.5.50;
Rename the DIV0 traps to avoid confusion with the usage on the sparc
port: T_IDIV0 is the hardware trap generated on integer division by
zero, T_DIV0 is the software trap used to signal the same event.

This makes 32 bit kernels able to run sparc code with the v7 multiply/
divide library.

Spotted by Valeriy E. Ushakov.
 1.4 07-Jun-1999  eeh Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
 1.3 05-Jun-1999  eeh Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.
 1.2 07-Sep-1998  eeh branches: 1.2.8;
Add new 64-bit specific traps and 64-bit Solaris syscall.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.50.1 22-Oct-2006  yamt sync with head
 1.5.48.1 18-Nov-2006  ad Sync with head.
 1.5.18.1 30-Dec-2006  yamt sync with head.
 1.6.78.2 21-Apr-2011  rmind sync with head
 1.6.78.1 05-Mar-2011  rmind sync with head
 1.7.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.28.1 10-Aug-2014  tls Rebase.
 1.9.14.2 03-Dec-2017  jdolecek update from HEAD
 1.9.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.4.1 06-Apr-2015  skrll Sync with HEAD
 1.11.18.1 10-Jun-2019  christos Sync with HEAD
 1.11.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.29 08-Aug-2021  thorpej Define preprocessor symbols (__HAVE_OPENFIRMWARE_VARIANT_AAPL and
__HAVE_OPENFIRMWARE_VARIANT_SUNW) that lets generic OpenFirmware
code deal with differences / quirks among implementation variants.
 1.28 06-Apr-2019  thorpej branches: 1.28.16;
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.27 26-Jan-2017  christos branches: 1.27.14;
provide __HAVE_COMPAT_NETBSD32 and fix multiple include protection consistently.
 1.26 14-Nov-2013  martin branches: 1.26.6; 1.26.10; 1.26.14;
Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.
 1.25 11-Dec-2005  christos branches: 1.25.6; 1.25.112; 1.25.122; 1.25.128;
merge ktrace-lwp.
 1.24 10-Jul-2005  christos Now that sparc has syscall intern, no need to define it here too.
 1.23 10-Jul-2005  christos Re-factor syscall, and make it use syscall_{plain,fancy}.
 1.22 20-Jul-2002  mrg branches: 1.22.6;
use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.21 03-May-2002  thorpej branches: 1.21.2;
Revert revision 1.20.
 1.20 03-May-2002  eeh Provide _LP64 definition if we are generating LP64 binaries.
 1.19 28-Feb-2002  simonb Use "#define<tab>".
 1.18 04-Dec-2001  darrenr defopt "options SUN4*", put #define for each of SUN4, SUN4C, SUN4M and SUN4U
into opt_arch_sparc.h and include this wherever they are used.
 1.17 12-May-2001  kleink branches: 1.17.2; 1.17.8;
Delint my previous change.
 1.16 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.15 14-Jan-2001  thorpej branches: 1.15.2;
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.14 03-Jan-2001  takemura replace 'long long' with int64_t to compile stand alone program with
compiler other than GCC.
 1.13 04-Dec-2000  mrg Remove __BROKEN_CONFIG_UNIT_USAGE. (sync with sparc)
 1.12 05-Feb-2000  cgd add __BROKEN_CONFIG_UNIT_USAGE #define, becuase these ports do very
wrong things with device configuration data "cf_unit" information.
 1.11 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.10 27-Nov-1999  eeh Apparently sys/sysctl.h includes vm/vm_map.h which makes use of vaddr_t,
 1.9 27-Nov-1999  mrg merge sparc64 types.h; these files are now identical.
 1.8 31-Jan-1999  mrg branches: 1.8.8; 1.8.14;
retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.
 1.7 07-Sep-1998  eeh Make register32_t unsigned so we don't have sign extension problems.
 1.6 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.5 22-Aug-1998  eeh Fix typo in previous fix.
 1.4 22-Aug-1998  eeh 64-bit-ify this. Depend on _lp64.
 1.3 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.2 20-Jun-1998  kleink branches: 1.2.2;
Merge in recent changes:
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.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.2.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.2.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.8.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.8.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.8.8.3 05-Jan-2001  bouyer Sync with HEAD
 1.8.8.2 08-Dec-2000  bouyer Sync with HEAD.
 1.8.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.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.8.5 01-Aug-2002  nathanw Catch up to -current.
 1.17.8.4 20-Jun-2002  nathanw Catch up to -current.
 1.17.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.17.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.17.8.1 12-May-2001  nathanw file types.h was added on branch nathanw_sa on 2002-01-08 00:28:00 +0000
 1.17.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.2.1 31-Aug-2002  gehenna catch up with -current.
 1.22.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.25.128.1 18-May-2014  rmind sync with head
 1.25.122.2 03-Dec-2017  jdolecek update from HEAD
 1.25.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.112.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25.6.2 02-Jun-2006  kardel - support timecounters
 1.25.6.1 27-May-2006  kardel sparc64 has yet to be converted so #undef __HAVE_TIMECOUNTER
 1.26.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.26.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.26.6.1 05-Feb-2017  skrll Sync with HEAD
 1.27.14.1 10-Jun-2019  christos Sync with HEAD
 1.28.16.1 14-May-2021  thorpej Define __HAVE_OPENFIRMWARE_VARIANT_SUNW for sparc64 systems and handle
its OpenFirmware quirks with respect to i2c:

- "reg" property is 2 cells, the first one containing the channel the
device is on, the second one containing the i2c device address.
- The i2c device address is shifted left 1 bit to account for the r/w
bit on the wire.
 1.9 17-Oct-2009  nakayama Merge want_ast check in userret() into trap handler, and repeat
preempt() call while want_resched is true. While there remove
unnecessary #if 1.

This should fix a performance degradation of disk I/O on heavy load.
 1.8 30-Jun-2008  nakayama branches: 1.8.6; 1.8.12; 1.8.14;
Avoid use of "<< TSTATE_PSTATE_SHIFT".
 1.7 05-Nov-2007  ad branches: 1.7.16; 1.7.20; 1.7.22; 1.7.24;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.6 09-Feb-2007  ad branches: 1.6.6; 1.6.22; 1.6.24; 1.6.28;
Merge newlock2 to head.
 1.5 20-Feb-2006  cdi branches: 1.5.12; 1.5.16;
Use ANSI-style function definitions and declarations.
 1.4 16-Feb-2006  perry Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.3 24-Dec-2005  perry branches: 1.3.2; 1.3.4; 1.3.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 10-Jul-2005  christos branches: 1.1.6;
Forgot to add this.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 10-Jul-2005  skrll file userret.h was added on branch ktrace-lwp on 2005-11-10 13:59:18 +0000
 1.3.6.1 22-Apr-2006  simonb Sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.3.2.2 01-Mar-2006  yamt sync with head.
 1.3.2.1 18-Feb-2006  yamt sync with head.
 1.5.16.1 11-Jan-2007  ad Checkpoint work in progress.
 1.5.12.4 15-Nov-2007  yamt sync with head.
 1.5.12.3 26-Feb-2007  yamt sync with head.
 1.5.12.2 21-Jun-2006  yamt sync with head.
 1.5.12.1 20-Feb-2006  yamt file userret.h was added on branch yamt-lazymbuf on 2006-06-21 14:56:47 +0000
 1.6.28.1 13-Nov-2007  bouyer Sync with HEAD
 1.6.24.1 06-Nov-2007  matt sync with HEAD
 1.6.22.1 06-Nov-2007  joerg Sync with HEAD.
 1.6.6.1 03-Dec-2007  ad Sync with HEAD.
 1.7.24.1 03-Jul-2008  simonb Sync with head.
 1.7.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.20.2 11-Mar-2010  yamt sync with head
 1.7.20.1 04-May-2009  yamt sync with head.
 1.7.16.1 02-Jul-2008  mjf Sync with HEAD.
 1.8.14.1 21-Apr-2010  matt sync to netbsd-5
 1.8.12.1 19-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1103):
sys/arch/sparc64/include/userret.h: revision 1.9
sys/arch/sparc64/sparc64/trap.c: revision 1.158

Merge want_ast check in userret() into trap handler, and repeat preempt()
call while want_resched is true. While there remove unnecessary #if 1. This
should fix a performance degradation of disk I/O on heavy load.
 1.8.6.1 19-Oct-2009  sborrill Pull up the following revisions(s) (requested by nakayama in ticket #1103):
sys/arch/sparc64/include/userret.h: revision 1.9
sys/arch/sparc64/sparc64/trap.c: revision 1.158

Merge want_ast check in userret() into trap handler, and repeat preempt()
call while want_resched is true. While there remove unnecessary #if 1. This
should fix a performance degradation of disk I/O on heavy load.
 1.3 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.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.43 07-Feb-2023  hgutch Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.42 26-Feb-2021  simonb branches: 1.42.18;
Say what 1UL<<39 (MAXDSIZ value) is in the comment.
 1.41 06-Oct-2020  christos branches: 1.41.2;
GC unused MAXTSIZ32
 1.40 22-Jan-2020  ad Bump UBC defaults on sparc64 & aarch64, which already have a large pager_map.
 1.39 03-Sep-2018  riastradh branches: 1.39.4; 1.39.6;
Rename min/max -> uimin/uimax for better honesty.

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

HOWEVER! Some subsystems have

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

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

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

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

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

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

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.38 14-Nov-2017  martin branches: 1.38.2; 1.38.4;
Bump PAGER_MAP_DEFAULT_SIZE to 512 MB (like amd64 recently did).
 1.37 26-Mar-2016  martin branches: 1.37.10;
Fix comment
 1.36 22-Nov-2015  martin Reduce the "MAXDSIZ" limit for bottom-up-VA (i.e. old binaries) processes
to the old limit of 1 GB. Some old binaries can not deal with more.
 1.35 15-Nov-2015  martin PR 32999: adjust VM parameters for 64 bit kernel/userlands.
Limit old binaries (i.e. processes not using topdown VA layout) to 2 GB
data size.
Use the same limits as native sparc for netbsd32 emulation - we need to
revisit this, but currently automatic test runs in this environment
fail big time, so there is no easy way to verify any changes.
 1.34 14-Apr-2014  martin branches: 1.34.4;
Implement and enable TOPDOWN_VM. From Chuck Silvers.
 1.33 03-Jan-2013  martin branches: 1.33.2; 1.33.10;
Rearange VA layout for 64 bit kernels, as suggested by Lars Heidieker:
move the dynamic kernel memory past 4GB (basically unlimiting it) and
use the now freed address range past kernel data upto 2GB for modules.
 1.32 14-Nov-2010  uebayasi branches: 1.32.8; 1.32.18;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.31 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.30 06-Mar-2009  joerg branches: 1.30.2; 1.30.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.29 27-Jan-2006  cdi branches: 1.29.76; 1.29.84; 1.29.90;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.28 11-Dec-2005  christos branches: 1.28.2;
merge ktrace-lwp.
 1.27 26-Mar-2005  fvdl branches: 1.27.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.26 21-Oct-2003  kleink branches: 1.26.8; 1.26.10; 1.26.14;
Don't use NULL in integer-type assignments/comparisons.
 1.25 10-Aug-2003  chs remove some leftover cruft.
 1.24 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.23 01-Apr-2003  thorpej branches: 1.23.2;
We use 8K VM pages on Sun4U, so make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK
into compile-time constants.
 1.22 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.21 22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.20 03-Sep-2002  thorpej Increase the default stack limit to 2M (from 512K on sparc and 1M
on sparc64).
 1.19 15-Nov-2001  soren branches: 1.19.2; 1.19.12;
MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.18 01-May-2001  thorpej branches: 1.18.2;
Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.17 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.16 16-Feb-2001  eeh branches: 1.16.2;
Define VM_MASUSER_ADDRESS32.
 1.15 11-Feb-2001  eeh Increase limits slightly. We're still not using all 32 address bits yet,
let alone 64.....
 1.14 18-Dec-2000  mrg - rename 32bit USRSTACK32, and define USRSTACK to that if !__arch64__, so that
64bit code can see USRSTACK32
- bump the limits
 1.13 28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.12 31-Aug-2000  eeh Add support for multiple memory segments.
 1.11 13-Jul-2000  mrg remove old (bogus) comment.
 1.10 11-Feb-2000  thorpej branches: 1.10.4;
Update for the NKMEMPAGES changes.
 1.9 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.8 04-Dec-1999  ragge CL* discarding.
 1.7 20-Nov-1999  eeh Limit buffers to 1/4 of the kernel address space.
 1.6 26-Apr-1999  thorpej branches: 1.6.2; 1.6.8;
Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.
 1.5 16-Jan-1999  chuck branches: 1.5.4;
MNN is no longer optional, remove dead code
 1.4 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3 08-Jul-1998  thorpej branches: 1.3.2;
Define one page free list, and put all pages on it.
 1.2 20-Jun-1998  mrg merge comment fix.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh Import of sparc64.
 1.3.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.5.4.2 06-Aug-1999  chs take an initial guess at UBC parameters.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.6.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.6.2.2 05-Jan-2001  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.10.4.2 18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.10.4.1 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.18.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.18.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.18.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.12.1 30-Nov-2002  he Pull up revision 1.20 (requested by thorpej in ticket #763):
Increase the default stack limit to 2M (from 512K on sparc
and 1M on sparc64).
 1.19.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.19.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.19.2.6 17-Sep-2002  nathanw Catch up to -current.
 1.19.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.19.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.19.2.3 04-Jan-2002  eeh Cleanup.
 1.19.2.2 03-Jan-2002  petrov make kernel compile
 1.19.2.1 15-Nov-2001  petrov file vmparam.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.23.2.4 01-Apr-2005  skrll Sync with HEAD.
 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.26.14.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.26.10.1 26-Mar-2005  yamt sync with head.
 1.26.8.1 29-Apr-2005  kent sync with -current
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.28.2.1 01-Feb-2006  yamt sync with head.
 1.29.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.29.76.1 04-May-2009  yamt sync with head.
 1.30.4.1 05-Mar-2011  rmind sync with head
 1.30.2.3 16-Nov-2010  uebayasi Sync with HEAD.
 1.30.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.30.2.1 23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.32.18.3 03-Dec-2017  jdolecek update from HEAD
 1.32.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.18.1 25-Feb-2013  tls resync with head
 1.32.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.32.8.1 23-Jan-2013  yamt sync with head
 1.33.10.1 10-Aug-2014  tls Rebase.
 1.33.2.1 18-May-2014  rmind sync with head
 1.34.4.2 22-Apr-2016  skrll Sync with HEAD
 1.34.4.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.37.10.1 11-Apr-2018  martin Pull up following revision(s) (requested by mrg in ticket #733):

sys/arch/amd64/include/vmparam.h: revision 1.44
sys/arch/amd64/include/vmparam.h: revision 1.45
sys/arch/sparc64/include/vmparam.h: revision 1.38

bump PAGER_MAP_DEFAULT_SIZE to 512MB. this should allow more
concurrent IOs to be possible, and i'm unable to see pager_map
contention any more.

other larger platforms should probably do this too.
ok chs@.

Remove superfluous word in comment. Noted by Geoff Wing.

Bump PAGER_MAP_DEFAULT_SIZE to 512 MB (like amd64 recently did).
 1.38.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.4.1 10-Jun-2019  christos Sync with HEAD
 1.38.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.39.6.1 25-Jan-2020  ad Sync with head.
 1.39.4.1 08-Feb-2023  martin Pull up following revision(s) (requested by hgutch in ticket #1588):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.41.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.42.18.1 08-Feb-2023  martin Pull up following revision(s) (requested by hgutch in ticket #71):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.3 27-Aug-2002  uwe Make sun ports use common keyboard/firm events related includes
from dev/sun.
 1.2 20-Jul-2002  mrg use <sparc/foo.h> where appropriate. now these files become very
very difficult to get out of sync. add bootinfo.h and promlib.h
(using the same method) so that sparc64 headers can build sparc
stand (not yet finished.)
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.28; 1.1.1.1.32; 1.1.1.1.40;
Import of sparc64.
 1.1.1.1.40.1 31-Aug-2002  gehenna catch up with -current.
 1.1.1.1.32.2 27-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.32.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.1.1.28.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2 11-Dec-2005  christos 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:41:34 +0000
 1.13 01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.12 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.11 07-Nov-2007  ad branches: 1.11.14;
Merge tty changes from the vmlocking branch.
 1.10 13-Feb-2006  cdi branches: 1.10.24; 1.10.42; 1.10.44; 1.10.48; 1.10.50;
ANSIfy: u_intN_t -> uintN_t, remove __P(), fix function definitions.
 1.9 11-Dec-2005  christos branches: 1.9.2; 1.9.4; 1.9.6;
merge ktrace-lwp.
 1.8 07-Aug-2003  agc branches: 1.8.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 03-May-2003  wiz branches: 1.7.2;
DMA, not dma nor Dma.
 1.6 30-Sep-2002  abs #include "kbd.h" for NKBD and only override cn_isconsole to check cn_hw if set.
Fixes compilation without kbd.
 1.5 11-Mar-2002  chs branches: 1.5.6;
override cn_trap() with zs_abort() so we can drop to the monitor
if there's no DDB. fixes PR 12547.
 1.4 08-Nov-2000  eeh branches: 1.4.4; 1.4.8;
Support for MI console magic framework.
 1.3 09-Jul-2000  eeh Upgrate interrupt handling:

1) use interrupt vectors for specific zs chips rather than polling
all of them.

2) use softintr_schedule() and schedule it for a particular device
rather than poll all devices.
 1.2 19-May-2000  eeh branches: 1.2.4;
Fix the sparc64 console.

Unlike the other Sun machines, UltraSPARCs can have consoles run on different
chips than zs, so we need to support them. So, here we go:

Add a new PROM console driver with a major number and everything.
This is the default driver if nothing else attaches. It does not
use the keyboard driver since the PROM translates keystrokes itself.
(Unfortunately it also swallows L1-A).

Have the keyboard driver take over the console when it attaches on a
serial port. When a serial port detects a keyboard and attaches the
keyboard driver, it needs to provide a set of consdev vectors. They
keyboard driver will use those to send I/O to the keyboard and mouse.
 1.1 20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1 20-Jun-1998  eeh branches: 1.1.1.1.14;
Import of sparc64.
 1.1.1.1.14.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.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 18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.4.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.4.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.5.6.1 07-Dec-2002  he Pull up revision 1.6 (requested by abs in ticket #890):
Allow sparc64 kernels to be compiled without kbd.
 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.8.16.2 15-Nov-2007  yamt sync with head.
 1.8.16.1 21-Jun-2006  yamt sync with head.
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.50.1 19-Nov-2007  mjf Sync with HEAD.
 1.10.48.1 13-Nov-2007  bouyer Sync with HEAD
 1.10.44.1 08-Nov-2007  matt sync with -HEAD
 1.10.42.1 11-Nov-2007  joerg Sync with HEAD.
 1.10.24.1 03-Dec-2007  ad Sync with HEAD.
 1.11.14.1 03-Apr-2008  mjf Sync with HEAD.

RSS XML Feed