Home | History | Annotate | Download | only in include
History log of /src/sys/arch/i386/include/cpu.h
RevisionDateAuthorComments
 1.185  04-Sep-2023  mrg x86: avoid annoying GCC 12 bounds check in curcpu() and curlwp().

these functions read %gs and return an pointer at an offset from this
value (the current cpu, or lwp pointers), and GCC is complaining that
they're accessing a array cpu_info[0] (ie, zero length, no storage.)

several attempts to workaround it have failed, and because of the
asm volatile nature of this, it seems very unlikely a compiler would
take this and do something wrong with it.
 1.184  09-Apr-2023  riastradh i386: Make curlwp and curcpu() flushable.

The only effect of the `volatile' qualifier on an asm block with
outputs is to force the instructions to appear in the generated code,
even if the outputs end up being unused. Since these instructions
have no (architectural) side effects -- provided %fs is set
correctly, which must be the case here -- there's no need for the
volatile qualifier, so nix it.
 1.183  02-Nov-2021  ryo In order to prevent _mcount() from being recursively called when built with COPTS=-O0,
sprinkle `__always_inline' to make _mcount() be generated as a single function.
 1.182  21-Nov-2019  ad mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
 1.181  11-Feb-2019  cherry We reorganise definitions for XEN source support as follows:

XEN - common sources required for baseline XEN support.
XENPV - sources required for support of XEN in PV mode.
XENPVHVM - sources required for support for XEN in HVM mode.
XENPVH - sources required for support for XEN in PVH mode.
 1.180  18-Nov-2018  cherry On Xen, copy just the bits we need from the trapframe for hardclock(9)
and statclock(9).

Current, the macros that use the trapframe are:
CLKF_USERMODE()
CLKF_PC()
CLKF_INTR()

Of these, CLKF_INTR() already ignores the frame and uses the ci_idepth
variable to do its job.

Convert the two remaining ones to do this, but only for XEN.
 1.179  17-Sep-2017  maxv branches: 1.179.2; 1.179.4;
Remove the second argument from USERMODE and KERNELMODE, it is unused
now that we don't have vm86 anymore.
 1.178  30-Dec-2011  cherry branches: 1.178.6;
Move the per-cpu l3 page allocation code to a separate MD function. Avoids code duplication for xen PAE
 1.177  26-Jul-2011  yamt branches: 1.177.2; 1.177.6;
whitespace
 1.176  29-Dec-2008  pooka branches: 1.176.2; 1.176.12;
_LKM -> _MODULE
 1.175  22-May-2008  ad branches: 1.175.6;
Mark x86_curlwp() with __attribute__ ((const)), so gcc can CSE it and know
that it does not clobber global data.
 1.174  11-May-2008  ad Wrap stuff in #ifdef _KERNEL
 1.173  11-May-2008  ad Share cpu.h between the x86 ports.
 1.172  11-May-2008  ad Simplify x86 identcpu code, and share between i386/amd64.
 1.171  10-May-2008  ad Improve x86 tsc handling:

- Ditch the cross-CPU calibration stuff. It didn't work properly, and it's
near impossible to synchronize the CPUs in a running system, because bus
traffic will interfere with any calibration attempt, messing up the
timings.

- Only enable the TSC on CPUs where we are sure it does not drift. If we are
On a known good CPU, give the TSC high timecounter quality, making it the
default.

- When booting CPUs, detect TSC skew and account for it. Most Intel MP
systems have synchronized counters, but that need not be true if the
system has a complicated bus structure. As far as I know, AMD systems
do not have synchronized TSCs and so we need to handle skew.

- While an AP is waiting to be set running, try and make the TSC drift by
entering a reduced power state. If we detect drift, ensure that the TSC
does not get a high timecounter quality. This should not happen and is
only for safety.

- Make cpu_counter() stuff LKM safe.
 1.170  09-May-2008  joerg Make cpu_idle a macro calling a function pointer on x86.
Select the Xen idle routine for Xen, mwait if supported by the CPU and
it is not AMD and halt otherwise. As reported by Christoph Egger,
AMD Barcelona keeps the CPU in C0 state with MWAIT, contrary to HLT,
which uses C1 and therefore much less power.
 1.169  30-Apr-2008  ad branches: 1.169.2;
Avoid unneeded AST faults.
 1.168  28-Apr-2008  ad Add support for kernel preeemption to the i386 and amd64 ports. Notes:

- I have seen one isolated panic in the x86 pmap, but otherwise i386
seems stable with preemption enabled.

- amd64 is missing the FPU handling changes and it's not yet safe to
enable it there.

- The usual level for kern.sched.kpreempt_pri will be 128 once enabled
by default. For testing, setting it to 0 helps to shake out bugs.
 1.167  24-Apr-2008  ad branches: 1.167.2;
- Give ci_want_resched a single cache line, and align. This is for monitor/
mwait. At least one errata sheet from Intel notes that a single line
should be used.
- Align cc_microtime.
 1.166  21-Apr-2008  cegger Access Xen's vcpu info structure per-CPU.
Tested on i386 and amd64 (both dom0 and domU) by me.
Xen2 tested (both dom0 and domU) by bouyer.
OK bouyer
 1.165  27-Feb-2008  xtraeme branches: 1.165.2;
Add back the CPU_TMLR_* definitions for binary sysctl compatibility
with NetBSD pre-2.0, and use them in the longrun driver again.

Requested by cube@.
 1.164  27-Feb-2008  xtraeme Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.163  27-Feb-2008  xtraeme - Fixup the machdep.tm_longrun_* sysctl nodes creation.
- The CTL_TMLR_ static definitions for CTL_MACHDEP are not needed anymore.
 1.162  26-Feb-2008  xtraeme Split off the Transmeta Crusoe Longrun code into its own file, that
way identcpu.c and machdep.c are not cluttered with foreign code.

The driver is built by default as before, but the sysctl subtree will
only be created if longrun is detected and not always as the old code
did. This matches what the FreeBSD code does.

Ok by christos@.
 1.161  10-Feb-2008  ad branches: 1.161.2; 1.161.6;
Align cc_microtime and struct cpu_info to 64b.
 1.160  16-Jan-2008  ad Remove options MATH_EMULATE.
 1.159  15-Jan-2008  joerg Introduce optional cpu_offline_md to execute MD actions at the end of
cpu_offline. Use this on amd64/i386 to force a FPU save. As this was
triggered by npxsave_cpu/fpusave_cpu not working for a different CPU,
remove the cpu_info argument and adjust npxsave_*/fpusave_* to use bool
for the save.

OK ad@
 1.158  11-Jan-2008  bouyer Merge the bouyer-xeni386 branch to head, at tag bouyer-xeni386-merge1 (the
branch is still active and will see i386PAE support developement).
Sumary of changes:
- switch xeni386 to the x86/x86/pmap.c, and the xen/x86/x86_xpmap.c
pmap bootstrap.
- merge back most of xen/i386/ to i386/i386
- change the build to reduce diffs between i386 and amd64 in file locations
- remove include files that were identical to the i386/amd64 counterparts,
the build will find them via the xen-ma/machine link.
 1.157  05-Jan-2008  yamt move IOMAP_INVALOFF from cpu.h to tss.h
 1.156  05-Jan-2008  yamt g/c ci_idle_pcb_paddr
 1.155  04-Jan-2008  yamt i386:
- make tss per-cpu. this considerably speeds up context switch for,
at least, pentium4, where ltr instruction seems very slow.
i386, xen:
- kill cpu_maxproc.
kvm86:
- adapt to per-cpu tss.
- cleanup and simplify.
- move kvm86_mp_lock to more meaningful place.
- disable preemption during a call.
 1.154  01-Jan-2008  yamt try to detect processor resource sharing topologies. ie. package/core/smt IDs.
 1.153  25-Dec-2007  perry Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.152  18-Dec-2007  joerg Add new IPI for saving CPU state explicitly, share high-level part of
ACPI wakeup code and teach it how to start the APs again. As a side
effect the CPU_START interface allows choosing between different
bootstrap codes more easily now.
 1.151  03-Dec-2007  joerg branches: 1.151.4;
Add a CPU local timer based on the LAPIC. This is consistently faster
than TSC, but doesn't suffer from SpeedStep as TSC does.

The default quality is higher than HPET for UP, but -100 for
MULTIPROCESSOR as it needs CPU local state which doesn't exist yet.
 1.150  29-Oct-2007  ad branches: 1.150.2; 1.150.4;
Mark cpu_info::ci_tlbstate volatile to ensure that the compiler doesn't
reorder accesses to it. It's updated from the TLB IPI handlers and we don't
block those, so the order in which things are read/updated is important.
 1.149  26-Oct-2007  joerg Match delay/DELAY on x86 with delay(9). It takes an unsigned int as
argument. Use this and replace the inline assembly (mul + div using the
64bit intermediate result) with normal 32bit multiplication and
division. The compiler can turn the division into a multiplication and
shift, making it even cheaper then the original assembly. For extreme
long delays, just use 64bit arithmetic.
 1.148  18-Oct-2007  yamt merge yamt-x86pmap branch.

- reduce differences between amd64 and i386. notably, share pmap.c
between them. it makes several i386 pmap improvements available to
amd64, including tlb shootdown reduction and bug fixes from Stephan Uphoff.
- implement deferred pmap switching for amd64.
- remove LARGEPAGES option. always use large pages if available.
also, make it work on amd64.
 1.147  17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

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

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

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.146  26-Sep-2007  ad branches: 1.146.2;
x86 changes for pcc and LKMs.

- Replace most inline assembly with proper functions. As a side effect
this reduces the size of amd64 GENERIC by about 120kB, and i386 by a
smaller amount. Nearly all of the inlines did something slow, or something
that does not need to be fast.
- Make curcpu() and curlwp functions proper, unless __GNUC__ && _KERNEL.
In that case make them inlines. Makes curlwp LKM and preemption safe.
- Make bus_space and bus_dma more LKM friendly.
- Share a few more files between the ports.
- Other minor changes.
 1.145  25-Sep-2007  ad ci_astpending is no more.
 1.144  29-Aug-2007  ad branches: 1.144.2;
Merge most x86 changes from the vmlocking branch, except the threaded soft
interrupt stuff. This is mostly comprised of changes to the pmap modules to
work on multiprocessor systems without kernel_lock, and changes to speed up
tlb shootdowns.
 1.143  09-Jul-2007  ad branches: 1.143.4; 1.143.8; 1.143.10;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.142  03-Jun-2007  xtraeme Make the Enhanced Speedstep driver available for i386 and amd64.
To use it on EM64T CPUs supporting the EST CPUID feature. Note that
some CPUs still don't work with this driver, like Xeon or Pentium 4.

Move the p[34]_get_bus_clock functions into its own file,
intel_busclock.c and remove this code from i386/identcpu.c.

Tested on i386 by myself and amd64 by Tonerre.
 1.141  17-May-2007  yamt merge yamt-idlelwp branch. asked by core@. some ports still needs work.

from doc/BRANCHES:

idle lwp, and some changes depending on it.

1. separate context switching and thread scheduling.
(cf. gmcgarry_ctxsw)
2. implement idle lwp.
3. clean up related MD/MI interfaces.
4. make scheduler(s) modular.
 1.140  16-Apr-2007  ad branches: 1.140.2;
Share the sysarch stuff between the x86 ports. PR kern/36046.
 1.139  21-Mar-2007  xtraeme - Remove ci_msr_rvalue, it's not useful anymore as yamt@ pointed out.
- Remove completely debug from msr_ipifuncs, now it's known to work.
 1.138  20-Mar-2007  xtraeme MSR read and write IPI handlers for x86. A MSR will be read or written
in all CPUs available in the system. This adds another member
to struct cpu_info, ci_msr_rvalue; it will contain the value of the MSR
in a previous operation.

Tested with clockmod in UP and SMP by me, tested with est in SMP
by Daniel Carosone and Michael Van Elst.

Ok'ed by Andrew Doran and Matthew R. Green.
 1.137  18-Mar-2007  xtraeme There's no need to run est_init or k8_powernow_init on each CPU.
Just run it once (in the first cpu probed) with the RUN_ONCE(9)
framework.

Change the argument of est_init and k8_powernow_init to void, we don't
need cpu_info * anymore.

Suggested by tls@ and mrg@.
 1.136  12-Mar-2007  ad branches: 1.136.2; 1.136.4;
Include sys/simplelock.h, not sys/lock.h.
 1.135  05-Mar-2007  drochner branches: 1.135.2;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.
 1.134  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.133  17-Feb-2007  daniel branches: 1.133.2;
Add an opencrypto provider for the AES xcrypt instructions found on VIA
C5P and later cores (also known as 'ACE', which is part of the VIA PadLock
security engine). Ported from OpenBSD.

Reviewed on tech-crypto and port-i386, no objections to commiting this.
 1.132  16-Feb-2007  ad Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.131  09-Feb-2007  ad Merge newlock2 to head.
 1.130  08-Dec-2006  yamt - pass intrframe by-pointer, not by-value.
- make i386 and xen use per-cpu interrupt stack.

xen part is reviewed by Manuel Bouyer.
 1.129  03-Sep-2006  xtraeme branches: 1.129.2; 1.129.4; 1.129.6;
Conditionalize *_get_bus_clock() functions inside of
#ifdef ENHANCED_SPEEDSTEP to fix build when ENHANCED_SPEEDSTEP is not
defined.

Reported by Geoff Wing.
 1.128  03-Sep-2006  xtraeme Update the enhanced speedstep driver and sync the code with OpenBSD:

est.c:

* Use a quintuplet (vendor, MHz_hi, mV_hi, MHz_lo, mV_lo } to match
CPUs more correctly than parsing the brand string.
* Add support for a bunch of models.
* Create a fake table on the fly if the CPU is unknown (there's no
table for it) with the current/highest/lowest frequency.

specialreg.h:

* Add some MSRs needed to get the bus clock value.

identcpu.c:

* Add functions specific to Pentium III, Pentium M and Pentium 4 to
get the bus clock value.

Note that the new fake table code from Simon Burge is not included on
this commit.

Ok'ed by simonb and dogcow.
 1.127  23-Aug-2006  xtraeme - Move k7_powernow_* prototypes from i386/include/cpu.h to
x86/include/powernow.h
- Protect k[78]_powernow_init() functions with #ifdef POWERNOW_K[78] to
make it build without these options.

This fixes the problem reported by hubertf.
 1.126  08-Aug-2006  xtraeme - Add k7_powernow_destroy() prototype into cpu.h.
- Call k7_powernow_destroy() unloading the module.
 1.125  06-Aug-2006  xtraeme branches: 1.125.2;
