History log of /netbsd-current/sys/arch/powerpc/ibm4xx/trap.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.102 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.101 05-Oct-2022 rin

Minor style fixes to asm codes. No binary changes.


# 1.100 04-Oct-2022 rin

copy{in,out}{,str}: Drop needless dcbst.

Data cache is purely physical for 40[53] with 16KB pages, and therefore
no need to flush cache before context switch.

This significantly improves copy{in,out} against small data; for example,
bytebench on DHT becomes:

-Pipe Throughput 12440.0 8826.1 7.1
+Pipe Throughput 12440.0 18364.8 14.8

No performance/ATF regression observed on 405. 403 boots successfully
into multiuser mode, and builds some packages.


Revision tags: bouyer-sunxi-drm-base
# 1.99 12-Sep-2022 rin

Work around clang 13.0.0 bug; copy{in,out}() are miscompiled with -O[12],
by which /sbin/init cannot be executed.


# 1.98 12-Sep-2022 rin

Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.


# 1.97 12-Sep-2022 rin

copy{in,out}(): Minor clean up:
- No need to supply count (== 0).
- %r0 can be used as %[ctx] and %[len].


# 1.96 12-Sep-2022 rin

copyin(): Remove one more needless mtpid. No regression for full ATF.


# 1.95 11-Sep-2022 rin

copyin(): Fix comment. No binary changes.


# 1.94 11-Sep-2022 rin

copy{in,out}(): Tiny optimizations for __asm codes.
No regressions for full ATF run.

- Use {l,st}swx instead of loop for remaining bytes.
- Drop needless "mtpid %[x]; isync;".


# 1.93 11-Sep-2022 rin

copy{in,out}(): Add missing clobber registers to __asm codes.


# 1.92 11-Sep-2022 rin

copy{in,out}(): Add missing ``if (count == 0) goto done;''.


# 1.91 11-Sep-2022 rin

copy{in,out}(): Consistently use %[tmp] as scratch register. NFC.


# 1.90 11-Sep-2022 rin

copyin(): Fix copy-paste in comment. No binary changes.


# 1.89 11-Sep-2022 rin

copy{in,out}(): Cosmetic changes to __asm codes. No binary changes.

- Editor-friendly indentation.
- One insn per line.
- Group insns with logical blocks.


# 1.88 11-Sep-2022 rin

s/udaddr/uaddr/g for consistency; we use kaddr for kernel data address.
No binary changes.


# 1.87 30-May-2022 rin

For IBM_PPC403, emulate unaligned memory access for userland process.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.86 06-Mar-2021 rin

For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.


# 1.85 15-Jul-2020 rin

branches: 1.85.2;
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


# 1.84 15-Jul-2020 rin

Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.101 05-Oct-2022 rin

Minor style fixes to asm codes. No binary changes.


# 1.100 04-Oct-2022 rin

copy{in,out}{,str}: Drop needless dcbst.

Data cache is purely physical for 40[53] with 16KB pages, and therefore
no need to flush cache before context switch.

This significantly improves copy{in,out} against small data; for example,
bytebench on DHT becomes:

-Pipe Throughput 12440.0 8826.1 7.1
+Pipe Throughput 12440.0 18364.8 14.8

No performance/ATF regression observed on 405. 403 boots successfully
into multiuser mode, and builds some packages.


Revision tags: bouyer-sunxi-drm-base
# 1.99 12-Sep-2022 rin

Work around clang 13.0.0 bug; copy{in,out}() are miscompiled with -O[12],
by which /sbin/init cannot be executed.


# 1.98 12-Sep-2022 rin

Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.


# 1.97 12-Sep-2022 rin

copy{in,out}(): Minor clean up:
- No need to supply count (== 0).
- %r0 can be used as %[ctx] and %[len].


# 1.96 12-Sep-2022 rin

copyin(): Remove one more needless mtpid. No regression for full ATF.


# 1.95 11-Sep-2022 rin

copyin(): Fix comment. No binary changes.


# 1.94 11-Sep-2022 rin

copy{in,out}(): Tiny optimizations for __asm codes.
No regressions for full ATF run.

- Use {l,st}swx instead of loop for remaining bytes.
- Drop needless "mtpid %[x]; isync;".


# 1.93 11-Sep-2022 rin

copy{in,out}(): Add missing clobber registers to __asm codes.


