History log of /netbsd-current/sys/arch/arm/arm32/fault.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.119 02-Feb-2024 andvar

fix various typos in comments.


Revision tags: thorpej-ifq-base thorpej-altq-separation-base
# 1.118 06-Oct-2023 martin

Fix previous and restore setting of "user" flag from trapframe.


# 1.117 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-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.116 01-Feb-2021 skrll

G/C some old code that was for acorn26


# 1.115 29-Jan-2021 skrll

the last_fault_code DEBUG variable is not MP safe, so don't compile it in.


# 1.114 29-Jan-2021 skrll

Typo in comment


# 1.113 20-Jun-2020 skrll

branches: 1.113.2;
KNF


# 1.112 20-Jun-2020 skrll

KNF #includes

Remove some unnecessary ones while I'm here.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.111 29-Mar-2020 skrll

Support PMAP_FAULTINFO on arm


Revision tags: is-mlppp-base ad-namecache-base3
# 1.110 24-Feb-2020 rin

0x%#x --> %#x for non-external codes.
Also, stop mixing up 0x%x and %#x in single files as far as possible.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.109 29-Nov-2019 ryo

branches: 1.109.2;
if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.118 06-Oct-2023 martin

Fix previous and restore setting of "user" flag from trapframe.


# 1.117 05-Oct-2023 ad

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

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


Revision tags: netbsd-10-base bouyer-sunxi-drm-base 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.116 01-Feb-2021 skrll

G/C some old code that was for acorn26


# 1.115 29-Jan-2021 skrll

the last_fault_code DEBUG variable is not MP safe, so don't compile it in.


# 1.114 29-Jan-2021 skrll

Typo in comment


# 1.113 20-Jun-2020 skrll

branches: 1.113.2;
KNF


# 1.112 20-Jun-2020 skrll

KNF #includes

Remove some unnecessary ones while I'm here.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.111 29-Mar-2020 skrll

Support PMAP_FAULTINFO on arm


Revision tags: is-mlppp-base ad-namecache-base3
# 1.110 24-Feb-2020 rin

0x%#x --> %#x for non-external codes.
Also, stop mixing up 0x%x and %#x in single files as far as possible.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.109 29-Nov-2019 ryo

branches: 1.109.2;
if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.116 01-Feb-2021 skrll

G/C some old code that was for acorn26


# 1.115 29-Jan-2021 skrll

the last_fault_code DEBUG variable is not MP safe, so don't compile it in.


# 1.114 29-Jan-2021 skrll

Typo in comment


Revision tags: thorpej-futex-base
# 1.113 20-Jun-2020 skrll

KNF


# 1.112 20-Jun-2020 skrll

KNF #includes

Remove some unnecessary ones while I'm here.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.111 29-Mar-2020 skrll

Support PMAP_FAULTINFO on arm


Revision tags: is-mlppp-base ad-namecache-base3
# 1.110 24-Feb-2020 rin

0x%#x --> %#x for non-external codes.
Also, stop mixing up 0x%x and %#x in single files as far as possible.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.109 29-Nov-2019 ryo

branches: 1.109.2;
if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.115 29-Jan-2021 skrll

the last_fault_code DEBUG variable is not MP safe, so don't compile it in.


# 1.114 29-Jan-2021 skrll

Typo in comment


Revision tags: thorpej-futex-base
# 1.113 20-Jun-2020 skrll

KNF


# 1.112 20-Jun-2020 skrll

KNF #includes

Remove some unnecessary ones while I'm here.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.111 29-Mar-2020 skrll

Support PMAP_FAULTINFO on arm


Revision tags: is-mlppp-base ad-namecache-base3
# 1.110 24-Feb-2020 rin

0x%#x --> %#x for non-external codes.
Also, stop mixing up 0x%x and %#x in single files as far as possible.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.109 29-Nov-2019 ryo

branches: 1.109.2;
if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.113 20-Jun-2020 skrll

