History log of /netbsd-current/sys/arch/vax/vax/trap.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.138 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
# 1.137 11-Dec-2022 oster

Support save/restore of AST levels in the PCB for context switching.

Code written by ragge@ , tested by oster@.


Revision tags: bouyer-sunxi-drm-base 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.136 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-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base 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 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.135 22-May-2017 ragge

branches: 1.135.10;
Update copyright notice for Ludd (remove clause 3 & 4).


Revision tags: 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
# 1.134 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: 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.133 03-Mar-2015 martin

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


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 rmind-smpnet-base tls-maxphys-base
# 1.132 25-Oct-2013 martin

branches: 1.132.6;
Mark a diagnostic-only variable


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.131 02-Aug-2012 matt

branches: 1.131.2; 1.131.4;
Supress print fatal traps if the process is being debugged of it the signal
will be caught by a signal handler.


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.130 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-base2 netbsd-6-base
# 1.129 02-Feb-2012 matt

On a kernel segfault, print the registers from the trapframe.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.128 03-Jul-2011 matt

branches: 1.128.2; 1.128.6;
Cleanup trapframe handling. Instead of keeping a trapframe pointer in the
pcb, put in the mdlwp instead. We had a dummy field so it didn't grow in
size. This also follows the practice that mips and powerpc follow that a
pointer to the user trapframe is in l->l_md.md_utf. Make trapframe members
start with tf_


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-nbase jym-xensuspend-base
# 1.127 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.126 20-Dec-2010 matt

branches: 1.126.2; 1.126.4;
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
# 1.125 13-Nov-2010 matt

Implement CAS using a RAS for non-MP VAX systems. This technique uses the
atomicity of indirect addressing for correctness. It also uses the knowledge
of dereferencing an address outside the page table length will cause a PTELEN
trap. [Tested on netbsd-5]


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.124 23-Apr-2010 rmind

Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.


# 1.123 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
# 1.122 05-Jan-2010 mbalmer

branches: 1.122.2; 1.122.4;
One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.121 10-Dec-2009 matt

Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.


# 1.120 21-Nov-2009 rmind

- Use lwp_getpcb() on VAX, clean from struct user usage.
- Include sys/user.h in MD proc.h .


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
# 1.119 25-Feb-2009 mhitch

The ci_want_resched check and preempt() call had been removed from
userret() which resulted in no process preemption (and probably
contributed to the signal trap loop locking up the machine that was
recently fixed). Put the check and preempt() call in the AST trap
handler to restore process preemption.


# 1.118 18-Feb-2009 mhitch

On the vax, the trapsignal() call will change frame->sp to point to a
callg on the user's stack that calls the user's signal handler, so do
the skip_opcode() before calling trapsignal(). A floating point
overflow no longer causes a signal loop. This should stop the native
compile hangs trying to compile src/lib/libm/complex/catan.ln.


# 1.117 16-Feb-2009 christos

- add siginfo translation for all arithmetic faults and traps.
- skip the current instruction for all faults, to avoid infinite loops on
SIGFPE (from OpenBSD)
Info from: http://bitsavers.vt100.net/pdf/dec/vax/archSpec/EK-VAXAR-RM-001_Arch_May82.pdf


Revision tags: netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.116 15-Oct-2008 wrstuden

branches: 1.116.2; 1.116.4; 1.116.8;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.115 05-Aug-2008 matt

For ARITH traps, set the siginfo code appropriately for FP related traps.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.114 21-May-2008 ad

branches: 1.114.4;
Remove unneeded playing about with kernel_lock.


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 keiichi-mipv6-base matt-armv6-nbase
# 1.113 11-Mar-2008 matt

branches: 1.113.2; 1.113.4; 1.113.6;
Rototill the vax code. Switch to devicet/PRIV_ALLOC. Cleanup vax autoconf
code. Move to prototype definitions. staticfy, constify, avoid casting.
Use device_* accessors.


Revision tags: hpcarm-cleanup-base
# 1.112 22-Feb-2008 matt

expand some printfs. Don't bother checking for curlwp == NULL; it can't
happen anymore. Convert some variables to bool.


Revision tags: nick-net80211-sync-base
# 1.111 20-Feb-2008 matt

branches: 1.111.2; 1.111.6;
Make NetBSD/vax work again. Add support for __HAVE_FAST_SOFTINTS.
Add a few small optimizations.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.110 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base ppcoea-renovation-base vmlocking-base
# 1.109 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.108 04-Mar-2007 christos

branches: 1.108.2; 1.108.10; 1.108.14; 1.108.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.107 16-Feb-2007 ad

branches: 1.107.2;
More MD changes to get vax compiling.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.105 23-Jul-2006 ad

branches: 1.105.4;
Use the LWP cached credentials where sane.


# 1.104 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 simonb-timecounters-base
# 1.103 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.102 14-May-2006 elad

integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base
# 1.101 15-Mar-2006 drochner

branches: 1.101.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument


Revision tags: yamt-pdpolicy-base2
# 1.100 12-Mar-2006 christos

welcome to syscall_intern.


# 1.99 07-Mar-2006 thorpej

branches: 1.99.2;
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.98 24-Dec-2005 perry

branches: 1.98.4; 1.98.6; 1.98.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.97 11-Dec-2005 christos

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.96 01-Jul-2005 christos

branches: 1.96.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.


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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.95 02-Sep-2004 tacha

Make this compile again.


# 1.94 28-Aug-2004 jdolecek

use uvm_grow() to update stack segment size on stack page fault instead
of MD code


Revision tags: 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 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-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.93 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.92 13-Feb-2004 drochner

plug obvious kernel lock leaks
(untested)


# 1.91 02-Jan-2004 cl

kernel part of no-syscall upcall stack return: libpthread registers
an offset between ss_sp and struct sa_stackinfo_t (located in struct
__pthread_st) when calling sa_register. The kernel increments the
sast_gen counter in struct sastack when an upcall stack is used.
libpthread increments the sasi_stackgen counter in struct
sa_stackinfo_t when an upcall stack is freed. The kernel compares the
two counters to decide if a stack is free or in use.

- add struct sa_stackinfo_t with sasi_stackgen to count stack use in
userland
- add sast_gen to struct sastack to count stack use in kernel
- add SA_FLAG_STACKINFO to enable the stackinfo_offset argument in the
sa_register syscall
- add sa_stackinfo_offset to struct sadata for offset between ss_sp
and struct sa_stackinfo_t
- add ssize_t stackinfo_offset argument to sa_register, initialize
struct sadata's sa_stackinfo_offset from it if SA_FLAG_STACKINFO is
set
- add sa_getstack, sa_getstack0, sa_stackused and sa_setstackfree
functions to find/use/free upcall stacks and use these where
appropriate
- don't record stack for upcall in sa_upcall0
- pass sau to sa_switchcall instead of l2 (l2 = curlwp in sa_switchcall)
- add sa_vp_blocker to struct sadata to pass recently blocked lwp to
sa_switchcall
- delay finding a stack for blocked upcalls to sa_switchcall
- add sa_stacknext to struct sadata pointing to next most likely free
upcall stack; also g/c sa_stackslist in struct sadata and sast_list
in struct sastack
- add L_SA_WOKEN flag: LWP is on sa_woken queue
- add L_SA_RECYCLE flag: LWP should be recycled in sa_setwoken
- replace l_upcallstack with L_SA_WOKEN/L_SA_RECYCLE/L_SA_BLOCKING
flags
- g/c now unused sast_blocker in struct sastack
- make sa_switchcall, sa_upcall0 and sa_upcall_getstate static in
kern_sa.c
- call sa_upcall_userret only once in userret
- split sa_makeupcalls out of sa_upcall_userret and use to process
the sa_upcalls queue
- on process exit: mark LWPs sleeping in saunblock interruptible; also
there are no LWPs sleeping on l->l_upcallstack anymore; also clear
sa_wokenq_head to prevent unblocked upcalls

additional changes:
- cleanup timerupcall sa_vp == curlwp check
- add check in sa_yield if we didn't block on our way here and we
wouldn't any longer be the LWP on the VP
- invalidate sa_vp_ofaultaddr after resolving pagefault


# 1.90 06-Nov-2003 he

Initialize 'p' to NULL, to work around that the compiler otherwise
can't know that 'p' is initialized before it's being used.

Reviewed by ragge.


# 1.89 01-Nov-2003 cl

Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().


# 1.88 31-Oct-2003 simonb

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


# 1.87 18-Oct-2003 ragge

Do not try to fetch the current proc if curlwp == NULL. This caused
DDB to fail if no process were running.


# 1.86 08-Oct-2003 thorpej

* Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.


# 1.85 29-Sep-2003 matt

trap.c: Set ksi.ksi_trap to frame->trap.
sig_machdep.c: Use ksi->ksi_addr in compat code to supply the
'code' argument to the old signal routines.


# 1.84 29-Sep-2003 matt

Set ksi_addr to frame->code.


# 1.83 29-Sep-2003 matt

Add SA_SIGINFO support for VAX.


# 1.82 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on vax


# 1.81 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.80 29-Jun-2003 fvdl

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


# 1.79 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.78 01-Mar-2003 matt

Add machdep sysctl support. Support booted_device, consdev, and
printfataltraps.


# 1.77 20-Jan-2003 matt

Fix some SA lossage.


# 1.76 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.75 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.74 16-Nov-2002 uebayasi

branches: 1.74.2;
Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.

Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.73 29-Sep-2002 thorpej

Record stack growth, done inline to avoid another function call on
every user page fault.

XXX Should make uvm_grow() an inline.


Revision tags: gehenna-devsw-base
# 1.72 23-Jun-2002 mrg

finish previous; it would be nice if people were to use the lovely
cross compiling mechanisms we have when making sweeping changes...


# 1.71 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.70 29-Apr-2002 thorpej

branches: 1.70.2; 1.70.4;
Only print console messages about SIGSEGV and SIGILL if the
kernel was built with DEBUG.


Revision tags: eeh-devprop-base
# 1.69 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.68 10-Mar-2002 ragge

Major update of the vax pmap:
- Reinstall the "dynamic page table length" that was removed some
years ago.
- Limit the user page table submap to max 5% of available memory.
- Free the page table space when a process is swapped out.
- If the UPT submap runs out of space, throw away pmap mappings
using the same algorithm as for swapping processes.

As a result of this, 4MB machines are useable again and it's even possible
to compile a kernel for 2MB machines (but it will be slow... :-)

Still to do:
- Multiprocessor fixes.
- More profiling.


Revision tags: newlock-base ifpoll-base
# 1.67 14-Feb-2002 chs

allow writing to write-only mappings. fixes PR 3493.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.66 28-Jun-2001 ragge

branches: 1.66.2; 1.66.8;
Panic if page fault on interrupt stack, per request from Jason Thorpe.


# 1.65 04-Jun-2001 ragge

Move some locks closer to the important point.


# 1.64 03-Jun-2001 ragge

A bunch of fixes:
- Make generic console routines not relying on running on master cpu.
- Add routine to start console transmitter (after IPI).
- Use real IPIs instead of the "console doorbell".
- Add routines cpu_send_ipi()/cpu_handle_ipi().


# 1.63 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.62 29-May-2001 ragge

Add a bunch of locking code for MP systems.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.61 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.60 31-Dec-2000 matt

branches: 1.60.2;
de-__P. cleanup the whitespace a bit. add a very small optimization.


# 1.59 31-Dec-2000 matt

Rename arithflt to trap. Change trap label to Xtrap. This is due to that
arithflt is really the trap handler so call it that.


# 1.58 24-Nov-2000 matt

Make this compile again.


# 1.57 17-Jul-2000 matt

Changes so that the kernel can be compiled under __ELF__.


# 1.56 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.55 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.54 29-May-2000 ragge

Use the cpu_info struct to store cpu-specific data in the same way in
both uniprocessor and multiprocessor environments. Use the otherwise
unused internal CPU register SSP to store the cpu_info pointer.
The macros curcpu(), curproc, cpu_number() and need_resched() are now the
same in both uniprocessor and multiprocessor environments.


