History log of /netbsd-current/sys/arch/sparc64/sparc64/machdep.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.308 05-Mar-2024 thorpej

Move the at-shutdown call to resettodr() from cpu_reboot() to kern_reboot().

It's a small step, but it's a step.


Revision tags: thorpej-ifq-base thorpej-altq-separation-base
# 1.307 04-Oct-2023 ad

Eliminate l->l_ncsw and l->l_nivcsw. From memory think they were added
before we had per-LWP struct rusage; the same is now tracked there.


Revision tags: netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.306 26-Oct-2022 riastradh

ddb/db_active.h: New home for extern db_active.

This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero. Reduces need for #include opt_ddb.h, #ifdef DDB.


Revision tags: bouyer-sunxi-drm-base
# 1.305 26-Jul-2022 andvar

s/functin/function/ in copy pasted comment.


# 1.304 26-Dec-2021 riastradh

sys: Skip suspendsched on cpu_reboot if we're in ddb.

If we're in ddb, the scheduler and all other CPUs are quiesced
anyway. But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.


# 1.303 11-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.302 07-Sep-2021 riastradh

Revert "ksyms: Use pserialize(9) for kernel access to ksyms."


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.307 04-Oct-2023 ad

Eliminate l->l_ncsw and l->l_nivcsw. From memory think they were added
before we had per-LWP struct rusage; the same is now tracked there.


Revision tags: netbsd-10-base
# 1.306 26-Oct-2022 riastradh

ddb/db_active.h: New home for extern db_active.

This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero. Reduces need for #include opt_ddb.h, #ifdef DDB.


Revision tags: bouyer-sunxi-drm-base
# 1.305 26-Jul-2022 andvar

s/functin/function/ in copy pasted comment.


# 1.304 26-Dec-2021 riastradh

sys: Skip suspendsched on cpu_reboot if we're in ddb.

If we're in ddb, the scheduler and all other CPUs are quiesced
anyway. But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.


# 1.303 11-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.302 07-Sep-2021 riastradh

Revert "ksyms: Use pserialize(9) for kernel access to ksyms."


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.306 26-Oct-2022 riastradh

ddb/db_active.h: New home for extern db_active.

This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero. Reduces need for #include opt_ddb.h, #ifdef DDB.


Revision tags: bouyer-sunxi-drm-base
# 1.305 26-Jul-2022 andvar

s/functin/function/ in copy pasted comment.


# 1.304 26-Dec-2021 riastradh

sys: Skip suspendsched on cpu_reboot if we're in ddb.

If we're in ddb, the scheduler and all other CPUs are quiesced
anyway. But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.


# 1.303 11-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.302 07-Sep-2021 riastradh

Revert "ksyms: Use pserialize(9) for kernel access to ksyms."


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.305 26-Jul-2022 andvar

s/functin/function/ in copy pasted comment.


# 1.304 26-Dec-2021 riastradh

sys: Skip suspendsched on cpu_reboot if we're in ddb.

If we're in ddb, the scheduler and all other CPUs are quiesced
anyway. But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.


# 1.303 11-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.302 07-Sep-2021 riastradh

Revert "ksyms: Use pserialize(9) for kernel access to ksyms."


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.304 26-Dec-2021 riastradh

sys: Skip suspendsched on cpu_reboot if we're in ddb.

If we're in ddb, the scheduler and all other CPUs are quiesced
anyway. But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.


# 1.303 11-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.302 07-Sep-2021 riastradh

Revert "ksyms: Use pserialize(9) for kernel access to ksyms."


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.303 11-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.302 07-Sep-2021 riastradh

Revert "ksyms: Use pserialize(9) for kernel access to ksyms."


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.302 07-Sep-2021 riastradh

Revert "ksyms: Use pserialize(9) for kernel access to ksyms."


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.301 07-Sep-2021 riastradh

ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.300 09-Aug-2021 andvar

s/aligment/alignment/ + one more typo fix in comments.


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.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


# 1.298 11-Jun-2020 ad

branches: 1.298.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.299 04-Jan-2021 thorpej

malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.


Revision tags: thorpej-futex-base
# 1.298 11-Jun-2020 ad

uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.298 11-Jun-2020 ad

uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.


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

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.297 31-Dec-2019 ad

Rename uvm_free() -> uvm_availmem().


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.296 21-Dec-2019 ad

uvmexp.free -> uvm_free()


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.295 03-Dec-2019 riastradh

Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.294 01-Dec-2019 ad

Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.293 23-Nov-2019 ad

cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


Revision tags: phil-wifi-20191119
# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


# 1.292 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14; 1.287.16;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118
# 1.291 07-Jan-2019 martin

When writing a kernel core dump, display the countdown w/o timestamps.


Revision tags: pgoyette-compat-1226
# 1.290 19-Dec-2018 maxv

Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.


# 1.289 27-Nov-2018 maxv

Fix widespread leak in the sendsig_siginfo() functions. sigframe_siginfo
has padding, so zero it out properly. While here I'm also zeroing out some
other things in several ports, for safety. Same problem in netbsd32, so
fix that too.

I can't compile-test on each architecture, but there should be no
breakage (tm).

Overall this fixes at least 14 info leaks. Prompted by the discovery by
KLEAK of a leak in amd64's sendsig_siginfo.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.288 03-Sep-2018 riastradh

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)


Revision tags: 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
# 1.287 04-Nov-2016 macallan

branches: 1.287.6; 1.287.8; 1.287.14;
allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision


Revision tags: nick-nhusb-base-20161204
# 1.287 04-Nov-2016 macallan

allow BUS_SPACE_MAP_PREFETCHABLE with bus_space_map() as well


Revision tags: pgoyette-localcount-20161104
# 1.286 04-Nov-2016 macallan

add plumbing to support bus_space_mmap() with:
- write combining allowed via BUS_SPACE_MAP_PREFETCHABLE
- byte order translation via BUS_SPACE_MAP_LITTLE


Revision tags: nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.285 07-Jul-2016 msaitoh

branches: 1.285.2;
KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529
# 1.284 13-May-2016 nakayama