KNF


# 1.112 20-Jun-2020 skrll

KNF #includes

Remove some unnecessary ones while I'm here.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 1.111 29-Mar-2020 skrll

Support PMAP_FAULTINFO on arm


Revision tags: is-mlppp-base ad-namecache-base3
# 1.110 24-Feb-2020 rin

0x%#x --> %#x for non-external codes.
Also, stop mixing up 0x%x and %#x in single files as far as possible.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.109 29-Nov-2019 ryo

branches: 1.109.2;
if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.111 29-Mar-2020 skrll

Support PMAP_FAULTINFO on arm


Revision tags: ad-namecache-base3
# 1.110 24-Feb-2020 rin

0x%#x --> %#x for non-external codes.
Also, stop mixing up 0x%x and %#x in single files as far as possible.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.109 29-Nov-2019 ryo

branches: 1.109.2;
if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.110 24-Feb-2020 rin

0x%#x --> %#x for non-external codes.
Also, stop mixing up 0x%x and %#x in single files as far as possible.


Revision tags: ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.109 29-Nov-2019 ryo

if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.109 29-Nov-2019 ryo

if Thumb-32 bit instruction located on a page boundariy, also need to consider the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2; 1.105.4;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


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

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

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

Welcome to NetBSD 8.99.37.


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.107 10-Aug-2018 maxv

Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@


Revision tags: pgoyette-compat-0728
# 1.106 15-Jul-2018 maxv

Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.105 28-Oct-2017 pgoyette

branches: 1.105.2;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


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 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.105 28-Oct-2017 pgoyette

Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base
# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.


# 1.104 02-Jul-2017 skrll

Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


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

Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.


Revision tags: nick-nhusb-base
# 1.102 25-Oct-2014 skrll

branches: 1.102.2;
Remove katelib.h and references to it.

{Read,Write}{Word,Byte} macros are provided in the files that still use
them. Someone(tm) should convert them to bus_space(9)


# 1.101 13-Aug-2014 matt

Add __NO_FIQ to prevent testing of the PSR FIQ bit
Use VALID_R15_PSR(pc, spsr) instead of testing explicitly


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.100 12-Apr-2014 skrll

Trailing whitespace


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.99 01-Apr-2014 matt

branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC


Revision tags: riastradh-drm2-base3
# 1.98 05-Mar-2014 matt

Now that maphist is statically initialized, remove initialize tests


# 1.97 05-Mar-2014 matt

Only do UVMHIST_LOG is maphist have its entry buffer initialized


# 1.96 26-Feb-2014 skrll

Re-enable FSR_WRITE for armv6.


# 1.95 25-Feb-2014 matt

Only use FSR_WRITE on armv7 for now.


# 1.94 25-Feb-2014 matt

ARMv6+ supplied a write bit in the FSR so use instead of reading the
instruction.


# 1.93 29-Jan-2014 matt

Add read_insn and read_thumb_insn inlines to hide the endianness of
instructions and use them as appropriate.


# 1.92 11-Jan-2014 matt

Add hw.printfataltraps sysctl. Always print fatal traps for init. For all
other processes, only do so if cpu_printfataltraps is true.


# 1.91 06-Nov-2013 christos

sprinkle diagused


# 1.90 18-Aug-2013 matt

Move parts of cpu.h that are not needed by MI code in <arm/locore.h>
Don't include <machine/cpu.h> or <machine/frame.h>, use <arm/locore.h>
Use <arm/asm.h> instead of <machine/arm.h>


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.89 02-Jul-2013 matt

Use __func__ in UVMHIST_FUNC


Revision tags: agc-symver-base
# 1.88 18-Feb-2013 matt

branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.87 10-Dec-2012 matt

Rename pcb_sp/PCB_SP to pcb_ksp/PCB_KSP so that ipsec.c will compile.


# 1.86 12-Nov-2012 skrll

