History log of /netbsd-current/sys/arch/sh3/sh3/exception.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.75 05-Oct-2023 ad

Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.74 15-Sep-2021 rin

For kernel mode address error, do not overwrite tf->tf_spc and tf->tf_r0
*before* checking pcb->pbc_onfault != NULL.

Should fix part of

PR port-sh3/56382
PR port-sh3/56401

i.e., DDB will no longer wrongly indicate NULL as fault PC for kernel mode
address error (and 0xe == EFAULT as r0).

Yes, we have another bugs that cause panics described in the two PRs, but
now we can examine them more easily :).


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.73 03-Dec-2019 ad

One more tweak.


# 1.72 03-Dec-2019 ad

tlb_exception: in slow path, check for usermode before calling userret().


# 1.71 01-Dec-2019 ad

sh3: make ASTs work as expected, and fix a few things in the TLB refill path.
With help from uwe@ and martin@.


# 1.70 30-Nov-2019 ad

Revert previous. Looks like it requires a more extensive fix.


# 1.69 29-Nov-2019 ad

PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().


# 1.68 21-Nov-2019 ad

mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.67 06-Apr-2019 thorpej

Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.66 22-Oct-2017 uwe

branches: 1.66.4;
tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

branches: 1.64.10;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.2; 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


# 1.74 15-Sep-2021 rin

For kernel mode address error, do not overwrite tf->tf_spc and tf->tf_r0
*before* checking pcb->pbc_onfault != NULL.

Should fix part of

PR port-sh3/56382
PR port-sh3/56401

i.e., DDB will no longer wrongly indicate NULL as fault PC for kernel mode
address error (and 0xe == EFAULT as r0).

Yes, we have another bugs that cause panics described in the two PRs, but
now we can examine them more easily :).


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.73 03-Dec-2019 ad

One more tweak.


# 1.72 03-Dec-2019 ad

tlb_exception: in slow path, check for usermode before calling userret().


# 1.71 01-Dec-2019 ad

sh3: make ASTs work as expected, and fix a few things in the TLB refill path.
With help from uwe@ and martin@.


# 1.70 30-Nov-2019 ad

Revert previous. Looks like it requires a more extensive fix.


# 1.69 29-Nov-2019 ad

PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().


# 1.68 21-Nov-2019 ad

mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.67 06-Apr-2019 thorpej

Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.66 22-Oct-2017 uwe

branches: 1.66.4;
tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

branches: 1.64.10;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.2; 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


# 1.73 03-Dec-2019 ad

One more tweak.


# 1.72 03-Dec-2019 ad

tlb_exception: in slow path, check for usermode before calling userret().


# 1.71 01-Dec-2019 ad

sh3: make ASTs work as expected, and fix a few things in the TLB refill path.
With help from uwe@ and martin@.


# 1.70 30-Nov-2019 ad

Revert previous. Looks like it requires a more extensive fix.


# 1.69 29-Nov-2019 ad

PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().


# 1.68 21-Nov-2019 ad

mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.67 06-Apr-2019 thorpej

Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.66 22-Oct-2017 uwe

branches: 1.66.4;
tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

branches: 1.64.10;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.2; 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


# 1.71 01-Dec-2019 ad

sh3: make ASTs work as expected, and fix a few things in the TLB refill path.
With help from uwe@ and martin@.


# 1.70 30-Nov-2019 ad

Revert previous. Looks like it requires a more extensive fix.


# 1.69 29-Nov-2019 ad

PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().


# 1.68 21-Nov-2019 ad

mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.67 06-Apr-2019 thorpej

Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.66 22-Oct-2017 uwe

branches: 1.66.4;
tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

branches: 1.64.10;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.2; 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


# 1.69 29-Nov-2019 ad

PR port-sparc/54718 (sparc install hangs since recent scheduler changes)

- userret() must be called every time we return to user, it's not optional.
- If clearing the AST with interrupts off, you must loop over userret().


# 1.68 21-Nov-2019 ad

mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.67 06-Apr-2019 thorpej

Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.66 22-Oct-2017 uwe

branches: 1.66.4;
tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

branches: 1.64.10;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.2; 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


# 1.68 21-Nov-2019 ad

mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.


Revision tags: phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.67 06-Apr-2019 thorpej

Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.66 22-Oct-2017 uwe

branches: 1.66.4;
tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

branches: 1.64.10;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.2; 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


Revision tags: isaki-audio2-base
# 1.67 06-Apr-2019 thorpej

Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.66 22-Oct-2017 uwe

tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

branches: 1.64.10;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.2; 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


# 1.66 22-Oct-2017 uwe

tlb_exception - set ksi_addr to va also when a userland page is not found.
Helps SIGSEGV handlers for PROT_NONE red zones.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]


# 1.65 20-Jun-2017 uwe

Use vmspace::vm_minsaddr instead of hardcoding USRSTACK.
Requested by joerg@.


Revision tags: netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.64 04-Mar-2015 skrll

Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.

From martin@


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base
# 1.63 08-Jul-2012 dsl

branches: 1.63.16;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.62 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base jym-xensuspend-base
# 1.61 28-Jan-2011 uwe

branches: 1.61.4; 1.61.8;
Implement PT_STEP.


# 1.60 27-Jan-2011 uwe

general_exception: when printing current mode in the panic message,
test "usermode" directly instead of testing for EXP_USER bit.


Revision tags: jruoho-x86intr-base
# 1.59 14-Jan-2011 rmind

branches: 1.59.2; 1.59.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231
# 1.58 29-Dec-2010 nisimura

one more line for lwp_getpcb() conversion.


# 1.57 29-Dec-2010 nisimura

use lwp_getpcb() to hide the detail about how struct pcb is populated.


# 1.56 20-Dec-2010 matt

Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.55 20-Mar-2010 chs

fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Nov-2009 rmind

branches: 1.54.2; 1.54.4;
Use lwp_getpcb() on mips, powerpc and sh3, clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 nick-hppapmap-base mjf-devfs2-base
# 1.53 19-Dec-2008 njoly

Fix remaining archs (arm, luna68k, powerpc and sh3) that were still
using a proc argument instead of an expected lwp for ADDUPROF macro.

ok by christos.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base
# 1.52 21-Oct-2008 wrstuden

branches: 1.52.2;
upcallret() will work much better if it's not in the middle of another
routine!


Revision tags: haad-dm-base1
# 1.51 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base wrstuden-revivesa-base
# 1.50 07-Jun-2008 uwe

branches: 1.50.4;
Pass trap code to kgdb_trap().


# 1.49 07-Jun-2008 uwe

Move EXPEVT_BREAK case next to EXPEVT_TRAPA case, they both generate
SIGTRAP and it's easier to read when they are together.


Revision tags: yamt-pf42-base3
# 1.48 21-May-2008 ad

Remove unneeded playing about with kernel_lock.


# 1.47 20-May-2008 uwe

Add semicolon that was lost some 5 years ago.
Reported missing by proper do-while macro hygiene in systm.h.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.46 21-Feb-2008 uwe

branches: 1.46.6; 1.46.8; 1.46.10; 1.46.12;
Use __arraycount.


# 1.45 21-Feb-2008 uwe

Revert previous, it's too noisy and misleading (e.g. single stepping
in ddb is not "fatal"). Need to redo it, but not now.


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.44 08-Jan-2008 uwe

In general_exception() in do_panic case print error message *before*
we drop into ddb.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.43 17-Oct-2007 garbled

branches: 1.43.2; 1.43.8;
Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.42 01-Oct-2007 ad

Make want_resched a member of cpu_info.


# 1.41 24-Sep-2007 uwe

Do RAS check in sh_vector_interrupt, don't abuse ast() for that.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.40 27-Aug-2007 uwe

branches: 1.40.2; 1.40.4;
Move child_return() and startlwp() to be in the same file with
cpu_lwp_fork() that is used to call them.


# 1.39 15-Aug-2007 ad

Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.38 17-May-2007 yamt

branches: 1.38.4; 1.38.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.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.37 30-Mar-2007 uwe

branches: 1.37.4;
Re-enable interrupts in tlb_exception too.


# 1.36 14-Mar-2007 uwe

Convert _lock_cas to RAS. Check for restart in ast() on return from interrupt.


Revision tags: ad-audiomp-base
# 1.35 21-Feb-2007 thorpej

branches: 1.35.4; 1.35.6;
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.


Revision tags: post-newlock2-merge
# 1.34 09-Feb-2007 ad

branches: 1.34.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.33 08-Oct-2006 uwe

branches: 1.33.2; 1.33.4;
general_exception() is called with all interrupts masked in SR
(effectively we were running syscalls with interrupts disabled).
splx back to previous interrupt level from tf->tf_ssr.

