summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include
Commit message (Collapse)AuthorAgeFilesLines
* Declare or #define per-cpu globals in <machine/globals.h> in all cases.bde2000-10-276-31/+0
| | | | The i386 UP case was messily different.
* - Add atomic_cmpset_{acq_,rel_,}_longjhb2000-10-251-0/+52
| | | | - Add in atomic operations for 8-bit, 16-bit, and 32-bit integers
* - Overhaul the software interrupt code to use interrupt threads for eachjhb2000-10-251-2/+1
| | | | | | | | | | | | | | | | | | | type of software interrupt. Roughly, what used to be a bit in spending now maps to a swi thread. Each thread can have multiple handlers, just like a hardware interrupt thread. - Instead of using a bitmask of pending interrupts, we schedule the specific software interrupt thread to run, so spending, NSWI, and the shandlers array are no longer needed. We can now have an arbitrary number of software interrupt threads. When you register a software interrupt thread via sinthand_add(), you get back a struct intrhand that you pass to sched_swi() when you wish to schedule your swi thread to run. - Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit more intuitive. Also, prefix all the members of struct intrhand with 'ih_'. - Make swi_net() a MI function since there is now no point in it being MD. Submitted by: cp
* Define the mtx_legal2block() macro used in the witness code that managedjhb2000-10-201-0/+2
| | | | | | to get lost during the MI mutex conversion. Reported by: Steve Kargl <sgk@troutmask.apl.washington.edu>
* Catch up to moving headers:jhb2000-10-201-1/+1
| | | | | - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h
* - Make the mutex code almost completely machine independent. This greatlyjhb2000-10-201-512/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reducues the maintenance load for the mutex code. The only MD portions of the mutex code are in machine/mutex.h now, which include the assembly macros for handling mutexes as well as optionally overriding the mutex micro-operations. For example, we use optimized micro-ops on the x86 platform #ifndef I386_CPU. - Change the behavior of the SMP_DEBUG kernel option. In the new code, mtx_assert() only depends on INVARIANTS, allowing other kernel developers to have working mutex assertiions without having to include all of the mutex debugging code. The SMP_DEBUG kernel option has been renamed to MUTEX_DEBUG and now just controls extra mutex debugging code. - Abolish the ugly mtx_f hack. Instead, we dynamically allocate seperate mtx_debug structures on the fly in mtx_init, except for mutexes that are initiated very early in the boot process. These mutexes are declared using a special MUTEX_DECLARE() macro, and use a new flag MTX_COLD when calling mtx_init. This is still somewhat hackish, but it is less evil than the mtx_f filler struct, and the mtx struct is now the same size with and without mutex debugging code. - Add some micro-micro-operation macros for doing the actual atomic operations on the mutex mtx_lock field to make it easier for other archs to override/optimize mutex ops if needed. These new tiny ops also clean up the code in some places by replacing long atomic operation function calls that spanned 2-3 lines with a short 1-line macro call. - Don't call mi_switch() from mtx_enter_hard() when we block while trying to obtain a sleep mutex. Calling mi_switch() would bogusly release Giant before switching to the next process. Instead, inline most of the code from mi_switch() in the mtx_enter_hard() function. Note that when we finally kill Giant we can back this out and go back to calling mi_switch().
* - Expand the set of atomic operations to optionally include memory barriersjhb2000-10-201-2/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | in most of the atomic operations. Now for these operations, you can use the normal atomic operation, you can use the operation with a read barrier, or you can use the operation with a write barrier. The function names follow the same semantics used in the ia64 instruction set. An atomic operation with a read barrier has the extra suffix 'acq', due to it having "acquire" semantics. An atomic operation with a write barrier has the extra suffix 'rel'. These suffixes are inserted between the name of the operation to perform and the typename. For example, the atomic_add_int() function now has 3 variants: - atomic_add_int() - this is the same as the previous function - atomic_add_acq_int() - this function combines the add operation with a read memory barrier - atomic_add_rel_int() - this function combines the add operation with a write memory barrier - Add 'ptr' to the list of types that we can perform atomic operations on. This allows one to do atomic operations on uintptr_t's. This is useful in the mutex code, for example, because the actual mutex lock is a pointer. - Add two new operations for doing loads and stores with memory barriers. The new load operations use a read barrier before the load, and the new store operations use a write barrier after the load. For example, atomic_load_acq_int() will atomically load an integer as well as enforcing a read barrier.
* Axe the barrier_{read,write,rw}() helper functions as this method ofjhb2000-10-203-72/+0
| | | | | | | doing memory barriers doesn't really scale well for the ia64. Also, memory barriers are more a property of the CPU than bus space. Requested by: dfr
* Add PCI BIOS function codes for IRQ routing fetch and route.msmith2000-10-191-0/+2
|
* Add in a simple API for memory barriers to machine/bus.h:jhb2000-10-183-0/+69
| | | | | | - barrier_read() enforces a memory read barrier - barrier_write() enforces a memory write barrier - barrier_rw() enforces a memory read/write barrier
* Add types and prototypes.imp2000-10-162-2/+46
| | | | Submitted by: msmith
* Move DELAY() from <machine/clock.h> to <sys/systm.h>phk2000-10-151-1/+0
|
* Removed unused include of <machine/lock.h>. The locking interface stoppedbde2000-10-121-4/+0
| | | | being (ab)used here in rev.1.97.
* Moved the definitions of AST_PENDING and AST_RESCHED to the correct place.bde2000-10-121-0/+6
|
* Work around a bug by adding struct tags. gcc-2.95 apparently gets thebde2000-10-061-2/+2
| | | | | | | | | check in the [basic.link] section of the C++ standard wrong. gcc-2.7.2.3 apparently doesn't do the check, so the bug doesn't affect RELENG_3. PR: 16170, 21427 Submitted by: Max Khon <fjoe@lark.websci.ru> (i386 version) Discussed with: jdp
* - Change fast interrupts on x86 to push a full interrupt frame and tojhb2000-10-064-25/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | return through doreti to handle ast's. This is necessary for the clock interrupts to work properly. - Change the clock interrupts on the x86 to be fast instead of threaded. This is needed because both hardclock() and statclock() need to run in the context of the current process, not in a separate thread context. - Kill the prevproc hack as it is no longer needed. - We really need Giant when we call psignal(), but we don't want to block during the clock interrupt. Instead, use two p_flag's in the proc struct to mark the current process as having a pending SIGVTALRM or a SIGPROF and let them be delivered during ast() when hardclock() has finished running. - Remove CLKF_BASEPRI, which was #ifdef'd out on the x86 anyways. It was broken on the x86 if it was turned on since cpl is gone. It's only use was to bogusly run softclock() directly during hardclock() rather than scheduling an SWI. - Remove the COM_LOCK simplelock and replace it with a clock_lock spin mutex. Since the spin mutex already handles disabling/restoring interrupts appropriately, this also lets us axe all the *_intr() fu. - Back out the hacks in the APIC_IO x86 cpu_initclocks() code to use temporary fast interrupts for the APIC trial. - Add two new process flags P_ALRMPEND and P_PROFPEND to mark the pending signals in hardclock() that are to be delivered in ast(). Submitted by: jakeb (making statclock safe in a fast interrupt) Submitted by: cp (concept of delaying signals until ast())
* currentldt is now a "special" global-data variable, and as such, therejhb2000-10-061-3/+0
| | | | | is no actual currentldt integer variable directly. Thus, don't claim that there is.
* Interrupt frames don't include the saved cpl anymore since cpl is dead.jhb2000-10-061-2/+0
|
* - Heavyweight interrupt threads on the alpha for device I/O interrupts.jhb2000-10-051-0/+1
| | | | | | | | | | | - Make softinterrupts (SWI's) almost completely MI, and divorce them completely from the x86 hardware interrupt code. - The ihandlers array is now gone. Instead, there is a MI shandlers array that just contains SWI handlers. - Most of the former machine/ipl.h files have moved to a new sys/ipl.h. - Stub out all the spl*() functions on all architectures. Submitted by: dfr
* Replace loadandclear() with atomic_readandclear_int().jhb2000-10-051-11/+0
|
* Add atomic_readandclear_int and atomic_readandclear_long.jhb2000-10-051-2/+34
|
* Make the gd_currentldt member in struct globaldata unconditional sojhb2000-10-051-3/+1
| | | | | that this header doesn't depend on USER_LDT. This fixes the USER_LDT breakage with SMP kernels.
* Reduce userland namespace polution.jasone2000-10-041-1/+4
|
* Move the i386 PCI attachment code out of i386/isa back into i386/pci.msmith2000-10-021-0/+5
| | | | | Split out the configuration space access primitives, as these are needed elsewhere as well.
* More updates to the ACPI code:msmith2000-09-301-0/+13
| | | | | | | | | | | | | | | - Move all register I/O into acpi_io.c - Move event handling into acpi_event.c - Reorganise headers into acpivar/acpireg/acpiio - Move find-RSDT and find-ACPI-owned-memory into acpi_machdep - Allocate all resources (except those detailed only by AML) as real resources. Add infrastructure that will make adding resource support to AML code easy. - Remove all ACPI #ifdefs in non-ACPI code - Removed unnecessary includes - Minor style and commenting fixes Reviewed by: iwasaki
* This is the first snapshot of the FreeBSD/ia64 kernel. This kernel willdfr2000-09-291-0/+80
| | | | | | not work on any real hardware (or fully work on any simulator). Much more needs to happen before this is actually functional but its nice to see the FreeBSD copyright message appear in the ia64 simulator.
* First shot at identifying the Pentum 4 acording to our reading of thepeter2000-09-291-2/+3
| | | | | | | | the cpu_id extensions in the Intel docs. There is more info available. See the following URL for more details. http://developer.intel.com/design/processor/future/manuals/CPUID_Supplement.htm Requested by: Intel
* Get out the roto-rooter and clean up the abuse of nexus ivars by thepeter2000-09-281-0/+55
| | | | | | | | | | | | i386/isa/pcibus.c. This gets -current running again on multiple host->pci machines after the most recent nexus commits. I had discussed this with Mike Smith, but ended up doing it slightly differently to what we discussed as it turned out cleaner this way. Mike was suggesting creating a new resource (SYS_RES_PCIBUS) or something and using *_[gs]et_resource(), but IMHO that wasn't ideal as SYS_RES_* is meant to be a global platform property, not a quirk of a given implementation. This does use the ivar methods but does so properly. It also now prints the physical pci bus that a host->pci bridge (pcib) corresponds to.
* Fix the assmebly mutex macros to handle saving/restoring interrupt statejhb2000-09-241-7/+21
| | | | | properly. Fix the recursive mutex macros to actually compile. At the moment we only use MTX_EXIT anyways.
* Move MAXCPU from machine/smp.h to machine/param.h to fix breakageps2000-09-231-10/+0
| | | | | with !SMP kernels. Also, replace NCPUS with MAXCPU since they are redundant.
* #include <sys/proc.h> in order to get curproc. This seems to be the lesserjasone2000-09-231-3/+2
| | | | | of two evils; the greater evil is requiring sys/proc.h to be included before including machine/mutex.h.
* Remove the NCPU, NAPIC, NBUS, NINTR config options. Make NAPIC,ps2000-09-222-48/+65
| | | | | | NBUS, NINTR dynamic and set NCPU to a maximum of 16 under SMP. Reviewed by: peter
* Teach MTX_EXIT_RECURSE that the recursion count is a 32-bit integer,jhb2000-09-221-3/+3
| | | | not a 16-bit one.
* Add a couple of debug register helper functions to assist in settingbsd2000-09-212-0/+10
| | | | | | and clearing watchpoints. Reviewed by: jwd@FreeBSD.org, -hackers@
* Make LINT compile.phk2000-09-161-1/+1
|
* Remove the mtx_t, witness_t, and witness_blessed_t types. Instead, justjhb2000-09-141-25/+23
| | | | | | use struct mtx, struct witness, and struct witness_blessed. Requested by: bde
* Clean up process accounting some more. Unfortunately, it is still notjhb2000-09-121-18/+14
| | | | | quite right on i386 as the CPU who runs statclock() doesn't have a valid clockframe to calculate statistics with.
* When doing statistics for statclock on other CPU's, use the other CPUs'jhb2000-09-111-3/+3
| | | | | | idleproc pointers instead of our own for comparisons. Submitted by: tegge
* Style cleanups. No functional changes.jasone2000-09-091-42/+37
|
* Add file and line arguments to WITNESS_ENTER() and WITNESS_EXIT, sincejasone2000-09-091-14/+14
| | | | | | __FILE__ and __LINE__ don't get expanded usefully in inline functions. Add const to all witness*() arguments that are filenames.
* Rename mtx_enter(), mtx_try_enter(), and mtx_exit() and wrap them with cppjasone2000-09-081-68/+80
| | | | | | | | macros that expand to pass filename and line number information. This is necessary since we're using inline functions instead of macros now. Add const to the filename pointers passed througout the mtx and witness code.
* Remove an unneeded extern declaration of cp_time.jhb2000-09-081-2/+0
|
* Really fix USER_LDT. (Don't use currentldt as an L-value.)jake2000-09-081-1/+1
|
* Test for both SMP and I386_CPU being set before generating an error.jhb2000-09-071-1/+1
|
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-077-74/+910
| | | | | | | | | | | | | | | 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
* Introduce atomic_cmpset_int() and atomic_cmpset_long() from SMPng aphk2000-09-061-0/+72
| | | | | | | | | | | few hours earlier than the rest. The next DEVFS commit needs these functions. Alpha versions by: dfr i386 versions by: jakeb Approved by: SMPng
* Increase the default NAPIC from 1 to 2 as a bandaid until we allocatemsmith2000-08-181-1/+1
| | | | these dynamically (ie. typically you shouldn't have to set NAPIC at all)
* Prepare for a cleanup of pmap module API pollution introduced by thetegge2000-08-161-0/+1
| | | | | | | | | | | | | | | suggested fix in PR 12378. Keep track of all existing pmaps independent of existing processes. This allows for a process to temporarily connect to a different address space without the risk of missing an update of the original address space if the kernel grows. pmap_pinit2() is no longer needed on the i386 platform but is left as a stub until the alpha pmap code is updated. PR: 12378
* Clean up some low level bootstrap code:peter2000-08-113-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - stop using the evil 'struct trapframe' argument for mi_startup() (formerly main()). There are much better ways of doing it. - do not use prepare_usermode() - setregs() in execve() will do it all for us as long as the p_md.md_regs pointer is set. (which is now done in machdep.c rather than init_main.c. The Alpha port did it this way all along and is much cleaner). - collect all the magic %cr0 etc register settings into one place and have the AP's call that instead of using magic numbers (!!) that keep changing over and over again. - Make it safe to call kthread_create() earlier, including during the device probe sequence. It doesn't need the callback mechanism that NetBSD's version uses. - kthreads created this way are root-less as they exist before the root filesystem is mounted. init(1) is set up so that it aquires the root pointers prior to running. If other kthreads want filesystem acccess we can make this code more generic. - set all threads start times once we have decided what time it is. - init uses a trampoline rather than the evil prepare_usermode() hack. - kern_descrip.c has a couple of tweaks to deal with forking when there is no rootdir or cwd etc. - adjust the early SYSINIT() sequence so that a few prereqisites are in place. eg: make sure the run queue is initialized before doing forks. With this, the USB code can easily create a kthread to do the device tree discovery. (I have tested it, it works nicely). There are still some open issues before this is truely useful. - tsleep() does not like working before the clock is running. It sort-of tries to spin wait, but it can do more useful things now. - stopping a kthread in kld code at unload time is "interesting" but we have a solution for that. The Alpha code needs no changes for this. It already uses pretty much the same strategies, but a little cleaner.
* Don't skip IOAPIC id conflict detection when only one pci bus is present.tegge2000-08-101-6/+4
| | | | | PR: 20312 Reviewed by: Steve Roome <steve@sse0691.bri.hp.com>
OpenPOWER on IntegriCloud