C99 types


Revision tags: yamt-pagecache-base6
# 1.85 07-Sep-2012 matt

branches: 1.85.2;
Switch cortex_a9 back to need_ptesync = 1
Add code to disable the L2 cache on cortex-a9 (for now).
Add evcnt for all the fault types.
Move cache info in a structure and have one for the pcache and one for scache.
Probe L1/L2 caches properly for ARMv7


# 1.84 29-Aug-2012 matt

Use curcpu() instead of l->l_cpu


# 1.83 16-Aug-2012 matt

small rototill.
pcb_flags is dead. PCB_NOALIGNFLT is now in stored l_md.md_flags as
MDLWP_NOALIGNFLT. This avoids a few loads of the PCB in exception handling.
pcb_tf has been moved to l_md.md_tf. Again this avoids a lot of pcb
references just to access or set this. It also means that pcb doesn't
need to accessed by MI code.
Move pcb_onfault to after the pcb union.
Add pcb_sp macro to make code prettier.
Add lwp_settrapframe(l, tf) to set the l_md.md_tf field.
Use lwp_trapframe to access it (was process_frame but that name was changed
in a previous commit).
Kill off curpcb in acorn26.
Kill the checks for curlwp being NULL.
Move TRAP_USERMODE from arm32/fault.c to frame.h and a __PROG26 version.
Replace tests for usermode with that macro.


# 1.82 14-Aug-2012 matt

Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).


# 1.81 30-Jul-2012 matt

Recognize STREX* as store instructions


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.80 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.79 09-Feb-2012 christos

branches: 1.79.4;
Cosmetic:
- add %s: __func__, function names change [most of them were wrong]
- add a DIAGNOSTIC printf to help debug alignment fixups


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.78 20-Dec-2010 matt

branches: 1.78.8; 1.78.12;
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
# 1.77 07-Jul-2010 chs

implement ucas_* for arm.


Revision tags: uebayasi-xip-base1
# 1.76 21-Mar-2010 chs

assert that pcb_onfault is NULL in places where it should be.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.75 03-Feb-2010 wiz

branches: 1.75.2; 1.75.4;
Add missing parentheses. Found by cppcheck, reported by
Henning Petersen in PR 42728.


# 1.74 05-Jan-2010 mbalmer

One semicolon is enough.


Revision tags: matt-premerge-20091211
# 1.73 21-Nov-2009 rmind

Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.72 19-Nov-2008 matt

Conditionalize the KERN_SA bits.


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

branches: 1.71.2; 1.71.8;
build fix: <sys/savar.h> is needed to make dereferencing sadata_vp compile.
A fwd declaration is enough for defining a pointer, but you need the definition to access the structure


# 1.70 15-Oct-2008 wrstuden

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 14-Aug-2008 is

Fixed typo in message text noticed by Ilya Dogolazky. No functional change.


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

branches: 1.68.4;
Remove unneeded playing about with kernel_lock.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.67 27-Apr-2008 matt

branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.66 29-Mar-2008 chris

branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 chris-arm-intr-rework-base7 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base chris-arm-intr-rework-base6 chris-arm-intr-rework-base5 chris-arm-intr-rework-base4 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.65 06-Jan-2008 matt

branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.


Revision tags: nick-csl-alignment-base5 chris-arm-intr-rework-base3 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base chris-arm-intr-rework-base2 chris-arm-intr-rework-base jmcneill-pm-base nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 ppcoea-renovation-base thorpej-atomic-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base
# 1.64 18-Feb-2007 matt

branches: 1.64.18; 1.64.22; 1.64.24; 1.64.30; 1.64.36;
Changes for newlock2.


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

branches: 1.63.2;
Merge newlock2 to head.


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

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


# 1.61 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.60 15-May-2006 yamt

include kauth.h for kauth_cred_geteuid.


# 1.59 14-May-2006 elad

integrate kauth.


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

