Home | History | Annotate | Download | only in arm32
History log of /src/sys/arch/arm/arm32/fault.c
RevisionDateAuthorComments
 1.119  02-Feb-2024  andvar fix various typos in comments.
 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).
 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.
 1.111  29-Mar-2020  skrll Support PMAP_FAULTINFO on arm
 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.
 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.
 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.
 1.107  10-Aug-2018  maxv Retire CPU_ARM2, CPU_ARM250 and CPU_ARM3, they are all leftovers of
acorn26.

ok jmcneill@ skrll@
 1.106  15-Jul-2018  maxv Retire ipkdb entirely. The option was removed from the config files
yesterday.

ok kamil christos
 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.
 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.
 1.103  02-Mar-2015  martin branches: 1.103.10;
Handle EINVAL in the fault path and send SIGBUS for mmap acces past EOF.
 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
 1.100  12-Apr-2014  skrll Trailing whitespace
 1.99  01-Apr-2014  matt branches: 1.99.2;
In prefetch_abort, call uvm_fault with VM_PROT_EXEC
 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>
 1.89  02-Jul-2013  matt Use __func__ in UVMHIST_FUNC
 1.88  18-Feb-2013  matt branches: 1.88.2;
Supply VM_PROT_EXECUTE to pmap_fault_fixup when trying to fixup prefetch
aborts.
 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
 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
 1.80  19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 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
 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>.
 1.77  07-Jul-2010  chs implement ucas_* for arm.
 1.76  21-Mar-2010  chs assert that pcb_onfault is NULL in places where it should be.
 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.
 1.73  21-Nov-2009  rmind Use lwp_getpcb() on ARM (and acorn26/32), clean from struct user usage.
 1.72  19-Nov-2008  matt Conditionalize the KERN_SA bits.
 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.
 1.69  14-Aug-2008  is Fixed typo in message text noticed by Ilya Dogolazky. No functional change.
 1.68  21-May-2008  ad branches: 1.68.4;
Remove unneeded playing about with kernel_lock.
 1.67  27-Apr-2008  matt branches: 1.67.2;
Merge kernel changes in matt-armv6 to HEAD.
 1.66  29-Mar-2008  chris branches: 1.66.2; 1.66.4;
Add missing bracing for some THUMB_CODE.
 1.65  06-Jan-2008  matt branches: 1.65.6;
current_intr_depth is dead. Make sure we don't use it anymore.
 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.
 1.63  09-Feb-2007  ad branches: 1.63.2;
Merge newlock2 to head.
 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.
 1.60  15-May-2006  yamt include kauth.h for kauth_cred_geteuid.
 1.59  14-May-2006  elad integrate kauth.
 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.
 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.
 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
 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.
 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.
 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).
 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.
 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
 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.
 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.
 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.
 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").
 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.1.2.8  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.2.7  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.6  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.5  16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.4  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.3  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.2.2  03-Aug-2001  lukem update to -current
 1.1.2.1  28-Jul-2001  lukem file fault.c was added on branch kqueue on 2001-08-03 04:10:58 +0000
 1.2.4.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.2.15  18-Oct-2002  nathanw Catch up to -current.
 1.4.2.14  26-Sep-2002  nathanw Pull up stack-tracking fix.
 1.4.2.13  28-Aug-2002  nathanw Merge fix - G/C cowfault.
 1.4.2.12  19-Aug-2002  thorpej Partial (ARM only) sync with trunk -- significant performance improvements
for XScale-based systems.
 1.4.2.11  13-Aug-2002  nathanw Catch up to -current.
 1.4.2.10  24-Jun-2002  nathanw Curproc->curlwp renaming.

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

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.4.2.9  20-Jun-2002  nathanw Catch up to -current.
 1.4.2.8  17-Apr-2002  nathanw Catch up to -current.
 1.4.2.7  11-Apr-2002  thorpej Make this compile again.
 1.4.2.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.2.5  28-Feb-2002  nathanw Catch up to -current.
 1.4.2.4  11-Jan-2002  nathanw More catchup.
 1.4.2.3  08-Jan-2002  nathanw Catch up to -current.
 1.4.2.2  15-Nov-2001  thorpej Machine-dependent kernel mods for scheduler activations on
