History log of /netbsd-current/sys/arch/hppa/hppa/trap.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.123 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.122 23-Jul-2023 skrll

PR/57261: hppa should be converted to __HAVE_SYSCALL_INTERN

Provide syscall_intern and use the md_syscall in syscall trap handling.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.121 02-Sep-2022 thorpej

Remove unnecessary inclusion of <net/netisr.h>.


# 1.120 09-Jun-2022 skrll

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT

This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and single-step breakpoints


# 1.119 09-Jun-2022 skrll

Handle 'NA' (non-access) traps for the lpa and probe instructions. The
change is inspired by OpenBSD with a bunch of my own, mainly stylistic,
changes.

Thanks to Tom Lane for the analysis.

PR/56118: sporadic app crashes in HPPA -current


# 1.118 07-Jun-2022 skrll

Whitespace


# 1.117 28-May-2022 andvar

fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.116 19-Aug-2020 msaitoh

s/ be be / be /


Revision tags: bouyer-xenpvh-base2
# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

branches: 1.114.6;
Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.122 23-Jul-2023 skrll

PR/57261: hppa should be converted to __HAVE_SYSCALL_INTERN

Provide syscall_intern and use the md_syscall in syscall trap handling.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.121 02-Sep-2022 thorpej

Remove unnecessary inclusion of <net/netisr.h>.


# 1.120 09-Jun-2022 skrll

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT

This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and single-step breakpoints


# 1.119 09-Jun-2022 skrll

Handle 'NA' (non-access) traps for the lpa and probe instructions. The
change is inspired by OpenBSD with a bunch of my own, mainly stylistic,
changes.

Thanks to Tom Lane for the analysis.

PR/56118: sporadic app crashes in HPPA -current


# 1.118 07-Jun-2022 skrll

Whitespace


# 1.117 28-May-2022 andvar

fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.116 19-Aug-2020 msaitoh

s/ be be / be /


Revision tags: bouyer-xenpvh-base2
# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

branches: 1.114.6;
Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.121 02-Sep-2022 thorpej

Remove unnecessary inclusion of <net/netisr.h>.


# 1.120 09-Jun-2022 skrll

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT

This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and single-step breakpoints


# 1.119 09-Jun-2022 skrll

Handle 'NA' (non-access) traps for the lpa and probe instructions. The
change is inspired by OpenBSD with a bunch of my own, mainly stylistic,
changes.

Thanks to Tom Lane for the analysis.

PR/56118: sporadic app crashes in HPPA -current


# 1.118 07-Jun-2022 skrll

Whitespace


# 1.117 28-May-2022 andvar

fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.116 19-Aug-2020 msaitoh

s/ be be / be /


Revision tags: bouyer-xenpvh-base2
# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

branches: 1.114.6;
Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.120 09-Jun-2022 skrll

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT

This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and single-step breakpoints


# 1.119 09-Jun-2022 skrll

Handle 'NA' (non-access) traps for the lpa and probe instructions. The
change is inspired by OpenBSD with a bunch of my own, mainly stylistic,
changes.

Thanks to Tom Lane for the analysis.

PR/56118: sporadic app crashes in HPPA -current


# 1.118 07-Jun-2022 skrll

Whitespace


# 1.117 28-May-2022 andvar

fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.116 19-Aug-2020 msaitoh

s/ be be / be /


Revision tags: bouyer-xenpvh-base2
# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

branches: 1.114.6;
Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.118 07-Jun-2022 skrll

Whitespace


# 1.117 28-May-2022 andvar

fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.116 19-Aug-2020 msaitoh

s/ be be / be /


Revision tags: bouyer-xenpvh-base2
# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

branches: 1.114.6;
Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.117 28-May-2022 andvar

fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.116 19-Aug-2020 msaitoh

s/ be be / be /


Revision tags: bouyer-xenpvh-base2
# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

branches: 1.114.6;
Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.116 19-Aug-2020 msaitoh

s/ be be / be /


Revision tags: bouyer-xenpvh-base2
# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

branches: 1.114.6;
Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.115 25-Apr-2020 skrll

Fix KASSERT that has been incorrect since revision 1.85 from 10 years
ago.


Revision tags: phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.114 06-Dec-2019 skrll

Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

branches: 1.111.4;
Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.10; 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.114 06-Dec-2019 skrll

Simplify userret function signature. From ad@


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.113 29-Nov-2019 ad

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

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


# 1.112 21-Nov-2019 ad

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


Revision tags: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


# 1.112 21-Nov-2019 ad

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


Revision tags: phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.111 15-Apr-2019 skrll

Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

branches: 1.107.18;
Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.


Revision tags: isaki-audio2-base
# 1.111 15-Apr-2019 skrll

