History log of /netbsd-current/sys/arch/sh3/include/cpu.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.61 23-Feb-2022 andvar

fix various typos in comments, mainly immediatly/immediately/,
as well shared and recently fixed typos in OpenBSD code by Jonathan Grey.


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.60 03-Aug-2020 uwe

SH3_P2SEG_FUNC(f) - get a P2 address of a function.


Just SH3_P1SEG_TO_P2SEG + cast, but we now define SH3_P1SEG_TO_P2SEG
and SH3_P2SEG_TO_P1SEG to use arithmetic, not bitwise ops. That gives
the same result for the correct P1/P2 input values, but addition can
be done at link time with addends. Thus SH3_P2SEG_FUNC compiles to a
constant P2 address.


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.59 01-Dec-2019 ad

Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.


# 1.58 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: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.57 22-Aug-2018 msaitoh

- Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE 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 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE 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 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.56 19-Oct-2013 christos

branches: 1.56.28; 1.56.30;
make cpu_need_resched() macros consistent; __USE flags


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.55 22-Dec-2010 nisimura

branches: 1.55.8; 1.55.18; 1.55.22;
PROC_PC() should have been changed to LWP_PC().


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Oct-2009 rmind

branches: 1.54.4;
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: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 mjf-devfs2-base
# 1.53 22-Mar-2008 uwe

branches: 1.53.4;
Revert interrupt stack changes. There are some issues and, at least
in the current form, they complicate implementation of fast software
interrupts. I'd rather get fast softints in now and may be revisit
interrupt stack later.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.52 16-Mar-2008 uwe

Rewrite RUN_P2, RUN_P1 in asm. gcc4 is too happy to optimize away
assigned-goto versions if try to do anything fancy with them
(discovered by trying to wrap RUN_P2 into an "if").


# 1.51 27-Feb-2008 xtraeme

Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.50 07-Jan-2008 uwe

branches: 1.50.2; 1.50.6;
Now that sh3 has didicated interrupt stack we can check for cpu_intr_p
with simple sp comparison, so we can drop ci_idepth.


Revision tags: vmlocking2-base3
# 1.49 14-Dec-2007 uwe

Use dedicated interrupt stack. Tested on hpcsh and landisk. This has
been sitting in my tree for quite a while. While here s/top/bottom/
in a few places related to stacks to confirm to conventional
terminology.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.48 03-Dec-2007 ad

branches: 1.48.2; 1.48.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.47 17-Oct-2007 garbled

branches: 1.47.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.46 01-Oct-2007 ad

Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.45 04-Aug-2007 ad

branches: 1.45.2; 1.45.4;
Add ci_cpuid where it's missing.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.44 17-May-2007 yamt

branches: 1.44.2; 1.44.4; 1.44.8;
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 ad-audiomp-base
# 1.43 16-Feb-2007 ad

branches: 1.43.2; 1.43.6; 1.43.8; 1.43.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base 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 rpaulo-netinet-merge-pcb-base
# 1.41 21-Jan-2006 uwe

branches: 1.41.18;
Declare cpu_reset as __attribute__((__noreturn__)).


# 1.40 21-Jan-2006 uwe

Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.


# 1.39 21-Jan-2006 uwe

Use uint32_t.


# 1.38 24-Dec-2005 perry

branches: 1.38.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile


# 1.37 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base ktrace-lwp-base
# 1.36 25-Sep-2004 yamt

branches: 1.36.12;
include sys/cpu_data.h only if defined(_KERNEL)


# 1.35 22-Sep-2004 yamt

move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.33 04-Jan-2004 jdolecek

Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread


# 1.32 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.31 18-Jan-2003 thorpej

branches: 1.31.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.30 13-Nov-2002 msaitoh

add some definitions for P[VR]R register


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base kqueue-base
# 1.29 07-May-2002 thorpej

branches: 1.29.6;
Make CLKF_INTR() slightly less broken. The previous definition always
tested true if the CPU was running in the kernel at the time of the clock
interrupt, therefore all such time (kernel and idle) was counted as interrupt
time. The new definition simply punts on trying to count interrupt time,
which allows us to see kernel and idle time.


# 1.28 28-Apr-2002 uch

Use "#define<tab>", white space nits.


# 1.27 26-Apr-2002 msaitoh

add SH4 Processor Version Register


# 1.26 24-Mar-2002 uch

Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.


Revision tags: eeh-devprop-base
# 1.25 17-Mar-2002 uch

cosmetic changes, fix comments.