# 1.92 11-Sep-2022 rin

copy{in,out}(): Add missing ``if (count == 0) goto done;''.


# 1.91 11-Sep-2022 rin

copy{in,out}(): Consistently use %[tmp] as scratch register. NFC.


# 1.90 11-Sep-2022 rin

copyin(): Fix copy-paste in comment. No binary changes.


# 1.89 11-Sep-2022 rin

copy{in,out}(): Cosmetic changes to __asm codes. No binary changes.

- Editor-friendly indentation.
- One insn per line.
- Group insns with logical blocks.


# 1.88 11-Sep-2022 rin

s/udaddr/uaddr/g for consistency; we use kaddr for kernel data address.
No binary changes.


# 1.87 30-May-2022 rin

For IBM_PPC403, emulate unaligned memory access for userland process.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.86 06-Mar-2021 rin

For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.


# 1.85 15-Jul-2020 rin

branches: 1.85.2;
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


# 1.84 15-Jul-2020 rin

Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.99 12-Sep-2022 rin

Work around clang 13.0.0 bug; copy{in,out}() are miscompiled with -O[12],
by which /sbin/init cannot be executed.


# 1.98 12-Sep-2022 rin

Make ibm4xx kernels compiled by clang.

As clang cannot correctly assemble m[ft]pid:
- for asm sources, use m[ft]spr from/to SPR_PID
- for C sources, use M[FT]PID macros (see include/ibm4xx/spr.h)
This is ugly...

No binary changes for GCC-compiled kernels.


# 1.97 12-Sep-2022 rin

copy{in,out}(): Minor clean up:
- No need to supply count (== 0).
- %r0 can be used as %[ctx] and %[len].


# 1.96 12-Sep-2022 rin

copyin(): Remove one more needless mtpid. No regression for full ATF.


# 1.95 11-Sep-2022 rin

copyin(): Fix comment. No binary changes.


# 1.94 11-Sep-2022 rin

copy{in,out}(): Tiny optimizations for __asm codes.
No regressions for full ATF run.

- Use {l,st}swx instead of loop for remaining bytes.
- Drop needless "mtpid %[x]; isync;".


# 1.93 11-Sep-2022 rin

copy{in,out}(): Add missing clobber registers to __asm codes.


# 1.92 11-Sep-2022 rin

copy{in,out}(): Add missing ``if (count == 0) goto done;''.


# 1.91 11-Sep-2022 rin

copy{in,out}(): Consistently use %[tmp] as scratch register. NFC.


# 1.90 11-Sep-2022 rin

copyin(): Fix copy-paste in comment. No binary changes.


# 1.89 11-Sep-2022 rin

copy{in,out}(): Cosmetic changes to __asm codes. No binary changes.

- Editor-friendly indentation.
- One insn per line.
- Group insns with logical blocks.


# 1.88 11-Sep-2022 rin

s/udaddr/uaddr/g for consistency; we use kaddr for kernel data address.
No binary changes.


# 1.87 30-May-2022 rin

For IBM_PPC403, emulate unaligned memory access for userland process.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.86 06-Mar-2021 rin

For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.


# 1.85 15-Jul-2020 rin

branches: 1.85.2;
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


# 1.84 15-Jul-2020 rin

Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.95 11-Sep-2022 rin

copyin(): Fix comment. No binary changes.


# 1.94 11-Sep-2022 rin

copy{in,out}(): Tiny optimizations for __asm codes.
No regressions for full ATF run.

- Use {l,st}swx instead of loop for remaining bytes.
- Drop needless "mtpid %[x]; isync;".


# 1.93 11-Sep-2022 rin

copy{in,out}(): Add missing clobber registers to __asm codes.


# 1.92 11-Sep-2022 rin

copy{in,out}(): Add missing ``if (count == 0) goto done;''.


# 1.91 11-Sep-2022 rin

copy{in,out}(): Consistently use %[tmp] as scratch register. NFC.


# 1.90 11-Sep-2022 rin

copyin(): Fix copy-paste in comment. No binary changes.


# 1.89 11-Sep-2022 rin

copy{in,out}(): Cosmetic changes to __asm codes. No binary changes.

- Editor-friendly indentation.
- One insn per line.
- Group insns with logical blocks.


# 1.88 11-Sep-2022 rin

s/udaddr/uaddr/g for consistency; we use kaddr for kernel data address.
No binary changes.


# 1.87 30-May-2022 rin

For IBM_PPC403, emulate unaligned memory access for userland process.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.86 06-Mar-2021 rin

For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.


# 1.85 15-Jul-2020 rin

branches: 1.85.2;
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


# 1.84 15-Jul-2020 rin

Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.87 30-May-2022 rin

For IBM_PPC403, emulate unaligned memory access for userland process.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.86 06-Mar-2021 rin

For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.


# 1.85 15-Jul-2020 rin

branches: 1.85.2;
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


# 1.84 15-Jul-2020 rin

Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.86 06-Mar-2021 rin

For booke and ibm4xx, switch to software-based single-stepping for PT_STEP
ptrace(2) command from broken hardware-based implementation.

As described in proposal on port-powerpc@,

http://mail-index.netbsd.org/port-powerpc/2021/02/26/msg003597.html

hardware debug facilities of booke and 4xx use critical interrupts, that
are difficult to handle for this purpose; they are not automatically masked
when entering kernel mode via system call trap or hardware interrupt.
See my proposal above for more details.

Now, hardware debug facilities are exclusively usable by kernel itself.
They are much more functional than PSL_SE MSR bit of oea, and should be
useful to, e.g., support byte-granular watchpoint for DDB in the future.


Revision tags: thorpej-futex-base
# 1.85 15-Jul-2020 rin

For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


# 1.84 15-Jul-2020 rin

Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.85 15-Jul-2020 rin

For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


# 1.84 15-Jul-2020 rin

Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.83 06-Jul-2020 rin

- Drop unused opt_altivec.h.
- Include missing opt_ppcarch.h.


# 1.82 06-Jul-2020 rin

Style and cosmetic changes. No binary changes intended.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.81 19-Jun-2020 rin

Try to sanitize usage of isync and sync instructions.

According to reference manuals of 4xx, isync is "context synchronization",
which satisfies both 1 and 2:

1. instructions preceding it complete in the context that existed before it
2. instructions following it complete in the context that exists after it

Whereas sync (== msync for 440) is "execution synchronization", which
satisfies just 1, not 2. At the same time, sync guarantees "storage
synchronization", by which any previous storage references completes
before any subsequent instructions begin to execute.

Tested on 405 over months.


# 1.80 19-Jun-2020 rin

Return correct signo and si_code to userland when page fault.
Taken from powerpc/trap.c. Found by tests in lib/libc/sys.


# 1.79 19-Jun-2020 rin

Return error code from uvm layer on fault, instead of hard-coded 1.
Found by some tests in tests/lib/libc/sys.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

branches: 1.70.4; 1.70.6;
Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.78 21-Feb-2020 rin

Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49


# 1.77 21-Feb-2020 rin

Tiny improvements to copyin() and copyout():

- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
support unaligned word load/store by hardware. In many cases, both
source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
invalidate the cache line. Copied data should be used soon after.


# 1.76 21-Feb-2020 rin

Cosmetic changes for assembler codes. No binary changes.


# 1.75 21-Feb-2020 rin

Comment out badaddr() and badaddr_read() on ibm4xx for now.

They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.74 20-Feb-2020 rin

Oops, sort header again. My bad...


# 1.73 20-Feb-2020 rin

Convert mi_userret(9) into powerpc-specific userret().

This is necessary in order to support RAS.

There are some sanity checks in userret() as well.


# 1.72 20-Feb-2020 rin

Sort more headers...


# 1.71 20-Feb-2020 rin

Sort headers.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 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 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
# 1.69 26-Dec-2016 rin

branches: 1.69.16;
Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


Revision tags: isaki-audio2-base
# 1.70 07-Apr-2019 thorpej

Detangle some of the PowerPC CPU configuration spaghetti.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 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 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
# 1.69 26-Dec-2016 rin

Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

branches: 1.67.2; 1.67.4;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.


# 1.69 26-Dec-2016 rin

Remove wrong comment which was copy-and-pasted from somewhere.


# 1.68 16-Dec-2016 rin

Remove needless goto's. No functional changes.


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 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 nick-nhusb-base
# 1.67 18-Oct-2014 snj

src is too big these days to tolerate superfluous apostrophes. It's
"its", people!


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 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.66 23-Aug-2013 matt

Get rid of MDLWP_USED{FPU,VEC}


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.65 23-Jul-2012 matt