* Sync powernow_k7.c driver with OpenBSD, it seems to work much
better finding PST tables.
* Use functions defined in powernow_common.c to detect if the
CPU can run powernow.
* Update the LKM with current code.
 1.124  07-Jun-2006  kardel convert to timecounters (from branch simonb-timecounters)
 1.123  16-Feb-2006  perry branches: 1.123.2; 1.123.8;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.122  03-Feb-2006  xtraeme branches: 1.122.2;
Fix "hard reboot" problem reported by Rhialto weeks ago on current-users@.
The problem was that pnowk7_init() was called too early in the boot
process, at this point the required calls were not available.

Thanks to Rhialto for testing and cube/christos for comments.
 1.121  31-Dec-2005  xtraeme branches: 1.121.2;
AMD PowerNow K7 driver written by Martin Vegiard via PR port-i386/26239.

Enabled by default on GENERIC and GENERIC_LAPTOP.

Imported 1 year later... but it's here finally.
 1.120  26-Dec-2005  perry branches: 1.120.2;
u_intN_t -> uintN_t
 1.119  24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.118  11-Aug-2005  cube Change all archs that did:

#define clockframe somethingelse

to:

struct clockframe {
struct somethingelse cf_se;
};

and change access macros accordingly.

That means that, at least for that very issue, things will not go
ka-boomy if you don't have the actual definition of struct clockframe
before including systm.h.
 1.117  21-Feb-2005  he branches: 1.117.4;
Probe and print the Intel Extended Feature Bits, as documented
in the CPUID instruction description in the "Intel Extended Memory 64
Technology Software Developer's Guide, Volume 1 of 2" available at
ftp://download.intel.com/technology/64bitextensions/30083402.pdf

This presently consists of the SYSCALL/SYSRET and the EM64T features.
CPUs with the EM64T feature available should be able to run amd64 code.

Reviewed by fvdl
 1.116  22-Sep-2004  yamt branches: 1.116.4; 1.116.6;
move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.115  16-May-2004  yamt curcpu: fix a typo. (cpuinfo -> cpu_info)
no functional difference.
 1.114  30-Apr-2004  lukem Integrate support for Enhanced SpeedStep Technology (est) that
Michael Eriksson posted to port-i386 on 20031102, with various
modifications by me to work in the new sysctl(9) framework.

The code is enabled with 'options ENHANCED_SPEEDSTEP', and if
the CPU supports EST the following sysctl(8) nodes appear
(with the values that a Dell Inspiron 8600 + WUXGA with a
1.4GHz Pentium M CPU supports):
machdep.est.cpu_brand = Intel(R) Pentium(R) M processor 1400MHz
machdep.est.frequency.target = 1400
machdep.est.frequency.current = 1400
machdep.est.frequency.available = 1400 1200 1000 800 600

If EST support isn't available, the "machdep.est" sysctl sub-MIB
is not created.

Once we have a more general "CPU frequency" control API we can
migrate this code to using that.

Thanks to Michael Erikkson for providing this code!
 1.113  20-Feb-2004  yamt defer pmap switching until it's really needed
to avoid frequent loading of cr3 register, which involves tlb flush.

with some fixes/improvements from Stephan Uphoff and Bang Jun-Young.
 1.112  04-Jan-2004  jdolecek Process and lwp exit path always executes lwp_exit2() now and cpu_exit()
is empty besides calling switch_exit(). So, rename switch_exit() to
cpu_exit() and modify the routine to call lwp_exit2() direct.
This saves couple cycles on the exit path.
 1.111  30-Dec-2003  pk Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

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

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
 1.110  30-Dec-2003  yamt g/c unused x86_ipisend.
 1.109  27-Oct-2003  junyoung Nuke __P().
 1.108  10-Oct-2003  simonb Take previous even further - leave only CTL_MACHDEP and related
definitions and structures outside the #ifdef _KERNEL block.
 1.107  10-Oct-2003  yamt revert the previous (thanks, lukem)
and wrap curcpu, cpu_info and friends with #ifdef _KERNEL completely.
 1.106  10-Oct-2003  lukem Userland needs <stddef.h> for offsetof(), not <lib/libkern/libkern.h> ...

