#
272461 |
|
02-Oct-2014 |
gjb |
Copy stable/10@r272459 to releng/10.1 as part of the 10.1-RELEASE process.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
256281 |
|
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation
|
#
255331 |
|
06-Sep-2013 |
gibbs |
Implement PV IPIs for PVHVM guests and further converge PV and HVM IPI implmementations.
Submitted by: Roger Pau Monné Sponsored by: Citrix Systems R&D Submitted by: gibbs (misc cleanup, table driven config) Reviewed by: gibbs MFC after: 2 weeks
sys/amd64/include/cpufunc.h: sys/amd64/amd64/pmap.c: Move invltlb_globpcid() into cpufunc.h so that it can be used by the Xen HVM version of tlb shootdown IPI handlers.
sys/x86/xen/xen_intr.c: sys/xen/xen_intr.h: Rename xen_intr_bind_ipi() to xen_intr_alloc_and_bind_ipi(), and remove the ipi vector parameter. This api allocates an event channel port that can be used for ipi services, but knows nothing of the actual ipi for which that port will be used. Removing the unused argument and cleaning up the comments surrounding its declaration helps clarify its actual role.
sys/amd64/amd64/mp_machdep.c: sys/amd64/include/cpu.h: sys/i386/i386/mp_machdep.c: sys/i386/include/cpu.h: Implement a generic framework for amd64 and i386 that allows the implementation of certain CPU management functions to be selected at runtime. Currently this is only used for the ipi send function, which we optimize for Xen when running on a Xen hypervisor, but can easily be expanded to support more operations.
sys/x86/xen/hvm.c: Implement Xen PV IPI handlers and operations, replacing native send IPI.
sys/amd64/include/pcpu.h: sys/i386/include/pcpu.h: sys/i386/include/smp.h: Remove NR_VIRQS and NR_IPIS from FreeBSD headers. NR_VIRQS is defined already for us in the xen interface files. NR_IPIS is only needed in one file per Xen platform and is easily inferred by the IPI vector table that is defined in those files.
sys/i386/xen/mp_machdep.c: Restructure to more closely match the HVM implementation by performing table driven IPI setup.
|
#
255058 |
|
30-Aug-2013 |
kib |
Provide a wrapper for the INVPCID instruction, definition of the descriptor and symbolic names for the operation types.
Sponsored by: The FreeBSD Foundation Reviewed by: alc Tested by: pho, bf
|
#
238972 |
|
01-Aug-2012 |
kib |
Add lfence().
MFC after: 1 week
|
#
238311 |
|
09-Jul-2012 |
jhb |
Add a clts() wrapper around the 'clts' instruction to <machine/cpufunc.h> on x86 and use that to implement stop_emulating() in the fpu/npx code. Reimplement start_emulating() in the non-XEN case by using load_cr0() and rcr0() instead of the 'lmsw' and 'smsw' instructions. Intel explicitly discourages the use of 'lmsw' and 'smsw' on 80386 and later processors in the description of these instructions in Volume 2 of the ADM.
Reviewed by: kib MFC after: 1 month
|
#
238142 |
|
05-Jul-2012 |
jhb |
Now that our assembler supports the xsave family of instructions, use them natively rather than hand-assembled versions. For xgetbv/xsetbv, add a wrapper API to deal with xcr* registers: rxcr() and load_xcr().
Reviewed by: kib MFC after: 1 month
|
#
237855 |
|
30-Jun-2012 |
alc |
Optimize reserve_pv_entries() using the popcnt instruction.
|
#
232227 |
|
27-Feb-2012 |
jhb |
Correct function prototype for read_rflags().
|
#
230766 |
|
30-Jan-2012 |
kib |
Move xrstor/xsave/xsetbv into fpu.c and reorder them.
Requested by: bde MFC after: 1 month
|
#
230538 |
|
25-Jan-2012 |
kib |
Order newly added functions alphabetically.
Requested by: bde MFC after: 3 days
|
#
230262 |
|
17-Jan-2012 |
kib |
Implement xsetbv(), xsave() and xrstor() providing C access to the similarly named CPU instructions.
Since our in-tree binutils gas is not aware of the instructions, and I have to use the byte-sequence to encode them, hardcode the r/m operand as (%rdi). This way, first argument of the pseudo-function is already placed into proper register.
MFC after: 1 week
|
#
223796 |
|
05-Jul-2011 |
jkim |
Correct cpu_monitor() and cpu_mwait() for amd64. These instructions take %rcx as "extensions" in long mode. If any unused bit is set in %rcx, these instructions cause general protection fault. Fix style nits and synchronize i386 with amd64.
|
#
220631 |
|
14-Apr-2011 |
jkim |
Add a function rdtsc32() to read lower 32 bits from TSC and discard upper 32 bits. Some times compiler inserts unnecessary instructions to preserve unused upper 32 bits even when it is casted to a 32-bit value. It reduces such compiler mistakes where every cycle counts.
|
#
220629 |
|
14-Apr-2011 |
jkim |
Consistently use __volatile as the rest of this file.
|
#
220628 |
|
14-Apr-2011 |
jkim |
Prefer C99 standard integers to reduce diff from i386 version.
|
#
212177 |
|
03-Sep-2010 |
rdivacky |
Change the parameter passed to the inline assembly to u_short as we are dealing with 16bit segment registers. Change mov to movw.
Approved by: rpaulo (mentor) Reviewed by: kib, rink
|
#
201369 |
|
01-Jan-2010 |
obrien |
Quiet variable "shadows" warning: sys/vmmeter.h: warning: shadowed declaration is here machine/cpufunc.h: In function 'insw': machine/cpufunc.h: warning: declaration of 'cnt' shadows a global declaration ..snip..
|
#
197647 |
|
30-Sep-2009 |
avg |
cpufunc.h: unify/correct style of c extension names
i386 and amd64 archs only. inline => __inline. [1] __asm__ => __asm. [2]
Reviewed by: kib, jhb [1] Suggested by: kib [2] MFC after: 1 week
|
#
195820 |
|
22-Jul-2009 |
kib |
When the page caching attributes are changed, after new mapping is established, OS shall flush the caches on all processors that may have used the mapping previously. This operation is not needed if processors support self-snooping. If not, but clflush instruction is implemented on the CPU, series of the clflush can be used on the mapping region. Otherwise, we have to flush the whole cache. The later operation is very expensive, and AMD-made CPUs do not have self-snooping.
Implement cache flush for remapped region by using clflush for amd64, when supported by CPU.
Proposed and reviewed by: alc Approved by: re (kensmith)
|
#
190919 |
|
11-Apr-2009 |
ed |
Simplify in/out functions (for i386 and AMD64).
Remove a hack to generate more efficient code for port numbers below 0x100, which has been obsolete for at least ten years, because GCC has an asm constraint to specify that.
Submitted by: Christoph Mallon <christoph mallon gmx de>
|
#
190817 |
|
07-Apr-2009 |
ed |
Don't explicitly force ecx to be used for MSR_FSBASE/MSR_GSBASE.
Because the "c" input constaint is used, the compiler will already place the MSR_FSBASE/MSR_GSBASE constants in ecx. Using __asm("ecx") makes LLVM crash. Even though this is also an LLVM bug, we'd better remove the unnecessary GCCism as well.
Submitted by: Christoph Mallon <christoph.mallon@gmx.de>
|
#
187948 |
|
31-Jan-2009 |
obrien |
Change some movl's to mov's. Newer GAS no longer accept 'movl' instructions for moving between a segment register and a 32-bit memory location.
Looked at by: jhb
|
#
181430 |
|
08-Aug-2008 |
stas |
- Add cpuctl(4) pseudo-device driver to provide access to some low-level features of CPUs like reading/writing machine-specific registers, retrieving cpuid data, and updating microcode. - Add cpucontrol(8) utility, that provides userland access to the features of cpuctl(4). - Add subsequent manpages.
The cpuctl(4) device operates as follows. The pseudo-device node cpuctlX is created for each cpu present in the systems. The pseudo-device minor number corresponds to the cpu number in the system. The cpuctl(4) pseudo- device allows a number of ioctl to be preformed, namely RDMSR/WRMSR/CPUID and UPDATE. The first pair alows the caller to read/write machine-specific registers from the correspondent CPU. cpuid data could be retrieved using the CPUID call, and microcode updates are applied via UPDATE.
The permissions are inforced based on the pseudo-device file permissions. RDMSR/CPUID will be allowed when the caller has read access to the device node, while WRMSR/UPDATE will be granted only when the node is opened for writing. There're also a number of priv(9) checks.
The cpucontrol(8) utility is intened to provide userland access to the cpuctl(4) device features. The utility also allows one to apply cpu microcode updates.
Currently only Intel and AMD cpus are supported and were tested.
Approved by: kib Reviewed by: rpaulo, cokane, Peter Jeremy MFC after: 1 month
|
#
178299 |
|
18-Apr-2008 |
jeff |
- Add inlines for the monitor and mwait instructions.
Sponsored by: Nokia
|
#
146170 |
|
12-May-2005 |
nectar |
Add a knob for disabling/enabling HTT, "machdep.hyperthreading_allowed". Default off due to information disclosure on multi-user systems.
Submitted by: cperciva Reviewed by: jhb
|
#
143434 |
|
11-Mar-2005 |
peter |
Remove diffs to i386 version that came in via the compiler support ifdefs. This changes things like whitespace, inconsistent use of #ifndef vs #if !defined(), different macro argument orders, mismatched comments, etc.
|
#
143063 |
|
02-Mar-2005 |
joerg |
netchild's mega-patch to isolate compiler dependencies into a central place.
This moves the dependency on GCC's and other compiler's features into the central sys/cdefs.h file, while the individual source files can then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42.
By now, GCC and ICC (the Intel compiler) have been actively tested on IA32 platforms by netchild. Extension to other compilers is supposed to be possible, of course.
Submitted by: netchild Reviewed by: various developers on arch@, some time ago
|
#
132888 |
|
30-Jul-2004 |
ps |
MFia64: Fix -O builds with gcc 3.4 by defining ffs as __builtin_ffs instead of creating an inline function that just calls __builtin_ffs.
|
#
127973 |
|
06-Apr-2004 |
peter |
MFi386: move rss() from db_interface.c to cpufunc.h
|
#
127920 |
|
05-Apr-2004 |
imp |
Remove advertising clause from University of California Regent's license, per letter dated July 22, 1999 and email from Peter Wemm.
Approved by: core, peter
|
#
126846 |
|
11-Mar-2004 |
bde |
Don't implement anything in the ffs family in <machine/cpufunc.h> in the non-_KERNEL case. This "fixes" applications that include this "kernel-only" header and also include <strings.h> (or get <strings.h> via the default _BSD_VISIBLE pollution in <string.h>. In C++ there was a fatal error: the declaration specifies C linkage but the implementation gives C++ linkage. In C there was only a static/extern mismatch if the headers were included in a certain order order, and a partially redundant declaration for all include orders; gcc emits incomplete or wrong diagnostics for these, but only for compiling with -Wsystem-headers and certain other warning options, so the problem was usually not seen for C.
Ports breakage reported by: kris
|
#
126734 |
|
07-Mar-2004 |
peter |
MFi386: re-sort non-gcc function prototypes, trim includes
|
#
126649 |
|
05-Mar-2004 |
le |
Fix syntax errors and wrong function prototypes in several MD header files when using non-GNUC compilers.
PR: kern/58515 Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at> Approved by: grog (mentor), obrien
|
#
125175 |
|
28-Jan-2004 |
peter |
Re-add debug register functions
|
#
123181 |
|
06-Dec-2003 |
peter |
Add 64 bit bsf*/ffs* routines. Have the ffs() inline use gcc's builtin because it uses the better cmove instructions to avoid branches.
|
#
122296 |
|
08-Nov-2003 |
peter |
Update the graffiti.
|
#
115006 |
|
14-May-2003 |
peter |
Collect the nastiness for preserving the kernel MSR_GSBASE around the load_gs() calls into a single place that is less likely to go wrong.
Eliminate the per-process context switching of MSR_GSBASE, because it should be constant for a single cpu. Instead, save/restore it during the loading of the new %gs selector for the new process.
Approved by: re (amd64/* blanket)
|
#
114987 |
|
14-May-2003 |
peter |
Add BASIC i386 binary support for the amd64 kernel. This is largely stolen from the ia64/ia32 code (indeed there was a repocopy), but I've redone the MD parts and added and fixed a few essential syscalls. It is sufficient to run i386 binaries like /bin/ls, /usr/bin/id (dynamic) and p4. The ia64 code has not implemented signal delivery, so I had to do that.
Before you say it, yes, this does need to go in a common place. But we're in a freeze at the moment and I didn't want to risk breaking ia64. I will sort this out after the freeze so that the common code is in a common place.
On the AMD64 side, this required adding segment selector context switch support and some other support infrastructure. The %fs/%gs etc code is hairy because loading %gs will clobber the kernel's current MSR_GSBASE setting. The segment selectors are not used by the kernel, so they're only changed at context switch time or when changing modes. This still needs to be optimized.
Approved by: re (amd64/* blanket)
|
#
114349 |
|
30-Apr-2003 |
peter |
Commit MD parts of a loosely functional AMD64 port. This is based on a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to attempt to get a stable base to start from. There is a lot missing still. Worth noting: - The kernel runs at 1GB in order to cheat with the pmap code. pmap uses a variation of the PAE code in order to avoid having to worry about 4 levels of page tables yet. - It boots in 64 bit "long mode" with a tiny trampoline embedded in the i386 loader. This simplifies locore.s greatly. - There are still quite a few fragments of i386-specific code that have not been translated yet, and some that I cheated and wrote dumb C versions of (bcopy etc). - It has both int 0x80 for syscalls (but using registers for argument passing, as is native on the amd64 ABI), and the 'syscall' instruction for syscalls. int 0x80 preserves all registers, 'syscall' does not. - I have tried to minimize looking at the NetBSD code, except in a couple of places (eg: to find which register they use to replace the trashed %rcx register in the syscall instruction). As a result, there is not a lot of similarity. I did look at NetBSD a few times while debugging to get some ideas about what I might have done wrong in my first attempt.
|
#
113734 |
|
20-Apr-2003 |
obrien |
Rev 1.132 was backed out because of the following from BDE:
By returning garbage for the unused high bits of segment registers, we avoid wasting time initializing the bits if the results are assigned to 32-bit variables. movl instead of movw was also intentional, to prevent gas adding pessimal pessimal segment overrides.
See src-committers Message-ID: <20030419173421.N15436@gamplex.bde.org>, for more details and how to optimize this farther.
|
#
113728 |
|
19-Apr-2003 |
davidxu |
Backout my last commit.
Requested by: bde
|
#
113704 |
|
19-Apr-2003 |
davidxu |
Don't return garbage in high 16 bits.
|
#
103778 |
|
22-Sep-2002 |
peter |
Create inlines for ltr(sel), lldt(sel), lidt(addr) rather than functions that have one instruction.
|
#
103749 |
|
21-Sep-2002 |
markm |
Provide in inline function for the (GNUC) assembler "hlt" instruction.
|
#
100432 |
|
21-Jul-2002 |
peter |
Move SWTCH_OPTIM_STATS related code out of cpufunc.h. (This sort of stat gathering is not an x86 cpu feature)
|
#
100078 |
|
15-Jul-2002 |
markm |
Cast to prevent "signed/unsigned comparison" warnings.
|
#
99862 |
|
12-Jul-2002 |
peter |
Revive backed out pmap related changes from Feb 2002. The highlights are: - It actually works this time, honest! - Fine grained TLB shootdowns for SMP on i386. IPI's are very expensive, so try and optimize things where possible. - Introduce ranged shootdowns that can be done as a single IPI. - PG_G support for i386 - Specific-cpu targeted shootdowns. For example, there is no sense in globally purging the TLB cache for where we are stealing a page from the local unshared process on the local cpu. Use pm_active to track this. - Add some instrumentation for the tlb shootdown code. - Rip out SMP code from <machine/cpufunc.h> - Try and fix some very bogus PG_G and PG_PS interactions that were bad enough to cause vm86 bios calls to break. vm86 depended on our existing bugs and this was the cause of the VESA panics last time. - Fix the silly one-line error that caused the 'panic: bad pte' last time. - Fix a couple of other silly one-line errors that should have caused more pain than they did.
Some more work is needed: - pmap_{zero,copy}_page[_idle]. These can be done without IPI's if we have a hook in cpu_switch. - The IPI handlers need some cleanup. I have a bogus %ds load that can be avoided. - APTD handling is rather bogus and appears to be a large source of global TLB IPI shootdowns for no really good reason.
I see speedups of between 1.5% and ~4% on buildworlds in a while 1 loop. I expect to see a bigger difference when there is significant pageout activity or the system otherwise has memory shortages.
I have backed out a few optimizations that I had been using over the last few days in order to be a little more conservative. I'll revisit these again over the next few days as the dust settles.
New option: DISABLE_PG_G - In case I missed something.
|
#
97139 |
|
22-May-2002 |
jhb |
Rename pause() to ia32_pause() so it doesn't conflict with the pause() function defined in <unistd.h>. I didn't #ifdef _KERNEL it because the mutex implementation in libpthread will probably need this.
|
#
97115 |
|
22-May-2002 |
jhb |
Debug registers aren't selectors, so use saner names for the variables in the inline functions for reading and writing the debug registers.
|
#
97114 |
|
22-May-2002 |
jhb |
- Sort the pause() inline into the appropriate location. - Add many missing prototypes to the non-GCC section.
|
#
97113 |
|
22-May-2002 |
jhb |
Rename cpu_pause() to pause(). Originally I was going to make this an MI API with empty cpu_pause() functions on other arch's, but this functionality is definitely unique to IA-32, so I decided to leave it as i386-only and wrap it in #ifdef's. I should have dropped the cpu_ prefix when I made that decision.
Requested by: bde
|
#
97076 |
|
21-May-2002 |
jhb |
Add an inline function cpu_pause() for the IA32 'pause' instruction.
|
#
94386 |
|
10-Apr-2002 |
dwmalone |
Move do_cpuid into the correct place in this file and make the indentation more like the other multi-line assembley in this file.
Someone who understands gcc constraints could update the constraints for do_cpuid.
|
#
93607 |
|
01-Apr-2002 |
dillon |
Stage-2 commit of the critical*() code. This re-inlines cpu_critical_enter() and cpu_critical_exit() and moves associated critical prototypes into their own header file, <arch>/<arch>/critical.h, which is only included by the three MI source files that need it.
Backout and re-apply improperly comitted syntactical cleanups made to files that were still under active development. Backout improperly comitted program structure changes that moved localized declarations to the top of two procedures. Partially re-apply one of the program structure changes to move 'mask' into an intermediate block rather then in three separate sub-blocks to make the code more readable. Re-integrate bug fixes that Jake made to the sparc64 code.
Note: In general, developers should not gratuitously move declarations out of sub-blocks. They are where they are for reasons of structure, grouping, readability, compiler-localizability, and to avoid developer-introduced bugs similar to several found in recent years in the VFS and VM code.
Reviewed by: jake
|
#
93264 |
|
27-Mar-2002 |
dillon |
Compromise for critical*()/cpu_critical*() recommit. Cleanup the interrupt disablement assumptions in kern_fork.c by adding another API call, cpu_critical_fork_exit(). Cleanup the td_savecrit field by moving it from MI to MD. Temporarily move cpu_critical*() from <arch>/include/cpufunc.h to <arch>/<arch>/critical.c (stage-2 will clean this up).
Implement interrupt deferral for i386 that allows interrupts to remain enabled inside critical sections. This also fixes an IPI interlock bug, and requires uses of icu_lock to be enclosed in a true interrupt disablement.
This is the stage-1 commit. Stage-2 will occur after stage-1 has stabilized, and will move cpu_critical*() into its own header file(s) + other things. This commit may break non-i386 architectures in trivial ways. This should be temporary.
Reviewed by: core Approved by: core
|
#
93018 |
|
23-Mar-2002 |
bde |
Fixed some style bugs in the removal of __P(()). The main ones were not removing tabs before "__P((", and not outdenting continuation lines to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting and/or rewrap the whole prototype in some cases.
|
#
92860 |
|
21-Mar-2002 |
imp |
Fix abuses of cpu_critical_{enter,exit} by converting to intr_{disable,restore} as well as providing an implemenation of intr_{disable,restore}.
Reviewed by: jake, rwatson, jhb
|
#
92819 |
|
20-Mar-2002 |
imp |
Fix minor style(9) violation in de__Ping
|
#
92761 |
|
20-Mar-2002 |
alfred |
Remove __P.
|
#
91497 |
|
28-Feb-2002 |
markm |
Make it a bit clearer where this file is to be used and where it should not be. (Comments only)
Inspired by: bde
|
#
91367 |
|
27-Feb-2002 |
peter |
Back out all the pmap related stuff I've touched over the last few days. There is some unresolved badness that has been eluding me, particularly affecting uniprocessor kernels. Turning off PG_G helped (which is a bad sign) but didn't solve it entirely. Userland programs still crashed.
|
#
91328 |
|
26-Feb-2002 |
dillon |
revert last commit temporarily due to whining on the lists.
|
#
91315 |
|
26-Feb-2002 |
dillon |
STAGE-1 of 3 commit - allow (but do not require) interrupts to remain enabled in critical sections and streamline critical_enter() and critical_exit().
This commit allows an architecture to leave interrupts enabled inside critical sections if it so wishes. Architectures that do not wish to do this are not effected by this change.
This commit implements the feature for the I386 architecture and provides a sysctl, debug.critical_mode, which defaults to 1 (use the feature). For now you can turn the sysctl on and off at any time in order to test the architectural changes or track down bugs.
This commit is just the first stage. Some areas of the code, specifically the MACHINE_CRITICAL_ENTER #ifdef'd code, is strictly temporary and will be cleaned up in the STAGE-2 commit when the critical_*() functions are moved entirely into MD files.
The following changes have been made:
* critical_enter() and critical_exit() for I386 now simply increment and decrement curthread->td_critnest. They no longer disable hard interrupts. When critical_exit() decrements the counter to 0 it effectively calls a routine to deal with whatever interrupts were deferred during the time the code was operating in a critical section.
Other architectures are unaffected.
* fork_exit() has been conditionalized to remove MD assumptions for the new code. Old code will still use the old MD assumptions in regards to hard interrupt disablement. In STAGE-2 this will be turned into a subroutine call into MD code rather then hardcoded in MI code.
The new code places the burden of entering the critical section in the trampoline code where it belongs.
* I386: interrupts are now enabled while we are in a critical section. The interrupt vector code has been adjusted to deal with the fact. If it detects that we are in a critical section it currently defers the interrupt by adding the appropriate bit to an interrupt mask.
* In order to accomplish the deferral, icu_lock is required. This is i386-specific. Thus icu_lock can only be obtained by mainline i386 code while interrupts are hard disabled. This change has been made.
* Because interrupts may or may not be hard disabled during a context switch, cpu_switch() can no longer simply assume that PSL_I will be in a consistent state. Therefore, it now saves and restores eflags.
* FAST INTERRUPT PROVISION. Fast interrupts are currently deferred. The intention is to eventually allow them to operate either while we are in a critical section or, if we are able to restrict the use of sched_lock, while we are not holding the sched_lock.
* ICU and APIC vector assembly for I386 cleaned up. The ICU code has been cleaned up to match the APIC code in regards to format and macro availability. Additionally, the code has been adjusted to deal with deferred interrupts.
* Deferred interrupts use a per-cpu boolean int_pending, and masks ipending, spending, and fpending. Being per-cpu variables it is not currently necessary to lock; bus cycles modifying them.
Note that the same mechanism will enable preemption to be incorporated as a true software interrupt without having to further hack up the critical nesting code.
* Note: the old critical_enter() code in kern/kern_switch.c is currently #ifdef to be compatible with both the old and new methodology. In STAGE-2 it will be moved entirely to MD code.
Performance issues:
One of the purposes of this commit is to enhance critical section performance, specifically to greatly reduce bus overhead to allow the critical section code to be used to protect per-cpu caches. These caches, such as Jeff's slab allocator work, can potentially operate very quickly making the effective savings of the new critical section code's performance very significant.
The second purpose of this commit is to allow architectures to enable certain interrupts while in a critical section. Specifically, the intention is to eventually allow certain FAST interrupts to operate rather then defer.
The third purpose of this commit is to begin to clean up the critical_enter()/critical_exit()/cpu_critical_enter()/ cpu_critical_exit() API which currently has serious cross pollution in MI code (in fork_exit() and ast() for example).
The fourth purpose of this commit is to provide a framework that allows kernel-preempting software interrupts to be implemented cleanly. This is currently used for two forward interrupts in I386. Other architectures will have the choice of using this infrastructure or building the functionality directly into critical_enter()/ critical_exit().
Finally, this commit is designed to greatly improve the flexibility of various architectures to manage critical section handling, software interrupts, preemption, and other highly integrated architecture-specific details.
|
#
91260 |
|
25-Feb-2002 |
peter |
Work-in-progress commit syncing up pmap cleanups that I have been working on for a while: - fine grained TLB shootdown for SMP on i386 - ranged TLB shootdowns.. eg: specify a range of pages to shoot down with a single IPI, since the IPI is very expensive. Adjust some callers that used to trigger this inside tight loops to do a ranged shootdown at the end instead. - PG_G support for SMP on i386 (options ENABLE_PG_G) - defer PG_G activation till after we decide what we are going to do with PSE and the 4MB pages at the start of the kernel. This should solve some rumored strangeness about stale PG_G entries getting stuck underneath the 4MB pages. - add some instrumentation for the fine TLB shootdown - convert some asm instruction wrappers from functions to inlines. gcc seems to do a fair bit better with this. - [temporarily!] pessimize the tlb shootdown IPI handlers. I will fix this again shortly.
This has been working fairly well for me for a while, but I have tweaked it again prior to commit since my last major testing round. The only outstanding problem that I know of is PG_G related, which is why there is an option for it (not on by default for SMP). I have seen a world speedups by a few percent (as much as 4 or 5% in one case) but I have *not* accurately measured this - I am a bit sceptical of these numbers.
|
#
90589 |
|
12-Feb-2002 |
dwmalone |
Move do_cpuid() from a identcpu.c into cpufunc.h.
|
#
88118 |
|
18-Dec-2001 |
jhb |
Various assembly fixes mostly in the form of using the "+" modifier for output operands to mark them as both input and output rather than listing operands twice.
Reviewed by: bde
|
#
88088 |
|
17-Dec-2001 |
jhb |
Modify the critical section API as follows: - The MD functions critical_enter/exit are renamed to start with a cpu_ prefix. - MI wrapper functions critical_enter/exit maintain a per-thread nesting count and a per-thread critical section saved state set when entering a critical section while at nesting level 0 and restored when exiting to nesting level 0. This moves the saved state out of spin mutexes so that interlocking spin mutexes works properly. - Most low-level MD code that used critical_enter/exit now use cpu_critical_enter/exit. MI code such as device drivers and spin mutexes use the MI wrappers. Note that since the MI wrappers store the state in the current thread, they do not have any return values or arguments. - mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is assigned to curthread->td_savecrit during fork_exit().
Tested on: i386, alpha
|
#
78903 |
|
28-Jun-2001 |
bsd |
Provide access to the IA32 hardware debug registers from the ddb kernel debugger. Proper use of these registers allows setting hardware watchpoints for use in kernel debugging.
MFC after: 2 weeks
|
#
75677 |
|
18-Apr-2001 |
imp |
Back out 1.103. It wasn't approved by the owner of the file and introduced style bugs.
Submited by: bde
|
#
75141 |
|
03-Apr-2001 |
imp |
De __P() while I'm here. Done as a separate commit since it is just stylistic.
# Yes, this break K&R, but this file already used so many gcc extensions # keeping K&R support seemed too anachronistic for me.
Didn't fix the bug where functions that can only be used in the kernel are exported to userland.
|
#
75139 |
|
03-Apr-2001 |
imp |
Make this file C++ safe. It defines many useful functions (inb, outb) that people use from userland in C++ programs. I've had this in my tree for ages and just got bit by it not being in the real tree again.
This is a MFC candidate.
|
#
74897 |
|
28-Mar-2001 |
jhb |
- Add the new critical_t type used to save state inside of critical sections. - Add implementations of the critical_enter() and critical_exit() functions and remove restore_intr() and save_intr(). - Remove the somewhat bogus disable_intr() and enable_intr() functions on the alpha as the alpha actually uses a priority level and not simple bit flag on the CPU.
|
#
69006 |
|
21-Nov-2000 |
markm |
Assembler fixes.
Fix opcodes that were typed as ".byte 0xNN, 0xMM" when an older assembler could not recognise the newer Pentium instructions. Reviewed by: jhb
|
#
67030 |
|
12-Oct-2000 |
bde |
Removed unused include of <machine/lock.h>. The locking interface stopped being (ab)used here in rev.1.97.
|
#
66696 |
|
05-Oct-2000 |
jhb |
Replace loadandclear() with atomic_readandclear_int().
|
#
65557 |
|
06-Sep-2000 |
jasone |
Major update to the way synchronization is done in the kernel. Highlights include:
* Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.)
* Per-CPU idle processes.
* Interrupts are run in their own separate kernel threads and can be preempted (i386 only).
Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
|
#
57376 |
|
21-Feb-2000 |
bsd |
Fix an __asm operand constraint which broke the -O3 and -O0 builds.
Submitted by: Seigo Tanimura <tanimura@freebsd.org> Approved by: jkh
|
#
57362 |
|
20-Feb-2000 |
bsd |
Don't forget to reset the hardware debug registers when a process that was using them exits.
Don't allow a user process to cause the kernel to take a TRCTRAP on a user space address.
Reviewed by: jlemon, sef Approved by: jkh
|
#
55672 |
|
09-Jan-2000 |
bde |
Fixed style bugs related to the access functions for the bsfl and bsrl i386 instructions.
|
#
55205 |
|
29-Dec-1999 |
peter |
Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL" is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
|
#
53189 |
|
15-Nov-1999 |
luoqi |
Segment registers can be read(write) to(from) memory locations as well as general registers.
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
50054 |
|
19-Aug-1999 |
peter |
Undo my previous commit and do it differently. Break the ffs() etc macros into two parts - one to do the bsfl and the other to convert the result (base 0) to ffs()-like (base 1) in inline C. This enables the optimizer to be a lot smarter in certain cases, like where it knows that the argument is non-zero and we want ffs(known non zero arg) - 1. This appears to produce identical code to the old inline when the argument is unknown.
|
#
50038 |
|
18-Aug-1999 |
peter |
Try using the builtin ffs() for egcs, it (by random inspection) generates slightly better code and avoids the incl then subl when using ffs(foo) - 1.
|
#
49043 |
|
23-Jul-1999 |
alc |
atomic.h: Change "void *" to "volatile TYPE *", improving type safety and eliminating some warnings (e.g., mp_machdep.c rev 1.106).
cpufunc.h: Eliminate setbits. As defined, it's not precisely correct; and it's redundant. (Use atomic_set_int instead.)
ipl_funcs.c: Use atomic_set_int instead of setbits.
systm.h: Include atomic.h.
Reviewed by: bde
|
#
46846 |
|
09-May-1999 |
peter |
loadandclear() uses an atomic instruction (even on SMP, where it's an implicitly LOCK'ed instruction), so there shouldn't be any harm in making it volatile pointer compatable for one of the users of it. It seems to generate the same code regardless.
|
#
46129 |
|
27-Apr-1999 |
luoqi |
Enable vmspace sharing on SMP. Major changes are, - %fs register is added to trapframe and saved/restored upon kernel entry/exit. - Per-cpu pages are no longer mapped at the same virtual address. - Each cpu now has a separate gdt selector table. A new segment selector is added to point to per-cpu pages, per-cpu global variables are now accessed through this new selector (%fs). The selectors in gdt table are rearranged for cache line optimization. - fask_vfork is now on as default for both UP and SMP. - Some aio code cleanup.
Reviewed by: Alan Cox <alc@cs.rice.edu> John Dyson <dyson@iquest.net> Julian Elischer <julian@whistel.com> Bruce Evans <bde@zeta.org.au> David Greenman <dg@root.com>
|
#
42427 |
|
09-Jan-1999 |
bde |
Don't put operands in clobber lists, since this is dubious for old versions of gcc and broken for current versions of egcs.
Submitted by: "John S. Dyson" <dyson@iquest.net> but rewritten by me
|
#
42411 |
|
08-Jan-1999 |
bde |
Fixed some style bugs. Clarified a comment.
|
#
42410 |
|
08-Jan-1999 |
bde |
Unspammed includes in <machine/cpufunc.h> in the !SMP case. Partially unspammed them in the SMP case.
|
#
42406 |
|
08-Jan-1999 |
bde |
Moved declarations related to copying and zeroing to the right place.
|
#
38392 |
|
17-Aug-1998 |
dfr |
Add macros for accessing device memory.
|
#
37552 |
|
11-Jul-1998 |
bde |
Don't pretend to support ix86's with 16-bit ints by using longs just to ensure 32-bit variables. Doing so broke and/or pessimized i386's with 64-bit longs (unnecessary use of 64-bit variables caused remarkably few problems in C code, but the inline asm here tended to fail because there are no 64-bit registers). Since the interfaces here are very machine-dependent and shouldn't be used outside of the kernel, use a standard types of "known" width instead of fixed-width types.
Changed all quad_t's to u_int64_t's. quad_t isn't standard, and using signed types for 64-bit registers was bogus (but made no difference).
|
#
36125 |
|
17-May-1998 |
tegge |
For SMP, use prv_PPAGE1/prv_PMAP1 instead of PADDR1/PMAP1. get_ptbase and pmap_pte_quick no longer generates IPIs. This should reduce the number of IPIs during heavy paging.
|
#
35976 |
|
12-May-1998 |
dyson |
Fix alot of silly LINT that I left in the code.
|
#
35933 |
|
11-May-1998 |
dyson |
Support better performance with P6 architectures and in SMP mode. Unnecessary TLB flushes removed. More efficient page zeroing on P6 (modify page only if non-zero.)
|
#
32781 |
|
25-Jan-1998 |
kato |
Undo previous commit. The cpuid symbol has been already used by SMP stuff.
Pointed-out by: Manfred Antar <root@mantar.slip.netcom.com>
|
#
32772 |
|
25-Jan-1998 |
kato |
Added cpuid instruction.
|
#
32517 |
|
15-Jan-1998 |
gibbs |
Implementation of Bus Space for FreeBSD-x86.
Obtained From: NetBSD
|
#
31709 |
|
14-Dec-1997 |
dyson |
After one of my analysis passes to evaluate methods for SMP TLB mgmt, I noticed some major enhancements available for UP situations. The number of UP TLB flushes is decreased much more than significantly with these changes. Since a TLB flush appears to cost minimally approx 80 cycles, this is a "nice" enhancement, equiv to eliminating between 40 and 160 instructions per TLB flush.
Changes include making sure that kernel threads all use the same PTD, and eliminate unneeded PTD switches at context switch time.
|
#
29213 |
|
07-Sep-1997 |
fsmp |
General cleanup of the lock pushdown code. They are grouped and enabled from machine/smptests.h:
#define PUSHDOWN_LEVEL_1 #define PUSHDOWN_LEVEL_2 #define PUSHDOWN_LEVEL_3 #define PUSHDOWN_LEVEL_4_NOT
|
#
29000 |
|
01-Sep-1997 |
fsmp |
General cleanup of the sub-system locking macros. Eliminated the RECURSIVE_MPINTRLOCK. clock.c and microtime use clock_lock. sio.c and cy.c use com_lock.
Suggestions by: Bruce Evans <bde@zeta.org.au>
|
#
28921 |
|
30-Aug-1997 |
fsmp |
Another round of lock pushdown. Add a simplelock to deal with disable_intr()/enable_intr() as used in UP kernel. UP kernel expects that this is enough to guarantee exclusive access to regions of code bracketed by these 2 functions. Add a simplelock to bracket clock accesses in clock.c: clock_lock.
Help from: Bruce Evans <bde@zeta.org.au>
|
#
27464 |
|
17-Jul-1997 |
dyson |
Add support for 4MB pages. This includes the .text, .data, .data parts of the kernel, and also most of the dynamic parts of the kernel. Additionally, 4MB pages will be allocated for display buffers as appropriate (only.)
The 4MB support for SMP isn't complete, but doesn't interfere with operation either.
|
#
26305 |
|
31-May-1997 |
peter |
remove #include of <machine/spl.h> - they are externed now
Reviewed by: bde
|
#
25982 |
|
21-May-1997 |
jdp |
Make setbits() SMP-safe. Eliminate the SETBITS() macro, and replace all uses of it with the equivalent calls to setbits().
This change incidentally eliminates a problem building ELF kernels that was caused by SETBITS.
Reviewed by: fsmp, peter Submitted by: bde
|
#
25547 |
|
07-May-1997 |
peter |
remove #include "opt_smp.h" and <machine/smp.h>. Slightly elaborate on a comment.
|
#
25215 |
|
27-Apr-1997 |
fsmp |
remove all the SMP_INVLTLB defines, making the code default for APIC_IO.
Reviewed by: informal discussion with Peter Wemm <peter@spinner.DIALix.COM>
|
#
25178 |
|
26-Apr-1997 |
peter |
Try and make these usermode safe, Steve beat me in finding these..
|
#
25164 |
|
26-Apr-1997 |
peter |
Man the liferafts! Here comes the long awaited SMP -> -current merge!
There are various options documented in i386/conf/LINT, there is more to come over the next few days.
The kernel should run pretty much "as before" without the options to activate SMP mode.
There are a handful of known "loose ends" that need to be fixed, but have been put off since the SMP kernel is in a moderately good condition at the moment.
This commit is the result of the tinkering and testing over the last 14 months by many people. A special thanks to Steve Passe for implementing the APIC code!
|
#
24112 |
|
22-Mar-1997 |
kato |
Improved CPU identification and initialization routines. This supports All Cyrix CPUs, IBM Blue Lightning CPU and NexGen (now AMD) Nx586 CPU, and initialize special registers of Cyrix CPU and msr of IBM Blue Lightning CPU.
If revision of Cyrix 6x86 CPU < 2.7, CPU cache is enabled in write-through mode. This can be disabled by kernel configuration options.
Reviewed by: Bruce Evans <bde@freebsd.org> and Jordan K. Hubbard <jkh@freebsd.org>
|
#
22975 |
|
22-Feb-1997 |
peter |
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not ready for it yet.
|
#
21673 |
|
14-Jan-1997 |
jkh |
Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
|
#
18567 |
|
29-Sep-1996 |
bde |
Added "memory" to clobber list in invlpg(). It needs it if invltlb() needs it.
Fixed style in invlpg().
Sorted recently renamed functions.
Added prototypes in the non-gcc section for recently added/renamed functions.
|
#
18548 |
|
28-Sep-1996 |
dyson |
Essentially rename pmap_update to be invltlb. It is a very machine dependent operation, and not really a correct name. invltlb and invlpg are more descriptive, and in the case of invlpg, a real opcode.
Additionally, fix the tlb management code for 386 machines.
|
#
18528 |
|
28-Sep-1996 |
dyson |
Move pmap_update_1pg to cpufunc.h. Additionally, use the invlpg opcode instead of the nasty looking .byte directives. There are some other minor micro-level code improvements to pmap.c
|
#
18490 |
|
24-Sep-1996 |
bde |
Fixed a few hundred warnings (2400 in LINT) for signed vs unsigned comparisons in the inb() and outb() macros. I decided that int args are OK here. Any type that can hold a u_int16_t without overflow is correct, and 32-bit types are optimal.
Introduced a few tens of warnings (100 in LINT) for use of pessimized (short) types for the port arg. Only a few drivers are affected by this. u_short pessimizations aren't detected.
Added `__extension__' before the statement-expression in inb() so that it can be compiled without warnings by gcc -pedantic.
|
#
18265 |
|
12-Sep-1996 |
asami |
Another round of merge/update.
(1) Add PC98 support to apm_bios.h and ns16550.h, remove pc98/pc98/ic (2) Move PC98 specific code out of cpufunc.h (to pc98.h) (3) Let the boot subtrees look more alike
Submitted by: The FreeBSD(98) Development Team <freebsd98-hackers@jp.freebsd.org>
|
#
17384 |
|
01-Aug-1996 |
wollman |
Add an fls() inline function which does the opposite operation to ffs(). (That is to say, it searches in the opposite direction.)
|
#
17256 |
|
23-Jul-1996 |
asami |
Update to current state of PC98 world.
Submitted by: The FreeBSD(98) development team
|
#
16878 |
|
01-Jul-1996 |
bde |
Fixed lots of warnings about unportable casts of pointers to volatile variables: don't depend on the compiler generating atomic code to set the variables - use inline asm to specify the atomic instruction(s) explicitly.
|
#
16875 |
|
01-Jul-1996 |
bde |
Moved declarations of non-cpu things from <machine/cpufunc.h> to better places.
|
#
16363 |
|
14-Jun-1996 |
asami |
The Great PC98 Merge.
All new code is "#ifdef PC98"ed so this should make no difference to PC/AT (and its clones) users.
Ok'd by: core Submitted by: FreeBSD(98) development team
|
#
15122 |
|
07-Apr-1996 |
bde |
Changed bdb() to breakpoint() and always enable it.
Made the style more consistent, especially for the new Pentium functions.
|
#
14943 |
|
31-Mar-1996 |
bde |
Moved rtcin() to clock.c.
Always delay using one inb(0x84) after each i/o in rtcin() - don't do this conditional on the bogus option DUMMY_NOPS not being defined. If you want an optionally slightly faster rtcin() again, then inline it and use a better named option or sysctl variable. It only needs to be fast in rtcintr().
|
#
14889 |
|
28-Mar-1996 |
wollman |
>Blush<. Use the correct opcode for the WRMSR instruction.
|
#
14825 |
|
26-Mar-1996 |
wollman |
Add support for Pentium and Pentium Pro performance counters. (This code is as yet untested; to come after man page is written.) This also adds inlines to cpufunc.h for the RDTSC, RDMSR, WRMSR, and RDPMC instructions. The user-mode interface is via a subdevice of mem.c; there is also a kernel-size interface which might be used to aid profiling.
|
#
13454 |
|
16-Jan-1996 |
bde |
Removed declarations of nonexistent functions.
|
#
13086 |
|
28-Dec-1995 |
dg |
Made bzero a function vector and added a 586/686 optimized version of bzero. Deprecated blkclr (removed it). Removed some old cruft from cpufunc.h.
The optimized bzero was submitted by Torbjorn Granlund <tege@matematik.su.se> The kernel adaption and other changes by me.
|
#
12929 |
|
19-Dec-1995 |
dg |
Implemented a (sorely needed for years) double fault handler to catch stack overflows. It sure would be nice if there was an unmapped page between the PCB and the stack (and that the size of the stack was configurable!). With the way things are now, the PCB will get clobbered before the double fault handler gets control, making somewhat of a mess of things. Despite this, it is still fairly easy to poke around in the overflowed stack to figure out the cause.
|
#
12592 |
|
03-Dec-1995 |
bde |
Moved inline functions for insque() and remque() to <sys/queue.h>. Protected them with `#ifdef KERNEL' so that <sys/queue.h> is valid C++. Added the necessary #includes of <sys/queue.h>.
These functions are bogus and should be replaced by the queue macros.
|
#
11222 |
|
05-Oct-1995 |
phk |
remove GCC divsi3 routines which are never used.
|
#
10342 |
|
26-Aug-1995 |
bde |
Remove "memory" clobber statement from enable_intr(). Enabling interrupts doesn't invalidate loaded variables.
Fix formatting of recent changes.
|
#
10004 |
|
08-Aug-1995 |
dyson |
Make the spl oriented inline functions less likely to allow potentially volatile memory to be kept in registers during the "call" (inline expansion.) Do the same for pmap_update.
|
#
9714 |
|
25-Jul-1995 |
bde |
Fix bogus constraint "i" that only worked with -O. The cases where it didn't work are somewhat bogusly optimized away before the constraint is checked. We still expect constants passed to inline functions to remain constant, but if the compiler ever decides that they aren't constant then it will just generate slightly slower code instead of an error.
|
#
8876 |
|
30-May-1995 |
rgrimes |
Remove trailing whitespace.
|
#
8521 |
|
14-May-1995 |
dg |
Added apersand constraint to make sure that the source and destination registers aren't combined.
Reviewed by: Bruce Evans and David Greenman Submitted by: John Dyson
|
#
8446 |
|
11-May-1995 |
bde |
Add loadandclear(). It atomically loads a value from memory, clears the value in memory and returns the original value.
|
#
6865 |
|
03-Mar-1995 |
dg |
Preserve reverse link integraty while doing the queue insertion.
|
#
6503 |
|
16-Feb-1995 |
bde |
Fix syntax errors in #ifdefed out code.
|
#
6367 |
|
14-Feb-1995 |
phk |
susword -> systm.h
|
#
5378 |
|
04-Jan-1995 |
dg |
Corrected the list of volatile registers for outsb, outsw, and outsl. This bug caused my ethernet driver to break, among other things no doubt.
|
#
4514 |
|
15-Nov-1994 |
bde |
Add prototype for Debugger().
|
#
4479 |
|
14-Nov-1994 |
bde |
Rewrite almost everything.
Alphabetize.
Write all i/o functions in sleep so that we don't use anything from NetBSD.
Restore the correct type of u_int for ports. This saves a whole cycle per i/o on 486's.
Change `inline' back to __inline to avoid compiler warnings with -Wreally-all.
Don't implement bdb() unless BDE_DEBUGGER is defined. Declare bdb_exists outside the function to avoid hundreds of compiler warnings.
Let the compiler pick the register in asms if possible.
Implement ffs() using inline asm(). gcc provides a slightly different one. It was broken in gcc-2.4.5 but works now. Declaring a correct version inline ensures getting a correct version. FreeBSD-1.1.5 has an slow inline version but FreeBSD-2.0 has a library version (which probably never gets used).
Do inb() and outb() without using %edx for constant ports below 0x100.
Remove casts to the same type in queue functions.
Declare prototypes for everything implemented i386/*.s and also for everything that is normally implemented as an inline here (I don't like the current complete dependency on gcc). Ifdef out the prototypes that are declared elsewhere. THere should be a separate header to declare things implemented in i386/*.s, but then it would be harder to override declarations with inlines.
${UII}
|
#
4319 |
|
08-Nov-1994 |
bde |
Don't declare DELAY() here. Callers should include <machine/clock.h>.
|
#
3102 |
|
25-Sep-1994 |
dg |
Inlined ins/outs functions.
Obtained from: NetBSD
|
#
3099 |
|
25-Sep-1994 |
dg |
Undo last change: the ins/outs functions DO NOT return a pointer!
|
#
3098 |
|
25-Sep-1994 |
phk |
While in the real world, I had a bad case of being swapped out for a lot of cycles. While waiting there I added a lot of the extra ()'s I have, (I have never used LISP to any extent). So I compiled the kernel with -Wall and shut up a lot of "suggest you add ()'s", removed a bunch of unused var's and added a couple of declarations here and there. Having a lap-top is highly recommended. My kernel still runs, yell at me if you kernel breaks.
|
#
2826 |
|
16-Sep-1994 |
dg |
Removed inclusion of pio.h and cpufunc.h (cpufunc.h is included from systm.h). Merged functionality of pio.h into cpufunc.h. Cleaned up some related code.
|
#
2824 |
|
16-Sep-1994 |
jkh |
Deal with outw being defined - the declaration clashes.
|
#
2804 |
|
15-Sep-1994 |
paul |
Include pio.h so that all those drivers that only include cpufunc.h get the faster io macros/inline code rather than call the routines in support.s
This whole area needs some going over.....
|
#
2801 |
|
15-Sep-1994 |
paul |
Added MCOUNT_ENTER and MCOUNT_EXIT macros to profile.h
Removed inb function since it's more correctly in pio.h
Copied write_eflags and read_eflags over from npx.c
(Some changes to the macros suggested by Bruce were not made at this time since his suggestions probably apply to all the macros and these inlined/macro definitions need a lot of cleaning up at some point in the future.)
Reviewed by: Bruce
|
#
2455 |
|
02-Sep-1994 |
dg |
Removed all vestiges of tlbflush(). Replaced them with calls to pmap_update(). Made pmap_update an inline assembly function.
|
#
2245 |
|
23-Aug-1994 |
paul |
Re-enabled inlining of inb. Changed u_int_inb to just inb and deleted define.
The code generated is identical to that generated with the cast so the problem was obviously fixed at some point after gcc 1.4
Reviewed by: Submitted by:
|
#
2244 |
|
23-Aug-1994 |
paul |
I've disabled this piece of code since it's what's hosing syscons. Doesn anyone know anything about this or can we just delete it now?
/* * This roundabout method of returning a u_char helps stop gcc-1.40 from * generating unnecessary movzbl's. */ #ifdef disable_for_gcc-2_6_0 #define inb(port) ((u_char) u_int_inb(port)) #endif
static inline u_int u_int_inb(u_int port) { u_char data; /* * We use %%dx and not %1 here because i/o is done at %dx and not at * %edx, while gcc-2.2.2 generates inferior code (movw instead of movl) * if we tell it to load (u_short) port. */ __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); return data; }
Reviewed by: Submitted by:
|
#
2112 |
|
18-Aug-1994 |
wollman |
Fix up some sloppy coding practices:
- Delete redundant declarations. - Add -Wredundant-declarations to Makefile.i386 so they don't come back. - Delete sloppy COMMON-style declarations of uninitialized data in header files. - Add a few prototypes. - Clean up warnings resulting from the above.
NB: ioconf.c will still generate a redundant-declaration warning, which is unavoidable unless somebody volunteers to make `config' smarter.
|
#
2056 |
|
13-Aug-1994 |
wollman |
Change all #includes to follow the current Berkeley style. Some of these ``changes'' are actually not changes at all, but CVS sometimes has trouble telling the difference.
This also includes support for second-directory compiles. This is not quite complete yet, as `config' doesn't yet do the right thing. You can still make it work trivially, however, by doing the following:
rm /sys/compile mkdir /usr/obj/sys/compile ln -s M-. /sys/compile cd /sys/i386/conf config MYKERNEL cd ../../compile/MYKERNEL ln -s /sys @ rm machine ln -s @/i386/include machine make depend make
|
#
2028 |
|
11-Aug-1994 |
jkh |
Change outb() as per Bruce's instructions so that it doesn't explicitly try to pass its argument in the ax register. Reviewed by: Submitted by:
|
#
1837 |
|
04-Aug-1994 |
dg |
Inlined insque and remque.
|
#
1817 |
|
02-Aug-1994 |
dg |
Added $Id$
|
#
1690 |
|
06-Jun-1994 |
dg |
trap.c: Vastly improved trap.c from me. This rewritten version has a variety of features, amoung them: higher performance and much higher code quality.
support.s, cpufunc.h: No longer use gs override to enforce range limits - compare directly against VM_MAXUSER_ADDRESS instead. The old way caused problems in preserving the gs selector...and this method is just as fast or faster.
|
#
1549 |
|
25-May-1994 |
rgrimes |
The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.
Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman
|
#
1321 |
|
02-Apr-1994 |
dg |
New interrupt code from Bruce Evans. In additional to Bruce's attached list of changes, I've made the following additional changes:
1) i386/include/ipl.h renamed to spl.h as the name conflicts with the file of the same name in i386/isa/ipl.h. 2) changed all use of *mask (i.e. netmask, biomask, ttymask, etc) to *_imask (net_imask, etc). 3) changed vestige of splnet use in if_is to splimp. 4) got rid of "impmask" completely (Bruce had gotten rid of netmask), and are now using net_imask instead. 5) dozens of minor cruft to glue in Bruce's changes.
These require changes I made to config(8) as well, and thus it must be rebuilt.
-DG
from Bruce Evans:
sio: o No diff is supplied. Remove the define of setsofttty(). I hope that is enough.
*.s: o i386/isa/debug.h no longer exists. The event counters became too much trouble to maintain. All function call entry and exception entry counters can be recovered by using profiling kernel (the new profiling supports all entry points; however, it is too slow to leave enabled all the time; it also). Only BDBTRAP() from debug.h is now used. That is moved to exception.s. It might be worth preserving SHOW_BITS() and calling it from _mcount() (if enabled). o T_ASTFLT is now only set just before calling trap(). o All exception handlers set SWI_AST_MASK in cpl as soon as possible after entry and arrange for _doreti to restore it atomically with exiting. It is not possible to set it atomically with entering the kernel, so it must be checked against the user mode bits in the trap frame before committing to using it. There is no place to store the old value of cpl for syscalls or traps, so there are some complications restoring it.
Profiling stuff (mostly in *.s): o Changes to kern/subr_mcount.c, gcc and gprof are not supplied yet. o All interesting labels `foo' are renamed `_foo' and all uninteresting labels `_bar' are renamed `bar'. A small change to gprof allows ignoring labels not starting with underscores. o MCOUNT_LABEL() is to provide names for counters for times spent in exception handlers. o FAKE_MCOUNT() is a version of MCOUNT() suitable for exception handlers. Its arg is the pc where the exception occurred. The new mcount() pretends that this was a call from that pc to a suitable MCOUNT_LABEL(). o MEXITCOUNT is to turn off any timer started by MCOUNT().
/usr/src/sys/i386/i386/exception.s: o The non-BDB BPTTRAP() macros were doing a sti even when interrupts were disabled when the trap occurred. The sti (fixed) sti is actually a no-op unless you have my changes to machdep.c that make the debugger trap gates interrupt gates, but fixing that would make the ifdefs messier. ddb seems to be unharmed by both interrupts always disabled and always enabled (I had the branch in the fix back to front for some time :-(). o There is no known pushal bug. o tf_err can be left as garbage for syscalls.
/usr/src/sys/i386/i386/locore.s: o Fix and update BDE_DEBUGGER support. o ENTRY(btext) before initialization was dangerous. o Warm boot shot was longer than intended.
/usr/src/sys/i386/i386/machdep.c: o DON'T APPLY ALL OF THIS DIFF. It's what I'm using, but may require other changes. Use the following: o Remove aston() and setsoftclock(). Maybe use the following: o No netisr.h. o Spelling fix. o Delay to read the Rebooting message. o Fix for vm system unmapping a reduced area of memory after bounds_check_with_label() reduces the size of a physical i/o for a partition boundary. A similar fix is required in kern_physio.c. o Correct use of __CONCAT. It never worked here for non- ANSI cpp's. Is it time to drop support for non-ANSI? o gdt_segs init. 0xffffffffUL is bogus because ssd_limit is not 32 bits. The replacement may have the same value :-), but is more natural. o physmem was one page too low. Confusing variable names. Don't use the following: o Better numbers of buffers. Each 8K page requires up to 16 buffer headers. On my system, this results in 5576 buffers containing [up to] 2854912 bytes of memory. The usual allocation of about 384 buffers only holds 192K of disk if you use it on an fs with a block size of 512. o gdt changes for bdb. o *TGT -> *IDT changes for bdb. o #ifdefed changes for bdb.
/usr/src/sys/i386/i386/microtime.s: o Use the correct asm macros. I think asm.h was copied from Mach just for microtime and isn't used now. It certainly doesn't belong in <sys>. Various macros are also duplicated in sys/i386/boot.h and libc/i386/*.h. o Don't switch to and from the IRR; it is guaranteed to be selected (default after ICU init and explicitly selected in isa.c too, and never changed until the old microtime clobbered it).
/usr/src/sys/i386/i386/support.s: o Non-essential changes (none related to spls or profiling). o Removed slow loads of %gs again. The LDT support may require not relying on %gs, but loading it is not the way to fix it! Some places (copyin ...) forgot to load it. Loading it clobbers the user %gs. trap() still loads it after certain types of faults so that fuword() etc can rely on it without loading it explicitly. Exception handlers don't restore it. If we want to preserve the user %gs, then the fastest method is to not touch it except for context switches. Comparing with VM_MAXUSER_ADDRESS and branching takes only 2 or 4 cycles on a 486, while loading %gs takes 9 cycles and using it takes another. o Fixed a signed branch to unsigned.
/usr/src/sys/i386/i386/swtch.s: o Move spl0() outside of idle loop. o Remove cli/sti from idle loop. sw1 does a cli, and in the unlikely event of an interrupt occurring and whichqs becoming zero, sw1 will just jump back to _idle. o There's no spl0() function in asm any more, so use splz(). o swtch() doesn't need to be superaligned, at least with the new mcounting. o Fixed a signed branch to unsigned. o Removed astoff().
/usr/src/sys/i386/i386/trap.c: o The decentralized extern decls were inconsistent, of course. o Fixed typo MATH_EMULTATE in comments. */ o Removed unused variables. o Old netmask is now impmask; print it instead. Perhaps we should print some of the new masks. o BTW, trap() should not print anything for normal debugger traps.
/usr/src/sys/i386/include/asmacros.h: o DON'T APPLY ALL OF THIS DIFF. Just use some of the null macros as necessary.
/usr/src/sys/i386/include/cpu.h: o CLKF_BASEPRI() changes since cpl == SWI_AST_MASK is now normal while the kernel is running. o Don't use var++ to set boolean variables. It fails after a mere 4G times :-) and is slower than storing a constant on [3-4]86s.
/usr/src/sys/i386/include/cpufunc.h: o DON'T APPLY ALL OF THIS DIFF. You need mainly the include of <machine/ipl.h>. Unfortunately, <machine/ipl.h> is needed by almost everything for the inlines.
/usr/src/sys/i386/include/ipl.h: o New file. Defines spl inlines and SWI macros and declares most variables related to hard and soft interrupt masks.
/usr/src/sys/i386/isa/icu.h: o Moved definitions to <machine/ipl.h>
/usr/src/sys/i386/isa/icu.s: o Software interrupts (SWIs) and delayed hardware interrupts (HWIs) are now handled uniformally, and dispatching them from splx() is more like dispatching them from _doreti. The dispatcher is essentially *(handler[ffs(ipending & ~cpl)](). o More care (not quite enough) is taken to avoid unbounded nesting of interrupts. o The interface to softclock() is changed so that a trap frame is not required. o Fast interrupt handlers are now handled more uniformally. Configuration is still too early (new handlers would require bits in <machine/ipl.h> and functions to vector.s). o splnnn() and splx() are no longer here; they are inline functions (could be macros for other compilers). splz() is the nontrivial part of the old splx().
/usr/src/sys/i386/isa/ipl.h o New file. Supposed to have only bus-dependent stuff. Perhaps the h/w masks should be declared here.
/usr/src/sys/i386/isa/isa.c: o DON'T APPLY ALL OF THIS DIFF. You need only things involving *mask and *MASK and comments about them. netmask is now a pure software mask. It works like the softclock mask.
/usr/src/sys/i386/isa/vector.s: o Reorganize AUTO_EOI* macros. o Option FAST_INTR_HANDLER_USERS_ES for people who don't trust fastintr handlers. o fastintr handlers need to metamorphose into ordinary interrupt handlers if their SWI bit has become set. Previously, sio had unintended latency for handling output completions and input of SLIP framing characters because this was not done.
/usr/src/sys/net/netisr.h: o The machine-dependent stuff is now imported from <machine/ipl.h>.
/usr/src/sys/sys/systm.h o DON'T APPLY ALL OF THIS DIFF. You need mainly the different splx() prototype. The spl*() prototypes are duplicated as inlines in <machine/ipl.h> but they need to be duplicated here in case there are no inlines. I sent systm.h and cpufunc.h to Garrett. We agree that spl0 should be replaced by splnone and not the other way around like I've done.
/usr/src/sys/kern/kern_clock.c o splsoftclock() now lowers cpl so the direct call to softclock() works as intended. o softclock() interface changed to avoid passing the whole frame (some machines may need another change for profile_tick()). o profiling renamed _profiling to avoid ANSI namespace pollution. (I had to improve the mcount() interface and may as well fix it.) The GUPROF variant doesn't actually reference profiling here, but the 'U' in GUPROF should mean to select the microtimer mcount() and not change the interface.
|
#
1056 |
|
31-Jan-1994 |
dg |
Added four pattern memory test routine that is done at startup. ...added filli - "fill integer" support routine.
|
#
1045 |
|
31-Jan-1994 |
dg |
VM system performance improvements from John Dyson and myself. The following is a summary:
1) increased object cache back up to a more reasonable value. 2) removed old & bogus cruft from machdep.c (clearseg, copyseg, physcopyseg, etc). 3) inlined many functions in pmap.c 4) changed "load_cr3(rcr3())" into tlbflush() and made tlbflush inline assembly. 5) changed the way that modified pages are tracked - now vm_page struct is kept updated directly - no more scanning page tables. 6) removed lots of unnecessary spl's 7) removed old unused functions from pmap.c 8) removed all use of page_size, page_shift, page_mask variables - replaced with PAGE_ constants. 9) moved trunc/round_page, atop, ptoa, out of vm_param.h and into i386/ include/param.h, and optimized them. 10) numerous changes to sys/vm/ swap_pager, vnode_pager, pageout, fault code to improve performance. LRU algorithm modified to be more effective, read ahead/behind values tuned for better performance, etc, etc...
|
#
907 |
|
21-Dec-1993 |
dg |
Changed pointer type from caddr_t to void * for fillw, insw, outsw, and outsb.
|
#
879 |
|
18-Dec-1993 |
wollman |
Make everything compile with -Wtraditional. Make it easier to distribute a binary link-kit. Make all non-optional options (pagers, procfs) standard, and update LINT to reflect new symtab requirements.
NB: -Wtraditional will henceforth be forgotten. This editing pass was primarily intended to detect any constructions where the old code might have been relying on traditional C semantics or syntax. These were all fixed, and the result of fixing some of them means that -Wall is now a realistic possibility within a few weeks.
|
#
798 |
|
24-Nov-1993 |
wollman |
Make the LINT kernel compile with -W -Wreturn-type -Wcomment -Werror, and add same (sans -Werror) to Makefile for future compilations.
|
#
719 |
|
07-Nov-1993 |
wollman |
Made all header files idempotent and moved incorrect common data from headers into a related source file. Added cons.h as first step towards moving i386/i386/cons.h to machine/cons.h where it belongs.
|
#
621 |
|
16-Oct-1993 |
rgrimes |
Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, some minor cleanup. Added $Id$ to files that did not have any version info, etc
|
#
200 |
|
27-Jul-1993 |
dg |
* Applied fixes from Bruce Evans to fix COW bugs, >1MB kernel loading, profiling, and various protection checks that cause security holes and system crashes. * Changed min/max/bcmp/ffs/strlen to be static inline functions - included from cpufunc.h in via systm.h. This change improves performance in many parts of the kernel - up to 5% in the networking layer alone. Note that this requires systm.h to be included in any file that uses these functions otherwise it won't be able to find them during the load. * Fixed incorrect call to splx() in if_is.c * Fixed bogus variable assignment to splx() in if_ed.c
|
#
5 |
|
12-Jun-1993 |
rgrimes |
This commit was generated by cvs2svn to compensate for changes in r4, which included commits to RCS files with non-trunk default branches.
|
#
4 |
|
12-Jun-1993 |
rgrimes |
Initial import, 0.1 + pk 0.2.4-B1
|