Trailing whitespace


# 1.110 06-Apr-2019 kamil

Centralized shared part of child_return() into MI part

Add a new function md_child_return() for MD specific bits only.

New child_return() is now part of MI and central code that handles
uniformly tracing code (KTR and ptrace(2)).

Synchronize value passed to ktrsysret() among ports to SYS_fork. This is
a traditional value and accessing p_lflag to check for PL_PPWAIT shall
use locking against proc_lock. Returning SYS_fork vs SYS_vfork still isn't
correct enough as there are more entry points to forking code. Instead of
making it too good, just settle with plain SYS_fork for all ports.


# 1.109 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.


# 1.108 03-Apr-2019 kamil

Rework the fork(2)/vfork(2) event signalling under ptrace(2)

Remove the constraint of SIGTRAP event being maskable by a tracee.

Now all SIGTRAP TRAP_CHLD events are delivered to debugger.

This code touches MD specific logic and the child_return routine.
It's an intermediate step with a room for refactoring in future and
right now the least invasive approach. This allows to assert expected
behavior in already existing ATF tests and make the code prettier
in future keeping the same semantics. Probably there is a need for a MI
wrapper of child_return for shared functionality between ports.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 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.107 02-Mar-2015 martin

Send SIGBUS when accessing mmap() past end of file (handle EINVAL in fault
path). While there, handle ENOMEM as well.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.106 06-Mar-2014 skrll

branches: 1.106.6;
Move to a flat space register convention. %sr[4-7] are all now the space
number allocated to the process. gcc produces (slightly) better code
with this convention.

Retain backwards compatiblity.

Welcome to 6.99.36


# 1.105 13-Feb-2014 skrll

Simplify cpu_spawn_return - setregs has done all the work already.


# 1.104 25-Oct-2013 martin

Change a few __unused to __diagused/__debugused


# 1.103 19-Oct-2013 skrll

Use __unused on a variable used in a KASSERT


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.102 13-Jul-2013 skrll

Use sy_invoke


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.101 23-Apr-2012 skrll

branches: 1.101.2; 1.101.4;
Pass the trap address in ksi_addr without privilege bits.

Previously GDB would get confused by the trap address given when hitting
the _rtld_debug_state breakpoint.


Revision tags: yamt-pagecache-base4
# 1.100 06-Apr-2012 skrll

unifdef FPEMUL. All our supported systems have an FPU.


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7
# 1.99 07-Mar-2012 skrll

Deal with setting of space registers and protection ids for posix_spawn.

Thanks to martin for the help.


Revision tags: jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 19-Feb-2012 rmind

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


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.97 13-Feb-2012 martin

branches: 1.97.2;
Add missing MD code for posix_spawn


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 rmind-uvmplock-base jym-xensuspend-base
# 1.96 23-Jan-2011 skrll

branches: 1.96.4; 1.96.8;
Make some more information (psw/fpu_state) per cpu.


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

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


Revision tags: uebayasi-xip-base6
# 1.94 09-Nov-2010 skrll

#if 0 out the trap checks around tf_iioq_{head,tail}. The sti(4) code
can/will trigger them.


Revision tags: uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.93 07-Jul-2010 chs

fix hppa ucas_*():
- "ret" is a kernel-space pointer.
- move the ucas RAS check from the device interrupt path
to the page-fault path.


# 1.92 31-May-2010 skrll

Fix previous.


# 1.91 31-May-2010 skrll

Pull change across from OpenBSD:

Make single stepping a system call work. Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.


Revision tags: uebayasi-xip-base1
# 1.90 26-Apr-2010 skrll

SANITY output tweak.


# 1.89 26-Apr-2010 skrll

KNF


# 1.88 23-Apr-2010 rmind

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


# 1.87 06-Apr-2010 skrll

Include SSBREAKPOINT in the PTRACE #ifdef/#endif.


# 1.86 03-Apr-2010 skrll

Add md_astpending to struct mdlwp and use it.


# 1.85 31-Mar-2010 skrll

Make cpl, ipending, and intr_depth per CPU values.


# 1.84 24-Mar-2010 skrll

Correct the list of traps that we need to get the va and space from
ii[os]q.

From OpenBSD.


# 1.83 22-Mar-2010 skrll

Wrap long line.


# 1.82 22-Mar-2010 skrll

Whitespace / comment formatting.


# 1.81 22-Mar-2010 skrll

Improve the output from frame_sanity_check.


# 1.80 20-Mar-2010 chs

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


# 1.79 16-Mar-2010 skrll

The FP regs are accessed in both physical and virtual modes. Make sure
they're allocated in directly mapped memory to avoid aliasing problems
and unnecessary cache flushing.