# 1.53 27-May-2000 ragge

Rewrite cpu_fork(), it now looks like and works as other ports' cpu_fork()
(calling child_return() etc...). Have fun, Jason!


Revision tags: minoura-xpg4dl-base
# 1.52 27-May-2000 sommerfeld

branches: 1.52.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()


# 1.51 26-May-2000 thorpej

First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

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

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

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

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

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.


# 1.50 25-May-2000 thorpej

Move common return-to-userland goo into userret(), like other ports.


# 1.49 24-May-2000 thorpej

Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).


# 1.48 19-Mar-2000 ragge

First cut of multiprocessor support for vax. Still much to do before
other CPUs than the master can spin up.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.47 21-Aug-1999 matt

branches: 1.47.2;
Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now. I don't expect anyone to work with it
since the binutils and gas changes are still pending. But you got to
crawl before you walk.


Revision tags: chs-ubc2-base
# 1.46 10-Jul-1999 ragge

Rewrite the page table entry routines. Don't take a pte invalid fault for
missing pte's, instead map in pte entries in pmap_enter(). The user ptes
is no more handled by the VM system. All this made swapping start working
on VAX again.
Still to do:
- Keep refcount per pte page, so that those pages get free'd when the
process is swapped out. Right now they are only free'd when the pmap
is destroyed.

Many thanks to Chuck Silvers for all help finding the deadlock problems.


# 1.45 20-Jun-1999 ragge

Add some small checks to avoid unwanted panic types.


Revision tags: kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.44 24-Mar-1999 mrg

branches: 1.44.2; 1.44.4; 1.44.6;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.43 18-Mar-1999 chs

if uvm_fault() fails with KERN_RESOURCE_SHORTAGE, send a SIGKILL
and print a message about it. this will be used to recover from
out-of-swap conditions.


# 1.42 13-Mar-1999 ragge

Change vsbus to take a locator for all devices.
Figure out interrupt vector/mask on vsbus by forcing all devices to
generate interrupts in the match routine, like on unibus.


# 1.41 19-Jan-1999 ragge

Allocate (almost) all interrupt vectors dynamically. Simplifies much
work when adding support for new machines and devices.


# 1.40 01-Jan-1999 ragge

Giant change: NBPG now set to 4k and CLSIZE == 1 for vax. This change
made a whole bunch of annoying bugs disappear; mostly depending on
bad use of NBPG in non-MD code. The VAX port was the only port that
used this historical "feature".

The CL* macros should probably go away totally, there is no reason
at all to keep them.


Revision tags: kenh-if-detach-base
# 1.39 29-Nov-1998 ragge

Fix (small) segv bug. Recognize in-kernel trace and breakpoint traps.


Revision tags: chs-ubc-base eeh-paddr_t-base
# 1.38 04-Jul-1998 jonathan

defopt DDB.


# 1.37 25-Jun-1998 thorpej

defopt KTRACE


# 1.36 08-Jun-1998 ragge

Wall fixes.


# 1.35 03-May-1998 ragge

Wall cleaning + a little better fault checking.


# 1.34 02-Mar-1998 ragge

Support for UVM on VAXen.


# 1.33 03-Jan-1998 thorpej

Adjust for the fact that the page {0,1} base and length registers are now
stored in the pmap structure.


# 1.32 04-Nov-1997 ragge

Optimized copy/fetch/store routines; rewritten in assembler.


# 1.31 02-Nov-1997 ragge

Major rewriting, optimization and simplifying of the pmap code:

- Map in all physical memory first in system space. This reduces
pmap_copy_page() and pmap_zero_page to 3 resp. 2 instructions.
- Have fized position user page tables. Makes the pv_table smaller
and all reverse references faster (and simpler).
- Remove the wiring code. Nobody doesn't even know what a DR32 is anymore.
- Simulate page reference bit by setting page invalid, as suggested by
Rich Draves in a paper for 1991 Mach Usenix Symposium.

This reduced the time spent in the pmap module to between 70-75% of
the previous; and made process startup _much_ faster.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.30 19-Oct-1997 ragge

Only check for process switch if we are coming in from userspace.
Make ERESTART work for syscalls >63.
While we're here; clean up a little bit.


Revision tags: marc-pcmcia-base
# 1.29 11-Sep-1997 mycroft

Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.28 28-Jul-1997 ragge

branches: 1.28.2;
Handle XFC instruction faults.


# 1.27 06-Jul-1997 ragge

Remove __VM_PMAP_HACK.


# 1.26 13-Jun-1997 ragge

Bug fixes to page fault handling system. Many thanks to Johnny Billquist
for hunting down this bug(s).


# 1.25 12-Jun-1997 ragge

cpu_switch() should be mi_switch(). Pointed out by Johnny Billquist.
(bqt@update.uu.se)


Revision tags: is-newarp-before-merge is-newarp-base
# 1.24 06-Nov-1996 cgd

Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().


# 1.23 13-Oct-1996 christos

backout previous kprintf change


# 1.22 11-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.21 19-May-1996 ragge

Fixed all (proto)type errors. Fixes PR 2377.


# 1.20 08-Apr-1996 ragge

Added prototypes to everything. Made all files compile with -Wall.


# 1.19 17-Mar-1996 ragge

Do not have debugging enabled by default.


# 1.18 09-Mar-1996 ragge

Add support for ktracing syscalls.


# 1.17 02-Feb-1996 mycroft

#ifdef a call to kdb_trap() on DDB.


# 1.16 02-Feb-1996 mycroft

Fix #includes.


# 1.15 28-Jan-1996 ragge

Be able to handle debugger traps from kernel.


# 1.14 12-Nov-1995 ragge

struct ivec_dsp for interrupt vector allocation added.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.13 05-Jul-1995 ragge

Null pointer were referenced if signal occurred before first
syscall. Didn't hurt on 4.3 Reno binaries.


# 1.12 16-Jun-1995 ragge

rudimentary DDB support.


# 1.11 05-Jun-1995 ragge

Enabled auto reboot. Fixed bug in conf.c. Started use of rpb.
Detecting kernel stack overflow. Removed local mapping of
sigtramp code. Frob kernel stack pages in cpu_swapin().
Cleaned up some code and changed to KNF.


# 1.10 03-May-1995 ragge

Changed conf.c to new style. Took away double saving of regs in traps.
Changed boot() to use vfs_shutdown(). Updated setregs.


# 1.9 22-Apr-1995 christos

- added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.


# 1.8 30-Mar-1995 ragge

Speed-up of pmap and trap.
Fixes due to uVAX support.


# 1.7 23-Feb-1995 ragge

Support for uVAXII, new tmscp driver added.


# 1.6 13-Feb-1995 ragge

Zillions of bugfixes. Obsolete files taken away. New style config
fixed. Inline assembler commonly used.


# 1.5 25-Nov-1994 ragge

Lots of fixes and updates.


# 1.4 26-Oct-1994 cgd

new RCS ID format.


# 1.3 08-Oct-1994 ragge

Lots of bug fixes; clock and mem files new.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.2 16-Aug-1994 ragge

branches: 1.2.2;
Lots of bug fixes. Generic console support added. Major changes in machdep.c.
pmap.c now supports user process mapping. Page faults handles correctly.


# 1.1 02-Aug-1994 ragge

Initial VAX port merging.


# 1.137 11-Dec-2022 oster

Support save/restore of AST levels in the PCB for context switching.

Code written by ragge@ , tested by oster@.


Revision tags: bouyer-sunxi-drm-base 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.136 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-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base 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 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.135 22-May-2017 ragge

branches: 1.135.10;
Update copyright notice for Ludd (remove clause 3 & 4).


Revision tags: 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
# 1.134 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: 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.133 03-Mar-2015 martin

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


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 rmind-smpnet-base tls-maxphys-base
# 1.132 25-Oct-2013 martin

branches: 1.132.6;
Mark a diagnostic-only variable


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.131 02-Aug-2012 matt

branches: 1.131.2; 1.131.4;
Supress print fatal traps if the process is being debugged of it the signal
will be caught by a signal handler.


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.130 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-base2 netbsd-6-base
# 1.129 02-Feb-2012 matt

On a kernel segfault, print the registers from the trapframe.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.128 03-Jul-2011 matt

branches: 1.128.2; 1.128.6;
Cleanup trapframe handling. Instead of keeping a trapframe pointer in the
pcb, put in the mdlwp instead. We had a dummy field so it didn't grow in
size. This also follows the practice that mips and powerpc follow that a
pointer to the user trapframe is in l->l_md.md_utf. Make trapframe members
start with tf_


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-nbase jym-xensuspend-base
# 1.127 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.126 20-Dec-2010 matt

branches: 1.126.2; 1.126.4;
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
# 1.125 13-Nov-2010 matt

Implement CAS using a RAS for non-MP VAX systems. This technique uses the
atomicity of indirect addressing for correctness. It also uses the knowledge
of dereferencing an address outside the page table length will cause a PTELEN
trap. [Tested on netbsd-5]


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.124 23-Apr-2010 rmind

Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.


# 1.123 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
# 1.122 05-Jan-2010 mbalmer

branches: 1.122.2; 1.122.4;
One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.121 10-Dec-2009 matt

Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.


# 1.120 21-Nov-2009 rmind

- Use lwp_getpcb() on VAX, clean from struct user usage.
- Include sys/user.h in MD proc.h .


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
# 1.119 25-Feb-2009 mhitch

The ci_want_resched check and preempt() call had been removed from
userret() which resulted in no process preemption (and probably
contributed to the signal trap loop locking up the machine that was
recently fixed). Put the check and preempt() call in the AST trap
handler to restore process preemption.


# 1.118 18-Feb-2009 mhitch

On the vax, the trapsignal() call will change frame->sp to point to a
callg on the user's stack that calls the user's signal handler, so do
the skip_opcode() before calling trapsignal(). A floating point
overflow no longer causes a signal loop. This should stop the native
compile hangs trying to compile src/lib/libm/complex/catan.ln.


# 1.117 16-Feb-2009 christos

- add siginfo translation for all arithmetic faults and traps.
- skip the current instruction for all faults, to avoid infinite loops on
SIGFPE (from OpenBSD)
Info from: http://bitsavers.vt100.net/pdf/dec/vax/archSpec/EK-VAXAR-RM-001_Arch_May82.pdf


Revision tags: netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.116 15-Oct-2008 wrstuden

branches: 1.116.2; 1.116.4; 1.116.8;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.115 05-Aug-2008 matt

For ARITH traps, set the siginfo code appropriately for FP related traps.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.114 21-May-2008 ad

branches: 1.114.4;
Remove unneeded playing about with kernel_lock.


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 keiichi-mipv6-base matt-armv6-nbase
# 1.113 11-Mar-2008 matt

branches: 1.113.2; 1.113.4; 1.113.6;
Rototill the vax code. Switch to devicet/PRIV_ALLOC. Cleanup vax autoconf
code. Move to prototype definitions. staticfy, constify, avoid casting.
Use device_* accessors.


Revision tags: hpcarm-cleanup-base
# 1.112 22-Feb-2008 matt

expand some printfs. Don't bother checking for curlwp == NULL; it can't
happen anymore. Convert some variables to bool.


Revision tags: nick-net80211-sync-base
# 1.111 20-Feb-2008 matt

branches: 1.111.2; 1.111.6;
Make NetBSD/vax work again. Add support for __HAVE_FAST_SOFTINTS.
Add a few small optimizations.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.110 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base ppcoea-renovation-base vmlocking-base
# 1.109 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.108 04-Mar-2007 christos

branches: 1.108.2; 1.108.10; 1.108.14; 1.108.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.107 16-Feb-2007 ad

branches: 1.107.2;
More MD changes to get vax compiling.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.105 23-Jul-2006 ad

branches: 1.105.4;
Use the LWP cached credentials where sane.


# 1.104 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 simonb-timecounters-base
# 1.103 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.102 14-May-2006 elad

integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base
# 1.101 15-Mar-2006 drochner

branches: 1.101.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument


Revision tags: yamt-pdpolicy-base2
# 1.100 12-Mar-2006 christos

welcome to syscall_intern.


# 1.99 07-Mar-2006 thorpej

branches: 1.99.2;
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.98 24-Dec-2005 perry

branches: 1.98.4; 1.98.6; 1.98.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.97 11-Dec-2005 christos

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.96 01-Jul-2005 christos

branches: 1.96.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.


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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.95 02-Sep-2004 tacha

Make this compile again.


# 1.94 28-Aug-2004 jdolecek

use uvm_grow() to update stack segment size on stack page fault instead
of MD code


Revision tags: 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 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-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.93 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.92 13-Feb-2004 drochner

plug obvious kernel lock leaks
(untested)


# 1.91 02-Jan-2004 cl

kernel part of no-syscall upcall stack return: libpthread registers
an offset between ss_sp and struct sa_stackinfo_t (located in struct
__pthread_st) when calling sa_register. The kernel increments the
sast_gen counter in struct sastack when an upcall stack is used.
libpthread increments the sasi_stackgen counter in struct
sa_stackinfo_t when an upcall stack is freed. The kernel compares the
two counters to decide if a stack is free or in use.

- add struct sa_stackinfo_t with sasi_stackgen to count stack use in
userland
- add sast_gen to struct sastack to count stack use in kernel
- add SA_FLAG_STACKINFO to enable the stackinfo_offset argument in the
sa_register syscall
- add sa_stackinfo_offset to struct sadata for offset between ss_sp
and struct sa_stackinfo_t
- add ssize_t stackinfo_offset argument to sa_register, initialize
struct sadata's sa_stackinfo_offset from it if SA_FLAG_STACKINFO is
set
- add sa_getstack, sa_getstack0, sa_stackused and sa_setstackfree
functions to find/use/free upcall stacks and use these where
appropriate
- don't record stack for upcall in sa_upcall0
- pass sau to sa_switchcall instead of l2 (l2 = curlwp in sa_switchcall)
- add sa_vp_blocker to struct sadata to pass recently blocked lwp to
sa_switchcall
- delay finding a stack for blocked upcalls to sa_switchcall
- add sa_stacknext to struct sadata pointing to next most likely free
upcall stack; also g/c sa_stackslist in struct sadata and sast_list
in struct sastack
- add L_SA_WOKEN flag: LWP is on sa_woken queue
- add L_SA_RECYCLE flag: LWP should be recycled in sa_setwoken
- replace l_upcallstack with L_SA_WOKEN/L_SA_RECYCLE/L_SA_BLOCKING
flags
- g/c now unused sast_blocker in struct sastack
- make sa_switchcall, sa_upcall0 and sa_upcall_getstate static in
kern_sa.c
- call sa_upcall_userret only once in userret
- split sa_makeupcalls out of sa_upcall_userret and use to process
the sa_upcalls queue
- on process exit: mark LWPs sleeping in saunblock interruptible; also
there are no LWPs sleeping on l->l_upcallstack anymore; also clear
sa_wokenq_head to prevent unblocked upcalls

additional changes:
- cleanup timerupcall sa_vp == curlwp check
- add check in sa_yield if we didn't block on our way here and we
wouldn't any longer be the LWP on the VP
- invalidate sa_vp_ofaultaddr after resolving pagefault


# 1.90 06-Nov-2003 he

Initialize 'p' to NULL, to work around that the compiler otherwise
can't know that 'p' is initialized before it's being used.

Reviewed by ragge.


# 1.89 01-Nov-2003 cl

Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().


# 1.88 31-Oct-2003 simonb

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


# 1.87 18-Oct-2003 ragge

Do not try to fetch the current proc if curlwp == NULL. This caused
DDB to fail if no process were running.


# 1.86 08-Oct-2003 thorpej

* Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.


# 1.85 29-Sep-2003 matt

trap.c: Set ksi.ksi_trap to frame->trap.
sig_machdep.c: Use ksi->ksi_addr in compat code to supply the
'code' argument to the old signal routines.


# 1.84 29-Sep-2003 matt

Set ksi_addr to frame->code.


# 1.83 29-Sep-2003 matt

Add SA_SIGINFO support for VAX.


# 1.82 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on vax


# 1.81 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.80 29-Jun-2003 fvdl

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


# 1.79 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.78 01-Mar-2003 matt

Add machdep sysctl support. Support booted_device, consdev, and
printfataltraps.


# 1.77 20-Jan-2003 matt

Fix some SA lossage.


# 1.76 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.75 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.74 16-Nov-2002 uebayasi

branches: 1.74.2;
Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.

Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.73 29-Sep-2002 thorpej

Record stack growth, done inline to avoid another function call on
every user page fault.

XXX Should make uvm_grow() an inline.


Revision tags: gehenna-devsw-base
# 1.72 23-Jun-2002 mrg

finish previous; it would be nice if people were to use the lovely
cross compiling mechanisms we have when making sweeping changes...


# 1.71 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.70 29-Apr-2002 thorpej

branches: 1.70.2; 1.70.4;
Only print console messages about SIGSEGV and SIGILL if the
kernel was built with DEBUG.


Revision tags: eeh-devprop-base
# 1.69 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.68 10-Mar-2002 ragge

Major update of the vax pmap:
- Reinstall the "dynamic page table length" that was removed some
years ago.
- Limit the user page table submap to max 5% of available memory.
- Free the page table space when a process is swapped out.
- If the UPT submap runs out of space, throw away pmap mappings
using the same algorithm as for swapping processes.

As a result of this, 4MB machines are useable again and it's even possible
to compile a kernel for 2MB machines (but it will be slow... :-)

Still to do:
- Multiprocessor fixes.
- More profiling.


Revision tags: newlock-base ifpoll-base
# 1.67 14-Feb-2002 chs

allow writing to write-only mappings. fixes PR 3493.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.66 28-Jun-2001 ragge

branches: 1.66.2; 1.66.8;
Panic if page fault on interrupt stack, per request from Jason Thorpe.


# 1.65 04-Jun-2001 ragge

Move some locks closer to the important point.


# 1.64 03-Jun-2001 ragge

A bunch of fixes:
- Make generic console routines not relying on running on master cpu.
- Add routine to start console transmitter (after IPI).
- Use real IPIs instead of the "console doorbell".
- Add routines cpu_send_ipi()/cpu_handle_ipi().


# 1.63 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.62 29-May-2001 ragge

Add a bunch of locking code for MP systems.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.61 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.60 31-Dec-2000 matt

branches: 1.60.2;
de-__P. cleanup the whitespace a bit. add a very small optimization.


# 1.59 31-Dec-2000 matt

Rename arithflt to trap. Change trap label to Xtrap. This is due to that
arithflt is really the trap handler so call it that.


# 1.58 24-Nov-2000 matt

Make this compile again.


# 1.57 17-Jul-2000 matt

Changes so that the kernel can be compiled under __ELF__.


# 1.56 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.55 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.54 29-May-2000 ragge

Use the cpu_info struct to store cpu-specific data in the same way in
both uniprocessor and multiprocessor environments. Use the otherwise
unused internal CPU register SSP to store the cpu_info pointer.
The macros curcpu(), curproc, cpu_number() and need_resched() are now the
same in both uniprocessor and multiprocessor environments.


# 1.53 27-May-2000 ragge

Rewrite cpu_fork(), it now looks like and works as other ports' cpu_fork()
(calling child_return() etc...). Have fun, Jason!


Revision tags: minoura-xpg4dl-base
# 1.52 27-May-2000 sommerfeld

branches: 1.52.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()


# 1.51 26-May-2000 thorpej

First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

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

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

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

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

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.


# 1.50 25-May-2000 thorpej

Move common return-to-userland goo into userret(), like other ports.


# 1.49 24-May-2000 thorpej

Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).


# 1.48 19-Mar-2000 ragge

First cut of multiprocessor support for vax. Still much to do before
other CPUs than the master can spin up.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.47 21-Aug-1999 matt

branches: 1.47.2;
Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now. I don't expect anyone to work with it
since the binutils and gas changes are still pending. But you got to
crawl before you walk.


Revision tags: chs-ubc2-base
# 1.46 10-Jul-1999 ragge

Rewrite the page table entry routines. Don't take a pte invalid fault for
missing pte's, instead map in pte entries in pmap_enter(). The user ptes
is no more handled by the VM system. All this made swapping start working
on VAX again.
Still to do:
- Keep refcount per pte page, so that those pages get free'd when the
process is swapped out. Right now they are only free'd when the pmap
is destroyed.

Many thanks to Chuck Silvers for all help finding the deadlock problems.


# 1.45 20-Jun-1999 ragge

Add some small checks to avoid unwanted panic types.


Revision tags: kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.44 24-Mar-1999 mrg

branches: 1.44.2; 1.44.4; 1.44.6;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.43 18-Mar-1999 chs

if uvm_fault() fails with KERN_RESOURCE_SHORTAGE, send a SIGKILL
and print a message about it. this will be used to recover from
out-of-swap conditions.


# 1.42 13-Mar-1999 ragge

Change vsbus to take a locator for all devices.
Figure out interrupt vector/mask on vsbus by forcing all devices to
generate interrupts in the match routine, like on unibus.


# 1.41 19-Jan-1999 ragge

Allocate (almost) all interrupt vectors dynamically. Simplifies much
work when adding support for new machines and devices.


# 1.40 01-Jan-1999 ragge

Giant change: NBPG now set to 4k and CLSIZE == 1 for vax. This change
made a whole bunch of annoying bugs disappear; mostly depending on
bad use of NBPG in non-MD code. The VAX port was the only port that
used this historical "feature".

The CL* macros should probably go away totally, there is no reason
at all to keep them.


Revision tags: kenh-if-detach-base
# 1.39 29-Nov-1998 ragge

Fix (small) segv bug. Recognize in-kernel trace and breakpoint traps.


Revision tags: chs-ubc-base eeh-paddr_t-base
# 1.38 04-Jul-1998 jonathan

defopt DDB.


# 1.37 25-Jun-1998 thorpej

defopt KTRACE


# 1.36 08-Jun-1998 ragge

Wall fixes.


# 1.35 03-May-1998 ragge

Wall cleaning + a little better fault checking.


# 1.34 02-Mar-1998 ragge

Support for UVM on VAXen.


# 1.33 03-Jan-1998 thorpej

Adjust for the fact that the page {0,1} base and length registers are now
stored in the pmap structure.


# 1.32 04-Nov-1997 ragge

Optimized copy/fetch/store routines; rewritten in assembler.


# 1.31 02-Nov-1997 ragge

Major rewriting, optimization and simplifying of the pmap code:

- Map in all physical memory first in system space. This reduces
pmap_copy_page() and pmap_zero_page to 3 resp. 2 instructions.
- Have fized position user page tables. Makes the pv_table smaller
and all reverse references faster (and simpler).
- Remove the wiring code. Nobody doesn't even know what a DR32 is anymore.
- Simulate page reference bit by setting page invalid, as suggested by
Rich Draves in a paper for 1991 Mach Usenix Symposium.

This reduced the time spent in the pmap module to between 70-75% of
the previous; and made process startup _much_ faster.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.30 19-Oct-1997 ragge

Only check for process switch if we are coming in from userspace.
Make ERESTART work for syscalls >63.
While we're here; clean up a little bit.


Revision tags: marc-pcmcia-base
# 1.29 11-Sep-1997 mycroft

Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.28 28-Jul-1997 ragge

branches: 1.28.2;
Handle XFC instruction faults.


# 1.27 06-Jul-1997 ragge

Remove __VM_PMAP_HACK.


# 1.26 13-Jun-1997 ragge

Bug fixes to page fault handling system. Many thanks to Johnny Billquist
for hunting down this bug(s).


# 1.25 12-Jun-1997 ragge

cpu_switch() should be mi_switch(). Pointed out by Johnny Billquist.
(bqt@update.uu.se)


Revision tags: is-newarp-before-merge is-newarp-base
# 1.24 06-Nov-1996 cgd

Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().


# 1.23 13-Oct-1996 christos

backout previous kprintf change


# 1.22 11-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.21 19-May-1996 ragge

Fixed all (proto)type errors. Fixes PR 2377.


# 1.20 08-Apr-1996 ragge

Added prototypes to everything. Made all files compile with -Wall.


# 1.19 17-Mar-1996 ragge

Do not have debugging enabled by default.


# 1.18 09-Mar-1996 ragge

Add support for ktracing syscalls.


# 1.17 02-Feb-1996 mycroft

#ifdef a call to kdb_trap() on DDB.


# 1.16 02-Feb-1996 mycroft

Fix #includes.


# 1.15 28-Jan-1996 ragge

Be able to handle debugger traps from kernel.


# 1.14 12-Nov-1995 ragge

struct ivec_dsp for interrupt vector allocation added.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.13 05-Jul-1995 ragge

Null pointer were referenced if signal occurred before first
syscall. Didn't hurt on 4.3 Reno binaries.


# 1.12 16-Jun-1995 ragge

rudimentary DDB support.


# 1.11 05-Jun-1995 ragge

Enabled auto reboot. Fixed bug in conf.c. Started use of rpb.
Detecting kernel stack overflow. Removed local mapping of
sigtramp code. Frob kernel stack pages in cpu_swapin().
Cleaned up some code and changed to KNF.


# 1.10 03-May-1995 ragge

Changed conf.c to new style. Took away double saving of regs in traps.
Changed boot() to use vfs_shutdown(). Updated setregs.


# 1.9 22-Apr-1995 christos

- added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.


# 1.8 30-Mar-1995 ragge

Speed-up of pmap and trap.
Fixes due to uVAX support.


# 1.7 23-Feb-1995 ragge

Support for uVAXII, new tmscp driver added.


# 1.6 13-Feb-1995 ragge

Zillions of bugfixes. Obsolete files taken away. New style config
fixed. Inline assembler commonly used.


# 1.5 25-Nov-1994 ragge

Lots of fixes and updates.


# 1.4 26-Oct-1994 cgd

new RCS ID format.


# 1.3 08-Oct-1994 ragge

Lots of bug fixes; clock and mem files new.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.2 16-Aug-1994 ragge

branches: 1.2.2;
Lots of bug fixes. Generic console support added. Major changes in machdep.c.
pmap.c now supports user process mapping. Page faults handles correctly.


# 1.1 02-Aug-1994 ragge

Initial VAX port merging.


# 1.136 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 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base 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 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.135 22-May-2017 ragge

Update copyright notice for Ludd (remove clause 3 & 4).


Revision tags: 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
# 1.134 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: 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.133 03-Mar-2015 martin

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


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 rmind-smpnet-base tls-maxphys-base
# 1.132 25-Oct-2013 martin

branches: 1.132.6;
Mark a diagnostic-only variable


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.131 02-Aug-2012 matt

branches: 1.131.2; 1.131.4;
Supress print fatal traps if the process is being debugged of it the signal
will be caught by a signal handler.


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.130 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-base2 netbsd-6-base
# 1.129 02-Feb-2012 matt

On a kernel segfault, print the registers from the trapframe.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.128 03-Jul-2011 matt

branches: 1.128.2; 1.128.6;
Cleanup trapframe handling. Instead of keeping a trapframe pointer in the
pcb, put in the mdlwp instead. We had a dummy field so it didn't grow in
size. This also follows the practice that mips and powerpc follow that a
pointer to the user trapframe is in l->l_md.md_utf. Make trapframe members
start with tf_


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-nbase jym-xensuspend-base
# 1.127 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.126 20-Dec-2010 matt

branches: 1.126.2; 1.126.4;
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
# 1.125 13-Nov-2010 matt

Implement CAS using a RAS for non-MP VAX systems. This technique uses the
atomicity of indirect addressing for correctness. It also uses the knowledge
of dereferencing an address outside the page table length will cause a PTELEN
trap. [Tested on netbsd-5]


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.124 23-Apr-2010 rmind

Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.


# 1.123 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
# 1.122 05-Jan-2010 mbalmer

branches: 1.122.2; 1.122.4;
One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.121 10-Dec-2009 matt

Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.


# 1.120 21-Nov-2009 rmind

- Use lwp_getpcb() on VAX, clean from struct user usage.
- Include sys/user.h in MD proc.h .


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
# 1.119 25-Feb-2009 mhitch

The ci_want_resched check and preempt() call had been removed from
userret() which resulted in no process preemption (and probably
contributed to the signal trap loop locking up the machine that was
recently fixed). Put the check and preempt() call in the AST trap
handler to restore process preemption.


# 1.118 18-Feb-2009 mhitch

On the vax, the trapsignal() call will change frame->sp to point to a
callg on the user's stack that calls the user's signal handler, so do
the skip_opcode() before calling trapsignal(). A floating point
overflow no longer causes a signal loop. This should stop the native
compile hangs trying to compile src/lib/libm/complex/catan.ln.


# 1.117 16-Feb-2009 christos

- add siginfo translation for all arithmetic faults and traps.
- skip the current instruction for all faults, to avoid infinite loops on
SIGFPE (from OpenBSD)
Info from: http://bitsavers.vt100.net/pdf/dec/vax/archSpec/EK-VAXAR-RM-001_Arch_May82.pdf


Revision tags: netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.116 15-Oct-2008 wrstuden

branches: 1.116.2; 1.116.4; 1.116.8;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.115 05-Aug-2008 matt

For ARITH traps, set the siginfo code appropriately for FP related traps.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.114 21-May-2008 ad

branches: 1.114.4;
Remove unneeded playing about with kernel_lock.


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 keiichi-mipv6-base matt-armv6-nbase
# 1.113 11-Mar-2008 matt

branches: 1.113.2; 1.113.4; 1.113.6;
Rototill the vax code. Switch to devicet/PRIV_ALLOC. Cleanup vax autoconf
code. Move to prototype definitions. staticfy, constify, avoid casting.
Use device_* accessors.


Revision tags: hpcarm-cleanup-base
# 1.112 22-Feb-2008 matt

expand some printfs. Don't bother checking for curlwp == NULL; it can't
happen anymore. Convert some variables to bool.


Revision tags: nick-net80211-sync-base
# 1.111 20-Feb-2008 matt

branches: 1.111.2; 1.111.6;
Make NetBSD/vax work again. Add support for __HAVE_FAST_SOFTINTS.
Add a few small optimizations.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.110 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base ppcoea-renovation-base vmlocking-base
# 1.109 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.108 04-Mar-2007 christos

branches: 1.108.2; 1.108.10; 1.108.14; 1.108.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.107 16-Feb-2007 ad

branches: 1.107.2;
More MD changes to get vax compiling.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.105 23-Jul-2006 ad

branches: 1.105.4;
Use the LWP cached credentials where sane.


# 1.104 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 simonb-timecounters-base
# 1.103 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.102 14-May-2006 elad

integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base
# 1.101 15-Mar-2006 drochner

branches: 1.101.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument


Revision tags: yamt-pdpolicy-base2
# 1.100 12-Mar-2006 christos

welcome to syscall_intern.


# 1.99 07-Mar-2006 thorpej

branches: 1.99.2;
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.98 24-Dec-2005 perry

branches: 1.98.4; 1.98.6; 1.98.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.97 11-Dec-2005 christos

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.96 01-Jul-2005 christos

branches: 1.96.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.


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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.95 02-Sep-2004 tacha

Make this compile again.


# 1.94 28-Aug-2004 jdolecek

use uvm_grow() to update stack segment size on stack page fault instead
of MD code


Revision tags: 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 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-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.93 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.92 13-Feb-2004 drochner

plug obvious kernel lock leaks
(untested)


# 1.91 02-Jan-2004 cl

kernel part of no-syscall upcall stack return: libpthread registers
an offset between ss_sp and struct sa_stackinfo_t (located in struct
__pthread_st) when calling sa_register. The kernel increments the
sast_gen counter in struct sastack when an upcall stack is used.
libpthread increments the sasi_stackgen counter in struct
sa_stackinfo_t when an upcall stack is freed. The kernel compares the
two counters to decide if a stack is free or in use.

- add struct sa_stackinfo_t with sasi_stackgen to count stack use in
userland
- add sast_gen to struct sastack to count stack use in kernel
- add SA_FLAG_STACKINFO to enable the stackinfo_offset argument in the
sa_register syscall
- add sa_stackinfo_offset to struct sadata for offset between ss_sp
and struct sa_stackinfo_t
- add ssize_t stackinfo_offset argument to sa_register, initialize
struct sadata's sa_stackinfo_offset from it if SA_FLAG_STACKINFO is
set
- add sa_getstack, sa_getstack0, sa_stackused and sa_setstackfree
functions to find/use/free upcall stacks and use these where
appropriate
- don't record stack for upcall in sa_upcall0
- pass sau to sa_switchcall instead of l2 (l2 = curlwp in sa_switchcall)
- add sa_vp_blocker to struct sadata to pass recently blocked lwp to
sa_switchcall
- delay finding a stack for blocked upcalls to sa_switchcall
- add sa_stacknext to struct sadata pointing to next most likely free
upcall stack; also g/c sa_stackslist in struct sadata and sast_list
in struct sastack
- add L_SA_WOKEN flag: LWP is on sa_woken queue
- add L_SA_RECYCLE flag: LWP should be recycled in sa_setwoken
- replace l_upcallstack with L_SA_WOKEN/L_SA_RECYCLE/L_SA_BLOCKING
flags
- g/c now unused sast_blocker in struct sastack
- make sa_switchcall, sa_upcall0 and sa_upcall_getstate static in
kern_sa.c
- call sa_upcall_userret only once in userret
- split sa_makeupcalls out of sa_upcall_userret and use to process
the sa_upcalls queue
- on process exit: mark LWPs sleeping in saunblock interruptible; also
there are no LWPs sleeping on l->l_upcallstack anymore; also clear
sa_wokenq_head to prevent unblocked upcalls

additional changes:
- cleanup timerupcall sa_vp == curlwp check
- add check in sa_yield if we didn't block on our way here and we
wouldn't any longer be the LWP on the VP
- invalidate sa_vp_ofaultaddr after resolving pagefault


# 1.90 06-Nov-2003 he

Initialize 'p' to NULL, to work around that the compiler otherwise
can't know that 'p' is initialized before it's being used.

Reviewed by ragge.


# 1.89 01-Nov-2003 cl

Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().


# 1.88 31-Oct-2003 simonb

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


# 1.87 18-Oct-2003 ragge

Do not try to fetch the current proc if curlwp == NULL. This caused
DDB to fail if no process were running.


# 1.86 08-Oct-2003 thorpej

* Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.


# 1.85 29-Sep-2003 matt

trap.c: Set ksi.ksi_trap to frame->trap.
sig_machdep.c: Use ksi->ksi_addr in compat code to supply the
'code' argument to the old signal routines.


# 1.84 29-Sep-2003 matt

Set ksi_addr to frame->code.


# 1.83 29-Sep-2003 matt

Add SA_SIGINFO support for VAX.


# 1.82 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on vax


# 1.81 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.80 29-Jun-2003 fvdl

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


# 1.79 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.78 01-Mar-2003 matt

Add machdep sysctl support. Support booted_device, consdev, and
printfataltraps.


# 1.77 20-Jan-2003 matt

Fix some SA lossage.


# 1.76 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.75 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.74 16-Nov-2002 uebayasi

branches: 1.74.2;
Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.

Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.73 29-Sep-2002 thorpej

Record stack growth, done inline to avoid another function call on
every user page fault.

XXX Should make uvm_grow() an inline.


Revision tags: gehenna-devsw-base
# 1.72 23-Jun-2002 mrg

finish previous; it would be nice if people were to use the lovely
cross compiling mechanisms we have when making sweeping changes...


# 1.71 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.70 29-Apr-2002 thorpej

branches: 1.70.2; 1.70.4;
Only print console messages about SIGSEGV and SIGILL if the
kernel was built with DEBUG.


Revision tags: eeh-devprop-base
# 1.69 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.68 10-Mar-2002 ragge