branches: 1.58.2;
adjust a diagnostic printf


# 1.57 16-Mar-2006 he

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


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

branches: 1.56.4; 1.56.6; 1.56.8; 1.56.10;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.55 11-Dec-2005 christos

merge ktrace-lwp.


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 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge ktrace-lwp-base
# 1.54 07-Jan-2005 skrll

branches: 1.54.10;
KNF


# 1.53 02-Jan-2005 joff

set L_SA_PAGEFAULT for prefetch aborts, too. Fixes kern/28828


Revision tags: kent-audio1-base
# 1.52 24-Oct-2004 skrll

Fix the argument to KERNEL_PROC_LOCK/KERNEL_PROC_UNLOCK.


# 1.51 21-Aug-2004 rearnsha

Add support for prefetch and data aborts in Thumb code.


# 1.50 08-Aug-2004 rearnsha

Add UVMHIST tracking for data and prefetch aborts.


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.49 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.48 13-Feb-2004 wiz

Uppercase CPU, plural is CPUs.


# 1.47 26-Jan-2004 scw

Make it possible to call badaddr_read() from interrupt context, even
if curpcb is NULL, by borrowing lwp0's pcb if necessary (needed to
be able to set pcb_onfault).

Problem reported by Allen Briggs.


# 1.46 21-Jan-2004 skrll

Leave errno as zero when we SIGSEGV. This means my CATS now passes
regress/lib/libc/siginfo/sigsegv

OK'd by christos.


# 1.45 20-Nov-2003 scw

In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.


# 1.44 18-Nov-2003 scw

On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.


# 1.43 15-Nov-2003 scw

Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.


# 1.42 14-Nov-2003 briggs

Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out. This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).


# 1.41 14-Nov-2003 scw

- In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
de-reference the fault pc.

- If a fault came from kernel mode, and the fault address looks to be in
the kernel's address space, and pcb_onfault is *set*, check the
instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
then one of the copy in/out routines is trying to read/write a
kernel address with the wrong privilege. If that address is actually
mapped, we could end up in an infinite loop because we failed to
notice that it's really a 'user mode' access. Yay for "crashme".
I suspect this also fixes PR port-arm/23052.

Note: This *could* be fixed by adding sanity checks to copyin et al,
but that would add extra overhead to the non-error path...

- Fix a couple of __predict_false cases.


# 1.40 14-Nov-2003 scw

Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.


# 1.39 31-Oct-2003 scw

Overhaul arm32's abort handlers:

- Assume a permission fault is always the result of an attempted
write, so no need to disassemble the opcode.
(as discussed with Richard Earnshaw/Jason Thorpe a week or two ago)

- Split out non-MMU data aborts into separate functions, and deal
correctly with XScale imprecise aborts. Specifically, the old code
made no attempt to handle the double abort faults which can occur
as a result of two consecutive external (imprecise) aborts. This
was easy to provoke by read(2)ing from a /dev/mem offset which caused
an external abort. With the old code, this would bring the system
down instantly, with little clue as to why. (hint: tf_spsr held
PSR_ABT32_MODE...)

- Re-write badaddr_read() to use pcb_onfault instead of adding extra
overhead to data_abort_handler(). A side effect of this is that it
now benefits from the XScale double abort recovery.

- Invoke the cpu-specific prefetch/data abort fixup routines only if
the host cpu actually needs it. On other cpus, the code is optimised
away.

- Sprinkle __predict_{false,true} in all the right places.

- G/C some excess debugging baggage.


# 1.38 25-Oct-2003 scw

Enable alignment faults on arm32 for both kernel and userland.

If COMPAT_15 and EXEC_AOUT are defined, support per-process
alignment checking where AFLTs are always enabled when running
kernel code and userland ELF binaries, and dynamically disabled/
enabled when switching to/from a.out binaries. This is necessary
in order to execute older a.out binaries, where gcc made
deliberate use of misaligned loads under certain circumstances.