# 1.24 17-Mar-2002 uch

change to per-process AST.


Revision tags: newlock-base
# 1.23 08-Mar-2002 uch

cpu_swapout() moved to cpu.h


# 1.22 04-Mar-2002 uch

CTL_MACHDEP definitions are integrated into sh3/include/cpu.h again.


# 1.21 03-Mar-2002 uch

machine dependent sysctl are moved to machine/cpu.h
dreamcast, hpcsh ... CPU_CONSDEV
mmeye, evbsh3 ... CPU_CONSDEV, CPU_LOADANDRESET


Revision tags: ifpoll-base
# 1.20 28-Feb-2002 uch

cpu_dumpconf, reserve_dumppages, dumpsys, cpu_reset are moved to sh3/sh3_machdep.c


# 1.19 24-Feb-2002 uch

Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.


# 1.18 22-Feb-2002 uch

New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.


# 1.17 19-Feb-2002 uch

Clean up function declaration.


# 1.16 17-Feb-2002 uch

Add new MMU API. for detail, see sh3/mmu.h's comment.


# 1.15 12-Feb-2002 uch

ANSIfy KNF.


# 1.14 11-Feb-2002 uch

add useful macro for running P2, P1 area.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.13 24-Jun-2001 msaitoh

branches: 1.13.2;
fix KERNELMODE() macro (check MD bits, too)


# 1.12 30-May-2001 mrg

use _KERNEL_OPT


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 02-Feb-2001 thorpej

branches: 1.11.2;
Add some comments about P/USEG


# 1.10 25-Aug-2000 thorpej

Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.


Revision tags: netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.9 07-Jun-2000 tsubai

branches: 1.9.2;
Remove child_return prototype; it is now in sys/proc.h.


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

branches: 1.8.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.7 24-Feb-2000 msaitoh

SH4!


Revision tags: chs-ubc2-newbase
# 1.6 14-Jan-2000 msaitoh

add SH3_{PHYS,P1SEG,P2SEG}_TO_{PHYS,P1SEG,P2SEG} macros


# 1.5 24-Dec-1999 msaitoh

back to previous one (suggested by cgd)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.4 21-Dec-1999 msaitoh

move sysctl definitions into ${MACHINE}/include/cpu.h


# 1.3 21-Dec-1999 msaitoh

G.C.


Revision tags: comdex-fall-1999-base fvdl-softdep-base
# 1.2 14-Sep-1999 tsubai

branches: 1.2.2; 1.2.8;
Catch up with -current.


# 1.1 13-Sep-1999 itojun

Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.60 03-Aug-2020 uwe

SH3_P2SEG_FUNC(f) - get a P2 address of a function.


Just SH3_P1SEG_TO_P2SEG + cast, but we now define SH3_P1SEG_TO_P2SEG
and SH3_P2SEG_TO_P1SEG to use arithmetic, not bitwise ops. That gives
the same result for the correct P1/P2 input values, but addition can
be done at link time with addends. Thus SH3_P2SEG_FUNC compiles to a
constant P2 address.


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.59 01-Dec-2019 ad

Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.


# 1.58 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: netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.57 22-Aug-2018 msaitoh

- Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE 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 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE 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 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.56 19-Oct-2013 christos

branches: 1.56.28; 1.56.30;
make cpu_need_resched() macros consistent; __USE flags


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.55 22-Dec-2010 nisimura

branches: 1.55.8; 1.55.18; 1.55.22;
PROC_PC() should have been changed to LWP_PC().


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Oct-2009 rmind

branches: 1.54.4;
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: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 mjf-devfs2-base
# 1.53 22-Mar-2008 uwe

branches: 1.53.4;
Revert interrupt stack changes. There are some issues and, at least
in the current form, they complicate implementation of fast software
interrupts. I'd rather get fast softints in now and may be revisit
interrupt stack later.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.52 16-Mar-2008 uwe

Rewrite RUN_P2, RUN_P1 in asm. gcc4 is too happy to optimize away
assigned-goto versions if try to do anything fancy with them
(discovered by trying to wrap RUN_P2 into an "if").


# 1.51 27-Feb-2008 xtraeme

Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.50 07-Jan-2008 uwe

branches: 1.50.2; 1.50.6;
Now that sh3 has didicated interrupt stack we can check for cpu_intr_p
with simple sp comparison, so we can drop ci_idepth.


Revision tags: vmlocking2-base3
# 1.49 14-Dec-2007 uwe

