summaryrefslogtreecommitdiffstats
path: root/sys/amd64/isa
Commit message (Collapse)AuthorAgeFilesLines
* Define ovbcopy() as a macro which expands to the equivalent bcopy() call,des2003-04-041-4/+2
| | | | | | | | | | | | | | to take care of the KAME IPv6 code which needs ovbcopy() because NetBSD's bcopy() doesn't handle overlap like ours. Remove all implementations of ovbcopy(). Previously, bzero was a function pointer on i386, to save a jmp to bzero_vector. Get rid of this microoptimization as it only confuses things, adds machine-dependent code to an MD header, and doesn't really save all that much. This commit does not add my pagezero() / pagecopy() code.
* Commit a partial lazy thread switch mechanism for i386. it isn't as lazypeter2003-04-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as it could be and can do with some more cleanup. Currently its under options LAZY_SWITCH. What this does is avoid %cr3 reloads for short context switches that do not involve another user process. ie: we can take an interrupt, switch to a kthread and return to the user without explicitly flushing the tlb. However, this isn't as exciting as it could be, the interrupt overhead is still high and too much blocks on Giant still. There are some debug sysctls, for stats and for an on/off switch. The main problem with doing this has been "what if the process that you're running on exits while we're borrowing its address space?" - in this case we use an IPI to give it a kick when we're about to reclaim the pmap. Its not compiled in unless you add the LAZY_SWITCH option. I want to fix a few more things and get some more feedback before turning it on by default. This is NOT a replacement for Bosko's lazy interrupt stuff. This was more meant for the kthread case, while his was for interrupts. Mine helps a little for interrupts, but his helps a lot more. The stats are enabled with options SWTCH_OPTIM_STATS - this has been a pseudo-option for years, I just added a bunch of stuff to it. One non-trivial change was to select a new thread before calling cpu_switch() in the first place. This allows us to catch the silly case of doing a cpu_switch() to the current process. This happens uncomfortably often. This simplifies a bit of the asm code in cpu_switch (no longer have to call choosethread() in the middle). This has been implemented on i386 and (thanks to jake) sparc64. The others will come soon. This is actually seperate to the lazy switch stuff. Glanced at by: jake, jhb
* - In npxgetregs() use the td argument to save the fpu state from and notjeff2003-04-011-2/+1
| | | | | | | curthread. Nothing currently depends on this behavior. - Clean up an extra newline. Obtained from: bde
* - In npxsetregs don't set the floating point if td == fpcurthread not ifjeff2003-03-311-1/+1
| | | | | curthread == fpcurthread. This is important when we're saving the fp state for a thread other than curthread as in from set_mcontext.
* - Add vm_paddr_t, a physical address type. This is required for systemsjake2003-03-251-2/+3
| | | | | | | | | | | | | | | where physical addresses larger than virtual addresses, such as i386s with PAE. - Use this to represent physical addresses in the MI vm system and in the i386 pmap code. This also changes the paddr parameter to d_mmap_t. - Fix printf formats to handle physical addresses >4G in the i386 memory detection code, and due to kvtop returning vm_paddr_t instead of u_long. Note that this is a name change only; vm_paddr_t is still the same as vm_offset_t on all currently supported platforms. Sponsored by: DARPA, Network Associates Laboratories Discussed with: re, phk (cdevsw change)
* Use repo-copied files in sys/i386/bios.mdodd2003-03-243-3/+3
|
* Including <sys/stdint.h> is (almost?) universally only to be able to usephk2003-03-181-1/+0
| | | | | %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble.
* Move a bunch of flags from the KSE to the thread.julian2003-02-171-1/+1
| | | | | | | | I was in two minds as to where to put them in the first case.. I should have listenned to the other mind. Submitted by: parts by davidxu@ Reviewed by: jeff@ mini@
* Switch to using the TSC code in i386/i386/tsc.c.phk2003-02-111-114/+1
|
* Split the global timezone structure into two integer fields tophk2003-02-031-2/+2
| | | | | | | | | | prevent the compiler from optimizing assignments into byte-copy operations which might make access to the individual fields non-atomic. Use the individual fields throughout, and don't bother locking them with Giant: it is no longer needed. Inspired by: tjr
* Split statclock into statclock and profclock, and made the method for drivingjake2003-02-031-6/+22
| | | | | | | | | | | | | statclock based on profhz when profiling is enabled MD, since most platforms don't use this anyway. This removes the need for statclock_process, whose only purpose was to subdivide profhz, and gets the profiling clock running outside of sched_lock on platforms that implement suswintr. Also changed the interface for starting and stopping the profiling clock to do just that, instead of changing the rate of statclock, since they can now be separate. Reviewed by: jhb, tmm Tested on: i386, sparc64
* Make tsc_freq a 64bit quantity.phk2003-01-291-5/+7
| | | | Inspired by: http://www.theinquirer.net/?article=7481
* Use the correct value when writing the Day Of Week byte in the CMOS.phk2002-12-041-1/+1
| | | | | | | | | | | | | | | | | The correct range is [1...7] with Sunday=1, but we have been writing [0...6] with Sunday=0. The Soekris computers flagged the zero, zapped the date, so if you rebooted your soekris on a sunday, it would come up with a wrong date. Bruce has a more extensive rework of this code, but we will stick with the minimalist fix for now. Spotted by: Soren Kristensen <soren@soekris.com> Thanks to: Michael Sierchio <kudzu@tenebras.com>. Confirmed by: bde Approved by: re
* Add getcontext, setcontext, and swapcontext as system calls.deischen2002-11-161-2/+2
| | | | | | | | | | | Previously these were libc functions but were requested to be made into system calls for atomicity and to coalesce what might be two entrances into the kernel (signal mask setting and floating point trap) into one. A few style nits and comments from bde are also included. Tested on alpha by: gallatin
* Fix typo. ioport_rid should be irq_rid.davidxu2002-11-051-1/+1
|
* Finish fixing the 5.x FPU code for dealing with signal handlers.peter2002-10-251-0/+1
| | | | Obtained from: bde
* Remove a boatload of '&' which are surplus to the requirements.phk2002-10-202-82/+82
| | | | Validated by: md5 hash is unchanged.
* Hide inline assembly if lint is defined.phk2002-10-201-1/+1
|
* 1. Fix a comment. Locking _is_ needed (but not done).iwasaki2002-10-171-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | 2. Update a comment. We now restore much more than RTC updates and interrupts. 3. Order change. Stop interrupts by writing to RTC_STATUSB, restore rate bits for the interrupts by writing to RTC_STATUSA, then enable interrupts again. This seems to be done perfectly backwards in startrtclock(). Otherwise, the idea for this change was obtained from startrtclock(). 4. Don't stop the clock (RTCB_HALT). We only program some control bits and don't want to stop the clock. 5. (Not really related.) Add caveats to the comment about timer_restore(). The update is non-atomic since locking is not done. On locking: 6. rtcin() and writertc() are locked() adequately by splhigh() in RELENG_4, but this locking is null in -current. 7. Doing things in the correct order in (3) combined with (6) is probably enough locking for rtcrestore() in RELENG_4. In -current, the writertc()'s race with rtcintr() unless the BIOS disables RTC interrupts. Submitted by: bde (including commit message) MFC after: 1 week
* Be consistent about "static" functions: if the function is markedphk2002-09-281-1/+1
| | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
* Fix a 3 year old oversight: Remove the #ifdef/#endif pair now that therephk2002-09-211-2/+0
| | | | | | is nothing between them anymore. Spotted by: peter.
* Restore status register A of RTC at resume time.iwasaki2002-09-181-0/+1
| | | | | | | This should fix the 'too many RTC interrupts and statclock seems broken after resume' problem. MFC after: 1 week
* Add kernel support needed for the KSE-aware libpthread:mini2002-09-161-35/+152
| | | | | | | | - Maintain fpu state across signals. - Save and restore FPU state properly in ucontext_t's. Reviewed by: bde, deischen, julian Approved by: -arch
* Automatically enable CPU_ENABLE_SSE (detect and enable SSE instructions)peter2002-09-071-0/+7
| | | | | | | | if compiling with I686_CPU as a target. CPU_DISABLE_SSE will prevent this from happening and will guarantee the code is not compiled in. I am still not happy with this, but gcc is now generating code that uses these instructions if you set CPUTYPE to p3/p4 or athlon-4/mp/xp or higher.
* Revive backed out pmap related changes from Feb 2002. The highlights are:peter2002-07-121-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* The clock is already allocated as 'fast' - no need to try and intercept apeter2002-07-082-16/+0
| | | | 'slow' interrupt registration and convert it into 'fast'.
* Remove a couple of __P() stragglers.peter2002-06-291-1/+1
|
* Clock frequencies reported by sysctl should be unsigned values. Discoveredmp2002-06-221-2/+2
| | | | | | | | when machdep.tsc_freq returned a negative number on a 2.2GHz Xeon. Submitted by: Brian Harrison <bharrison@ironport.com> Reviewed by: phk MFC after: 1 week
* Don't export timecounter structures under debug. with sysctl, theyphk2002-04-301-6/+0
| | | | contain no truly interesting data anymore.
* Tidy up some loose ends.peter2002-04-291-2/+2
| | | | | | | | | | | | i386/ia64/alpha - catch up to sparc64/ppc: - replace pmap_kernel() with refs to kernel_pmap - change kernel_pmap pointer to (&kernel_pmap_store) (this is a speedup since ld can set these at compile/link time) all platforms (as suggested by jake): - gc unused pmap_reference - gc unused pmap_destroy - gc unused struct pmap.pm_count (we never used pm_count - we track address space sharing at the vmspace)
* Remove the tc_update() function. Any frequency change to thephk2002-04-261-2/+0
| | | | | | timecounter will be used starting at the next second, which is good enough for sysctl purposes. If better adjustment is needed the NTP PLL should be used.
* Move ICU_* defines into icu.h.nyan2002-04-067-70/+36
|
* Change callers of mtx_init() to pass in an appropriate lock type name. Injhb2002-04-042-2/+2
| | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64
* Stage-2 commit of the critical*() code. This re-inlines cpu_critical_enter()dillon2002-04-013-6/+6
| | | | | | | | | | | | | | | | | | | | | 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
* Tab-out the backslashes in icu_vector.s to make it more readable and todillon2002-03-273-366/+366
| | | | match it up with apic_vector.s.
* Compromise for critical*()/cpu_critical*() recommit. Cleanup the interruptdillon2002-03-278-174/+619
| | | | | | | | | | | | | | | | | | | 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
* Fixed some style bugs in the removal of __P(()). The main ones werebde2002-03-232-22/+22
| | | | | | 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.
* Fix abuses of cpu_critical_{enter,exit} by converting toimp2002-03-211-12/+12
| | | | | | | intr_{disable,restore} as well as providing an implemenation of intr_{disable,restore}. Reviewed by: jake, rwatson, jhb
* Remove __P.alfred2002-03-206-45/+44
|
* Back out all the pmap related stuff I've touched over the last few days.peter2002-02-273-13/+23
| | | | | | 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.
* revert last commit temporarily due to whining on the lists.dillon2002-02-268-734/+297
|
* STAGE-1 of 3 commit - allow (but do not require) interrupts to remaindillon2002-02-268-297/+734
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Work-in-progress commit syncing up pmap cleanups that I have been workingpeter2002-02-253-23/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* - Split the routine to initialize a bus_space_handle into the separatenyan2002-02-171-5/+7
| | | | | | | function. - Only access a bus_space_handle if the resource type is SYS_RES_MEMORY or SYS_RES_IOPORT. - Add the bus_space_subregion supports.
* Add needed include.nyan2002-02-101-0/+3
|
* Don't grab the ICU lock while reading the current pending interrupts andjhb2002-02-082-4/+0
| | | | | | current masked interrupts from the AT PIC. Requested by: bde
* Don't include <isa/isavar.h> or compile code depending on it when isabde2002-01-304-1/+14
| | | | | | | | is not configured. Including <isa/isavar.h> when it is not used is harmful as well as bogus, since it includes "isa_if.h" which is not generated when isa is not configured. This was fixed in 1999 but was broken by unconditionalizing PNPBIOS.
* Removed unused includes. In particular, don't include <isa/isavar.h> sincebde2002-01-301-24/+2
| | | | | | its only effect is to break the optionality of the isa option. Sorted includes.
* Change the preemption code for software interrupt thread schedules andjhb2002-01-053-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mutex releases to not require flags for the cases when preemption is not allowed: The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent switching to a higher priority thread on mutex releease and swi schedule, respectively when that switch is not safe. Now that the critical section API maintains a per-thread nesting count, the kernel can easily check whether or not it should switch without relying on flags from the programmer. This fixes a few bugs in that all current callers of swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from fast interrupt handlers and the swi_sched of softclock needed this flag. Note that to ensure that swi_sched()'s in clock and fast interrupt handlers do not switch, these handlers have to be explicitly wrapped in critical_enter/exit pairs. Presently, just wrapping the handlers is sufficient, but in the future with the fully preemptive kernel, the interrupt must be EOI'd before critical_exit() is called. (critical_exit() can switch due to a deferred preemption in a fully preemptive kernel.) I've tested the changes to the interrupt code on i386 and alpha. I have not tested ia64, but the interrupt code is almost identical to the alpha code, so I expect it will work fine. PowerPC and ARM do not yet have interrupt code in the tree so they shouldn't be broken. Sparc64 is broken, but that's been ok'd by jake and tmm who will be fixing the interrupt code for sparc64 shortly. Reviewed by: peter Tested on: i386, alpha
* Use the new resource_list_print_type() function.tmm2001-12-211-1/+1
| | | | | Pass the bus device to isa_init() (this is needed for the sparc64 version).
OpenPOWER on IntegriCloud