# 1.37 15-Oct-2003 scw

Remove the #ifdef __XSCALE__ around the strd test as the instruction
is available on any v5E processor.

Pointed out by Richard Earnshaw.


# 1.36 13-Oct-2003 scw

Tweak the read/write data abort check to recognise Xscale's strd/ldrd
instructions.

While the original code matched "strd" just fine, it also matched
the "ldrd" instruction ...


# 1.35 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.34 05-Oct-2003 matt

Add SA_SIGINFO support for ARM (from Chris Gilbert).


# 1.33 19-Sep-2003 agc

If we're going to reference SA variables in this file, might as well
include the header file to define them. From Steve Woodford.


# 1.32 18-Sep-2003 cl

add MD part of SA/pthread pagefault handling on arm


# 1.31 09-Jul-2003 thorpej

Make faulting in DDB continue back in the top-level command
loop properly.


# 1.30 21-May-2003 thorpej

branches: 1.30.2;
Remove #ifdefs supporting the old pmap, switching fully to the new.


# 1.29 28-Apr-2003 scw

Fix the bug reported by Richard Earnshaw in port-arm32/21349.

Make sure to check the access permissions before doing
ref/mod/domain fixups. This is particularly important
on machines with ARM_VECTORS_LOW.


# 1.28 28-Apr-2003 briggs

Add arm32 machine-specific remote kgdb support. Largely
from PR port-arm/15530 by bsh@, but with some updates from
me, including a fresh arm32/kgdb_machdep.c--ported from pc532.


# 1.27 18-Apr-2003 scw

Add the generic arm32 bits of the new pmap, contributed by Wasabi Systems.

Some features of the new pmap are:

- It allows L1 descriptor tables to be shared efficiently between
multiple processes. A typical "maxusers 32" kernel, where NPROC is set
to 532, requires 35 L1s. A "maxusers 2" kernel runs quite happily
with just 4 L1s. This completely solves the problem of running out
of contiguous physical memory for allocating new L1s at runtime on a
busy system.

- Much improved cache/TLB management "smarts". This change ripples
out to encompass the low-level context switch code, which is also
much smarter about when to flush the cache/TLB, and when not to.

- Faster allocation of L2 page tables and associated metadata thanks,
in part, to the pool_cache enhancements recently contributed to
NetBSD by Wasabi Systems.

- Faster VM space teardown due to accurate referenced tracking of L2
page tables.

- Better/faster cache-alias tracking.

The new pmap is enabled by adding options ARM32_PMAP_NEW to the kernel
config file, and making the necessary changes to the port-specific
initarm() function. Several ports have already been converted and will
be committed shortly.


# 1.26 17-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 kqueue-aftermerge kqueue-beforemerge bjh21-hydra-base
# 1.25 13-Oct-2002 bjh21

branches: 1.25.2; 1.25.4;
It appears that MI code requires ci_cpuid to be the CPU number of the CPU
in question, whereas the ARM code was using it to hold the model
identification. To fix this, rename:

ci_cpuid -> ci_arm_cpuid
ci_cputype -> ci_arm_cputype (for consistency)
ci_cpurev -> ci_arm_cpurev (ditto)
ci_cpunum -> ci_cpuid

This makes top(1) give correct CPU numbers in its "STATE" column (all 0 for
now).


Revision tags: kqueue-base
# 1.24 27-Sep-2002 provos

remove trailing \n in panic(). approved perry.


# 1.23 21-Sep-2002 nathanw

In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.


Revision tags: gehenna-devsw-base
# 1.22 14-Aug-2002 briggs

G/c cowfault.


# 1.21 12-Aug-2002 bjh21

__KERNEL_RCSID


# 1.20 12-Aug-2002 bjh21

When pcb_onfault is set, pass the error code we get from uvm_fault()
(or EFAULT if we never called uvm_fault) to the onfault handler in R0,
in case it wants to use it.