Major update of the vax pmap:
- Reinstall the "dynamic page table length" that was removed some
years ago.
- Limit the user page table submap to max 5% of available memory.
- Free the page table space when a process is swapped out.
- If the UPT submap runs out of space, throw away pmap mappings
using the same algorithm as for swapping processes.

As a result of this, 4MB machines are useable again and it's even possible
to compile a kernel for 2MB machines (but it will be slow... :-)

Still to do:
- Multiprocessor fixes.
- More profiling.


Revision tags: newlock-base ifpoll-base
# 1.67 14-Feb-2002 chs

allow writing to write-only mappings. fixes PR 3493.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.66 28-Jun-2001 ragge

branches: 1.66.2; 1.66.8;
Panic if page fault on interrupt stack, per request from Jason Thorpe.


# 1.65 04-Jun-2001 ragge

Move some locks closer to the important point.


# 1.64 03-Jun-2001 ragge

A bunch of fixes:
- Make generic console routines not relying on running on master cpu.
- Add routine to start console transmitter (after IPI).
- Use real IPIs instead of the "console doorbell".
- Add routines cpu_send_ipi()/cpu_handle_ipi().


# 1.63 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.62 29-May-2001 ragge

Add a bunch of locking code for MP systems.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.61 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.60 31-Dec-2000 matt

branches: 1.60.2;
de-__P. cleanup the whitespace a bit. add a very small optimization.


# 1.59 31-Dec-2000 matt

Rename arithflt to trap. Change trap label to Xtrap. This is due to that
arithflt is really the trap handler so call it that.


# 1.58 24-Nov-2000 matt

Make this compile again.


# 1.57 17-Jul-2000 matt

Changes so that the kernel can be compiled under __ELF__.


# 1.56 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.55 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.54 29-May-2000 ragge

Use the cpu_info struct to store cpu-specific data in the same way in
both uniprocessor and multiprocessor environments. Use the otherwise
unused internal CPU register SSP to store the cpu_info pointer.
The macros curcpu(), curproc, cpu_number() and need_resched() are now the
same in both uniprocessor and multiprocessor environments.


# 1.53 27-May-2000 ragge

Rewrite cpu_fork(), it now looks like and works as other ports' cpu_fork()
(calling child_return() etc...). Have fun, Jason!


Revision tags: minoura-xpg4dl-base
# 1.52 27-May-2000 sommerfeld

branches: 1.52.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()


# 1.51 26-May-2000 thorpej

First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

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

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

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

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

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.


# 1.50 25-May-2000 thorpej

Move common return-to-userland goo into userret(), like other ports.


# 1.49 24-May-2000 thorpej

Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).


# 1.48 19-Mar-2000 ragge

First cut of multiprocessor support for vax. Still much to do before
other CPUs than the master can spin up.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.47 21-Aug-1999 matt

branches: 1.47.2;
Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now. I don't expect anyone to work with it
since the binutils and gas changes are still pending. But you got to
crawl before you walk.


Revision tags: chs-ubc2-base
# 1.46 10-Jul-1999 ragge

Rewrite the page table entry routines. Don't take a pte invalid fault for
missing pte's, instead map in pte entries in pmap_enter(). The user ptes
is no more handled by the VM system. All this made swapping start working
on VAX again.
Still to do:
- Keep refcount per pte page, so that those pages get free'd when the
process is swapped out. Right now they are only free'd when the pmap
is destroyed.

Many thanks to Chuck Silvers for all help finding the deadlock problems.


# 1.45 20-Jun-1999 ragge

Add some small checks to avoid unwanted panic types.


Revision tags: kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.44 24-Mar-1999 mrg

branches: 1.44.2; 1.44.4; 1.44.6;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.43 18-Mar-1999 chs

if uvm_fault() fails with KERN_RESOURCE_SHORTAGE, send a SIGKILL
and print a message about it. this will be used to recover from
out-of-swap conditions.


# 1.42 13-Mar-1999 ragge

Change vsbus to take a locator for all devices.
Figure out interrupt vector/mask on vsbus by forcing all devices to
generate interrupts in the match routine, like on unibus.


# 1.41 19-Jan-1999 ragge

Allocate (almost) all interrupt vectors dynamically. Simplifies much
work when adding support for new machines and devices.


# 1.40 01-Jan-1999 ragge

Giant change: NBPG now set to 4k and CLSIZE == 1 for vax. This change
made a whole bunch of annoying bugs disappear; mostly depending on
bad use of NBPG in non-MD code. The VAX port was the only port that
used this historical "feature".

The CL* macros should probably go away totally, there is no reason
at all to keep them.


Revision tags: kenh-if-detach-base
# 1.39 29-Nov-1998 ragge

Fix (small) segv bug. Recognize in-kernel trace and breakpoint traps.


Revision tags: chs-ubc-base eeh-paddr_t-base
# 1.38 04-Jul-1998 jonathan

defopt DDB.


# 1.37 25-Jun-1998 thorpej

defopt KTRACE


# 1.36 08-Jun-1998 ragge

Wall fixes.


# 1.35 03-May-1998 ragge

Wall cleaning + a little better fault checking.


# 1.34 02-Mar-1998 ragge

Support for UVM on VAXen.


# 1.33 03-Jan-1998 thorpej

Adjust for the fact that the page {0,1} base and length registers are now
stored in the pmap structure.


# 1.32 04-Nov-1997 ragge

Optimized copy/fetch/store routines; rewritten in assembler.


# 1.31 02-Nov-1997 ragge

Major rewriting, optimization and simplifying of the pmap code:

- Map in all physical memory first in system space. This reduces
pmap_copy_page() and pmap_zero_page to 3 resp. 2 instructions.
- Have fized position user page tables. Makes the pv_table smaller
and all reverse references faster (and simpler).
- Remove the wiring code. Nobody doesn't even know what a DR32 is anymore.
- Simulate page reference bit by setting page invalid, as suggested by
Rich Draves in a paper for 1991 Mach Usenix Symposium.

This reduced the time spent in the pmap module to between 70-75% of
the previous; and made process startup _much_ faster.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.30 19-Oct-1997 ragge

Only check for process switch if we are coming in from userspace.
Make ERESTART work for syscalls >63.
While we're here; clean up a little bit.


Revision tags: marc-pcmcia-base
# 1.29 11-Sep-1997 mycroft

Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.28 28-Jul-1997 ragge

branches: 1.28.2;
Handle XFC instruction faults.


# 1.27 06-Jul-1997 ragge

Remove __VM_PMAP_HACK.


# 1.26 13-Jun-1997 ragge

Bug fixes to page fault handling system. Many thanks to Johnny Billquist
for hunting down this bug(s).


# 1.25 12-Jun-1997 ragge

cpu_switch() should be mi_switch(). Pointed out by Johnny Billquist.
(bqt@update.uu.se)


Revision tags: is-newarp-before-merge is-newarp-base
# 1.24 06-Nov-1996 cgd

Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().


# 1.23 13-Oct-1996 christos

backout previous kprintf change


# 1.22 11-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.21 19-May-1996 ragge

Fixed all (proto)type errors. Fixes PR 2377.


# 1.20 08-Apr-1996 ragge

Added prototypes to everything. Made all files compile with -Wall.


# 1.19 17-Mar-1996 ragge

Do not have debugging enabled by default.


# 1.18 09-Mar-1996 ragge

Add support for ktracing syscalls.


# 1.17 02-Feb-1996 mycroft

#ifdef a call to kdb_trap() on DDB.


# 1.16 02-Feb-1996 mycroft

Fix #includes.


# 1.15 28-Jan-1996 ragge

Be able to handle debugger traps from kernel.


# 1.14 12-Nov-1995 ragge

struct ivec_dsp for interrupt vector allocation added.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.13 05-Jul-1995 ragge

Null pointer were referenced if signal occurred before first
syscall. Didn't hurt on 4.3 Reno binaries.


# 1.12 16-Jun-1995 ragge

rudimentary DDB support.


# 1.11 05-Jun-1995 ragge

Enabled auto reboot. Fixed bug in conf.c. Started use of rpb.
Detecting kernel stack overflow. Removed local mapping of
sigtramp code. Frob kernel stack pages in cpu_swapin().
Cleaned up some code and changed to KNF.


# 1.10 03-May-1995 ragge

Changed conf.c to new style. Took away double saving of regs in traps.
Changed boot() to use vfs_shutdown(). Updated setregs.


# 1.9 22-Apr-1995 christos

- added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.


# 1.8 30-Mar-1995 ragge

Speed-up of pmap and trap.
Fixes due to uVAX support.


# 1.7 23-Feb-1995 ragge

Support for uVAXII, new tmscp driver added.


# 1.6 13-Feb-1995 ragge

Zillions of bugfixes. Obsolete files taken away. New style config
fixed. Inline assembler commonly used.


# 1.5 25-Nov-1994 ragge

Lots of fixes and updates.


# 1.4 26-Oct-1994 cgd

new RCS ID format.


# 1.3 08-Oct-1994 ragge

Lots of bug fixes; clock and mem files new.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.2 16-Aug-1994 ragge

branches: 1.2.2;
Lots of bug fixes. Generic console support added. Major changes in machdep.c.
pmap.c now supports user process mapping. Page faults handles correctly.


# 1.1 02-Aug-1994 ragge

Initial VAX port merging.


# 1.135 22-May-2017 ragge

Update copyright notice for Ludd (remove clause 3 & 4).


Revision tags: 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
# 1.134 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: 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.133 03-Mar-2015 martin

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


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 rmind-smpnet-base tls-maxphys-base
# 1.132 25-Oct-2013 martin

branches: 1.132.6;
Mark a diagnostic-only variable


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.131 02-Aug-2012 matt

branches: 1.131.2; 1.131.4;
Supress print fatal traps if the process is being debugged of it the signal
will be caught by a signal handler.


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.130 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-base2 netbsd-6-base
# 1.129 02-Feb-2012 matt

On a kernel segfault, print the registers from the trapframe.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.128 03-Jul-2011 matt

branches: 1.128.2; 1.128.6;
Cleanup trapframe handling. Instead of keeping a trapframe pointer in the
pcb, put in the mdlwp instead. We had a dummy field so it didn't grow in
size. This also follows the practice that mips and powerpc follow that a
pointer to the user trapframe is in l->l_md.md_utf. Make trapframe members
start with tf_


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-nbase jym-xensuspend-base
# 1.127 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.126 20-Dec-2010 matt

branches: 1.126.2; 1.126.4;
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
# 1.125 13-Nov-2010 matt

Implement CAS using a RAS for non-MP VAX systems. This technique uses the
atomicity of indirect addressing for correctness. It also uses the knowledge
of dereferencing an address outside the page table length will cause a PTELEN
trap. [Tested on netbsd-5]


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.124 23-Apr-2010 rmind

Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.


# 1.123 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
# 1.122 05-Jan-2010 mbalmer

branches: 1.122.2; 1.122.4;
One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.121 10-Dec-2009 matt

Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.


# 1.120 21-Nov-2009 rmind

- Use lwp_getpcb() on VAX, clean from struct user usage.
- Include sys/user.h in MD proc.h .


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
# 1.119 25-Feb-2009 mhitch

The ci_want_resched check and preempt() call had been removed from
userret() which resulted in no process preemption (and probably
contributed to the signal trap loop locking up the machine that was
recently fixed). Put the check and preempt() call in the AST trap
handler to restore process preemption.


# 1.118 18-Feb-2009 mhitch

On the vax, the trapsignal() call will change frame->sp to point to a
callg on the user's stack that calls the user's signal handler, so do
the skip_opcode() before calling trapsignal(). A floating point
overflow no longer causes a signal loop. This should stop the native
compile hangs trying to compile src/lib/libm/complex/catan.ln.


# 1.117 16-Feb-2009 christos

- add siginfo translation for all arithmetic faults and traps.
- skip the current instruction for all faults, to avoid infinite loops on
SIGFPE (from OpenBSD)
Info from: http://bitsavers.vt100.net/pdf/dec/vax/archSpec/EK-VAXAR-RM-001_Arch_May82.pdf


Revision tags: netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.116 15-Oct-2008 wrstuden

branches: 1.116.2; 1.116.4; 1.116.8;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.115 05-Aug-2008 matt

For ARITH traps, set the siginfo code appropriately for FP related traps.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.114 21-May-2008 ad

branches: 1.114.4;
Remove unneeded playing about with kernel_lock.


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 keiichi-mipv6-base matt-armv6-nbase
# 1.113 11-Mar-2008 matt

branches: 1.113.2; 1.113.4; 1.113.6;
Rototill the vax code. Switch to devicet/PRIV_ALLOC. Cleanup vax autoconf
code. Move to prototype definitions. staticfy, constify, avoid casting.
Use device_* accessors.


Revision tags: hpcarm-cleanup-base
# 1.112 22-Feb-2008 matt

expand some printfs. Don't bother checking for curlwp == NULL; it can't
happen anymore. Convert some variables to bool.


Revision tags: nick-net80211-sync-base
# 1.111 20-Feb-2008 matt

branches: 1.111.2; 1.111.6;
Make NetBSD/vax work again. Add support for __HAVE_FAST_SOFTINTS.
Add a few small optimizations.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.110 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base ppcoea-renovation-base vmlocking-base
# 1.109 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.108 04-Mar-2007 christos

branches: 1.108.2; 1.108.10; 1.108.14; 1.108.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.107 16-Feb-2007 ad

branches: 1.107.2;
More MD changes to get vax compiling.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.105 23-Jul-2006 ad

branches: 1.105.4;
Use the LWP cached credentials where sane.


# 1.104 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 simonb-timecounters-base
# 1.103 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.102 14-May-2006 elad

integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base
# 1.101 15-Mar-2006 drochner

branches: 1.101.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument


Revision tags: yamt-pdpolicy-base2
# 1.100 12-Mar-2006 christos

welcome to syscall_intern.


# 1.99 07-Mar-2006 thorpej

branches: 1.99.2;
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.98 24-Dec-2005 perry

branches: 1.98.4; 1.98.6; 1.98.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.97 11-Dec-2005 christos

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.96 01-Jul-2005 christos

branches: 1.96.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.


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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.95 02-Sep-2004 tacha

Make this compile again.


# 1.94 28-Aug-2004 jdolecek

use uvm_grow() to update stack segment size on stack page fault instead
of MD code


Revision tags: 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 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-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.93 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.92 13-Feb-2004 drochner

plug obvious kernel lock leaks
(untested)


# 1.91 02-Jan-2004 cl

kernel part of no-syscall upcall stack return: libpthread registers
an offset between ss_sp and struct sa_stackinfo_t (located in struct
__pthread_st) when calling sa_register. The kernel increments the
sast_gen counter in struct sastack when an upcall stack is used.
libpthread increments the sasi_stackgen counter in struct
sa_stackinfo_t when an upcall stack is freed. The kernel compares the
two counters to decide if a stack is free or in use.

- add struct sa_stackinfo_t with sasi_stackgen to count stack use in
userland
- add sast_gen to struct sastack to count stack use in kernel
- add SA_FLAG_STACKINFO to enable the stackinfo_offset argument in the
sa_register syscall
- add sa_stackinfo_offset to struct sadata for offset between ss_sp
and struct sa_stackinfo_t
- add ssize_t stackinfo_offset argument to sa_register, initialize
struct sadata's sa_stackinfo_offset from it if SA_FLAG_STACKINFO is
set
- add sa_getstack, sa_getstack0, sa_stackused and sa_setstackfree
functions to find/use/free upcall stacks and use these where
appropriate
- don't record stack for upcall in sa_upcall0
- pass sau to sa_switchcall instead of l2 (l2 = curlwp in sa_switchcall)
- add sa_vp_blocker to struct sadata to pass recently blocked lwp to
sa_switchcall
- delay finding a stack for blocked upcalls to sa_switchcall
- add sa_stacknext to struct sadata pointing to next most likely free
upcall stack; also g/c sa_stackslist in struct sadata and sast_list
in struct sastack
- add L_SA_WOKEN flag: LWP is on sa_woken queue
- add L_SA_RECYCLE flag: LWP should be recycled in sa_setwoken
- replace l_upcallstack with L_SA_WOKEN/L_SA_RECYCLE/L_SA_BLOCKING
flags
- g/c now unused sast_blocker in struct sastack
- make sa_switchcall, sa_upcall0 and sa_upcall_getstate static in
kern_sa.c
- call sa_upcall_userret only once in userret
- split sa_makeupcalls out of sa_upcall_userret and use to process
the sa_upcalls queue
- on process exit: mark LWPs sleeping in saunblock interruptible; also
there are no LWPs sleeping on l->l_upcallstack anymore; also clear
sa_wokenq_head to prevent unblocked upcalls

additional changes:
- cleanup timerupcall sa_vp == curlwp check
- add check in sa_yield if we didn't block on our way here and we
wouldn't any longer be the LWP on the VP
- invalidate sa_vp_ofaultaddr after resolving pagefault


# 1.90 06-Nov-2003 he

Initialize 'p' to NULL, to work around that the compiler otherwise
can't know that 'p' is initialized before it's being used.

Reviewed by ragge.


# 1.89 01-Nov-2003 cl

Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().


# 1.88 31-Oct-2003 simonb

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


# 1.87 18-Oct-2003 ragge

Do not try to fetch the current proc if curlwp == NULL. This caused
DDB to fail if no process were running.


# 1.86 08-Oct-2003 thorpej

* Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.


# 1.85 29-Sep-2003 matt

trap.c: Set ksi.ksi_trap to frame->trap.
sig_machdep.c: Use ksi->ksi_addr in compat code to supply the
'code' argument to the old signal routines.


# 1.84 29-Sep-2003 matt

Set ksi_addr to frame->code.


# 1.83 29-Sep-2003 matt

Add SA_SIGINFO support for VAX.


# 1.82 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on vax


# 1.81 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.80 29-Jun-2003 fvdl

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


# 1.79 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.78 01-Mar-2003 matt

Add machdep sysctl support. Support booted_device, consdev, and
printfataltraps.


# 1.77 20-Jan-2003 matt

Fix some SA lossage.


# 1.76 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.75 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.74 16-Nov-2002 uebayasi

branches: 1.74.2;
Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.

Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.73 29-Sep-2002 thorpej

Record stack growth, done inline to avoid another function call on
every user page fault.

XXX Should make uvm_grow() an inline.


Revision tags: gehenna-devsw-base
# 1.72 23-Jun-2002 mrg

finish previous; it would be nice if people were to use the lovely
cross compiling mechanisms we have when making sweeping changes...


# 1.71 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.70 29-Apr-2002 thorpej

branches: 1.70.2; 1.70.4;
Only print console messages about SIGSEGV and SIGILL if the
kernel was built with DEBUG.


Revision tags: eeh-devprop-base
# 1.69 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.68 10-Mar-2002 ragge

Major update of the vax pmap:
- Reinstall the "dynamic page table length" that was removed some
years ago.
- Limit the user page table submap to max 5% of available memory.
- Free the page table space when a process is swapped out.
- If the UPT submap runs out of space, throw away pmap mappings
using the same algorithm as for swapping processes.

As a result of this, 4MB machines are useable again and it's even possible
to compile a kernel for 2MB machines (but it will be slow... :-)

Still to do:
- Multiprocessor fixes.
- More profiling.


Revision tags: newlock-base ifpoll-base
# 1.67 14-Feb-2002 chs

allow writing to write-only mappings. fixes PR 3493.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.66 28-Jun-2001 ragge

branches: 1.66.2; 1.66.8;
Panic if page fault on interrupt stack, per request from Jason Thorpe.


# 1.65 04-Jun-2001 ragge

Move some locks closer to the important point.


# 1.64 03-Jun-2001 ragge

A bunch of fixes:
- Make generic console routines not relying on running on master cpu.
- Add routine to start console transmitter (after IPI).
- Use real IPIs instead of the "console doorbell".
- Add routines cpu_send_ipi()/cpu_handle_ipi().


# 1.63 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.62 29-May-2001 ragge

Add a bunch of locking code for MP systems.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.61 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.60 31-Dec-2000 matt

branches: 1.60.2;
de-__P. cleanup the whitespace a bit. add a very small optimization.


# 1.59 31-Dec-2000 matt

Rename arithflt to trap. Change trap label to Xtrap. This is due to that
arithflt is really the trap handler so call it that.


# 1.58 24-Nov-2000 matt

Make this compile again.


# 1.57 17-Jul-2000 matt

Changes so that the kernel can be compiled under __ELF__.


# 1.56 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.55 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.54 29-May-2000 ragge

Use the cpu_info struct to store cpu-specific data in the same way in
both uniprocessor and multiprocessor environments. Use the otherwise
unused internal CPU register SSP to store the cpu_info pointer.
The macros curcpu(), curproc, cpu_number() and need_resched() are now the
same in both uniprocessor and multiprocessor environments.


# 1.53 27-May-2000 ragge

Rewrite cpu_fork(), it now looks like and works as other ports' cpu_fork()
(calling child_return() etc...). Have fun, Jason!


Revision tags: minoura-xpg4dl-base
# 1.52 27-May-2000 sommerfeld

branches: 1.52.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()


# 1.51 26-May-2000 thorpej

First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

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

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

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

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

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.


# 1.50 25-May-2000 thorpej

Move common return-to-userland goo into userret(), like other ports.


# 1.49 24-May-2000 thorpej

Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).


# 1.48 19-Mar-2000 ragge

First cut of multiprocessor support for vax. Still much to do before
other CPUs than the master can spin up.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.47 21-Aug-1999 matt

branches: 1.47.2;
Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now. I don't expect anyone to work with it
since the binutils and gas changes are still pending. But you got to
crawl before you walk.


Revision tags: chs-ubc2-base
# 1.46 10-Jul-1999 ragge

Rewrite the page table entry routines. Don't take a pte invalid fault for
missing pte's, instead map in pte entries in pmap_enter(). The user ptes
is no more handled by the VM system. All this made swapping start working
on VAX again.
Still to do:
- Keep refcount per pte page, so that those pages get free'd when the
process is swapped out. Right now they are only free'd when the pmap
is destroyed.

Many thanks to Chuck Silvers for all help finding the deadlock problems.


# 1.45 20-Jun-1999 ragge

Add some small checks to avoid unwanted panic types.


Revision tags: kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.44 24-Mar-1999 mrg

branches: 1.44.2; 1.44.4; 1.44.6;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.43 18-Mar-1999 chs

if uvm_fault() fails with KERN_RESOURCE_SHORTAGE, send a SIGKILL
and print a message about it. this will be used to recover from
out-of-swap conditions.


# 1.42 13-Mar-1999 ragge

Change vsbus to take a locator for all devices.
Figure out interrupt vector/mask on vsbus by forcing all devices to
generate interrupts in the match routine, like on unibus.


# 1.41 19-Jan-1999 ragge

Allocate (almost) all interrupt vectors dynamically. Simplifies much
work when adding support for new machines and devices.


# 1.40 01-Jan-1999 ragge

Giant change: NBPG now set to 4k and CLSIZE == 1 for vax. This change
made a whole bunch of annoying bugs disappear; mostly depending on
bad use of NBPG in non-MD code. The VAX port was the only port that
used this historical "feature".

The CL* macros should probably go away totally, there is no reason
at all to keep them.


Revision tags: kenh-if-detach-base
# 1.39 29-Nov-1998 ragge

Fix (small) segv bug. Recognize in-kernel trace and breakpoint traps.


Revision tags: chs-ubc-base eeh-paddr_t-base
# 1.38 04-Jul-1998 jonathan

defopt DDB.


# 1.37 25-Jun-1998 thorpej

defopt KTRACE


# 1.36 08-Jun-1998 ragge

Wall fixes.


# 1.35 03-May-1998 ragge

Wall cleaning + a little better fault checking.


# 1.34 02-Mar-1998 ragge

Support for UVM on VAXen.