Use newly introduced intrhand_alloc().


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.283 22-Nov-2015 martin

remove all MD uses of suword(), replace by copyout()


Revision tags: nick-nhusb-base-20150921
# 1.282 11-Jun-2015 palle

sun4v: Avoid using ASI_PHYS_NON_CACHED/ASI_PHYS_NON_CACHED_LITTLE in sparc_bus_map() since they are deprecated according to the UA2005 docs. Using the ASI_PRIMARY/ASI_PRIMARY_LITTLE seems to work. ok martin@


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.281 15-Mar-2015 nakayama

Reuse results of "bootpath" and "bootargs" from openfirmware
instead of calling openfirmware in each sysctl CPU_BOOT*.

This change reduces openfirmware calls from userland since sysctl
CPU_BOOTED_KERNEL is used in system commands such as pstat and
netstat.


Revision tags: nick-nhusb-base
# 1.280 28-Oct-2014 nakayama

branches: 1.280.2;
Sync cpu_reboot with i386:
- avoid sync and unmount after panic.
- remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead.
- resurrect doshutdownhooks since some drivers still use it (eg. sab(4)).


# 1.279 21-Sep-2014 christos

fix leak


Revision tags: netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.278 14-Jul-2014 nakayama

branches: 1.278.2;
Make bus_space_barrier inline to avoid unnecessary argument handling.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.277 13-May-2014 palle

Use proper SYSCTL_DESCR() macro


# 1.276 13-May-2014 palle

get_vis() now handles sun4v (VIS 1 and VIS 2)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.275 25-Jan-2014 christos

branches: 1.275.2;
__USING_TOPDOWN_VM is gone.


# 1.274 14-Dec-2013 nakayama

Remove duplicate/unused declarations.


# 1.273 14-Nov-2013 martin

Allow TOPDOWN-VM only for binaries compiled with appropriate code model.
No change yet, as __HAVE_TOPDOWN is not yet defined.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base
# 1.272 04-Feb-2013 macallan

branches: 1.272.2;
add a sysctl.vis node that indicated which version of the VIS instruction set
is supported. Currently this will be 1 for UltraSPARC I and II, 2 for
UltraSPARC-III and up


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7
# 1.271 08-Dec-2012 kiyohara

Not FALLTHROUGH.


Revision tags: yamt-pagecache-base6
# 1.270 13-Sep-2012 martin

Adapt for _UC_TLSBASE


# 1.269 28-Jul-2012 matt

branches: 1.269.2;
Remove declartions of physmem


# 1.268 27-Jul-2012 matt

Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5
# 1.267 21-May-2012 martin

Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.


Revision tags: jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.266 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.265 06-Feb-2012 martin

branches: 1.265.2;
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng


# 1.264 27-Jan-2012 para

converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged


# 1.263 12-Dec-2011 mrg

implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.262 08-Oct-2011 nakayama

branches: 1.262.2; 1.262.6;
Fix namespace confilicts membar_ops(3) vs. macros for SPARC V9
membar instructions.


# 1.261 17-Jul-2011 dyoung

Switch sparc and sparc64 to new-style <sys/bus.h>.


# 1.260 02-Jul-2011 mrg

redo previous correctly:
don't try to print fr_arg[6] since it doesn't exist.


# 1.259 01-Jul-2011 mrg

use the right variables for the fp and pc, and avoid array bounds
violations.


# 1.258 12-Jun-2011 rmind

Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.257 01-Jun-2011 mrg

convert stackdump() to look up symbols rather than dumping raw %pc values.


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

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

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


Revision tags: uebayasi-xip-base7 bouyer-quota2-base jruoho-x86intr-base
# 1.255 14-Jan-2011 rmind

branches: 1.255.2; 1.255.4;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.


Revision tags: matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.254 26-Jun-2010 skrll

Remove unused cbit.


# 1.253 08-May-2010 mrg

remove pmap_update() calls on the kernel_pmap -- they do nothign.


Revision tags: uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.252 04-Mar-2010 mrg