branches: 1.65.2; 1.65.4;
Add support for PPC FP emulation to BookE.
Pass a ksiginfo_t to fpu_emulation so it can give more detailed
info on signals.


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.64 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.63 13-Dec-2011 kiyohara

Remove white-spaces.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.62 21-Jun-2011 matt

branches: 1.62.2; 1.62.6;
Switch to use new common cpu_ast routine.


# 1.61 18-Jun-2011 matt

Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.


# 1.60 14-Jun-2011 matt

Make startlwp and upcallret common instead of having 3 mostly identical copies.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.59 05-Jun-2011 matt

Remove <machine/atomic.h>; use <sys/atomic.h> instead.
Add <powerpc/cpuset.h> (for mpc85xx pmap).
Add some initial MP code for mpc85xx
Rework ipi code to be common across all ppcs
Change PPC to keep curlwp in %r13 while in the kernel.
Move astpending from cpu_info to mdlwp
Improve cpu_need_resched to be more MP friendly.


Revision tags: cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jym-xensuspend-base
# 1.58 18-Jan-2011 matt

branches: 1.58.4;
Add support for BookE Freescale MPC85xx (e500 core) processors.
Add fast softint support for PowerPC (though only booke uses it).
Redo FPU/VEC support and add e500 SPE support.
Rework trap/intrs to use a common trapframe format.
Support SOFTFLOAT (no hardfloat or fpu emulation) for BookE.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231
# 1.57 20-Dec-2010 matt

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


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 1.56 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.55 20-Mar-2010 chs

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


Revision tags: yamt-nfs-mp-base9
# 1.54 25-Feb-2010 matt

branches: 1.54.2;
Adapt to spr.h breakup.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.53 21-Nov-2009 rmind

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


# 1.52 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

Discussed on <tech-kern>, reviewed by <ad>.


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-base
# 1.51 14-Mar-2009 dsl

Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)


# 1.50 14-Mar-2009 dsl

Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 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.49 15-Oct-2008 wrstuden

branches: 1.49.2; 1.49.8; 1.49.16;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.48 02-Jan-2008 ad

branches: 1.48.6; 1.48.10; 1.48.12; 1.48.16;
Merge vmlocking2 to head.


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.47 28-Nov-2007 simonb

branches: 1.47.2; 1.47.6;
Use lswi/syswi instead of lwz/stw when doing loads/stores since we don't
know the alignment of data being copied. 403 cores have alignment
restrictions on lwz/stw that 405 cores don't have. lswi/syswi benchmark
at the same speed as lwz/stw on a 405 Walnut.

Fixes problems reported by Juergen Hannken-Illjes on the Explora.


Revision tags: bouyer-xenamd64-base
# 1.46 22-Nov-2007 hpeyerl

Optimize copyin/copyout to transfer as many words as possible before doing
residual bytes. This improves small transfers. As a result, we can avoid
doing bigcopyin/bigcopyout until len>1024 instead of len>256.

Reviewed by: simonb.

(everybody run, Herb's in the kernel again).


Revision tags: jmcneill-base bouyer-xenamd64-base2
# 1.45 05-Nov-2007 ad

branches: 1.45.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.


Revision tags: yamt-x86pmap-base4
# 1.44 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 nick-csl-alignment-base matt-mips64-base ppcoea-renovation-base mjf-ufs-trans-base vmlocking-base
# 1.43 09-Jul-2007 ad

branches: 1.43.8; 1.43.10; 1.43.12; 1.43.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


# 1.42 22-May-2007 rjs

Fix for yamt-idlelwp merge.


# 1.41 17-May-2007 yamt

merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.40 04-Mar-2007 christos

branches: 1.40.2; 1.40.4; 1.40.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.39 15-Feb-2007 ad

branches: 1.39.2;
Make these compile again.


Revision tags: post-newlock2-merge
# 1.38 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 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.37 05-Oct-2006 chs

add support for O_DIRECT (I/O directly to application memory,
bypassing any kernel caching for file data).


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.36 23-Jul-2006 ad

branches: 1.36.4; 1.36.6;
Use the LWP cached credentials where sane.


# 1.35 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.34 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.33 14-May-2006 elad

integrate kauth.


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

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


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

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


# 1.30 07-Mar-2006 thorpej

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


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.29 24-Dec-2005 perry

branches: 1.29.4; 1.29.6; 1.29.8;
bare asm -> __asm


# 1.28 24-Dec-2005 perry

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.27 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.26 03-Jun-2005 scw

branches: 1.26.2;
Appease the -Wshadow and -Wcast-qual gods.


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 kent-audio2-base
# 1.25 25-Feb-2005 simonb

KNF: put "if (...)" and following statement on separate lines.


Revision tags: yamt-km-base2 yamt-km-base
# 1.24 19-Jan-2005 simonb

branches: 1.24.2;
White space nit.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.23 02-Sep-2004 scw

branches: 1.23.4;
Apply suggested changes from PR port-powerpc/24830 arch/powerpc/ibm4xx:
Bad register constraints in copyin(), copyout(), copyinstr(), copyoutstr(),
and delay().


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.22 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.21 24-Feb-2004 drochner

deliver SIGSEGV/SEGV_ACCERR if code execution on stack is attempted,
tested by Juergen Hannken-Illjes
(there are more uninitialized ksi.ksi_code arguments)


# 1.20 31-Oct-2003 cl

Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.


# 1.19 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.18 26-Sep-2003 eeh

Define ksi.


# 1.17 25-Sep-2003 matt

Add siginfo support for PowerPC.


# 1.16 19-Sep-2003 cl

add MD part of SA/pthread pagefault handling on powerpc


# 1.15 24-Aug-2003 chs

add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

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

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

originally from openbsd, adapted for netbsd by me.


# 1.14 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.13 28-Jun-2003 simonb

branches: 1.13.2;
Sprinkle some KNF.


# 1.12 07-Feb-2003 thorpej

Fix some printf formats.


# 1.11 02-Feb-2003 matt

Perform a rototill of the powerpc code. Mandate use of SPRG0 to store
a pointer to current cpu's cpu_info structure. Use cpu_info for
intstk,intr_depth,still_stk,idle_pcb,curpcb,curlwp,etal even on
non-MULTIPROCESSOR machines. Add common macros GET_CPUINFO and
INIT_CPUINFO to get and initialize the cpu_info struct on startup. Make
ibm4xx use the standard <powerpc/frame.h>. Use IFRAME_xx in ibm4xx
trap_subr.S instead of explicit magic offsets. Move INTSTK and SPILLSTK
to std.<platform>. Change faultbuf to a struct instead of an array.

On MPC6XX cpus, stop using the vector page for temporary space and use
reserved space in cpu_info.


# 1.10 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.9 25-Nov-2002 thorpej

branches: 1.9.2;
Statements after labels.


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.8 02-Aug-2002 chs

use a completely separate trap handler for syscall traps.
this reduces syscall overhead by 10% to 20% depending on cpu type.


# 1.7 11-Jul-2002 simonb

Clean up some white space niggles.


# 1.6 05-Jul-2002 matt

Peform a rototill over the powerpc-based ports.

Move the trap/vector initialization for MPC6xx ports to mpc6xx_machdep.c
Also move softnet, install_extintr, mapiodev, kvtop. Add common BAT
initialization code.

Add user Altivec support.

Fix calls to OF_call_method in macppc/macppc/machdep.c.

Use ci_fpuproc in cpu_info instead of separate fpuproc.

Add separate syscall.c and defined __HAVE_SYSCALL_INTERN.


# 1.5 17-Jun-2002 christos

apply the fix from the powerpc port. this is almost a copy of powerpc/trap.c
and needs to be refactored.


# 1.4 17-Jun-2002 christos

MD systrace gluons.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base newlock-base ifpoll-base
# 1.3 14-Feb-2002 chs

branches: 1.3.8;
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.2 22-Jul-2001 wiz

branches: 1.2.6;
bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.


# 1.1 13-Jun-2001 simonb

branches: 1.1.2;
Add a port to IBM's PPC405GP Reference Board (the "walnut")
by Eduardo Horvath and Simon Burge of Wasabi Systems.

IBM 4xx series CPU features:
- New pmap and revised trap handler.
- Support on-chip timers, PCI controller, UARTs
- Framework for on-chip ethernet and watchdog timer.
General PowerPC features:
- Add in-kernel PPC floating point emulation
- New in{,4}_cksum that is between 1.5 and 5 times faster than the
old version depending on CPU type.
General changes:
- Kernel support for generic dbsym-style symbols.