# 1.33 03-Jan-1998 thorpej

Adjust for the fact that the page {0,1} base and length registers are now
stored in the pmap structure.


# 1.32 04-Nov-1997 ragge

Optimized copy/fetch/store routines; rewritten in assembler.


# 1.31 02-Nov-1997 ragge

Major rewriting, optimization and simplifying of the pmap code:

- Map in all physical memory first in system space. This reduces
pmap_copy_page() and pmap_zero_page to 3 resp. 2 instructions.
- Have fized position user page tables. Makes the pv_table smaller
and all reverse references faster (and simpler).
- Remove the wiring code. Nobody doesn't even know what a DR32 is anymore.
- Simulate page reference bit by setting page invalid, as suggested by
Rich Draves in a paper for 1991 Mach Usenix Symposium.

This reduced the time spent in the pmap module to between 70-75% of
the previous; and made process startup _much_ faster.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.30 19-Oct-1997 ragge

Only check for process switch if we are coming in from userspace.
Make ERESTART work for syscalls >63.
While we're here; clean up a little bit.


Revision tags: marc-pcmcia-base
# 1.29 11-Sep-1997 mycroft

Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.28 28-Jul-1997 ragge

branches: 1.28.2;
Handle XFC instruction faults.


# 1.27 06-Jul-1997 ragge

Remove __VM_PMAP_HACK.


# 1.26 13-Jun-1997 ragge

Bug fixes to page fault handling system. Many thanks to Johnny Billquist
for hunting down this bug(s).


# 1.25 12-Jun-1997 ragge

cpu_switch() should be mi_switch(). Pointed out by Johnny Billquist.
(bqt@update.uu.se)


Revision tags: is-newarp-before-merge is-newarp-base
# 1.24 06-Nov-1996 cgd

Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().


# 1.23 13-Oct-1996 christos

backout previous kprintf change


# 1.22 11-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.21 19-May-1996 ragge

Fixed all (proto)type errors. Fixes PR 2377.


# 1.20 08-Apr-1996 ragge

Added prototypes to everything. Made all files compile with -Wall.


# 1.19 17-Mar-1996 ragge

Do not have debugging enabled by default.


# 1.18 09-Mar-1996 ragge

Add support for ktracing syscalls.


# 1.17 02-Feb-1996 mycroft

#ifdef a call to kdb_trap() on DDB.


# 1.16 02-Feb-1996 mycroft

Fix #includes.


# 1.15 28-Jan-1996 ragge

Be able to handle debugger traps from kernel.


# 1.14 12-Nov-1995 ragge

struct ivec_dsp for interrupt vector allocation added.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.13 05-Jul-1995 ragge

Null pointer were referenced if signal occurred before first
syscall. Didn't hurt on 4.3 Reno binaries.


# 1.12 16-Jun-1995 ragge

rudimentary DDB support.


# 1.11 05-Jun-1995 ragge

Enabled auto reboot. Fixed bug in conf.c. Started use of rpb.
Detecting kernel stack overflow. Removed local mapping of
sigtramp code. Frob kernel stack pages in cpu_swapin().
Cleaned up some code and changed to KNF.


# 1.10 03-May-1995 ragge

Changed conf.c to new style. Took away double saving of regs in traps.
Changed boot() to use vfs_shutdown(). Updated setregs.


# 1.9 22-Apr-1995 christos

- added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.


# 1.8 30-Mar-1995 ragge

Speed-up of pmap and trap.
Fixes due to uVAX support.


# 1.7 23-Feb-1995 ragge

Support for uVAXII, new tmscp driver added.


# 1.6 13-Feb-1995 ragge

Zillions of bugfixes. Obsolete files taken away. New style config
fixed. Inline assembler commonly used.


# 1.5 25-Nov-1994 ragge

Lots of fixes and updates.


# 1.4 26-Oct-1994 cgd

new RCS ID format.


# 1.3 08-Oct-1994 ragge

Lots of bug fixes; clock and mem files new.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.2 16-Aug-1994 ragge

branches: 1.2.2;
Lots of bug fixes. Generic console support added. Major changes in machdep.c.
pmap.c now supports user process mapping. Page faults handles correctly.


# 1.1 02-Aug-1994 ragge

Initial VAX port merging.


Revision tags: 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
# 1.134 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: 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.133 03-Mar-2015 martin

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


Revision tags: 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 rmind-smpnet-base tls-maxphys-base
# 1.132 25-Oct-2013 martin

branches: 1.132.6;
Mark a diagnostic-only variable


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.131 02-Aug-2012 matt

branches: 1.131.2; 1.131.4;
Supress print fatal traps if the process is being debugged of it the signal
will be caught by a signal handler.


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.130 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-base2 netbsd-6-base
# 1.129 02-Feb-2012 matt

On a kernel segfault, print the registers from the trapframe.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.128 03-Jul-2011 matt

branches: 1.128.2; 1.128.6;
Cleanup trapframe handling. Instead of keeping a trapframe pointer in the
pcb, put in the mdlwp instead. We had a dummy field so it didn't grow in
size. This also follows the practice that mips and powerpc follow that a
pointer to the user trapframe is in l->l_md.md_utf. Make trapframe members
start with tf_


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase rmind-uvmplock-base jym-xensuspend-nbase jym-xensuspend-base
# 1.127 04-Mar-2011 joerg

Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.126 20-Dec-2010 matt

branches: 1.126.2; 1.126.4;
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
# 1.125 13-Nov-2010 matt

Implement CAS using a RAS for non-MP VAX systems. This technique uses the
atomicity of indirect addressing for correctness. It also uses the knowledge
of dereferencing an address outside the page table length will cause a PTELEN
trap. [Tested on netbsd-5]


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.124 23-Apr-2010 rmind

Remove lwp_uc_pool, replace it with kmem(9), plus add some consistency.
As discussed, a while ago, with ad@.


# 1.123 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
# 1.122 05-Jan-2010 mbalmer

branches: 1.122.2; 1.122.4;
One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.121 10-Dec-2009 matt

Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.


# 1.120 21-Nov-2009 rmind

- Use lwp_getpcb() on VAX, clean from struct user usage.
- Include sys/user.h in MD proc.h .


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
# 1.119 25-Feb-2009 mhitch

The ci_want_resched check and preempt() call had been removed from
userret() which resulted in no process preemption (and probably
contributed to the signal trap loop locking up the machine that was
recently fixed). Put the check and preempt() call in the AST trap
handler to restore process preemption.


# 1.118 18-Feb-2009 mhitch

On the vax, the trapsignal() call will change frame->sp to point to a
callg on the user's stack that calls the user's signal handler, so do
the skip_opcode() before calling trapsignal(). A floating point
overflow no longer causes a signal loop. This should stop the native
compile hangs trying to compile src/lib/libm/complex/catan.ln.


# 1.117 16-Feb-2009 christos

- add siginfo translation for all arithmetic faults and traps.
- skip the current instruction for all faults, to avoid infinite loops on
SIGFPE (from OpenBSD)
Info from: http://bitsavers.vt100.net/pdf/dec/vax/archSpec/EK-VAXAR-RM-001_Arch_May82.pdf


Revision tags: netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.116 15-Oct-2008 wrstuden

branches: 1.116.2; 1.116.4; 1.116.8;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.115 05-Aug-2008 matt

For ARITH traps, set the siginfo code appropriately for FP related traps.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.114 21-May-2008 ad

branches: 1.114.4;
Remove unneeded playing about with kernel_lock.


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 keiichi-mipv6-base matt-armv6-nbase
# 1.113 11-Mar-2008 matt

branches: 1.113.2; 1.113.4; 1.113.6;
Rototill the vax code. Switch to devicet/PRIV_ALLOC. Cleanup vax autoconf
code. Move to prototype definitions. staticfy, constify, avoid casting.
Use device_* accessors.


Revision tags: hpcarm-cleanup-base
# 1.112 22-Feb-2008 matt

expand some printfs. Don't bother checking for curlwp == NULL; it can't
happen anymore. Convert some variables to bool.


Revision tags: nick-net80211-sync-base
# 1.111 20-Feb-2008 matt

branches: 1.111.2; 1.111.6;
Make NetBSD/vax work again. Add support for __HAVE_FAST_SOFTINTS.
Add a few small optimizations.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base mjf-devfs-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base matt-armv6-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.110 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base ppcoea-renovation-base vmlocking-base
# 1.109 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.108 04-Mar-2007 christos

branches: 1.108.2; 1.108.10; 1.108.14; 1.108.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.107 16-Feb-2007 ad

branches: 1.107.2;
More MD changes to get vax compiling.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.105 23-Jul-2006 ad

branches: 1.105.4;
Use the LWP cached credentials where sane.


# 1.104 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 simonb-timecounters-base
# 1.103 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.102 14-May-2006 elad

integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base elad-kernelauth-base
# 1.101 15-Mar-2006 drochner

branches: 1.101.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument


Revision tags: yamt-pdpolicy-base2
# 1.100 12-Mar-2006 christos

welcome to syscall_intern.


# 1.99 07-Mar-2006 thorpej

branches: 1.99.2;
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.98 24-Dec-2005 perry

branches: 1.98.4; 1.98.6; 1.98.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.97 11-Dec-2005 christos

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.96 01-Jul-2005 christos

branches: 1.96.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.


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 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 1.95 02-Sep-2004 tacha

Make this compile again.


# 1.94 28-Aug-2004 jdolecek

use uvm_grow() to update stack segment size on stack page fault instead
of MD code


Revision tags: 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 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-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.93 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.92 13-Feb-2004 drochner

plug obvious kernel lock leaks
(untested)


# 1.91 02-Jan-2004 cl

kernel part of no-syscall upcall stack return: libpthread registers
an offset between ss_sp and struct sa_stackinfo_t (located in struct
__pthread_st) when calling sa_register. The kernel increments the
sast_gen counter in struct sastack when an upcall stack is used.
libpthread increments the sasi_stackgen counter in struct
sa_stackinfo_t when an upcall stack is freed. The kernel compares the
two counters to decide if a stack is free or in use.

- add struct sa_stackinfo_t with sasi_stackgen to count stack use in
userland
- add sast_gen to struct sastack to count stack use in kernel
- add SA_FLAG_STACKINFO to enable the stackinfo_offset argument in the
sa_register syscall
- add sa_stackinfo_offset to struct sadata for offset between ss_sp
and struct sa_stackinfo_t
- add ssize_t stackinfo_offset argument to sa_register, initialize
struct sadata's sa_stackinfo_offset from it if SA_FLAG_STACKINFO is
set
- add sa_getstack, sa_getstack0, sa_stackused and sa_setstackfree
functions to find/use/free upcall stacks and use these where
appropriate
- don't record stack for upcall in sa_upcall0
- pass sau to sa_switchcall instead of l2 (l2 = curlwp in sa_switchcall)
- add sa_vp_blocker to struct sadata to pass recently blocked lwp to
sa_switchcall
- delay finding a stack for blocked upcalls to sa_switchcall
- add sa_stacknext to struct sadata pointing to next most likely free
upcall stack; also g/c sa_stackslist in struct sadata and sast_list
in struct sastack
- add L_SA_WOKEN flag: LWP is on sa_woken queue
- add L_SA_RECYCLE flag: LWP should be recycled in sa_setwoken
- replace l_upcallstack with L_SA_WOKEN/L_SA_RECYCLE/L_SA_BLOCKING
flags
- g/c now unused sast_blocker in struct sastack
- make sa_switchcall, sa_upcall0 and sa_upcall_getstate static in
kern_sa.c
- call sa_upcall_userret only once in userret
- split sa_makeupcalls out of sa_upcall_userret and use to process
the sa_upcalls queue
- on process exit: mark LWPs sleeping in saunblock interruptible; also
there are no LWPs sleeping on l->l_upcallstack anymore; also clear
sa_wokenq_head to prevent unblocked upcalls

additional changes:
- cleanup timerupcall sa_vp == curlwp check
- add check in sa_yield if we didn't block on our way here and we
wouldn't any longer be the LWP on the VP
- invalidate sa_vp_ofaultaddr after resolving pagefault