XXX: tlb_exception() still has that problem.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 rpaulo-netinet-merge-pcb-base
# 1.32 04-Sep-2006 uwe

branches: 1.32.2; 1.32.4;
general_exception: g/c infinite loop after the call to panic.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base8 yamt-pdpolicy-base7
# 1.31 22-Jul-2006 uwe

tlb_exception: Move and indent TLB_ASSERT to reduce visual clutter.
Fix function name in the panic message. Print expevt on panic.
Split panic message so that the dumped numbers are on a separate line.


# 1.30 22-Jul-2006 uwe

exp_type[] was constified in exception.c but an extern declaration in
db_interface.c was not updated. Declare it publicly. While here,
constify the array itself too.


# 1.29 22-Jul-2006 uwe

Report traps from user break controller as ksi_code = TRAP_TRACE


# 1.28 22-Jul-2006 uwe

Minor cosmetics.


# 1.27 19-Jul-2006 ad

- Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base simonb-timecounters-base
# 1.26 16-Mar-2006 he

Transform to new signature for uvm_fault() by dropping the third arg.
Discussed with drochner.


Revision tags: yamt-pdpolicy-base2
# 1.25 07-Mar-2006 thorpej

branches: 1.25.2;
Syscall debug tracing is handled by trace_enter() / trace_exit(). Change
trace_is_enabled() to return TRUE if SYSCALL_DEBUG is defined, and g/c
all of the SYSCALL_DEBUG handling from individual system call dispatch
routines.


# 1.24 07-Mar-2006 thorpej

Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.23 11-Dec-2005 christos

branches: 1.23.4; 1.23.6; 1.23.8;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.22 10-Jul-2005 uwe

Implement syscall_intern for sh3.


# 1.21 01-Jul-2005 christos

branches: 1.21.2;
PR/29607: Christian Biere systrace doesn't handle interrupted syscalls properly
Instead of jumping to the default "bad" case, jump to the error handling
switch, so that we can deal with ERESTART/EJUSTRETURN properly.


# 1.20 31-May-2005 uwe

Constify as -Wcast-qual seyeth.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 yamt-km-base4 netbsd-2-0-2-RELEASE yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base netbsd-2-0-1-RELEASE kent-audio1-beforemerge netbsd-2-base kent-audio1-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.19 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.18 14-Mar-2004 cl

add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP


# 1.17 24-Nov-2003 uwe

general_exception() now receives TEA as a third argument. For user
mode EXPEVT_ADDR_ERR_{LD,ST} traps pass it as ksi_addr, also use it to
decide if this is a SIGBUS (unaliged access) or SIGSEGV (kernel VA
access).

Report EXPEVT_TLB_PROT_LD as SEGV_ACCERR, not SEGV_MAPERR.

While here, consistently use standard uint32_t instead of u_int32_t.


# 1.16 23-Nov-2003 uwe

Implement siginfo for sh3.


# 1.15 31-Oct-2003 simonb

Don't pass the (unused) return value args to the
trace_enter()/systrace_enter() functions.


# 1.14 31-Oct-2003 uwe

When signaling SIGTRAP for debugger break adjust pc to point back to
the TRAPA instruction. This makes gdb much happier.


# 1.13 31-Oct-2003 uwe

tlb_exception: pacify -Wuninitialized by adding default case.


# 1.12 22-Oct-2003 uwe

Don't compare an integer to NULL.


# 1.11 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on sh3


# 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 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.8 29-Jun-2003 fvdl

branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.7 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.6 09-Mar-2003 tsutsui

In tlb_exception(), don't panic immediately on access at va == 0
from kernel mode if fault hander is set.


# 1.5 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 21-Dec-2002 manu

Pass the system call table to trace_enter() and ktrsys() so that it is
possible to use alternate system call tables. This is usefull for
displaying correctly the arguments in Mach binaries traces.

If NULL is given, then the regular systam call table for the process is used.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.3 15-Nov-2002 manu

Add a realcode argument to trace_enter and ktrsyscall. realcode is the
original system call number, which can be negative for a Mach trap.
We cannot just replace code by realcode, because ktrsyscall uses it as
an index in the system call table, thus crashing the kernel when the
value is negative.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base gehenna-devsw-base
# 1.2 17-Jun-2002 christos

branches: 1.2.2; 1.2.4; 1.2.6;
MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.1 09-May-2002 uch

branches: 1.1.2;
rework general exception, and TLB exception handling for new pmap.
all exception staffs are moved to exception.[ch]