# 1.19 25-May-2002 ichiro

make compile when define DEBUG


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

branches: 1.18.2; 1.18.4;
Centralize ARM CPU configuration information by adding a new header
file, <arm/cpuconf.h>, which pulls in "opt_cputypes.h" and then defines
the following:
* CPU_NTYPES -- now many CPU types are configured into the kernel. What
you really want to know is "== 1" or "> 1".
* Defines ARM_ARCH_2, ARM_ARCH_3, ARM_ARCH_4, ARM_ARCH_5, depending
on which ARM architecture versions are configured (based on CPU_*
options). Also defines ARM_NARCH to determins how many architecture
versions are configured.
* Defines ARM_MMU_MEMC, ARM_MMU_GENERIC, ARM_MMU_XSCALE depending on
which classes of ARM MMUs are configured into the kernel, and ARM_NMMUS
to determine how many MMU classes are configured.

Remove the needless inclusion of "opt_cputypes.h" in several places.
Convert remaining users to <arm/cpuconf.h>.


# 1.17 04-Apr-2002 skrll

Fix compile problem when DDB not defined.


# 1.16 29-Mar-2002 thorpej

Fix a printf format.


# 1.15 25-Mar-2002 thorpej

Garbage-collect fetchuserword(); nothing uses it any more.


# 1.14 25-Mar-2002 thorpej

In the Prefetch Abort handler, just do the uvm_fault() dance
directly, rather than doing a data access to fetch the page,
which meant we had to take another fault (!!).


# 1.13 24-Mar-2002 thorpej

Only check for SA110 bugs on SA110 CPUs with step <= K.


# 1.12 24-Mar-2002 thorpej

* Only check for SA110 rev K bug if we're on an SA110 (XXX should also
check stepping).
* In said check, don't use pmap_pte().
* Garbage-collect some useless debug code.


Revision tags: eeh-devprop-base
# 1.11 15-Mar-2002 reinoud

Serious bug fix: a userland program could panic the kernel when it tried to
issue an instruction that caused the late abort handler to be called for
wich the kernel had no support build in for.

It now only panics when it happends in kernel but otherwise signals the
process a SEGV signal.


Revision tags: newlock-base ifpoll-base
# 1.10 22-Feb-2002 thorpej

When reporting there is no VM map for a fault, also report the
faulting address.


# 1.9 14-Feb-2002 bjh21

Undo part of rev 1.8: SWP intructions really do both read and write
the referenced address.


# 1.8 14-Feb-2002 chs

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


# 1.7 05-Jan-2002 chris

Make some of the arm32 files build with LOOSE_PROTOTYPES not set in the makefile. Turned up a few mismatched functions. Note that this isn't all of the arm32 files. Aim will be to get arm32 kernels built with LOOSE_PROTOTYPES not set.


# 1.6 23-Nov-2001 thorpej

No need to pull in <machine/pte.h> directly.


# 1.5 22-Nov-2001 thorpej

Kill <machine/katelib.h>. Any place that still uses it should just
reference <arm/arm32/katelib.h> until such time as all use of this
file has been purged from the face of the earth.


Revision tags: thorpej-mips-cache-base
# 1.4 09-Nov-2001 thorpej

branches: 1.4.2;
Print the fault PC for non-USR Prefetch Aborts.


# 1.3 09-Nov-2001 thorpej

Implement a badaddr_read() routine which performs a load of the
specified size for the caller, and returns true or false indicating
whether or not a Data Abort occurred (i.e. the address was "bad").


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.2 05-Sep-2001 matt

branches: 1.2.4;
Change <machine/irqhandler.h> to <machine/intr.h> since the latter always
includes the former and is a standard include file.


# 1.1 28-Jul-2001 chris

branches: 1.1.2;
Move the generic arm32 files into arm/arm32 from arm32/arm32, tested kernel builds on cats and riscpc.