# 1.90 06-Nov-2003 he

Initialize 'p' to NULL, to work around that the compiler otherwise
can't know that 'p' is initialized before it's being used.

Reviewed by ragge.


# 1.89 01-Nov-2003 cl

Avoid sneaking past signal delivery in sa_upcall_userret():
generate unblocked upcalls in sa_unblock_userret(), before signal
delivery/p_userret handling in userret().

Also defer getting state for preempted upcalls because on some ports
preemption can happen between sa_unblock_userret() and sa_upcall_userret().


# 1.88 31-Oct-2003 simonb

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


# 1.87 18-Oct-2003 ragge

Do not try to fetch the current proc if curlwp == NULL. This caused
DDB to fail if no process were running.


# 1.86 08-Oct-2003 thorpej

* Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.


# 1.85 29-Sep-2003 matt

trap.c: Set ksi.ksi_trap to frame->trap.
sig_machdep.c: Use ksi->ksi_addr in compat code to supply the
'code' argument to the old signal routines.


# 1.84 29-Sep-2003 matt

Set ksi_addr to frame->code.


# 1.83 29-Sep-2003 matt

Add SA_SIGINFO support for VAX.


# 1.82 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on vax


# 1.81 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.80 29-Jun-2003 fvdl

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


# 1.79 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.78 01-Mar-2003 matt

Add machdep sysctl support. Support booted_device, consdev, and
printfataltraps.


# 1.77 20-Jan-2003 matt

Fix some SA lossage.


# 1.76 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.75 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.74 16-Nov-2002 uebayasi

branches: 1.74.2;
Fix compilation errors introduced by recent trace_enter()/ktrsyscall() changes.

Provided by FUKAUMI Naoki <naoki at fukaumi dot org> in kern/19070.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.73 29-Sep-2002 thorpej

Record stack growth, done inline to avoid another function call on
every user page fault.

XXX Should make uvm_grow() an inline.


Revision tags: gehenna-devsw-base
# 1.72 23-Jun-2002 mrg

finish previous; it would be nice if people were to use the lovely
cross compiling mechanisms we have when making sweeping changes...


# 1.71 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.70 29-Apr-2002 thorpej

branches: 1.70.2; 1.70.4;
Only print console messages about SIGSEGV and SIGILL if the
kernel was built with DEBUG.


Revision tags: eeh-devprop-base
# 1.69 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.68 10-Mar-2002 ragge

Major update of the vax pmap:
- Reinstall the "dynamic page table length" that was removed some
years ago.
- Limit the user page table submap to max 5% of available memory.
- Free the page table space when a process is swapped out.
- If the UPT submap runs out of space, throw away pmap mappings
using the same algorithm as for swapping processes.

As a result of this, 4MB machines are useable again and it's even possible
to compile a kernel for 2MB machines (but it will be slow... :-)

Still to do:
- Multiprocessor fixes.
- More profiling.


Revision tags: newlock-base ifpoll-base
# 1.67 14-Feb-2002 chs

allow writing to write-only mappings. fixes PR 3493.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.66 28-Jun-2001 ragge

branches: 1.66.2; 1.66.8;
Panic if page fault on interrupt stack, per request from Jason Thorpe.


# 1.65 04-Jun-2001 ragge

Move some locks closer to the important point.


# 1.64 03-Jun-2001 ragge

A bunch of fixes:
- Make generic console routines not relying on running on master cpu.
- Add routine to start console transmitter (after IPI).
- Use real IPIs instead of the "console doorbell".
- Add routines cpu_send_ipi()/cpu_handle_ipi().


# 1.63 02-Jun-2001 chs

replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.62 29-May-2001 ragge

Add a bunch of locking code for MP systems.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.61 15-Mar-2001 chs

eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>


# 1.60 31-Dec-2000 matt

branches: 1.60.2;
de-__P. cleanup the whitespace a bit. add a very small optimization.


# 1.59 31-Dec-2000 matt

Rename arithflt to trap. Change trap label to Xtrap. This is due to that
arithflt is really the trap handler so call it that.


# 1.58 24-Nov-2000 matt

Make this compile again.


# 1.57 17-Jul-2000 matt

Changes so that the kernel can be compiled under __ELF__.


# 1.56 29-Jun-2000 mrg

remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>


# 1.55 26-Jun-2000 mrg

remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.54 29-May-2000 ragge

Use the cpu_info struct to store cpu-specific data in the same way in
both uniprocessor and multiprocessor environments. Use the otherwise
unused internal CPU register SSP to store the cpu_info pointer.
The macros curcpu(), curproc, cpu_number() and need_resched() are now the
same in both uniprocessor and multiprocessor environments.


# 1.53 27-May-2000 ragge

Rewrite cpu_fork(), it now looks like and works as other ports' cpu_fork()
(calling child_return() etc...). Have fun, Jason!


Revision tags: minoura-xpg4dl-base
# 1.52 27-May-2000 sommerfeld

branches: 1.52.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()


# 1.51 26-May-2000 thorpej

First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

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

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

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

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

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.


# 1.50 25-May-2000 thorpej

Move common return-to-userland goo into userret(), like other ports.


# 1.49 24-May-2000 thorpej

Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).


# 1.48 19-Mar-2000 ragge

First cut of multiprocessor support for vax. Still much to do before
other CPUs than the master can spin up.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.47 21-Aug-1999 matt

branches: 1.47.2;
Initial VAX ELF32 support (mostly untested). It's checked primarily for
testing and archival for now. I don't expect anyone to work with it
since the binutils and gas changes are still pending. But you got to
crawl before you walk.


Revision tags: chs-ubc2-base
# 1.46 10-Jul-1999 ragge

Rewrite the page table entry routines. Don't take a pte invalid fault for
missing pte's, instead map in pte entries in pmap_enter(). The user ptes
is no more handled by the VM system. All this made swapping start working
on VAX again.
Still to do:
- Keep refcount per pte page, so that those pages get free'd when the
process is swapped out. Right now they are only free'd when the pmap
is destroyed.

Many thanks to Chuck Silvers for all help finding the deadlock problems.


# 1.45 20-Jun-1999 ragge

Add some small checks to avoid unwanted panic types.


Revision tags: kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.44 24-Mar-1999 mrg

branches: 1.44.2; 1.44.4; 1.44.6;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.43 18-Mar-1999 chs

if uvm_fault() fails with KERN_RESOURCE_SHORTAGE, send a SIGKILL
and print a message about it. this will be used to recover from
out-of-swap conditions.


# 1.42 13-Mar-1999 ragge

Change vsbus to take a locator for all devices.
Figure out interrupt vector/mask on vsbus by forcing all devices to
generate interrupts in the match routine, like on unibus.


# 1.41 19-Jan-1999 ragge

Allocate (almost) all interrupt vectors dynamically. Simplifies much
work when adding support for new machines and devices.


# 1.40 01-Jan-1999 ragge

Giant change: NBPG now set to 4k and CLSIZE == 1 for vax. This change
made a whole bunch of annoying bugs disappear; mostly depending on
bad use of NBPG in non-MD code. The VAX port was the only port that
used this historical "feature".

The CL* macros should probably go away totally, there is no reason
at all to keep them.


Revision tags: kenh-if-detach-base
# 1.39 29-Nov-1998 ragge

Fix (small) segv bug. Recognize in-kernel trace and breakpoint traps.


Revision tags: chs-ubc-base eeh-paddr_t-base
# 1.38 04-Jul-1998 jonathan

defopt DDB.


# 1.37 25-Jun-1998 thorpej

defopt KTRACE


# 1.36 08-Jun-1998 ragge

Wall fixes.


# 1.35 03-May-1998 ragge

Wall cleaning + a little better fault checking.


# 1.34 02-Mar-1998 ragge

Support for UVM on VAXen.


# 1.33 03-Jan-1998 thorpej

Adjust for the fact that the page {0,1} base and length registers are now
stored in the pmap structure.


# 1.32 04-Nov-1997 ragge

Optimized copy/fetch/store routines; rewritten in assembler.


# 1.31 02-Nov-1997 ragge

Major rewriting, optimization and simplifying of the pmap code:

- Map in all physical memory first in system space. This reduces
pmap_copy_page() and pmap_zero_page to 3 resp. 2 instructions.
- Have fized position user page tables. Makes the pv_table smaller
and all reverse references faster (and simpler).
- Remove the wiring code. Nobody doesn't even know what a DR32 is anymore.
- Simulate page reference bit by setting page invalid, as suggested by
Rich Draves in a paper for 1991 Mach Usenix Symposium.

This reduced the time spent in the pmap module to between 70-75% of
the previous; and made process startup _much_ faster.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 1.30 19-Oct-1997 ragge

Only check for process switch if we are coming in from userspace.
Make ERESTART work for syscalls >63.
While we're here; clean up a little bit.


Revision tags: marc-pcmcia-base
# 1.29 11-Sep-1997 mycroft

Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)


Revision tags: thorpej-signal-base marc-pcmcia-bp
# 1.28 28-Jul-1997 ragge

branches: 1.28.2;
Handle XFC instruction faults.


# 1.27 06-Jul-1997 ragge

Remove __VM_PMAP_HACK.


# 1.26 13-Jun-1997 ragge

Bug fixes to page fault handling system. Many thanks to Johnny Billquist
for hunting down this bug(s).


# 1.25 12-Jun-1997 ragge

cpu_switch() should be mi_switch(). Pointed out by Johnny Billquist.
(bqt@update.uu.se)


Revision tags: is-newarp-before-merge is-newarp-base
# 1.24 06-Nov-1996 cgd

Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().


# 1.23 13-Oct-1996 christos

backout previous kprintf change


# 1.22 11-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.21 19-May-1996 ragge

Fixed all (proto)type errors. Fixes PR 2377.


# 1.20 08-Apr-1996 ragge

Added prototypes to everything. Made all files compile with -Wall.


# 1.19 17-Mar-1996 ragge

Do not have debugging enabled by default.


# 1.18 09-Mar-1996 ragge

Add support for ktracing syscalls.


# 1.17 02-Feb-1996 mycroft

#ifdef a call to kdb_trap() on DDB.


# 1.16 02-Feb-1996 mycroft

Fix #includes.


# 1.15 28-Jan-1996 ragge

Be able to handle debugger traps from kernel.


# 1.14 12-Nov-1995 ragge

struct ivec_dsp for interrupt vector allocation added.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.13 05-Jul-1995 ragge

Null pointer were referenced if signal occurred before first
syscall. Didn't hurt on 4.3 Reno binaries.


# 1.12 16-Jun-1995 ragge

rudimentary DDB support.


# 1.11 05-Jun-1995 ragge

Enabled auto reboot. Fixed bug in conf.c. Started use of rpb.
Detecting kernel stack overflow. Removed local mapping of
sigtramp code. Frob kernel stack pages in cpu_swapin().
Cleaned up some code and changed to KNF.


# 1.10 03-May-1995 ragge

Changed conf.c to new style. Took away double saving of regs in traps.
Changed boot() to use vfs_shutdown(). Updated setregs.


# 1.9 22-Apr-1995 christos

- added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.


# 1.8 30-Mar-1995 ragge

Speed-up of pmap and trap.
Fixes due to uVAX support.


# 1.7 23-Feb-1995 ragge

Support for uVAXII, new tmscp driver added.


# 1.6 13-Feb-1995 ragge

Zillions of bugfixes. Obsolete files taken away. New style config
fixed. Inline assembler commonly used.


# 1.5 25-Nov-1994 ragge

Lots of fixes and updates.


# 1.4 26-Oct-1994 cgd

new RCS ID format.


# 1.3 08-Oct-1994 ragge

Lots of bug fixes; clock and mem files new.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.2 16-Aug-1994 ragge

branches: 1.2.2;
Lots of bug fixes. Generic console support added. Major changes in machdep.c.
pmap.c now supports user process mapping. Page faults handles correctly.


# 1.1 02-Aug-1994 ragge

Initial VAX port merging.