Use dedicated interrupt stack. Tested on hpcsh and landisk. This has
been sitting in my tree for quite a while. While here s/top/bottom/
in a few places related to stacks to confirm to conventional
terminology.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.48 03-Dec-2007 ad

branches: 1.48.2; 1.48.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.47 17-Oct-2007 garbled

branches: 1.47.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.46 01-Oct-2007 ad

Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.45 04-Aug-2007 ad

branches: 1.45.2; 1.45.4;
Add ci_cpuid where it's missing.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.44 17-May-2007 yamt

branches: 1.44.2; 1.44.4; 1.44.8;
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 ad-audiomp-base
# 1.43 16-Feb-2007 ad

branches: 1.43.2; 1.43.6; 1.43.8; 1.43.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base 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 rpaulo-netinet-merge-pcb-base
# 1.41 21-Jan-2006 uwe

branches: 1.41.18;
Declare cpu_reset as __attribute__((__noreturn__)).


# 1.40 21-Jan-2006 uwe

Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.


# 1.39 21-Jan-2006 uwe

Use uint32_t.


# 1.38 24-Dec-2005 perry

branches: 1.38.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile


# 1.37 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base ktrace-lwp-base
# 1.36 25-Sep-2004 yamt

branches: 1.36.12;
include sys/cpu_data.h only if defined(_KERNEL)


# 1.35 22-Sep-2004 yamt

move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.33 04-Jan-2004 jdolecek

Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread


# 1.32 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.31 18-Jan-2003 thorpej

branches: 1.31.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.30 13-Nov-2002 msaitoh

add some definitions for P[VR]R register


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base kqueue-base
# 1.29 07-May-2002 thorpej

branches: 1.29.6;
Make CLKF_INTR() slightly less broken. The previous definition always
tested true if the CPU was running in the kernel at the time of the clock
interrupt, therefore all such time (kernel and idle) was counted as interrupt
time. The new definition simply punts on trying to count interrupt time,
which allows us to see kernel and idle time.


# 1.28 28-Apr-2002 uch

Use "#define<tab>", white space nits.


# 1.27 26-Apr-2002 msaitoh

add SH4 Processor Version Register


# 1.26 24-Mar-2002 uch

Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.


Revision tags: eeh-devprop-base
# 1.25 17-Mar-2002 uch

cosmetic changes, fix comments.


# 1.24 17-Mar-2002 uch

change to per-process AST.


Revision tags: newlock-base
# 1.23 08-Mar-2002 uch

cpu_swapout() moved to cpu.h


# 1.22 04-Mar-2002 uch

CTL_MACHDEP definitions are integrated into sh3/include/cpu.h again.


# 1.21 03-Mar-2002 uch

machine dependent sysctl are moved to machine/cpu.h
dreamcast, hpcsh ... CPU_CONSDEV
mmeye, evbsh3 ... CPU_CONSDEV, CPU_LOADANDRESET


Revision tags: ifpoll-base
# 1.20 28-Feb-2002 uch

cpu_dumpconf, reserve_dumppages, dumpsys, cpu_reset are moved to sh3/sh3_machdep.c


# 1.19 24-Feb-2002 uch

Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.


# 1.18 22-Feb-2002 uch

New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.


# 1.17 19-Feb-2002 uch

Clean up function declaration.


# 1.16 17-Feb-2002 uch

Add new MMU API. for detail, see sh3/mmu.h's comment.


# 1.15 12-Feb-2002 uch

ANSIfy KNF.


# 1.14 11-Feb-2002 uch

add useful macro for running P2, P1 area.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.13 24-Jun-2001 msaitoh

branches: 1.13.2;
fix KERNELMODE() macro (check MD bits, too)


# 1.12 30-May-2001 mrg

use _KERNEL_OPT


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 02-Feb-2001 thorpej

branches: 1.11.2;
Add some comments about P/USEG


# 1.10 25-Aug-2000 thorpej

Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.


Revision tags: netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.9 07-Jun-2000 tsubai

branches: 1.9.2;
Remove child_return prototype; it is now in sys/proc.h.


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

branches: 1.8.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.7 24-Feb-2000 msaitoh

SH4!


Revision tags: chs-ubc2-newbase
# 1.6 14-Jan-2000 msaitoh

add SH3_{PHYS,P1SEG,P2SEG}_TO_{PHYS,P1SEG,P2SEG} macros


# 1.5 24-Dec-1999 msaitoh

back to previous one (suggested by cgd)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.4 21-Dec-1999 msaitoh