Fix various names and references. If we ever directly map the uarea and
pcb we can change things at that point.

Significantly helps my J210 (PA7200).

Mostly from OpenBSD.


# 1.78 11-Mar-2010 skrll

branches: 1.78.2;
Start at the first, not the second, exception register.


# 1.77 11-Mar-2010 skrll

Comment formating.


Revision tags: yamt-nfs-mp-base9
# 1.76 10-Feb-2010 skrll

Oops. Whitespace in previous.


# 1.75 10-Feb-2010 skrll

Remove a cast by fixing a printf format.


# 1.74 10-Feb-2010 skrll

Reformat a comment.


# 1.73 10-Feb-2010 skrll

Minor tweaks.


# 1.72 10-Feb-2010 skrll

Use __arraycount


Revision tags: uebayasi-xip-base
# 1.71 17-Jan-2010 skrll

branches: 1.71.2;
Use pmap_extract instead of kvtop.


# 1.70 16-Jan-2010 skrll

Tweak astpending handling.


# 1.69 16-Jan-2010 skrll

Check cpl level has returned to entry value when leaving trap/syscall.

From OpenBSD.


# 1.68 16-Jan-2010 skrll

Add a comment.


# 1.67 16-Jan-2010 skrll

Rename type_raw to trapnum and use in a couple more places.

Reduces diff to OpenBSD.


# 1.66 16-Jan-2010 skrll

Count traps in uvmexp. Reduces diff to OpenBSD.


# 1.65 06-Jan-2010 skrll

Update 64bit arg handling to use the flags in the syscall table.

Only do trace_enter/trace_exit if we're tracing.


# 1.64 06-Jan-2010 skrll

curlwp is never NULL now. Sprinkle KASSERT just in case.


Revision tags: matt-premerge-20091211
# 1.63 27-Nov-2009 skrll

Fix DEBUG build. Hi rmind.


# 1.62 27-Nov-2009 rmind

- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.


# 1.61 21-Nov-2009 rmind

Use lwp_getpcb() on hppa and ia64, clean from struct user usage.


# 1.60 03-Nov-2009 snj

Follow upstream license changes for files with Michael Shalayeff's
copyright. In most cases, this means dropping the 3rd and 4th clauses.


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
# 1.59 30-Apr-2009 skrll

Merge nick-hppapmap.

This is a port of the OpenBSD pmap and trap handling code to get us

- Performance boost on some/all machines.
- Well on the way to PA2.0 (in 32bit mode) support. Several
machines probe hardware, but fail sometime after interrupts
are enabled.

Other things changed / fixed on the branch are

- update autoconf to use the OpenBSD code.
- com @ dino is very close to being supported.
- HPPA_REDZONE has been replaced with a working redzone which
is enabled with DIAGNOSTIC.
- UPAGES has been halved in size.
- power(4) from OpenBSD to fix a few bugs.
- updated list of modules from OpenBSD.
- initial ports of uturn(4), astro(4) and elroy(4).
- update some copyrights (remove advertising clause, etc.)

Thanks to mjf for some of the above, testing and listening.


Revision tags: nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.58 11-Apr-2009 skrll

Fixup two more syscalls with 64-bit args.

Remove reference to script that is supposed to do this automatically - I
don't have it.

Fixes PR/41185.


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

branches: 1.57.2; 1.57.8;
Provide a small inline wrapper for sysent::sy_call() and use it to store
the active syscall description in struct lwp. To be used at some future
point to prevent unloading of modules that provide syscalls, while the
syscalls are in use.


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

Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base
# 1.55 28-Apr-2008 martin

branches: 1.55.2; 1.55.6;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.54 06-Feb-2008 dsl

branches: 1.54.6; 1.54.8; 1.54.10;
Remove the 'args' parameter to 'trace_exit()' it is no longer used.
Instead of passing the (un)real system call code and syscall table pointer,
just pass the number of arguments - which is what ktrace really wants.
Ride forthcoming 4.99.53


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 1.53 18-Jan-2008 skrll

KNF


# 1.52 18-Jan-2008 skrll

Correct a comment.


# 1.51 10-Jan-2008 skrll

Various improvements to the hppa kernel for gdb.

- add the useful space and control registers to struct reg
- update process_{read,write}_regs accordingly
- use MID_HPPA in core dumps.
- dump the fp regs into cores.
- add single stepping support from OpenBSD.


Revision tags: matt-armv6-base
# 1.50 05-Jan-2008 dsl

Don't pass 'curlwp' into trace_enter() and trace_exit().


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.49 05-Nov-2007 ad

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


Revision tags: yamt-x86pmap-base4
# 1.48 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.47 02-Oct-2007 skrll