branches: 1.252.2;
- in _bus_dmamap_unload(), pmap_page_protect() and pmap_clear_reference()
switch the dcache_flush_page() into a dcache_flush_page_all()
- in both pmap_kremove()/pmap_remove(), remove the blast_dcache() call
and replace it with dcache_flush_page_all()
- in pmap_get_page() [used to allocate PTP's], always call pmap_zero_page(pa)
- flush the dcache of the dst page in pmap_{copy,zero}_page() by redirecting
throught a C function that calls the (renamed) asm. the old asm code had a
comment about needing to do this...
- add a couple of membar #Sync's that the USIII manual recommends


based on discussions with chuq@, skrll@ and martin@.


these help my SB2000 / SB2500 with both disk / nfs builds and other tasks,
sometimes lasting for several hours before failing or asserting.


# 1.251 08-Feb-2010 joerg

Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.250 07-Dec-2009 nakayama

branches: 1.250.2;
- fix corner case bugs around the segment offsets.
- make sure that on error condition we return "no valid mappings".


# 1.249 02-Dec-2009 nakayama

In calculating initial tstate, cast to 64-bit first to avoid sign extension.


# 1.248 21-Nov-2009 rmind

Use lwp_getpcb() on sparc{64} and sun2/3 MD code, clean from struct user usage.


# 1.247 07-Nov-2009 cegger

Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.


# 1.246 24-Oct-2009 nakayama

Use trunc_page or round_page where appropriate.
No functional changes intended, and generate same binaries.


# 1.245 21-Oct-2009 rmind

Remove uarea swap-out functionality:

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

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

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


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.244 15-Aug-2009 matt

Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6
# 1.243 26-Jun-2009 dyoung

During a normal shutdown, gracefully tear down arbitrary stacks of
filesystems and (pseudo-)devices, according to the algorithm at A3
and A4, below.

Proposed and discussed at
<http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>. No
objections.

During an emergency shutdown (e.g., shutdown -n, or after a panic),
shutdown is simple as always: filesystems are not sync'd or unmounted,
and devices are not detached.

It was necessary to change the order of operations during shutdown,
but the new order is more sensible: if a core dump is desired, then
cpu_reboot(9) dumps it first. cpu_reboot(9) does not call legacy
shutdown hooks any longer: they can interfere with device detachment
and PMF shutdown, and very few legacy hooks remain.

Here is the old order of operations:

B1 sync filesystems and TOD clock
B2 unmount filesystems
B3 dump core
B4 detach devices
B5 run legacy shutdown hooks
B6 run PMF shutdown hooks
B7 suspend interrupts
B8 MD reboot/shutdown/powerdown

And here is the new order:

A1 dump core
A2 sync filesystems and TOD clock
A3 unmount one or more filesystems OR
detach one or more devices OR
forcefully unmount one filesystem OR
skip to 5
A4 repeat at 3
A5 run PMF shutdown hooks
A6 suspend interrupts
A7 MD reboot/shutdown/powerdown

Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
Soekris net4521 and net4801.

VS: ----------------------------------------------------------------------


Revision tags: yamt-nfs-mp-base5
# 1.242 21-May-2009 jnemeth

pull in <sys/module.h>


# 1.241 21-May-2009 jnemeth

add a dummy module_init_md()

XXX if we ever teach the boot loader to load module, we'll have to
make this actually do something


# 1.240 19-May-2009 dyoung

Rename waittime to syncdone, make it bool, make it private to
cpu_reboot().


# 1.239 18-May-2009 dyoung

Make waittime static so that I know nothing else is using it.


# 1.238 18-May-2009 dyoung

Remove 'register' qualifier from several variables. The object
file did not change.


Revision tags: yamt-nfs-mp-base4
# 1.237 16-May-2009 nakayama

Use membar_sync() instead of inline asm.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.236 18-Mar-2009 cegger

Ansify function definitions w/o arguments. Generated with sed.


Revision tags: nick-hppapmap-base2
# 1.235 21-Jan-2009 martin

branches: 1.235.2;
Adapt to major()/minor() return value type changes.


Revision tags: mjf-devfs2-base
# 1.234 11-Jan-2009 nakayama

Make this compile.


# 1.233 15-Dec-2008 mrg

some minor KNF and also DPRINTF pm_flags in sparc_bus_map().


# 1.232 13-Dec-2008 mrg

DPRINTF() the new protection in sparc_bus_map()


Revision tags: haad-dm-base2 haad-nbase2 haad-dm-base
# 1.231 10-Dec-2008 mrg

clean up and use __func__ in sparc_bus_map() debug messages.


Revision tags: ad-audiomp2-base
# 1.230 25-Nov-2008 ad

dumpsys: don't spew numbers into the log.


# 1.229 19-Nov-2008 ad

Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime


# 1.228 11-Nov-2008 dyoung

It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.


Revision tags: netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.227 15-Oct-2008 wrstuden

branches: 1.227.2; 1.227.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 simonb-wapbl-nbase simonb-wapbl-base
# 1.226 10-Jul-2008 nakayama

Switch fpstate buffer allocation from malloc to pool_cache.

Ok by martin@.


# 1.225 02-Jul-2008 ad

branches: 1.225.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.224 04-Jun-2008 ad

branches: 1.224.2;
vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.


Revision tags: yamt-pf42-base3 hpcarm-cleanup-nbase
# 1.223 20-May-2008 nakayama

Put "powered down" message in case of RB_POWERDOWN for consistency.
Useful for a serial console.


# 1.222 18-May-2008 martin

Explicitly pass a "mpsafe" arg down to intr_establish, as at that point
we do not have the original ipl passed in around to check for mpsafeness.
Fixes PR port-sparc64/38673. Thanks to Andrew for pointing at the problem.


Revision tags: yamt-pf42-base2 yamt-nfs-mp-base2
# 1.221 28-Apr-2008 martin

branches: 1.221.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-nfs-mp-base
# 1.220 24-Apr-2008 ad

branches: 1.220.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.219 09-Apr-2008 nakayama

branches: 1.219.2;
Remove kernel locks around malloc introduced when I added SMP support.


# 1.218 03-Apr-2008 nakayama

Revise cpu_need_resched and cpu_signotify, then make them like x86's ones.
This can avoid sending IPI to myself.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.217 14-Mar-2008 nakayama

Improve FPU state save/clear like x86, idea from OpenBSD.


Revision tags: hpcarm-cleanup-base
# 1.216 22-Feb-2008 martin

Get rid of the IPI simple_lock.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base
# 1.215 16-Jan-2008 skrll

branches: 1.215.2; 1.215.6;
Zero dumppcb before doing a snapshot directly into dumppcb.

OK'd by martin.


# 1.214 14-Jan-2008 mrg

implement bus_dmamem_mmap() for sparc64. this is copied from the x86
code and then a single line adjusted to make it look identical to the
openbsd sparc64 version, who provided inspiration for this.

NOTE: not really tested yet with a real device, but, it can't really
be worse than panic() in a device mmap()...


Revision tags: matt-armv6-base
# 1.213 06-Jan-2008 martin

argh, I did not intend to remove all declarations of physmem.


# 1.212 06-Jan-2008 martin

Remove superflouse extern decls.


Revision tags: bouyer-xeni386-merge1 vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2
# 1.211 09-Dec-2007 martin

branches: 1.211.2;
Add support for "dumppcb" - Nick says it makes ddb a lot more happy.


# 1.210 09-Dec-2007 martin

Provide cpu_intr_p(), at least for non-MULTIPROCESSOR kernels.
Based on suggestions by Andrew Doran.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.209 17-Oct-2007 garbled

branches: 1.209.2; 1.209.4; 1.209.6;
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 ppcoea-renovation-base vmlocking-base
# 1.208 09-Oct-2007 martin

Waste a bit of kernel VA space (who cares?) and speed up crash dumps
significantly by writing larger chunks with one (polled) command.
Based on work and testing done by Chris Ross.


Revision tags: yamt-x86pmap-base2
# 1.207 01-Oct-2007 martin

No need to cast the size argument of the dump function to "int" - make
it size_t instead. Pointed out by Chris Ross.


# 1.206 01-Oct-2007 martin

Fix printf format.


# 1.205 30-Sep-2007 martin

Fix printf format string for 32bit builds - pointed out by Kurt S.
on current-users.


# 1.204 30-Sep-2007 martin

Cosmetics - improve the countdown while doing a crashdump.
XXX - need to add an ascii version of the game of life here someday.


# 1.203 30-Sep-2007 martin

When calculating memory sizes and related values for kernel dumps,
consistently use uint64_t. Fixes crash dumps on machines with > 2GB
memory. Found by Chris Ross.
While there, remove a #if 0'd part of code that prevented the first
physical memory page to be dumped - I'll solve that differently.


Revision tags: yamt-x86pmap-base
# 1.202 11-Sep-2007 martin

branches: 1.202.2;
Cleanup cpu_info: get rid of ci_number and ci_upaid, use ci_index
and ci_cpuid instead.


Revision tags: nick-csl-alignment-base5
# 1.201 06-Sep-2007 martin

Remove the (now unused) second 64k page mapped per CPU.
From matthew green, with small changes by me. All bugs are mine.


Revision tags: nick-csl-alignment-base matt-mips64-base mjf-ufs-trans-base
# 1.200 09-Jul-2007 ad

branches: 1.200.4; 1.200.8; 1.200.10;
Merge some of the less invasive changes from the vmlocking branch:

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


# 1.199 08-Jul-2007 pooka

Initialize the link context in a signal frame to the receiving lwp's
link context instead of NULL. Otherwise, if we got a signal while the
lwp had a link context set, the link context would be set to NULL upon
return from signal delivery.

christos@tech-kern: "I think you are right."


# 1.198 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.197 04-Mar-2007 christos

branches: 1.197.2; 1.197.4; 1.197.10;
fix fallout from caddr_t changes.


# 1.196 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.195 17-Feb-2007 pavel

Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.


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

branches: 1.194.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-RC1 newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.193 24-Nov-2006 christos

branches: 1.193.2; 1.193.4;
fix spelling of accommodate; from Zapher.


# 1.192 22-Oct-2006 pooka

constify in cpu_setmcontext()


Revision tags: yamt-splraiseipl-base2
# 1.191 05-Oct-2006 chs

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


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9
# 1.190 13-Sep-2006 mrg

branches: 1.190.2;
SMP cleanup. provide support for multiple CPUs in DDB. (SMP itself
is still not working.)

cpu.h:
- add a pointer for DDB regs in SMP environment to struct cpu_info
- remove the #defines for mp_pause_cpus() and mp_resume_cpus()
cpuset.h:
- remove CPUSET_ALL() and rename CPUSET_ALL_BUT() to CPUSET_EXCEPT()
from petrov.
db_machdep.h:
- rename the members of db_regs_t to be the same as sparc
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- redo DDB_REGS to no longer be a pointer to a fixed data structure
but to one allocated per-cpu when ddb is entered
- move a bunch of prototypes in here
intr.h:
- remove SPARC64_IPI_* macros, no longer used
db_interface.c:
- change "db_regs_t ddb_regs" to "db_regs_t *ddb_regp" and change
all references to suit
- make "nil" a 64 bit entity
- change the ddb register access methods to work in multiprocessor
environment, it is now very much like sparc does it
- in kdb_trap() avoid accessing ddb_regp when it is NULL
- update several messages to include the cpu number
- unpause other cpus much later when resuming from ddb
- rename db_lock() to db_lock_cmd(), as the sparc-like code has
db_lock as a simple lock
- remove "mach cpus" command, and replace it with "mach cpu" (which
does the same) and also implement "mach cpu N" to switch to
another cpus saved trapframe
db_trace.c:
- update for the ddb_regs -> ddb_regp change
genassym.cf:
- add TF_KSTACK as offsetof(struct trapframe64, tf_kstack)
ipifuncs.c:
- overhaul extensively
- remove all normal interrupt handlers as IPI's, we now handle
them all specially in locore.s:interrupt_vector
- add a simplelock around all ipi functions - it's not safe for
multiple cpus to be sending IPI's to each other right now
- rename sparc64_ipi_pause() to sparc64_ipi_pause_thiscpu() and,
if DDB is configured, enable it to save the passed-in trapframe
to a db_regs_t for this cpu's saved DDB registers.
- remove the "ipimask" system (SPARC64_IPI_* macros) and instead
pass functions directly
- in sparc64_send_ipi() always set the interrupt arguments to 0,
the address and argument of the to be called function. (the
argument right now is the address of ipi_tlb_args variable, and
part of the reason why only one CPU can send IPI's at a time.)
don't wait forever for an IPI to complete. some of this is
from petrov.
- rename sparc64_ipi_{halt,pause,resume}_cpus() to
mp_{halt,pause,resume}_cpus()
- new function mp_cpu_is_paused() used to avoid access missing
saved DDB registers
- actually broadcast the flush in smp_tlb_flush_pte(),
smp_tlb_flush_ctx() and smp_tlb_flush_all(). the other end may
not do anything yet in the pte/ctx cases yet...
kgdb_machdep.c:
- rework for changed member names in db_regs_t.
locore.s:
- shave an instruction from syscall_setup() (set + ld -> sethi + ld)
- remove some old dead debug code
- add new sparc64_ipi_halt IPI entry point, it just calls the C
vector to shutdown.
- add new sparc64_ipi_pause IPI entry point, which just traps into
the debugger using the normal breakpoint trap. these cpus usually
lose the race in db_interface.c:db_suspend_others() and end up
calling the C vector sparc64_ipi_pause_thiscpu().
- add #if 0'ed code to sparc64_ipi_flush_{pte,ctx}() IPI entry
points to call the sp_ version of these functions.
- in rft_kernel (return from trap, kernel), check to see if the
%tpc is at the sparc64_ipi_pause_trap_point and if so, call
"done" not "retry"
- rework cpu_switch slightly: save the passed-in lwp instead of
using the one in curlwp
- in cpu_loadproc(), save the new lwp not the old lwp, to curlwp
- in cpu_initialize(), set %tl to zero as well. from petrov.
- in cpu_exit(), fix a load register confusion. from petrov.
- change some "set" in delay branch to "mov".
machdep.c:
- deal with function renames
pmap.c:
- remove a spurious space
trap.c:
- remove unused "trapstats" variable
- add cpu number to a couple of messages


Revision tags: rpaulo-netinet-merge-pcb-base
# 1.189 03-Sep-2006 gdamore

branches: 1.189.2;
Convert both sparc and sparc64 to MI todr.


Revision tags: yamt-pdpolicy-base8
# 1.188 01-Sep-2006 mrg

s/E2BIG/EFBIG/ for bus_dma(9) errors. this is what every other
bus_dma does and several drivers depend on it. in particular,
both re(4) and ath(4) would both spew "can't map mbuf" messages
as rapidly as possible (spamming the 9600 bps console) and
effectively locking up the interface until ifconfig "down up"
cycle was run. with this fix, i get a much, much slower spew
of messages, and the interface (re(4)) continues to operate.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7 yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.187 10-Jun-2006 rjs

branches: 1.187.4;
Add opt_multiprocessor.h.


Revision tags: yamt-pdpolicy-base5 yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.186 20-Feb-2006 cdi

branches: 1.186.2; 1.186.8;
Use ANSI-style function definitions and declarations.


# 1.185 11-Feb-2006 cdi

ANSIfication: u_intN_t -> uintN_t, use ANSI function declarations/definitions
instead of K&R ones.


# 1.184 27-Jan-2006 cdi

branches: 1.184.2; 1.184.4;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)


# 1.183 11-Dec-2005 christos

branches: 1.183.2;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.182 27-Oct-2005 martin

Follow the lead of the sparc port:
- move md_flags back to mdproc, because we only have per-proc flags
currently
- implement cpu_proc_fork() to init p_md.md_flags on fork


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.181 31-May-2005 christos

branches: 1.181.2; 1.181.4;
- sprinkle const
- avoid shadowed variables


Revision tags: kent-audio2-base
# 1.180 25-Apr-2005 lukem

Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.


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
# 1.179 09-Mar-2005 matt

Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.


# 1.178 04-Mar-2005 scw

Undo revision 1.175 (hi jason!) to prevent a buzz-loop in
bus_dmamap_load_mbuf(). This implementation already dealt
with zero length mbufs.

Addresses port-sparc64/29473


Revision tags: yamt-km-base2
# 1.177 30-Jan-2005 chs

define a new LWP flag which indicates that we're in the process of
doing a context switch. use this on sparc and sparc64 to avoid trying
to access user memory (writing the register windows back to the stack)
in this case (since it's both unnecessary and wrong).


Revision tags: yamt-km-base
# 1.176 17-Jan-2005 martin

branches: 1.176.2;
In bus_dmamap_load_mbuf some diagnostic tests (#ifdef DEBUG) are only valid
if we are going to return success.


Revision tags: kent-audio1-beforemerge kent-audio1-base
# 1.175 28-Nov-2004 thorpej

branches: 1.175.4;
bus_dmamap_load_mbuf(): Skip zero-length mbufs.
kern/24811


# 1.174 13-Nov-2004 grant

tweak an error message.


# 1.173 08-Nov-2004 kleink

In cpu_getmcontext(), initialize the mcontext_t storage with 0 (not '0').
Reported by Arto Huusko.


# 1.172 31-Oct-2004 martin

When doing a crashdump, counting already dumped MB per mem_region
is ... slightly confusing. Instead calculate the total size of the dump
beforehand and show the number of MB we still need to dump instead - just
like 386 does it.


# 1.171 02-Jul-2004 petrov

_bus_dmamap_load_mbuf: check and process pmap_extract failure.


# 1.170 30-Jun-2004 pk

Introduce bus_space_tag_alloc() for the common parts of bus tag allocation.


# 1.169 28-Jun-2004 pk

Provide bus_space_translate_address_generic(), a helper function to
translate a local bus address to an address on the parent bus.


# 1.168 28-Jun-2004 pk

Add openprom range property to the bus space tag.


# 1.167 20-May-2004 martin

We need sigdebug and sigpid not only for COMPAT_16, but also SVR4 and
SunOS, so move it to a more generic place and fix the ifdefs.
Fixes PR port-sparc64/25650.


# 1.166 20-May-2004 petrov

ifdef protection for sparc64_ipi_ function calls.


Revision tags: 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.165 24-Mar-2004 atatat

branches: 1.165.2; 1.165.4;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.


# 1.164 14-Mar-2004 chs

checkpoint of MP work from dennis and myself. includes cross-processor
interrupt framework, a sledgehammer TLB invalidation and misc MP fixes.
doesn't work at all yet.


# 1.163 19-Jan-2004 martin

Add missing paranthesis. Fixes PR 24144.


# 1.162 18-Jan-2004 martin

Support RAS for 32bit kernels too.


# 1.161 06-Jan-2004 martin

Implement restartable atomic sequences (RAS) for sparc64.


# 1.160 30-Dec-2003 pk

Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.


# 1.159 04-Dec-2003 atatat

Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.


# 1.158 25-Nov-2003 cdi

Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.


# 1.157 13-Nov-2003 chs

eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.


# 1.156 09-Nov-2003 martin

bzero/bcopy -> memset/memcpy


# 1.155 30-Oct-2003 matt

Make this compile with 32bit kernels.


# 1.154 28-Oct-2003 hannken

Get rid of uninitialized variable.


# 1.153 28-Oct-2003 christos

eliminate oldsp variable, and don't save the original sp with STACK_OFFSET.


# 1.152 27-Oct-2003 christos

eliminate buildcontext, and fix siginfo delivery.


# 1.151 26-Oct-2003 christos

Initial siginfo support for sparc64 (untested). COMPAT_16 sigcontext signal
delivery tested.


# 1.150 21-Oct-2003 petrov

Don't use NULL for integer.


# 1.149 18-Oct-2003 petrov

cpu_getmcontext: get fsr from correct place.


# 1.148 26-Sep-2003 simonb

Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.


# 1.147 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.146 15-Jul-2003 lukem

__KERNEL_RCSID()


# 1.145 29-Jun-2003 fvdl

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


# 1.144 29-Jun-2003 martin

struct proc * -> struct lwp *


# 1.143 28-Jun-2003 darrenr

Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V


# 1.142 17-May-2003 nakayama

Avoid strict-alias warnings in gcc 3.3.


# 1.141 10-May-2003 martin

Convert a few home-grown if()... Debugger() sequences into real panics.


# 1.140 01-Apr-2003 thorpej

Use PAGE_SIZE rather than NBPG.


# 1.139 09-Feb-2003 martin

Remove left over pieces from reusing the signal trampoline for upcalls.
This should fix signal delivery for 32bit kernels.


# 1.138 24-Jan-2003 fvdl

Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.


# 1.137 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.136 10-Dec-2002 pk

Remove the `flags' argument from bus_intr_establish().


# 1.135 10-Dec-2002 pk

bus_intr_establish() signature change.
The additional `fast trap' argument is ignored in these drivers.
BUS_INTR_ESTABLISH_FASTTRAP and BUS_INTR_ESTABLISH_SOFTINTR are no longer used.


# 1.134 27-Nov-2002 pk

Sync machdep sysctls with sparc.


Revision tags: kqueue-aftermerge kqueue-beforemerge
# 1.133 16-Oct-2002 martin

Since we now use pmap_kenter_pa, which ignores PMAP_LITTLE, don't bother
to pass that as flags. We've already changed the ASIs used to access the
mapped pages acordingly.


# 1.132 16-Oct-2002 martin

Make 32bit sparc64 kernels with DEBUG and DIAGNOSTIC compile.


Revision tags: kqueue-base
# 1.131 29-Sep-2002 martin

Fix typo: set _asi depending on requested endianess, not _sasi (the streaming
accessors take care of this themselfs). Fixes 32-bit kernels on PCI machines.

Problem found by Takeshi Nakayama in PR port-sparc64/18459, fix from
Mathew Green.


# 1.130 29-Sep-2002 martin

Indentation nit.


# 1.129 27-Sep-2002 provos

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


# 1.128 25-Sep-2002 thorpej

Don't include <sys/map.h>.


# 1.127 22-Sep-2002 chs

many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.


# 1.126 19-Sep-2002 ragge

Do not include <sys/clist.h>, it's not used in NetBSD at all.


# 1.125 06-Sep-2002 gehenna

Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.


Revision tags: gehenna-devsw-base
# 1.124 25-Aug-2002 thorpej

Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.


# 1.123 04-Jul-2002 thorpej

Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.


# 1.122 12-Jun-2002 eeh

Fix some corner cases in bus_dmamap_load_mbuf().
From Takeshi Nakayama <tn@catvmics.ne.jp>


# 1.121 04-Jun-2002 eeh

Clear the P_32 flag when exec-ing native binaries.


# 1.120 02-Jun-2002 drochner

move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling


Revision tags: netbsd-1-6-base eeh-devprop-base
# 1.119 20-Mar-2002 eeh

branches: 1.119.4; 1.119.6;
Overhaul bus space.

bus_space_handle_t now holds an address and two ASIs, one for normal accesses
and one for streaming accesses. This allows to map individual handles
different ways, so some can use MMU bypass accesses and others use virtual
addresses. bus_space_map() will now create handles that use bypass accesses
unles BUS_SPACE_MAP_LINEAR is passed in. So only pass in BUS_SPACE_MAP_LINEAR
if you absolutely *need* to use bus_space_vaddr(). This removes at least one
extra level of indirection and should reduce TLB misses.

32-bit kernels have problems accessing 64-bit addresses, so they always use
virtual addresses.


# 1.118 20-Mar-2002 christos

kill remaining PS_STRINGS instances.


# 1.117 15-Mar-2002 eeh

Get PCI working with the new bus_space*.


# 1.116 14-Mar-2002 eeh

bus_type_t has gone away.


Revision tags: newlock-base
# 1.115 06-Mar-2002 tsutsui

Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.


Revision tags: ifpoll-base
# 1.114 14-Feb-2002 chs

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


# 1.113 07-Feb-2002 eeh

Make bus_space_barrier() an inline instead of a function vector.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 1.112 24-Sep-2001 eeh

branches: 1.112.4;
Change bus_space_mmap() signature to the official one.


Revision tags: post-chs-ubcperf pre-chs-ubcperf
# 1.111 15-Sep-2001 eeh

Only drop into the debuger if SDB_DDB is set.


# 1.110 10-Sep-2001 chris

Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.


Revision tags: thorpej-devvp-base
# 1.109 24-Aug-2001 chs

branches: 1.109.2;
use pmap_k* for buffer cache pages.


# 1.108 24-Jul-2001 eeh

Use OF routines instead of internal ones.


# 1.107 19-Jul-2001 eeh

Make bus_space_debug default to off.


# 1.106 02-Jun-2001 chs

branches: 1.106.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.


# 1.105 26-May-2001 chs

replace vm_page_t with struct vm_page *.


# 1.104 09-May-2001 kleink

In the 32-bit ABI case:
* rename sigcontext.sc_tstate to sc_psr, since this is how it is known to
the 32-bit API, and also used for;
* don't try to squeeze the tstate into it, just emulate the ICC bits.

Per discussion with Eduardo.


Revision tags: thorpej_scsipi_beforemerge
# 1.103 24-Apr-2001 thorpej

Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.


Revision tags: thorpej_scsipi_nbase thorpej_scsipi_base
# 1.102 15-Mar-2001 chs

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

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


# 1.101 11-Feb-2001 eeh

branches: 1.101.2;
Remove things that are defined in elf_machdep.h now.


# 1.100 23-Jan-2001 martin

Make bus_dmamap_load_mbuf and bus_dmamap_load_uio use independend
segment lists for their mapping; make iommu_dmamap_unload deal with
this type of maps.

Coded by Eduardo, tested (and minimaly tweaked) by me.


# 1.99 20-Jan-2001 pk

In cpu_reboot(), only reset the TOD clock if the time is known to be good
enough, e.g. it has been initialized already by inittodr() or set
explicitly before by resettodr(). This prevents the TOD clock from going
way backwards when typing `halt' at the `mount root filesystem' prompt.


# 1.98 15-Jan-2001 eeh

Implement some seblence of bus_dmamap_mbuf() and bus_dmamap_uio().


# 1.97 12-Jan-2001 pk

Implement bus_space_subregion().


# 1.96 22-Dec-2000 jdolecek

split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.


# 1.95 21-Dec-2000 eeh

Use an extent map for I/O addresses instead of a base so addresses can
be both allocated and freed.


# 1.94 06-Dec-2000 mrg

fix warnings in DEBUG & DIAGNSTIC code.


# 1.93 04-Dec-2000 fvdl

Avoid a warning in bus_dmamap_load_uio by inserting a 'return 0' for
good measure in this unimplemented function.


# 1.92 04-Dec-2000 eeh

Fix uninitialized variable bug and code cleanup.


# 1.91 04-Dec-2000 fvdl

Warning police. Mostly useless format warnings. Switch Makefile for
kernel compiles to the warning flags that other ports also use.


# 1.90 28-Sep-2000 eeh

Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.


# 1.89 16-Sep-2000 eeh

Add bus_space*stream*() methods. I hope they work.


# 1.88 13-Sep-2000 thorpej

Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.


# 1.87 11-Sep-2000 eeh

Don't take protection faults on I/O pages.


# 1.86 01-Aug-2000 eeh

`mem' is now a pointer, not an array. Fixes kernel coredumps.


# 1.85 01-Aug-2000 eeh

Overhaul cache flush code and coredump code.


# 1.84 28-Jul-2000 eeh

Don't dump if there's no address space reserved for it.


# 1.83 27-Jul-2000 mrg

delete unused variable.


Revision tags: mrg-merge-1-5-top
# 1.82 18-Jul-2000 mrg

#if 0 some dumpsys() debugging messages


# 1.81 14-Jul-2000 eeh

Make 64-bit stack tracebacks look decent.


# 1.80 14-Jul-2000 pk

Cast physmem to u_int64_t before applying ctob().


# 1.79 11-Jul-2000 eeh

Add UltraSPARC III specific flag bit. Currently ignored.


# 1.78 10-Jul-2000 eeh

Need to include <sys/exec_elf.h> to make things happy. So much for adding
dead code.


# 1.77 09-Jul-2000 eeh

Grab and use the memory model info from the flags in the ELF header.


# 1.76 09-Jul-2000 pk

Add a `device class' interrupt level argument (from machine/intr.h)
to bus_interrupt_establish().

It's currently only used in sparc64/dev/psycho.c to assign a CPU interrupt
level to devices in PCI slots.


# 1.75 07-Jul-2000 eeh

Handle bus_dma aligment properly.


# 1.74 30-Jun-2000 eeh

Fix interrupt delivery on UltraSPARC IIi machines.


# 1.73 29-Jun-2000 mrg

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


# 1.72 26-Jun-2000 mrg

remove/move more mach vm header files:

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

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


# 1.71 26-Jun-2000 simonb

Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.


# 1.70 24-Jun-2000 eeh

With these changes the kernel seems almost stable again.


# 1.69 24-Jun-2000 eeh

Remove a couple of references to vaddrs.h that slipped through.


Revision tags: netbsd-1-5-base
# 1.68 18-Jun-2000 mrg

branches: 1.68.2;
back out part of previous.


# 1.67 18-Jun-2000 mrg

give BSDB_MAP a value. add a shushing cast.


# 1.66 12-Jun-2000 eeh

Start reorganizing the kernel for MULTIPROCESSOR support.


# 1.65 12-Jun-2000 mrg

clean up cruft.


# 1.64 08-Jun-2000 eeh

Allow for cacheable device maps (in case there's some RAM out there).


# 1.63 02-Jun-2000 eeh

Use all 64 address bits in ld*a()/st*a() macros so physical device addresses
work. (Also add some bus_space_*() debug hooks).


Revision tags: minoura-xpg4dl-base
# 1.62 26-May-2000 thorpej

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

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

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

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

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

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


# 1.61 24-May-2000 eeh

If we have sparse PCI spaces we can run out of IO map space when mapping
PCI config space. Since PCI config space is mostly used by PCI bus drivers,
we won't actually map it in. Instead we use MMU bypass ASI accesses to read
and write PCI config space.


# 1.60 22-Apr-2000 mrg

whole bunch of changes:
- merge IOMMU DVMA code from sbus/psycho into iommu.c. this code was
identical and a few minor inconsistencies had crept in. this way
keeps them all in sync.
- with this code gone from psycho, merge the psycho.c and psycho_bus.c
files. same with ebus/ebus_bus.c. delete the _bus.c files.
- add a _ds_boundary member to the dma segment structure, so that later
dma mappings can find this value.
- set _ds_boundary in machdep.c:_bus_dmamem_alloc().
- kill much dead code.


# 1.59 22-Apr-2000 mrg

clean up mdallocsys().


# 1.58 10-Apr-2000 pk

Get a kernel without DDB to build.


# 1.57 06-Apr-2000 mrg

- #include "opt_ddb.h" to get correct Debugger() prototype.
- add some (u_long) casts to shut up GCC.


Revision tags: chs-ubc2-newbase
# 1.56 19-Jan-2000 thorpej

Move callout initialization to a single location; no need to duplicate
that code all over the place.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.55 04-Dec-1999 ragge

CL* discarding.


Revision tags: fvdl-softdep-base
# 1.54 13-Nov-1999 thorpej

Update for pmap_enter() API change. No functional difference.


# 1.53 08-Nov-1999 eeh

Implement sysctl machdep.booted_kernel.


# 1.52 06-Nov-1999 eeh

Explicitly use 32-bit and 64-bit types.


Revision tags: comdex-fall-1999-base
# 1.51 11-Oct-1999 eeh

branches: 1.51.2; 1.51.4;
Update to post 1.4.


# 1.50 17-Sep-1999 thorpej

branches: 1.50.2;
Centralize the declaration and clearing of `cold'.


Revision tags: chs-ubc2-base
# 1.49 08-Jul-1999 thorpej

Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.


# 1.48 21-Jun-1999 eeh

Nuke the last vestiges of a single DVMA map. This stuff should have
been completely migrated to individual bus drivers.


# 1.47 07-Jun-1999 eeh

Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.


# 1.46 05-Jun-1999 eeh

Make pbrobeget() and probeset() work for 64-bit values as well. To do this
the arguments are changed so the address is first and the ASI second so we
can have the address in %o0:%o1 and not worry about unused registers.

Also a bit of copyright cleanup.


# 1.45 05-Jun-1999 eeh

Fix things up so they compile again.


# 1.44 05-Jun-1999 mrg

if we are not bypassing the MMU, use ASI_PRIMARY. map PCI memory space
non-cached. XXX clean this up by looking at the "non-cacheable" bit of
the full physical address.
avoid having 'nbuf' change between calls to `mdallocsys()' by setting it
in mdallocsys() like the MI allocsys() does. XXX fix this too!
fix some printf lossage.
update for probeget() changes -- though bus_space_probe() appears to be
unused on the sparc64.


# 1.43 31-May-1999 eeh

Garbage collect.


# 1.42 26-May-1999 thorpej

Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.


# 1.41 25-May-1999 thorpej

bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.


# 1.40 22-May-1999 eeh

Fix bus_type_t properly and enable ASI accesses for bus_space_{read,write}*()


# 1.39 20-May-1999 lukem

* convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes


# 1.38 26-Apr-1999 thorpej

Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.


# 1.37 11-Apr-1999 chs

add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.


Revision tags: netbsd-1-4-base
# 1.36 01-Apr-1999 thorpej

branches: 1.36.2;
Don't call configure() from cpu_startup().


# 1.35 28-Mar-1999 eeh

Fix fault handling code to correctly report access_type and fault_type
and get rid of pmap_enter_phys().


# 1.34 28-Mar-1999 eeh

Fix ref counting.


# 1.33 26-Mar-1999 mycroft

Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.


# 1.32 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


# 1.31 27-Feb-1999 scottr

defopt BUFCACHE and BUFPAGES.


# 1.30 31-Jan-1999 mrg

retire _LP64; use compiler provided __arch64__, but still defined _LP64 where we used to anyway.


# 1.29 16-Jan-1999 chuck

MNN is no longer optional, remove dead code


# 1.28 10-Jan-1999 eeh

Support little-endian bus mappings.


# 1.27 09-Jan-1999 thorpej

Garbage-collect `mbutl'.


# 1.26 03-Jan-1999 eeh

More signal handling fixups.


# 1.25 18-Dec-1998 drochner

COMPAT_xxx option review: add missing opt_compat_netbsd.h


Revision tags: kenh-if-detach-base
# 1.24 24-Nov-1998 mrg

move now unsed variable under #ifdef NOT_DEBUG


# 1.23 22-Nov-1998 eeh

Move allocsys() back to cpu_startup(). We're no longer allocating it from
the locked 4MB TLB entry, but it solves the problem where large memory machines
overflow the 4MB TLB entry.


# 1.22 16-Nov-1998 eeh

Fixup the last broken bits of the signal handling code.


Revision tags: chs-ubc-base
# 1.21 19-Oct-1998 tron

Defopt SYSVMSG, SYSVSEM and SYSVSHM.


# 1.20 11-Oct-1998 chuck

remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)


# 1.19 06-Oct-1998 thorpej

Move the "XXX re-zero proc0 user area" to the end of configure(), before
interrupts are enabled.


# 1.18 22-Sep-1998 eeh

More fixup in the signal area.

64-bit syscall cleanup.

Add emulation for some new FPU insns: conversion to 64-bit long int and
conditional moves.


# 1.17 17-Sep-1998 thorpej

Make the signal code look a bit more like the 32-bit SPARC port's.


# 1.16 13-Sep-1998 eeh

Looks like something else changed in signal land.


# 1.15 13-Sep-1998 eeh

Fixup signal changes (hopefully). However SUN_COMPAT is likely broken by
this and I don't know how to fix it.

We can now exec a 64-bit init through a really ugly hack (don't ask.)


# 1.14 13-Sep-1998 mycroft

Fix pasto.


# 1.13 13-Sep-1998 mycroft

Update these for signal handling changes.
XXX Not tested yet.


# 1.12 11-Sep-1998 eeh

Add labels for the compat_sparc32 signal trampoline and break -- er -- fix
suword and fuword.


# 1.11 07-Sep-1998 eeh

Misc. cleanup.


# 1.10 06-Sep-1998 eeh

32-bit fixup.


# 1.9 05-Sep-1998 eeh

It slices. It dices. It does everything except exec a sparc32_compat init.


# 1.8 02-Sep-1998 eeh

Periodic update: now starts probing devices.


# 1.7 30-Aug-1998 eeh

Some more 64-bit cleanup. Now everything compiles.


# 1.6 29-Aug-1998 eeh

Some more 64-bit-ification.


Revision tags: PMAP32
# 1.5 23-Aug-1998 eeh

Remove dvma_mapin() and other cruft.


# 1.4 13-Aug-1998 eeh

Merge paddr_t changes into the main branch.


Revision tags: eeh-paddr_t-base
# 1.3 07-Jul-1998 eeh

branches: 1.3.2;
General update:

Added genassym.cf
Removed lderr which should never have gotten in
Removed lots of dead code from locore.s
Added some softint stuff to intr.c
Added support for halt -p
esp and le both use bus_dmamap_*() functions now
instead of kdvma_mapin()
groundwork for PCI (but we still have no drivers for
any sun4u PCI devices)


# 1.2 25-Jun-1998 thorpej

defopt COMPAT_SUNOS


# 1.1 20-Jun-1998 eeh

branches: 1.1.1;
Initial revision