(Arguably a chunk more of this file could be protected with _KERNEL.
That's a separate project.)
 1.105  09-Oct-2003  yamt avoid a magic number in curcpu().
 1.104  06-Sep-2003  christos SA_SIGINFO changes.
 1.103  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.102  26-Jun-2003  drochner branches: 1.102.2;
-make cpu_feature unsigned, just like ci_feature_flags
-clean up duplicate declaration of cpu_info_primary
 1.101  20-May-2003  kristerw Use __asm instead of asm, to make lint happy.
 1.100  25-Apr-2003  fvdl Share some common cache info cpuid code between i386 and x86_64.
 1.99  18-Mar-2003  fvdl Add some underscores in curcpu() to avoid a -Wshadow.
 1.98  01-Mar-2003  fvdl Move the CPU identification out of machdep.c into a seperate file.
 1.97  26-Feb-2003  fvdl Redirect some includes to x86/foo.h
 1.96  05-Feb-2003  nakayama Share i386/tsc_microtime.c with alpha and sparc64 as kern_microtime.c.
(approved by martin)
 1.95  17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.94  07-Jan-2003  fvdl Add various external declarations to accomodate ACPI MP probing as an
alternate method to MPBIOS probing. Move some stuff common to the two
methods into mpconfig.h
 1.93  16-Dec-2002  jdolecek use the __HAVE_CPU_MAXPROC hook to limit kern.maxproc to number
of available GDT slots
add code in init386() to force maxproc to be maximum cpu_maxproc()

this fixes port-i386/1635 by John Kohl
 1.92  06-Dec-2002  junyoung Don't pollute struct cpu_info with throwaway variables.
 1.91  06-Dec-2002  junyoung Display the extended feature flags with non-Intel processors rather than
the standard flags. See also PR#19163.

Before:

cpu0: AMD Athlon XP 1800+ (686-class), 1532.11 MHz
cpu0: features 383f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features 383f9ff<PGE,MCA,CMOV,FGPAT,PSE36,MMX>
cpu0: features 383f9ff<FXSR,SSE>

After:

cpu0: AMD Athlon XP 1800+ (686-class), 1532.11 MHz
cpu0: features c3cbf9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features c3cbf9ff<PGE,MCA,CMOV,PAT,PSE36,MPC,MMXX,MMX>
cpu0: features c3cbf9ff<FXSR,SSE,3DNOW2,3DNOW>

While I'm here, amd_cpuid_cpu_cacheinfo() is an info function rather
than a probe function.
 1.90  28-Nov-2002  fvdl Add ci_apicid field.
 1.89  22-Nov-2002  fvdl New interrupt code. The basic idea behind it is to hide the differences
in interrupt controllers in struct pic, and try to keep as much
common code as possible. At the lowest (asm) level, this is done
with CPP macros.

The main structure is now struct intrsource, describing an established
interrupt line, of any kind (soft/hard local apic/legacy apic/IO apic).
For quick masking, there may be a maximum of 32 sources per CPU.
Sources can be assigned to any CPU in the MP case, though currently they
all go to the boot CPU.
 1.88  02-Nov-2002  perry /*CONTCOND*/ a while (0) macro
 1.87  06-Oct-2002  fvdl Remove ci_lapic_ints from struct cpu_info again, it isn't needed anymore.
 1.86  06-Oct-2002  fvdl Keep size of struct cpu_info independent of DIAGNOSTIC/LOCKDEBUG
(was done in rev. 1.81, got lost in the MP merge).
 1.85  06-Oct-2002  fvdl Add per-CPU local apic redir table (2 pointers).
 1.84  06-Oct-2002  fvdl cpu_swapin now exists, so remove the empty define.
 1.83  05-Oct-2002  fvdl Add mask for TLB IPI rendezvous, and stackpointers + TSS structures
for TSS gates per CPU.

XXX struct cpu_info is getting to be a bit large
 1.82  01-Oct-2002  fvdl Merge Bill Sommerfeld's i386 MP branch. This code has some known
caveats, but works quite well in a lot of MP cases, and all
UP cases that I have tested. Parts of this will hopefully be
reworked in the not-too-distant future.
 1.81  09-Jul-2002  jdolecek always include ci_s*_locks in struct cpu_info, so that the size doesn't depend
on DIAGNOSTIC/LOCKDEBUG settings
 1.80  12-May-2002  matt branches: 1.80.2; 1.80.4;
Eliminate commons.
 1.79  08-May-2002  mycroft Wire CLKF_BASEPRI() to 0 on this platform. (See tech-kern.)
 1.78  31-Jan-2002  christos Fix comments.
 1.77  27-Dec-2001  christos add a new function to the cpu struct's that can be called to print extra
cpu information after initialization.
 1.76  17-Nov-2001  christos Add transmeta crusoe cpu support from toshi.
 1.75  02-Aug-2001  thorpej - Rename cpu_use_fxsave to i386_use_fxsave.
- If we detect SSE/SSE2 support in the CPU, enable SSE exceptions
and set i386_has_{sse,sse2} as appropriate.
- Expose i386_use_fxsave and i386_has_{sse,sse2} through sysctl
as machdep.{osfsxr,sse,sse2}.
 1.74  02-Aug-2001  thorpej Add support for saving/restoring SSE/SSE2 state using FXSAVE/FXRSTOR.

Reviewed by Frank.
 1.73  01-Aug-2001  thorpej Add several more Intel cache info entries, and fetch the CFLUSH
line size if we have the CFLUSH insn.
 1.72  14-Jun-2001  thorpej branches: 1.72.2;
Don't need to prototype child_return() here, it's in <sys/proc.h>.
 1.71  30-May-2001  mrg use _KERNEL_OPT
 1.70  03-May-2001  thorpej Rearrange the cache info fetching code some more, and add support
for fetching cache info for AMD processors.
 1.69  02-May-2001  thorpej - Keep cache/tlb info in the cpu_info structure.
- Add "associativity" to the cache_info structure.
- Add a (*cpu_cacheinfo)() function pointer, like we have a
(*cpu_setup)() function pointer. Cache info in the `cpuid'
is vendor-specific.
 1.68  14-Feb-2001  nathanw branches: 1.68.2;
Remove prototype for long-defunct i386_user_cleanup().

Remove duplicate prototype for i386_{set,get}_ldt() from sys_machdep.c.

Change i386_iopl() and i386_{set,get}_{ldt,ioperm}() to take a second
argument of "void *" instead of "char *", for consistency with other syscalls.
 1.67  10-Dec-2000  mycroft Introduce PROC_PC(), which is used to get a process's user PC. If this is
defined, call addupc_intr() directly from statclock() in the system time case,
using the same P_OWEUPC path if the copyin/copyout fails.
Use this in i386 to remove profiling code from the normal userret() path.
 1.66  16-Nov-2000  jdolecek make i386_nocpuid_cpus[] and i386_cpuid_cpus[] const - this pushes
another ~1.4KB to text section
 1.65  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.
 1.64  04-Jun-2000  mycroft branches: 1.64.2;
Implement CLKF_INTR(), to count interrupt time separately.
 1.63  26-May-2000  thorpej branches: 1.63.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.62  21-Apr-2000  thorpej - Declare biosbasemem and biosextmem in <machine/cpu.h>, don't extern
them everywhere they're used.
- Avoid integer overflow when converting bios{base,ext}mem (in units of
kilobytes) to bytes.
 1.61  29-Mar-2000  simonb Remove redundant decl of consinit() - it's in <sys/systm.h>.
Remove duplicate definition of delay() - we only need one in this file.
 1.60  28-Mar-2000  thorpej Extern cpu_id and cpu_vendor[] here.
 1.59  26-Jan-2000  drochner branches: 1.59.2;
next step in getting machdep.c maintainable - put bus_space related
stuff into a separate file
 1.58  21-Dec-1999  drochner machdep.c is becoming an unmaintainable mess
put console initialisation into a separate file
 1.57  06-Nov-1999  enami branches: 1.57.2;
- Export initrtclock().
- Call it from apm_resume().

This fixes timer problem on some laptop after hybernation (PR#4808).
Reviewd by: fvdl@netbsd.org
 1.56  06-Oct-1999  fvdl branches: 1.56.2; 1.56.4;
Define CPU_FPU_PRESENT sysctl value.
 1.55  10-Aug-1999  thorpej branches: 1.55.2;
Define cpu_number() as discussed on tech-smp.
 1.54  20-Jul-1999  thorpej Implement cpu_wait(), and move the call to tss_free() from switch_exit()
to cpu_wait(); tss_free() may block, and thus requires a valid context.
 1.53  01-Apr-1999  thorpej branches: 1.53.2; 1.53.4;
Do proc0's TSS and LDT initialization at the end of configure() (i.e.
once the FPU has been attached).
 1.52  12-Mar-1999  fvdl Clean up the BIOS disk matching code a bit (better naming, one structure
and sysctl to export to userland). Also, only use total number of sectors
given in the extended parameters if the physical chs geometry is
marked invalid. Hopefully fixes a problem where BIOSs would not correctly
fill in this field.
 1.51  10-Mar-1999  fvdl Create a list of native disks too, and make it retrievable. It contains
all matching BIOS disks per entry, so that we have complete match info.
Enable the matching code.
 1.50  08-Mar-1999  fvdl Add some fields to the already defined, but unused, bootinfo structure
for BIOS geometry. Define CPU_BIOS_GEOM sysctl value in cpu.h.
 1.49  11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.48  07-Oct-1998  thorpej Erg, frame -> trapframe in last. (thanks to john kohl)
 1.47  07-Oct-1998  thorpej Oops, back out a buglet I didn't intend to commit in the last change.
 1.46  06-Oct-1998  thorpej Move the code that does the deferred (post-autoconfiguration) buffer
cache allocation to its own function, and call it at the end of configure().
 1.45  06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.44  22-Jan-1998  thorpej Generate dependencies on the USER_LDT option.
 1.43  21-Jan-1998  thorpej Generate dependencies on the MATH_EMULATE option.
 1.42  15-Jan-1998  thorpej Generate dependencies on the VM86 option.
 1.41  27-Nov-1997  bouyer Add a cpu_setup() function to "struct cpu_nocpuid_nameclass" and
"struct cpu_cpuid_family", so that we can have a cpu_setup function per
known cpu type. For now use it only for cyrix 6x86 to enable suspend-on-halt
and implement cyrix's workaround to the "coma bug".
 1.40  20-Sep-1997  drochner branches: 1.40.2;
Define "machdep.booted_kernel" for sysctl.
 1.39  04-Feb-1997  perry branches: 1.39.8;
Nuke some options GENERIC residue.
 1.38  03-Dec-1996  fvdl Added types/definitions for changed CPU recognition code.
 1.37  18-Nov-1996  fvdl Changes for NKPDE calculation from cgd.

- New variables: biosextmem, biosbasemem, nkpde
- Above can be set by using the options BIOSEXTMEM, BIOSBASEMEM,
and NKPDE respectively (EXTMEM_SIZE is now called BIOSEXTMEM).
When preset this way, they won't be filled in / calculated.
- Readable by sysctl using machdep.nkpde, machdep.biosbasemem
and machdep.biosextmem.
- nkpde is calculated as:

min(NKPDE_MAX, NKPDE_BASE + (biosextmem >> 10) * NKPDE_SCALE)

Where NKPDE_MAX is 31, NKPDE_BASE is 4, NKPDE_SCALE = 1.
 1.36  11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.35  05-May-1996  christos Change the prototype of fillw from (int, caddr_t, size_t) to
(short, void *, size_t).
 1.34  03-May-1996  christos Add prototypes from other files.
 1.33  29-Mar-1996  mycroft Prototype delay().
 1.32  24-Dec-1995  mycroft Enable paging of the user area.
 1.31  11-Oct-1995  mycroft Various changes from John Kohl and me:
Map kernel stacks only at unique addresses.
Use one TSS per process.
Add sysarch calls for modifying IOPL and the I/O permission bitmap.
Add a compacting GDT entry allocator, for TSS and LDT selectors.
Enable modifying %fs and %gs with PT_SETREGS.
Sanitize various bits of code.
 1.30  10-Oct-1995  mycroft Add USERMODE() and KERNELMODE() macros, and use them.
 1.29  28-Jun-1995  cgd remove unused cpu_exec() definitions. moved "broken swap" markers, for
ports that still need it, to types.h.
 1.28  05-May-1995  cgd define BROKEN_SWAP and/or cpu_swapout as appropriate.
 1.27  22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.26  21-Apr-1995  mycroft Alias delay() to DELAY() for mi code.
 1.25  28-Mar-1995  jtc KERNEL -> _KERNEL
 1.24  27-Oct-1994  cgd new RCS ID format.
 1.23  14-Jun-1994  mycroft profile_tick() is no longer needed.
 1.22  27-May-1994  mycroft Add cpu_set_init_frame().
 1.21  23-May-1994  cgd add cpu_swapin
 1.20  19-May-1994  cgd make cpu_wait a macro, and define cpu_coredump
 1.19  07-May-1994  cgd cpu-dependent sysctl structs
 1.18  06-May-1994  mycroft Correct comment.
 1.17  05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.16  04-May-1994  cgd Rename a lot of process flags.
 1.15  07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.14  03-Apr-1994  mycroft This is #included multiple times.
 1.13  08-Mar-1994  mycroft Add `com' softintr.
 1.12  17-Dec-1993  mycroft branches: 1.12.2;
From magnum branch:
Remove Jolitz's netisr kluge. Make sure cpl == 0 really means base priority.
Other minor cleanup.
 1.11  11-Sep-1993  jtc Remove NEED_* defines, as they are now satisfied by libkern.
 1.10  02-Sep-1993  cgd branches: 1.10.2;
get rid of bogus #define of resettodr(); now setting time actually works!
 1.9  16-Jun-1993  jtc Move my assembly versions of strlen and ffs into the kernel
 1.8  03-Jun-1993  cgd add prototype for a function to be called from execve to check a_mid type
 1.7  02-Jun-1993  cgd set things up so that the signal trampoline code is on the stack,
like it normally is in BSD systems. still has a bit of hair...
 1.6  21-May-1993  cgd add "cpu classes" in addition to cpu names, put cpu names in table, along
with mapping to classes. this is for upgraded cpu-id code coming "soon"
 1.5  21-May-1993  cgd move cpu types out of assym.s and into cputypes.h
and have that file included by cpu.h and by locore.s
 1.4  20-May-1993  cgd hack on the uname "machine name" stuff for hopefully the last time.
now it uses MACHINE, as defined in param.h
 1.3  20-May-1993  cgd clean up for new cpu stuff
 1.2  20-May-1993  cgd make uname stuff in init_main machine independent
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10.2.9  01-Feb-1994  mycroft Revert clockframe and profiling stuff.
 1.10.2.8  11-Jan-1994  mycroft SIR_GENERIC --> SIR_AST, to match main branch.
 1.10.2.7  29-Oct-1993  mycroft Set sir bits correctly.
 1.10.2.6  18-Oct-1993  mycroft Add a more `normal' way of dealing with software interrupts.
 1.10.2.5  18-Oct-1993  mycroft Add need_proftick(), and some minor cleanup.
 1.10.2.4  14-Oct-1993  mycroft Remove aston().
 1.10.2.3  13-Oct-1993  mycroft Remove defunct profile_tick(). Put pending AST flag back in netisr.
 1.10.2.2  24-Sep-1993  mycroft Changes from trunk.
cpu.h: Add dummy (for now) CLKF_INTR(). #include psl.h.
endian.h: Add multiple-inclusion protection. #define _QUAD_{LOW,HIGH}WORD.
#include sys/cdefs for __P(). Don't define byte order stuff if _POSIX_SOURCE.
Remove big endian shit.
limits.h: Add {,U}QUAD_{MIN,MAX}.
psl.h: Get PSL_MB[ZO] right. Make cpl volatile just in case. Add alias for
spl0(). splnone() and splx() return int for now.
 1.10.2.1  14-Sep-1993  mycroft New i386 code.
 1.12.2.2  17-Dec-1993  mycroft From magnum branch:
Remove Jolitz's netisr kluge. Make sure cpl == 0 really means base priority.
Other minor cleanup.
 1.12.2.1  17-Dec-1993  mycroft file cpu.h was added on branch magnum on 1993-12-17 00:10:50 +0000
 1.39.8.1  22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.40.2.1  28-Nov-1997  mellon Pull rev 1.41 up from trunk (bouyer)
 1.53.4.1  02-Aug-1999  thorpej Update from trunk.
 1.53.2.1  27-Jun-2000  he Pull up revision 1.57 (via patch, requested by mjl):
Reinitialize clock after hibernation, something which seems to be
required on some laptops. Fixes PR#4808.
 1.55.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.56.4.1  15-Nov-1999  fvdl Sync with -current
 1.56.2.4  12-Mar-2001  bouyer Sync with HEAD.
 1.56.2.3  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.56.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.56.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.57.2.2  06-Nov-1999  enami - Export initrtclock().
- Call it from apm_resume().

This fixes timer problem on some laptop after hybernation (PR#4808).
Reviewd by: fvdl@netbsd.org
 1.57.2.1  06-Nov-1999  enami file cpu.h was added on branch comdex-fall-1999 on 1999-11-06 01:14:01 +0000
 1.59.2.32  18-May-2002  sommerfeld Catch up with -current. (commons elimination, changes to MI pci framework)
 1.59.2.31  27-Apr-2002  sommerfeld Add options TRAPLOG:

When enabled, each cpu gets a ring buffer; on every trap entry, we add
an entry to the trap log using the new locore "TLOG" macro. Somewhat
like a flight recorder, this may give some post-mortem clues as to
what was going on as we were spiralling in...

XXX currently depends on various intel MSR's to record the low order
32 bits of the cycle counter as well as last-branch from and to
addresses.
 1.59.2.30  24-Feb-2002  sommerfeld Resynch with mainline.
 1.59.2.29  29-Dec-2001  sommerfeld Set up per-cpu GDT.
Use %fs for per-cpu data access.
 1.59.2.28  29-Dec-2001  sommerfeld Yet another mergeup.

New work:
- Frank van der Linden's tlb shootdown fix.
Mainline functionality merged:
- IrDA
- Kernel RCSID's
- Transmeta CPU support
- ACPI
- XMM register access through procfs
 1.59.2.27  03-Sep-2001  sommerfeld Merge with -current once more.
 1.59.2.26  02-Jul-2001  fvdl Since cpuid_level value -1 is used to indicate "not available",
it should be signed.
 1.59.2.25  18-Jun-2001  sommerfeld checkpoint merge-in-progress from mainline.
 1.59.2.24  26-May-2001  sommerfeld Implement MP-synchronzed microtime(), based on Jason Thorpe's port of
Dave Mills's cycle-counter-based microtime.

XXX We need to figure out how to deal with processors where the cycle
counter speed varies. We don't have a whole lot of alternatives; we
could only use this on multiprocessors, which are less likely to
throttle the clock to save power.

The local apic timer runs at a fixed frequency, but it's
count-down-to-zero, not the count-up-forever type of timer which the
Mills code expects.

This also does not solve the problem of microtime on 486-based
multiprocessors..
 1.59.2.23  07-May-2001  sommerfeld Rework cache/tlb parsing, etc., One More Time.
Compact tables, rework associativity.
 1.59.2.22  07-May-2001  sommerfeld "Merge" in revised cache probing code (including amd cache size
probing). Separate feature probing from output formatting, and call
uvm_recolor() at an appropriate moment.
 1.59.2.21  30-Apr-2001  sommerfeld Merge sommerfeld_i386mp_1 branch with -current as of today.
GENERIC.MP kernel boots and runs multiuser on my ABIT BP6
 1.59.2.20  10-Jan-2001  sommerfeld Significant rewrite of slave CPU attach and initialization, centering
on identifycpu() and spreading outward.

Separate feature probes (cpuid invocation), which runs on the cpu
being attached, from the display of this information, which runs on
the boot cpu; remove some of the probe code from locore as it doesn't
need to run that early.

We now spin up secondary cpu's during cpu_attach, have them do a cpu
feature probe, and then have them spin waiting for a "go" signal.

We no longer pay attention to the cpu signature and cpuid features
reported by the MP BIOS since those are known to be truncated for at
least some bioses.

We now do npx initialization (including FDIV bug detection) on all
cpus.

XXX Change some of the cyrix bug workarounds to fit the new
identifycpu() system; this is untested.
 1.59.2.19  08-Jan-2001  sommerfeld Mostly fix cpu identification:
- move globals which contain per-cpu state into cpu_info.
- fix cache size probing to work off of cpu_info rather than globals
- print out itlb/dtlb sizes
- add a few more cache identifiers from the latest version of AP-485

cpu timing, cache probing, and processor serial number lookup still
happens only on the main cpu; this needs to be restructured; mark what
code needs to move into per-cpu probe code.

While we're here, eradicate "cpu_info_store" in favor of "cpu_info_primary".
 1.59.2.18  07-Jan-2001  sommerfeld Correct merge botches.
Post-merge kernel now boots multiuser.
 1.59.2.17  07-Jan-2001  sommerfeld Snapshot of merge-in-progress with -current.

[Not expected to build]. Catch up with the last N months worth of
changes to -current.
 1.59.2.16  04-Jan-2001  thorpej Make sure that there's at least one "cpu_info" slot, so that we don't
trash random memory in the non-MULTIPROCESSOR case.
 1.59.2.15  04-Jan-2001  thorpej Always statically allocated the primary CPU's cpu_info, and make the
cpu_info list available in the non-MULTIPROCESSOR case, as well.
 1.59.2.14  18-Nov-2000  sommerfeld Add some minimal support for iterating over cpus
 1.59.2.13  23-Sep-2000  sommerfeld Preliminary support for cloning MTRR values between CPU's at boot time.
XXX no API to *set* MTRR values yet.
 1.59.2.12  25-Aug-2000  sommerfeld Get this to at least build again in the !MULTIPROCESSOR case..
 1.59.2.11  25-Aug-2000  sommerfeld The need_resched() function now takes a (cpu_info *) parameter.
Get asts out of <machine/intr.h>
Untangle astpending and want_resched variables somewhat.
 1.59.2.10  18-Aug-2000  sommerfeld misc changes:
- CPUF_PAUSE (indicating CPU is paused in debugger).
- ci_flags is now a u_int32_t.
- npx interface changes.
 1.59.2.9  12-Aug-2000  sommerfeld Get ready for context switch changes:
- initialize idle pcbs earlier, before the first tsleep (instead of as
part of booting the secondary cpu's), since we'll actually use them
when idling in the near future.
- clean up cpu_hatch()
- fixup curproc's cpu pointer when switching to "real" cpu_info (XXX).
- turn on local apic clock in cpu_hatch()
- load the right gdt descriptor in cpu_hatch()
- return from cpu_hatch() instead of spinning there; current
mptramp code will spin; future code will jump to idle loop.
 1.59.2.8  26-Jun-2000  sommerfeld Start making npx.c MP-safe; Interface to npx now specifies the process
and/or cpu to act on. Implement an IPI for MP lazy FP save.
Tested and working when only one CPU is running; untested in the MP
case since we can't run user processes on multiple CPU's yet.

Along for the ride:
- Change i386_send_ipi to take a "struct cpu_info *" rather than a cpu number.
- Turn off the "give me the brain" test IPI's.
 1.59.2.7  25-Jun-2000  sommerfeld Add CPUF_PRIMARY, CPU_IS_PRIMARY()
 1.59.2.6  25-Jun-2000  sommerfeld Merge up to just-post-1.5 -current
 1.59.2.5  22-Apr-2000  sommerfeld Merge up to -current.
 1.59.2.4  17-Apr-2000  sommerfeld Catch up sommerfeld_i386mp_1 branch with -current.
 1.59.2.3  24-Feb-2000  sommerfeld Patch from Matt Debergalis to un-break bootblock build
 1.59.2.2  21-Feb-2000  sommerfeld MP: attempt to deal with the case where the BSP is at apic id 1 instead
of apic id 0.
 1.59.2.1  20-Feb-2000  sommerfeld MP: include cpu_info structure, which picks up what used to be in
several global variables.
XXX cpu_info is bigger than it should be..
 1.63.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.64.2.1  25-Apr-2001  he Pull up revision 1.66 (requested by jdolecek):
Add ``const'' to cpu tables.
Properly identify and distinguish newer Intel CPUs using Brand
ID information.
 1.68.2.18  07-Jan-2003  thorpej Sync with HEAD.
 1.68.2.17  03-Jan-2003  thorpej Merge switch_exit() and switch_lwp_exit().
 1.68.2.16  19-Dec-2002  thorpej Sync with HEAD.
 1.68.2.15  11-Dec-2002  thorpej Sync with HEAD.
 1.68.2.14  25-Nov-2002  nathanw Make ASTs per-proc rather than per-cpu; per-proc makes more sense when
a process that needs a trap can be running on multiple CPUs.
 1.68.2.13  11-Nov-2002  nathanw Catch up to -current
 1.68.2.12  18-Oct-2002  nathanw cpu_info->fp_curlwp is a struct lwp, not a struct proc.

npxsave_proc() -> npxsave_lwp().
 1.68.2.11  18-Oct-2002  nathanw Define curlwp, not curproc.
 1.68.2.10  18-Oct-2002  nathanw Catch up to -current.
 1.68.2.9  01-Aug-2002  nathanw Catch up to -current.
 1.68.2.8  20-Jun-2002  nathanw Catch up to -current.
 1.68.2.7  28-Feb-2002  nathanw Catch up to -current.
 1.68.2.6  23-Feb-2002  gmcgarry Protect cpu_proc_fork() with _KERNEL
 1.68.2.5  08-Jan-2002  nathanw Catch up to -current.
 1.68.2.4  08-Dec-2001  thorpej Add a cpu_proc_fork(), called from uvm_proc_fork(), which takes care
of machine-dependent handling a fork() time (this is different from
forking the actual context in an LWP world). #define it away on
platforms which do not need it.

Problem noted by Gregory McGarry.
 1.68.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.68.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.68.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.72.2.6  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.72.2.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.72.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.72.2.3  11-Feb-2002  jdolecek Sync w/ -current.
 1.72.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.72.2.1  03-Aug-2001  lukem update to -current
 1.80.4.1  07-Sep-2003  tron Apply patch (requested by drochner in ticket 1344):
Make output of CPU features look nicer on new Pentium IV CPUs.
 1.80.2.1  16-Jul-2002  gehenna catch up with -current.
 1.102.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.102.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.102.2.4  24-Sep-2004  skrll Sync with HEAD.
 1.102.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.102.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.102.2.1  03-Aug-2004  skrll Sync with HEAD
 1.116.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.116.4.1  29-Apr-2005  kent sync with -current
 1.117.4.11  17-Mar-2008  yamt sync with head.
 1.117.4.10  27-Feb-2008  yamt sync with head.
 1.117.4.9  11-Feb-2008  yamt sync with head.
 1.117.4.8  21-Jan-2008  yamt sync with head
 1.117.4.7  07-Dec-2007  yamt sync with head
 1.117.4.6  15-Nov-2007  yamt sync with head.
 1.117.4.5  27-Oct-2007  yamt sync with head.
 1.117.4.4  03-Sep-2007  yamt sync with head.
 1.117.4.3  26-Feb-2007  yamt sync with head.
 1.117.4.2  30-Dec-2006  yamt sync with head.
 1.117.4.1  21-Jun-2006  yamt sync with head.
 1.120.2.2  18-Feb-2006  yamt sync with head.
 1.120.2.1  15-Jan-2006  yamt sync with head.
 1.121.2.1  09-Sep-2006  rpaulo sync with head
 1.122.2.3  22-Apr-2006  simonb Sync with head.
 1.122.2.2  28-Feb-2006  kardel initrtclock() now gets the frequency as parameter
 1.122.2.1  04-Feb-2006  simonb Remove port-specific microtime() function support.
 1.123.8.1  19-Jun-2006  chap Sync with head.
 1.123.2.3  03-Sep-2006  yamt sync with head.
 1.123.2.2  11-Aug-2006  yamt sync with head
 1.123.2.1  26-Jun-2006  yamt sync with head.
 1.125.2.4  07-Sep-2006  tron Pull up following revision(s) (requested by xtraeme in ticket #114):
sys/arch/i386/include/cpu.h: revision 1.129
sys/arch/i386/i386/identcpu.c: revision 1.40
Conditionalize *_get_bus_clock() functions inside of
#ifdef ENHANCED_SPEEDSTEP to fix build when ENHANCED_SPEEDSTEP is not
defined.
Reported by Geoff Wing.
 1.125.2.3  06-Sep-2006  riz Pull up following revision(s) (requested by xtraeme in ticket #111):
sys/arch/x86/include/specialreg.h: revision 1.11
sys/arch/i386/i386/identcpu.c: revision 1.39
sys/arch/i386/include/cpu.h: revision 1.128
sys/arch/i386/i386/est.c: revision 1.26
Update the enhanced speedstep driver and sync the code with OpenBSD:
est.c:
* Use a quintuplet (vendor, MHz_hi, mV_hi, MHz_lo, mV_lo } to match
CPUs more correctly than parsing the brand string.
* Add support for a bunch of models.
* Create a fake table on the fly if the CPU is unknown (there's no
table for it) with the current/highest/lowest frequency.
specialreg.h:
* Add some MSRs needed to get the bus clock value.
identcpu.c:
* Add functions specific to Pentium III, Pentium M and Pentium 4 to
get the bus clock value.
Note that the new fake table code from Simon Burge is not included on
this commit.
Ok'ed by simonb and dogcow.
 1.125.2.2  27-Aug-2006  tron Pull up following revision(s) (requested by xtraeme in ticket #57):
sys/arch/i386/i386/identcpu.c: revision 1.37
sys/arch/x86/include/powernow.h: revision 1.4
sys/arch/i386/include/cpu.h: revision 1.127
- Move k7_powernow_* prototypes from i386/include/cpu.h to
x86/include/powernow.h
- Protect k[78]_powernow_init() functions with #ifdef POWERNOW_K[78] to
make it build without these options.
This fixes the problem reported by hubertf.
 1.125.2.1  11-Aug-2006  riz Pull up following revision(s) (requested by xtraeme in ticket #10):
sys/arch/i386/include/cpu.h: revision 1.126
sys/lkm/arch/i386/powernow/lkminit_powernow.c: revision 1.5
- Add k7_powernow_destroy() prototype into cpu.h.
- Call k7_powernow_destroy() unloading the module.
 1.129.6.2  12-Sep-2007  msaitoh Pull up following patches (requested by xtraeme in ticket #809)

share/man/man4/options.4 patch
sys/arch/i386/conf/files.i386 patch
sys/arch/i386/i386/est.c delete
sys/arch/i386/i386/identcpu.c patch
sys/arch/i386/include/cpu.h patch
sys/arch/x86/conf/files.x86 patch
sys/arch/x86/include/cpuvar.h patch
sys/arch/x86/x86/est.c new file
sys/arch/x86/x86/intel_busclock.c new file
sys/arch/amd64/amd64/identcpu.c patch
sys/arch/amd64/conf/GENERIC patch

Add support for the VIA C7-M and Eden processors in the Enhanced
Speedstep driver.
amd64: The Enhanced Speedstep driver is now able to work on EM64T
CPUs running in 64bit mode.
 1.129.6.1  20-Apr-2007  bouyer branches: 1.129.6.1.2;
Pull up following revision(s) (requested by mlelstv in ticket #575):
sys/arch/i386/i386/est.c sync with 1.37
sys/arch/i386/i386/ipifuncs.c sync with 1.16
sys/arch/x86/include/cpu_msr.h sync with 1.4
sys/arch/x86/include/intrdefs.h sync with 1.8
sys/arch/x86/include/powernow.h sync with 1.9
sys/arch/x86/x86/powernow_k8.c sync with 1.20
sys/arch/x86/x86/msr_ipifuncs.c sync with 1.8
sys/arch/amd64/amd64/ipifuncs.c sync with 1.9
sys/arch/i386/i386/identcpu.c patch
sys/arch/i386/i386/machdep.c patch
sys/arch/i386/include/cpu.h patch
sys/arch/x86/conf/files.x86 patch
sys/arch/x86/x86/x86_machdep.c patch
sys/arch/amd64/amd64/machdep.c patch
Add MSR write IPI handler for x86. Use it and the RUN_ONCE framework
to make est and powernow drivers work properly with SMP.
 1.129.6.1.2.1  23-Sep-2007  wrstuden Sync with somewhat-recent netbsd-4.
 1.129.4.1  10-Dec-2006  yamt sync with head.
 1.129.2.5  27-Jan-2007  ad If running on a PPro or later, at boot patch in versions of spllower() and
similar that use cmpxchg8b instead of cli/sti. Cuts the clock cycles for
splx() by a factor of ~6 on the P4, and ~3 on the PIII when bracketed by
serializing instructions (and hopefully more when not).
 1.129.2.4  12-Jan-2007  ad Sync with head.
 1.129.2.3  11-Jan-2007  ad Checkpoint work in progress.
 1.129.2.2  17-Nov-2006  ad Checkpoint work in progress.
 1.129.2.1  20-Oct-2006  ad - Make ASTs per-LWP.
- The signal stack and signal mask will be per-LWP shortly.

need_resched(), need_proftick(), signotify():

- Prefix with cpu_
- Make per-LWP.
- Send an IPI if the LWP is on another CPU.
 1.133.2.8  07-May-2007  yamt sync with head.
 1.133.2.7  24-Mar-2007  yamt sync with head.
 1.133.2.6  17-Mar-2007  rmind Backport lock.h split into the simplelock.h and other #include changes
from HEAD. This fixes the problems with circular includes.
 1.133.2.5  12-Mar-2007  rmind Sync with HEAD.
 1.133.2.4  03-Mar-2007  yamt curpcb: wrap the definition with parenthesises.
 1.133.2.3  23-Feb-2007  yamt - introduce sys/cpu.h which has cpu_idle and cpu_need_resched.
- use it where appropriate.
- while i'm here, remove several unnecessary #include.
 1.133.2.2  17-Feb-2007  yamt - separate context switching and thread scheduling.
- introduce idle lwp.
- change some related MD/MI interfaces and implement i386 version.
 1.133.2.1  17-Feb-2007  yamt file cpu.h was added on branch yamt-idlelwp on 2007-02-17 10:30:49 +0000
 1.135.2.14  03-Dec-2007  ad Sync with HEAD.
 1.135.2.13  23-Oct-2007  ad Sync with head.
 1.135.2.12  10-Oct-2007  ad Share cpu_intr_p() between amd64/i386.
 1.135.2.11  09-Oct-2007  ad Sync with head.
 1.135.2.10  21-Aug-2007  ad - Add ci_cpumask and use in preference to (1 << ci_cpuid). Some processors
are bad at shifting by non-constant amounts.
- pmap_tlb_shootdown() must be called with preemption disabled.
- Defer waiting for tlb shootdown to complete after kenter_pa()/kremove().
Spin in pmap_update() and in pmap_detactivate(), in case the LWP has been
preempted
- When preparing to send a multicast shootdown IPI, avoid scanning the list
of CPUs if the pmap's bitmask indicates that it's only active locally.
 1.135.2.9  29-Jul-2007  ad - When zeroing/copying pages, use SSE2 movtni to avoid polluting the cache.
- By default, align assembly routines on 32-byte starting boundaries.
- There are now 8 interrupt priority levels, half of which are softints.
Update intrdefs.h to match.
- Always clear/set spinlock words - removes lots of ifdefs.
- Remove the horrible ci_self150 hack that I introduced.
- Overhaul how TLB shootdown is performed. Inspired by a similar change in
OpenBSD but implemented quite differently. This should be a lot faster
but I have not benchmarked it yet.
 1.135.2.8  17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.135.2.7  09-Jun-2007  ad Sync with head.
 1.135.2.6  27-May-2007  ad Sync with head.
 1.135.2.5  29-Apr-2007  ad Replace another simplelock.
 1.135.2.4  28-Apr-2007  ad - Make the PV cache per-CPU and eliminate the global pvalloc_lock. Cuts
contention on the freelist locks by a factor of ~50 on a dual core box.
- Mirror a patch for amd64 posted by oster@, and make the TLB shootdown
freelist per-CPU. Increase the number of TLB shootdown jobs from 16
to 32 per CPU.
 1.135.2.3  10-Apr-2007  ad Sync with head.
 1.135.2.2  05-Apr-2007  ad Fix the pmap locking.
 1.135.2.1  13-Mar-2007  ad Sync with head.
 1.136.4.1  29-Mar-2007  reinoud Pullup to -current
 1.136.2.1  11-Jul-2007  mjf Sync with head.
 1.140.2.3  03-Oct-2007  garbled Sync with HEAD
 1.140.2.2  26-Jun-2007  garbled Sync with HEAD.
 1.140.2.1  22-May-2007  matt Update to HEAD.
 1.143.10.3  23-Mar-2008  matt sync with HEAD
 1.143.10.2  09-Jan-2008  matt sync with HEAD
 1.143.10.1  06-Nov-2007  matt sync with HEAD
 1.143.8.6  09-Dec-2007  jmcneill Sync with HEAD.
 1.143.8.5  29-Oct-2007  joerg Sync with HEAD.
 1.143.8.4  28-Oct-2007  joerg Sync with HEAD.
 1.143.8.3  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.143.8.2  02-Oct-2007  joerg Sync with HEAD.
 1.143.8.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.143.4.1  03-Sep-2007  skrll Sync with HEAD.
 1.144.2.3  07-Oct-2007  yamt g/c nkpde.
 1.144.2.2  06-Oct-2007  yamt sync with head.
 1.144.2.1  23-Sep-2007  yamt - sync with amd64.
- pmap_alloc_level: remove fast call special case.
- tweak some printf to work for both of LP64 and LP32.
- remove machdep.nkpde sysctl.
- remove automatic adjustment of nkpde for now. will revisit later.
 1.146.2.2  13-Nov-2007  bouyer Sync with HEAD
 1.146.2.1  25-Oct-2007  bouyer Sync with HEAD.
 1.150.4.4  26-Dec-2007  ad Sync with head.
 1.150.4.3  26-Dec-2007  ad Back out the dumppcb changes for the time being.
 1.150.4.2  12-Dec-2007  ad - Dump basic trap and register info before entering the debugger, in
case ddb screws the machine up further.
- Fill dumppcb asap so that gdb has less chance to get confused.
 1.150.4.1  08-Dec-2007  ad Sync with head.
 1.150.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.150.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.150.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.151.4.4  19-Jan-2008  bouyer Sync with HEAD
 1.151.4.3  08-Jan-2008  bouyer Sync with HEAD
 1.151.4.2  06-Jan-2008  bouyer Merge needed changes to genassym.cf and locore.S for xeni386 back to
arch/i386. Switch xeni386 to use the arch/i386 cpu.h.
 1.151.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.161.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.161.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.161.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.161.2.1  24-Mar-2008  keiichi sync with head.
 1.165.2.2  04-Jun-2008  yamt sync with head
 1.165.2.1  18-May-2008  yamt sync with head.
 1.167.2.2  04-May-2009  yamt sync with head.
 1.167.2.1  16-May-2008  yamt sync with head.
 1.169.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.175.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.176.12.1  17-Aug-2011  cherry Pullup relevant changes from -current
 1.176.2.1  27-Aug-2011  jym Sync with HEAD. Most notably: uvm/pmap work done by rmind@, and MP Xen
work of cherry@.

No regression observed on suspend/restore.
 1.177.6.1  18-Feb-2012  mrg merge to -current.
 1.177.2.1  17-Apr-2012  yamt sync with head
 1.178.6.1  03-Dec-2017  jdolecek update from HEAD
 1.179.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.179.4.1  10-Jun-2019  christos Sync with HEAD
 1.179.2.1  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts

RSS XML Feed