branches: 1.47.2;
Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base
# 1.46 15-Aug-2007 ad

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


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.45 27-May-2007 skrll

branches: 1.45.4; 1.45.8;
Fix up the frame sanity checking to not bitch when taking interrupts in
the sti ROM code.

Fixes PR/34715.

Thanks to David H. Gutteridge.


# 1.44 18-May-2007 skrll

Minor KNF and make some output a bit easier to read.


# 1.43 17-May-2007 yamt

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

from doc/BRANCHES:

idle lwp, and some changes depending on it.

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


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

branches: 1.42.2; 1.42.4; 1.42.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


# 1.41 03-Mar-2007 skrll

Remove hppa_{round,trunc}_page.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.40 09-Feb-2007 ad

branches: 1.40.2;
Merge newlock2 to head.


Revision tags: newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 newlock2-base
# 1.39 18-Dec-2006 skrll

Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.


Revision tags: yamt-splraiseipl-base3 yamt-splraiseipl-base2 netbsd-4-base
# 1.38 09-Oct-2006 skrll

branches: 1.38.2;
Make this compile without KTRACE.

From Sergey Svishchev in a private email.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.37 25-Aug-2006 skrll

branches: 1.37.2; 1.37.4;
Fix a spello in a debug message.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.36 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.35 07-Jul-2006 skrll

Fix use of user_backtrace. It takes a lwp pointer now.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.34 12-May-2006 skrll

branches: 1.34.4;
P_PROFIL is held in p_flag of struct proc so test for it there.


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

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


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

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


# 1.31 07-Mar-2006 thorpej

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


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

branches: 1.30.4; 1.30.6; 1.30.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.29 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.28 03-Jul-2005 he

branches: 1.28.2;
Remove "bad" label no longer in use.


# 1.27 01-Jul-2005 christos

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


# 1.26 07-May-2005 chs

add additional args to frame_sanity_check() so we can log which
context it was called from and the trap type (if called from trap()).


# 1.25 01-May-2005 chs

check pcb_onfault for kernel T_DATALIGN traps (for ddb).


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base kent-audio2-base
# 1.24 17-Feb-2005 tsutsui

user_backtrace() is used if DEBUG or USERTRACE is defined, but not DIAGNOSTIC.


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.23 07-Aug-2004 chs

branches: 1.23.4; 1.23.6;
handle T_CONDITION traps (by sending SIGFPE).
fix T_EXCEPTION code to handle the other FP major opcodes.


# 1.22 24-Jul-2004 chs

real siginfo support.


# 1.21 24-Jul-2004 chs

FPU fixes and improvements, adapted from openbsd:
- handle exceptions correctly
- emulation of unimplemented instructions (eg. on PA-7300LC)


# 1.20 18-Jul-2004 chs

use mi_userret().


# 1.19 15-Jun-2004 chs

clear pcb_onfault before calling uvm_fault() and restore it after.
remove some debug code that actually makes debugging harder.


# 1.18 09-Jun-2004 chs

redo rev. 1.13, handle curlwp being NULL correctly.


# 1.17 16-May-2004 chs

for instruction TLB miss traps, process the fault with VM_PROT_EXECUTE
instead of VM_PROT_READ (to support non-executable mappings).


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.16 26-Mar-2004 drochner

To the rest of the kernel, pretend that hppa supports SIGINFO.
There are still only "sigcontext" stackframes passed to the user,
but at least we can clean up the MI sources now.


# 1.15 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.14 28-Nov-2003 chs

de-__P, remove register, ansify.


# 1.13 08-Nov-2003 tsutsui

In trap(), curlwp could be NULL so don't refer it implicitly.


# 1.12 31-Oct-2003 simonb

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


# 1.11 21-Oct-2003 fvdl

NULL -> 0 for preempt() argument.


# 1.10 13-Oct-2003 cl

add MD part of SA/pthread pagefault handling on hppa


# 1.9 31-Aug-2003 chs

update for LWPs, and some lite cleanup.


# 1.8 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.7 01-Apr-2003 thorpej

branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base
# 1.6 21-Dec-2002 manu

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

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


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

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


Revision tags: kqueue-aftermerge kqueue-beforemerge gehenna-devsw-base kqueue-base
# 1.4 19-Aug-2002 fredette

Since trap_kdebug() may be a macro, be sure to cast to void when not
using its result.


# 1.3 07-Jul-2002 fredette

branches: 1.3.2;
Now include the HPPA trap number in a user backtrace, and display
backtraces for more traps.


# 1.2 17-Jun-2002 christos

branches: 1.2.2;
MD systrace gluons.


# 1.1 05-Jun-2002 fredette

Added files to support generic HP PA-RISC based machines. hp700-specific
files to follow.