move sysctl definitions into ${MACHINE}/include/cpu.h


# 1.3 21-Dec-1999 msaitoh

G.C.


Revision tags: comdex-fall-1999-base fvdl-softdep-base
# 1.2 14-Sep-1999 tsubai

branches: 1.2.2; 1.2.8;
Catch up with -current.


# 1.1 13-Sep-1999 itojun

Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.59 01-Dec-2019 ad

Fix false sharing problems with cpu_info. Identified with tprof(8).
This was a very nice win in my tests on a 48 CPU box.

- Reorganise cpu_data slightly according to usage.
- Put cpu_onproc into struct cpu_info alongside ci_curlwp (now is ci_onproc).
- On x86, put some items in their own cache lines according to usage, like
the IPI bitmask and ci_want_resched.


# 1.58 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: netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.57 22-Aug-2018 msaitoh

- Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE 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 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE 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 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.56 19-Oct-2013 christos

branches: 1.56.28; 1.56.30;
make cpu_need_resched() macros consistent; __USE flags


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.55 22-Dec-2010 nisimura

branches: 1.55.8; 1.55.18; 1.55.22;
PROC_PC() should have been changed to LWP_PC().


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Oct-2009 rmind

branches: 1.54.4;
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: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 mjf-devfs2-base
# 1.53 22-Mar-2008 uwe

branches: 1.53.4;
Revert interrupt stack changes. There are some issues and, at least
in the current form, they complicate implementation of fast software
interrupts. I'd rather get fast softints in now and may be revisit
interrupt stack later.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.52 16-Mar-2008 uwe

Rewrite RUN_P2, RUN_P1 in asm. gcc4 is too happy to optimize away
assigned-goto versions if try to do anything fancy with them
(discovered by trying to wrap RUN_P2 into an "if").


# 1.51 27-Feb-2008 xtraeme

Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.50 07-Jan-2008 uwe

branches: 1.50.2; 1.50.6;
Now that sh3 has didicated interrupt stack we can check for cpu_intr_p
with simple sp comparison, so we can drop ci_idepth.


Revision tags: vmlocking2-base3
# 1.49 14-Dec-2007 uwe

Use dedicated interrupt stack. Tested on hpcsh and landisk. This has
been sitting in my tree for quite a while. While here s/top/bottom/
in a few places related to stacks to confirm to conventional
terminology.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.48 03-Dec-2007 ad

branches: 1.48.2; 1.48.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.47 17-Oct-2007 garbled

branches: 1.47.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.46 01-Oct-2007 ad

Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.45 04-Aug-2007 ad

branches: 1.45.2; 1.45.4;
Add ci_cpuid where it's missing.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.44 17-May-2007 yamt

branches: 1.44.2; 1.44.4; 1.44.8;
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 ad-audiomp-base
# 1.43 16-Feb-2007 ad

branches: 1.43.2; 1.43.6; 1.43.8; 1.43.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base 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 rpaulo-netinet-merge-pcb-base
# 1.41 21-Jan-2006 uwe

branches: 1.41.18;
Declare cpu_reset as __attribute__((__noreturn__)).


# 1.40 21-Jan-2006 uwe

Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.


# 1.39 21-Jan-2006 uwe

Use uint32_t.


# 1.38 24-Dec-2005 perry

branches: 1.38.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile


# 1.37 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base ktrace-lwp-base
# 1.36 25-Sep-2004 yamt

branches: 1.36.12;
include sys/cpu_data.h only if defined(_KERNEL)


# 1.35 22-Sep-2004 yamt

move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.33 04-Jan-2004 jdolecek

Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread


# 1.32 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.31 18-Jan-2003 thorpej

branches: 1.31.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.30 13-Nov-2002 msaitoh

add some definitions for P[VR]R register


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base kqueue-base
# 1.29 07-May-2002 thorpej

branches: 1.29.6;
Make CLKF_INTR() slightly less broken. The previous definition always
tested true if the CPU was running in the kernel at the time of the clock
interrupt, therefore all such time (kernel and idle) was counted as interrupt
time. The new definition simply punts on trying to count interrupt time,
which allows us to see kernel and idle time.


# 1.28 28-Apr-2002 uch

Use "#define<tab>", white space nits.


# 1.27 26-Apr-2002 msaitoh

add SH4 Processor Version Register


# 1.26 24-Mar-2002 uch

Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.


Revision tags: eeh-devprop-base
# 1.25 17-Mar-2002 uch

cosmetic changes, fix comments.


# 1.24 17-Mar-2002 uch

change to per-process AST.


Revision tags: newlock-base
# 1.23 08-Mar-2002 uch

cpu_swapout() moved to cpu.h


# 1.22 04-Mar-2002 uch

CTL_MACHDEP definitions are integrated into sh3/include/cpu.h again.


# 1.21 03-Mar-2002 uch

machine dependent sysctl are moved to machine/cpu.h
dreamcast, hpcsh ... CPU_CONSDEV
mmeye, evbsh3 ... CPU_CONSDEV, CPU_LOADANDRESET


Revision tags: ifpoll-base
# 1.20 28-Feb-2002 uch

cpu_dumpconf, reserve_dumppages, dumpsys, cpu_reset are moved to sh3/sh3_machdep.c


# 1.19 24-Feb-2002 uch

Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.


# 1.18 22-Feb-2002 uch

New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.


# 1.17 19-Feb-2002 uch

Clean up function declaration.


# 1.16 17-Feb-2002 uch

Add new MMU API. for detail, see sh3/mmu.h's comment.


# 1.15 12-Feb-2002 uch

ANSIfy KNF.


# 1.14 11-Feb-2002 uch

add useful macro for running P2, P1 area.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.13 24-Jun-2001 msaitoh

branches: 1.13.2;
fix KERNELMODE() macro (check MD bits, too)


# 1.12 30-May-2001 mrg

use _KERNEL_OPT


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 02-Feb-2001 thorpej

branches: 1.11.2;
Add some comments about P/USEG


# 1.10 25-Aug-2000 thorpej

Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.


Revision tags: netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.9 07-Jun-2000 tsubai

branches: 1.9.2;
Remove child_return prototype; it is now in sys/proc.h.


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

branches: 1.8.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.7 24-Feb-2000 msaitoh

SH4!


Revision tags: chs-ubc2-newbase
# 1.6 14-Jan-2000 msaitoh

add SH3_{PHYS,P1SEG,P2SEG}_TO_{PHYS,P1SEG,P2SEG} macros


# 1.5 24-Dec-1999 msaitoh

back to previous one (suggested by cgd)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.4 21-Dec-1999 msaitoh

move sysctl definitions into ${MACHINE}/include/cpu.h


# 1.3 21-Dec-1999 msaitoh

G.C.


Revision tags: comdex-fall-1999-base fvdl-softdep-base
# 1.2 14-Sep-1999 tsubai

branches: 1.2.2; 1.2.8;
Catch up with -current.


# 1.1 13-Sep-1999 itojun

Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


# 1.58 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 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.57 22-Aug-2018 msaitoh

- Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE 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 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE 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 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.56 19-Oct-2013 christos

branches: 1.56.28; 1.56.30;
make cpu_need_resched() macros consistent; __USE flags


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.55 22-Dec-2010 nisimura

branches: 1.55.8; 1.55.18; 1.55.22;
PROC_PC() should have been changed to LWP_PC().


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Oct-2009 rmind

branches: 1.54.4;
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: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 mjf-devfs2-base
# 1.53 22-Mar-2008 uwe

branches: 1.53.4;
Revert interrupt stack changes. There are some issues and, at least
in the current form, they complicate implementation of fast software
interrupts. I'd rather get fast softints in now and may be revisit
interrupt stack later.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.52 16-Mar-2008 uwe

Rewrite RUN_P2, RUN_P1 in asm. gcc4 is too happy to optimize away
assigned-goto versions if try to do anything fancy with them
(discovered by trying to wrap RUN_P2 into an "if").


# 1.51 27-Feb-2008 xtraeme

Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.50 07-Jan-2008 uwe

branches: 1.50.2; 1.50.6;
Now that sh3 has didicated interrupt stack we can check for cpu_intr_p
with simple sp comparison, so we can drop ci_idepth.


Revision tags: vmlocking2-base3
# 1.49 14-Dec-2007 uwe

Use dedicated interrupt stack. Tested on hpcsh and landisk. This has
been sitting in my tree for quite a while. While here s/top/bottom/
in a few places related to stacks to confirm to conventional
terminology.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.48 03-Dec-2007 ad

branches: 1.48.2; 1.48.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.47 17-Oct-2007 garbled

branches: 1.47.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.46 01-Oct-2007 ad

Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.45 04-Aug-2007 ad

branches: 1.45.2; 1.45.4;
Add ci_cpuid where it's missing.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.44 17-May-2007 yamt

branches: 1.44.2; 1.44.4; 1.44.8;
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 ad-audiomp-base
# 1.43 16-Feb-2007 ad

branches: 1.43.2; 1.43.6; 1.43.8; 1.43.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base 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 rpaulo-netinet-merge-pcb-base
# 1.41 21-Jan-2006 uwe

branches: 1.41.18;
Declare cpu_reset as __attribute__((__noreturn__)).


# 1.40 21-Jan-2006 uwe

Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.


# 1.39 21-Jan-2006 uwe

Use uint32_t.


# 1.38 24-Dec-2005 perry

branches: 1.38.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile


# 1.37 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base ktrace-lwp-base
# 1.36 25-Sep-2004 yamt

branches: 1.36.12;
include sys/cpu_data.h only if defined(_KERNEL)


# 1.35 22-Sep-2004 yamt

move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.33 04-Jan-2004 jdolecek

Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread


# 1.32 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.31 18-Jan-2003 thorpej

branches: 1.31.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.30 13-Nov-2002 msaitoh

add some definitions for P[VR]R register


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base kqueue-base
# 1.29 07-May-2002 thorpej

branches: 1.29.6;
Make CLKF_INTR() slightly less broken. The previous definition always
tested true if the CPU was running in the kernel at the time of the clock
interrupt, therefore all such time (kernel and idle) was counted as interrupt
time. The new definition simply punts on trying to count interrupt time,
which allows us to see kernel and idle time.


# 1.28 28-Apr-2002 uch

Use "#define<tab>", white space nits.


# 1.27 26-Apr-2002 msaitoh

add SH4 Processor Version Register


# 1.26 24-Mar-2002 uch

Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.


Revision tags: eeh-devprop-base
# 1.25 17-Mar-2002 uch

cosmetic changes, fix comments.


# 1.24 17-Mar-2002 uch

change to per-process AST.


Revision tags: newlock-base
# 1.23 08-Mar-2002 uch

cpu_swapout() moved to cpu.h


# 1.22 04-Mar-2002 uch

CTL_MACHDEP definitions are integrated into sh3/include/cpu.h again.


# 1.21 03-Mar-2002 uch

machine dependent sysctl are moved to machine/cpu.h
dreamcast, hpcsh ... CPU_CONSDEV
mmeye, evbsh3 ... CPU_CONSDEV, CPU_LOADANDRESET


Revision tags: ifpoll-base
# 1.20 28-Feb-2002 uch

cpu_dumpconf, reserve_dumppages, dumpsys, cpu_reset are moved to sh3/sh3_machdep.c


# 1.19 24-Feb-2002 uch

Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.


# 1.18 22-Feb-2002 uch

New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.


# 1.17 19-Feb-2002 uch

Clean up function declaration.


# 1.16 17-Feb-2002 uch

Add new MMU API. for detail, see sh3/mmu.h's comment.


# 1.15 12-Feb-2002 uch

ANSIfy KNF.


# 1.14 11-Feb-2002 uch

add useful macro for running P2, P1 area.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.13 24-Jun-2001 msaitoh

branches: 1.13.2;
fix KERNELMODE() macro (check MD bits, too)


# 1.12 30-May-2001 mrg

use _KERNEL_OPT


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 02-Feb-2001 thorpej

branches: 1.11.2;
Add some comments about P/USEG


# 1.10 25-Aug-2000 thorpej

Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.


Revision tags: netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.9 07-Jun-2000 tsubai

branches: 1.9.2;
Remove child_return prototype; it is now in sys/proc.h.


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

branches: 1.8.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.7 24-Feb-2000 msaitoh

SH4!


Revision tags: chs-ubc2-newbase
# 1.6 14-Jan-2000 msaitoh

add SH3_{PHYS,P1SEG,P2SEG}_TO_{PHYS,P1SEG,P2SEG} macros


# 1.5 24-Dec-1999 msaitoh

back to previous one (suggested by cgd)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.4 21-Dec-1999 msaitoh

move sysctl definitions into ${MACHINE}/include/cpu.h


# 1.3 21-Dec-1999 msaitoh

G.C.


Revision tags: comdex-fall-1999-base fvdl-softdep-base
# 1.2 14-Sep-1999 tsubai

branches: 1.2.2; 1.2.8;
Catch up with -current.


# 1.1 13-Sep-1999 itojun

Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.57 22-Aug-2018 msaitoh

- Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.


Revision tags: netbsd-7-2-RELEASE 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 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE 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 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.56 19-Oct-2013 christos

branches: 1.56.28;
make cpu_need_resched() macros consistent; __USE flags


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base jym-xensuspend-nbase uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 rmind-uvmplock-base jym-xensuspend-base
# 1.55 22-Dec-2010 nisimura

branches: 1.55.8; 1.55.18; 1.55.22;
PROC_PC() should have been changed to LWP_PC().


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211
# 1.54 21-Oct-2009 rmind

branches: 1.54.4;
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: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 yamt-nfs-mp-base8 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 yamt-nfs-mp-base7 netbsd-5-0-1-RELEASE jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 mjf-devfs2-base
# 1.53 22-Mar-2008 uwe

branches: 1.53.4;
Revert interrupt stack changes. There are some issues and, at least
in the current form, they complicate implementation of fast software
interrupts. I'd rather get fast softints in now and may be revisit
interrupt stack later.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.52 16-Mar-2008 uwe

Rewrite RUN_P2, RUN_P1 in asm. gcc4 is too happy to optimize away
assigned-goto versions if try to do anything fancy with them
(discovered by trying to wrap RUN_P2 into an "if").


# 1.51 27-Feb-2008 xtraeme

Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.50 07-Jan-2008 uwe

branches: 1.50.2; 1.50.6;
Now that sh3 has didicated interrupt stack we can check for cpu_intr_p
with simple sp comparison, so we can drop ci_idepth.


Revision tags: vmlocking2-base3
# 1.49 14-Dec-2007 uwe

Use dedicated interrupt stack. Tested on hpcsh and landisk. This has
been sitting in my tree for quite a while. While here s/top/bottom/
in a few places related to stacks to confirm to conventional
terminology.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.48 03-Dec-2007 ad

branches: 1.48.2; 1.48.6;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.


Revision tags: jmcneill-base bouyer-xenamd64-base2 yamt-x86pmap-base4 bouyer-xenamd64-base
# 1.47 17-Oct-2007 garbled

branches: 1.47.2;
Merge the ppcoea-renovation branch to HEAD.

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

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

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


Revision tags: yamt-x86pmap-base3 yamt-x86pmap-base2 ppcoea-renovation-base vmlocking-base
# 1.46 01-Oct-2007 ad

Make want_resched a member of cpu_info.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base matt-mips64-base
# 1.45 04-Aug-2007 ad

branches: 1.45.2; 1.45.4;
Add ci_cpuid where it's missing.


Revision tags: nick-csl-alignment-base mjf-ufs-trans-base
# 1.44 17-May-2007 yamt

branches: 1.44.2; 1.44.4; 1.44.8;
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 ad-audiomp-base
# 1.43 16-Feb-2007 ad

branches: 1.43.2; 1.43.6; 1.43.8; 1.43.14;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.


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

Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 yamt-pdpolicy-base7 netbsd-4-base yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base 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 rpaulo-netinet-merge-pcb-base
# 1.41 21-Jan-2006 uwe

branches: 1.41.18;
Declare cpu_reset as __attribute__((__noreturn__)).


# 1.40 21-Jan-2006 uwe

Hide RUN_P2 and RUN_P1 from lint.
Drop CONSTCOND as lint doesn't see that code now.
While here, tweak them a bit to use less casts.


# 1.39 21-Jan-2006 uwe

Use uint32_t.


# 1.38 24-Dec-2005 perry

branches: 1.38.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile


# 1.37 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 yamt-readahead-base3 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 yamt-readahead-base2 netbsd-3-0-RC2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base netbsd-3-0-RC1 yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base ktrace-lwp-base
# 1.36 25-Sep-2004 yamt

branches: 1.36.12;
include sys/cpu_data.h only if defined(_KERNEL)


# 1.35 22-Sep-2004 yamt

move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 24-Mar-2004 wiz

Move
(c) TNF
line from 4-clause UCB to 3-clause UCB license; in other words,
remove UCB's ad clause from the license TNF grants.
There is no point in TNF demanding that UCB's ad clause be followed
when even UCB doesn't demand it any longer.

Ok'd by board@ and agc@.


# 1.33 04-Jan-2004 jdolecek

Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread


# 1.32 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.31 18-Jan-2003 thorpej

branches: 1.31.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.30 13-Nov-2002 msaitoh

add some definitions for P[VR]R register


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base kqueue-base
# 1.29 07-May-2002 thorpej

branches: 1.29.6;
Make CLKF_INTR() slightly less broken. The previous definition always
tested true if the CPU was running in the kernel at the time of the clock
interrupt, therefore all such time (kernel and idle) was counted as interrupt
time. The new definition simply punts on trying to count interrupt time,
which allows us to see kernel and idle time.


# 1.28 28-Apr-2002 uch

Use "#define<tab>", white space nits.


# 1.27 26-Apr-2002 msaitoh

add SH4 Processor Version Register


# 1.26 24-Mar-2002 uch

Rework interrupt code.
+ Fully utilize SH SR.I[0:3] interrupt level.
+ software interrupt is emulated by TMU1, 2 one shot interrupt.
+ implement generic soft interrupts.
+ implement clockframe correctly.


Revision tags: eeh-devprop-base
# 1.25 17-Mar-2002 uch

cosmetic changes, fix comments.


# 1.24 17-Mar-2002 uch

change to per-process AST.


Revision tags: newlock-base
# 1.23 08-Mar-2002 uch

cpu_swapout() moved to cpu.h


# 1.22 04-Mar-2002 uch

CTL_MACHDEP definitions are integrated into sh3/include/cpu.h again.


# 1.21 03-Mar-2002 uch

machine dependent sysctl are moved to machine/cpu.h
dreamcast, hpcsh ... CPU_CONSDEV
mmeye, evbsh3 ... CPU_CONSDEV, CPU_LOADANDRESET


Revision tags: ifpoll-base
# 1.20 28-Feb-2002 uch

cpu_dumpconf, reserve_dumppages, dumpsys, cpu_reset are moved to sh3/sh3_machdep.c


# 1.19 24-Feb-2002 uch

Move common exception vector and scheduler code to
sh3/sh3/exception_vector.S and sh3/sh3/locore_subr.S. exception
vectors are installed by sh_cpu_init(). machine/locore.S contains
kernel entry, interrupt handler, and some MD code.


# 1.18 22-Feb-2002 uch

New NetBSD/sh3 clock framework.
+ hardclock source is moved from TMU1 to TMU0.
+ SH3/SH4 common kernel support.
+ PCLOCK estimation.
+ remove duplicated code.


# 1.17 19-Feb-2002 uch

Clean up function declaration.


# 1.16 17-Feb-2002 uch

Add new MMU API. for detail, see sh3/mmu.h's comment.


# 1.15 12-Feb-2002 uch

ANSIfy KNF.


# 1.14 11-Feb-2002 uch

add useful macro for running P2, P1 area.


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.13 24-Jun-2001 msaitoh

branches: 1.13.2;
fix KERNELMODE() macro (check MD bits, too)


# 1.12 30-May-2001 mrg

use _KERNEL_OPT


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.11 02-Feb-2001 thorpej

branches: 1.11.2;
Add some comments about P/USEG


# 1.10 25-Aug-2000 thorpej

Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.


Revision tags: netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
# 1.9 07-Jun-2000 tsubai

branches: 1.9.2;
Remove child_return prototype; it is now in sys/proc.h.


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

branches: 1.8.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.7 24-Feb-2000 msaitoh

SH4!


Revision tags: chs-ubc2-newbase
# 1.6 14-Jan-2000 msaitoh

add SH3_{PHYS,P1SEG,P2SEG}_TO_{PHYS,P1SEG,P2SEG} macros


# 1.5 24-Dec-1999 msaitoh

back to previous one (suggested by cgd)


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.4 21-Dec-1999 msaitoh

move sysctl definitions into ${MACHINE}/include/cpu.h


# 1.3 21-Dec-1999 msaitoh

G.C.


Revision tags: comdex-fall-1999-base fvdl-softdep-base
# 1.2 14-Sep-1999 tsubai

branches: 1.2.2; 1.2.8;
Catch up with -current.


# 1.1 13-Sep-1999 itojun

Merge in NetBSD/sh3 from cvs.kame.net repository.

Tree structure:
- sys/arch/sh3: sh3 generic code
As commented, in-chip device drivers are put into sys/arch/sh3/dev.
- sys/arch/evbsh3: sh3 evaluation boards (pure sh3 CPU, no fancy external HW)
- sys/arch/mmeye: Brains mmEye, www.brains.co.jp
MI source code includes couple of #ifdef for sh3-coff support.
(sh3 uses coff or elf)

Needs some more improvements, especialy in sys/arch/sh3/conf/files.sh3,
to compile the tree (due to last minute tree structure change).