32-bit ARM processors. Kernel boots multi-user on an XScale,
but upcalls not yet tested.
 1.4.2.1  09-Nov-2001  thorpej file fault.c was added on branch nathanw_sa on 2001-11-15 06:39:21 +0000
 1.18.4.1  01-Oct-2002  lukem Pull up revision 1.23 (requested by nathanw in ticket #885):
In the fault handler, record growth of the stack, so that core dumps
actually contain the entire stack.
 1.18.2.2  30-Aug-2002  gehenna catch up with -current.
 1.18.2.1  30-May-2002  gehenna Catch up with -current.
 1.25.4.1  18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.25.2.2  24-Oct-2002  bjh21 Remove DEBUG check for pcb != curpcb. This can legitimately occur if
curpcb == NULL and curproc == NULL on entry. At least, I think it's
legitimate.
 1.25.2.1  19-Oct-2002  bjh21 Lock the kernel when handling page faults and undefined instructions.
 1.30.2.7  17-Jan-2005  skrll Sync with HEAD.
 1.30.2.6  02-Nov-2004  skrll Sync with HEAD.
 1.30.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.30.2.3  25-Aug-2004  skrll Sync with HEAD.
 1.30.2.2  12-Aug-2004  skrll Sync with HEAD.
 1.30.2.1  03-Aug-2004  skrll Sync with HEAD
 1.54.10.4  21-Jan-2008  yamt sync with head
 1.54.10.3  26-Feb-2007  yamt sync with head.
 1.54.10.2  30-Dec-2006  yamt sync with head.
 1.54.10.1  21-Jun-2006  yamt sync with head.
 1.56.10.2  19-Apr-2006  elad sync with head - hopefully this will work
 1.56.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.56.8.3  11-Aug-2006  yamt sync with head
 1.56.8.2  24-May-2006  yamt sync with head.
 1.56.8.1  01-Apr-2006  yamt sync with head.
 1.56.6.2  01-Jun-2006  kardel Sync with head.
 1.56.6.1  22-Apr-2006  simonb Sync with head.
 1.56.4.1  09-Sep-2006  rpaulo sync with head
 1.58.2.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.62.4.1  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.63.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.64.36.1  08-Jan-2008  bouyer Sync with HEAD
 1.64.30.1  18-Feb-2008  mjf Sync with HEAD.
 1.64.24.2  09-Jan-2008  matt sync with HEAD
 1.64.24.1  28-Aug-2007  matt Update to new reality.
 1.64.22.1  20-Jan-2008  chris Sync to HEAD.
 1.64.18.1  28-Feb-2008  rjs Sync with HEAD.
 1.65.6.4  17-Jan-2009  mjf Sync with HEAD.
 1.65.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.65.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.65.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.66.4.4  11-Aug-2010  yamt sync with head.
 1.66.4.3  11-Mar-2010  yamt sync with head
 1.66.4.2  04-May-2009  yamt sync with head.
 1.66.4.1  16-May-2008  yamt sync with head.
 1.66.2.2  04-Jun-2008  yamt sync with head
 1.66.2.1  18-May-2008  yamt sync with head.
 1.67.2.4  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.67.2.3  30-Jun-2008  wrstuden Change how we make SA threads not generate upcalls. Instead of clearing
LW_SA, use a private flag, LP_SA_NOBLOCK, that we set when we want
to not generate upcalls. This means we do NOT need to lock (l)
(ourselves) to set it.

Adjust tests that look at LW_SA. Now, we are an upcall-generating
lwp if ((l->l_flag & LW_SA) && (~l->l_pflag & LP_SA_NOBLOCK)).

Introduce code pattern to set & remember this:

f = ~l->l_pflag & LP_SA_NOBLOCK;
l->l_pflag |= LP_SA_NOBLOCK;

...

/* f is now LP_SA_NOBLOCK if it wasn't set in l_pflag before */

l->l_pflag ^= f;

I updated a lot of the trap handlers to do trap handling iff LP_SA_NOBLOCK
is not set. I tried to figure out if the trap handler could be triggered
for user-based faults as opposed to kernel faults to user addresses, and
only look at LP_SA_NOBLOCK for the latter.

Above is a result of discussions with rmind at to reduce lock twiddling.

Also, per same discussions, add locking to sys_sa_preempt(). p_lock is
the lock we want.

Also, per same discussions, remove use of LSSUSPENDED as a thread state.
We needed to use it when we were emulating the 4.X and previous behavior
of hiding cached threads. For the moment, we now have them instead
remain visible to all and have them sleeping on the "lwpcache" wait
channel.

sa_newcachelwp(): sa_putcachelwp() wants savp_mutex held, not p_lock.

Tweak some comments.
 1.67.2.2  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.67.2.1  22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.68.4.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.68.4.1  19-Oct-2008  haad Sync with HEAD.
 1.71.8.1  15-Feb-2014  matt Merge armv7 support from HEAD, specifically support for the BCM5301X
and BCM56340 evbarm kernels.
 1.71.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.75.4.2  05-Mar-2011  rmind sync with head
 1.75.4.1  30-May-2010  rmind sync with head
 1.75.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.75.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.78.12.2  24-Feb-2012  mrg sync to -current.
 1.78.12.1  18-Feb-2012  mrg merge to -current.
 1.78.8.4  22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.78.8.3  16-Jan-2013  yamt sync with (a bit old) head
 1.78.8.2  30-Oct-2012  yamt sync with head
 1.78.8.1  17-Apr-2012  yamt sync with head
 1.79.4.1  28-Nov-2012  matt Merge improved arm support (especially Cortex) from HEAD
including OMAP and BCM53xx support.
 1.85.2.4  03-Dec-2017  jdolecek update from HEAD
 1.85.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.85.2.2  25-Feb-2013  tls resync with head
 1.85.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.88.2.2  18-May-2014  rmind sync with head
 1.88.2.1  28-Aug-2013  rmind sync with head
 1.99.2.1  10-Aug-2014  tls Rebase.
 1.102.2.2  28-Aug-2017  skrll Sync with HEAD
 1.102.2.1  06-Apr-2015  skrll Sync with HEAD
 1.103.10.1  02-Nov-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #335):
share/man/man9/kernhist.9: 1.5-1.8
sys/arch/acorn26/acorn26/pmap.c: 1.39
sys/arch/arm/arm32/fault.c: 1.105 via patch
sys/arch/arm/arm32/pmap.c: 1.350, 1.359
sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7
sys/arch/arm/omap/if_cpsw.c: 1.20
sys/arch/arm/omap/tiotg.c: 1.7
sys/arch/evbarm/conf/RPI2_INSTALL: 1.3
sys/dev/ic/sl811hs.c: 1.98
sys/dev/usb/ehci.c: 1.256
sys/dev/usb/if_axe.c: 1.83
sys/dev/usb/motg.c: 1.18
sys/dev/usb/ohci.c: 1.274
sys/dev/usb/ucom.c: 1.119
sys/dev/usb/uhci.c: 1.277
sys/dev/usb/uhub.c: 1.137
sys/dev/usb/umass.c: 1.160-1.162
sys/dev/usb/umass_quirks.c: 1.100
sys/dev/usb/umass_scsipi.c: 1.55
sys/dev/usb/usb.c: 1.168
sys/dev/usb/usb_mem.c: 1.70
sys/dev/usb/usb_subr.c: 1.221
sys/dev/usb/usbdi.c: 1.175
sys/dev/usb/usbdi_util.c: 1.67-1.70
sys/dev/usb/usbroothub.c: 1.3
sys/dev/usb/xhci.c: 1.75
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34
sys/kern/kern_history.c: 1.15
sys/kern/kern_xxx.c: 1.74
sys/kern/vfs_bio.c: 1.275-1.276
sys/miscfs/genfs/genfs_io.c: 1.71
sys/sys/kernhist.h: 1.21
sys/ufs/ffs/ffs_balloc.c: 1.63
sys/ufs/lfs/lfs_vfsops.c: 1.361
sys/ufs/lfs/ulfs_inode.c: 1.21
sys/ufs/lfs/ulfs_vnops.c: 1.52
sys/ufs/ufs/ufs_inode.c: 1.102
sys/ufs/ufs/ufs_vnops.c: 1.239
sys/uvm/pmap/pmap.c: 1.37-1.39
sys/uvm/pmap/pmap_tlb.c: 1.22
sys/uvm/uvm_amap.c: 1.108
sys/uvm/uvm_anon.c: 1.64
sys/uvm/uvm_aobj.c: 1.126
sys/uvm/uvm_bio.c: 1.91
sys/uvm/uvm_device.c: 1.66
sys/uvm/uvm_fault.c: 1.201
sys/uvm/uvm_km.c: 1.144
sys/uvm/uvm_loan.c: 1.85
sys/uvm/uvm_map.c: 1.353
sys/uvm/uvm_page.c: 1.194
sys/uvm/uvm_pager.c: 1.111
sys/uvm/uvm_pdaemon.c: 1.109
sys/uvm/uvm_swap.c: 1.175
sys/uvm/uvm_vnode.c: 1.103
usr.bin/vmstat/vmstat.c: 1.219
Reorder to test for null before null deref in debug code
--
Reorder to test for null before null deref in debug code
--
KNF
--
No need for '\n' in UVMHIST_LOG
--
normalise a BIOHIST log message
--
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.
--
For some reason this single kernel seems to have outgrown its declared
size as a result of the kernhist(9) changes. Bump the size.
XXX The amount of increase may be excessive - anyone with more detailed
XXX knowledge please feel free to further adjust the value
appropriately.
--
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit
--
And yet another one. :(
--
Use correct mark-up for NetBSD version.
--
More improvements in grammar and readability.
--
Remove a stray '"' (obvious typo) and add a couple of casts that are
probably needed.
--
And replace an instance of "%p" conversion with "%#jx"
--
Whitespace fix. Give Bl tag table a width. Fix Xr.
 1.105.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.105.4.1  10-Jun-2019  christos Sync with HEAD
 1.105.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.105.2.1  28-Jul-2018  pgoyette Sync with HEAD
 1.108.4.1  08-Dec-2019  martin Pull up following revision(s) (requested by ryo in ticket #510):

sys/arch/arm/arm32/fault.c: revision 1.109

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.
 1.109.2.1  29-Feb-2020  ad Sync with head.
 1.113.2.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed