summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
Commit message (Collapse)AuthorAgeFilesLines
* Properly wrap mtx_intr_enable() macro in "do $bla while (0)"phk2001-06-021-1/+1
|
* GC #if 0'd calls to releasing and acquiring the old style giant kerneljhb2001-05-292-12/+0
| | | | lock.
* - FDESC, FIFO, NULL, PORTAL, PROC, UMAP and UNION fileru2001-05-231-1/+1
| | | | | | | | | | | | | | | systems were repo-copied from sys/miscfs to sys/fs. - Renamed the following file systems and their modules: fdesc -> fdescfs, portal -> portalfs, union -> unionfs. - Renamed corresponding kernel options: FDESC -> FDESCFS, PORTAL -> PORTALFS, UNION -> UNIONFS. - Install header files for the above file systems. - Removed bogus -I${.CURDIR}/../../sys CFLAGS from userland Makefiles.
* catch these files up to their i386 neighbors to make alpha bootgallatin2001-05-212-12/+32
| | | | prior to the vm_mtx
* Make _BSD_TIME_T_ (time_t) an `int' rather than `long'. This will helpobrien2001-05-181-1/+1
| | | | | | | flag errors where programmers assume time_t is a long, which it is not on 64-bit platforms. Submitted by: bde
* Style changes -- revert ordering to mostly two revs ago.obrien2001-05-181-61/+64
| | | | | | Embellish some comments, fix tab'ing. Requested by: bde
* Consistently define the rune types.obrien2001-05-161-4/+14
| | | | Follow NetBSD's lead and add a _BSD_MBSTATE_T_ type.
* Move the int typedefs to the top so they can be used in defining other types.obrien2001-05-161-19/+24
| | | | | | Ensure every platform has __offsetof. Make multiple inclusion detection consistent with other <platform>/include/*.h files.
* Lock the procfs functions for doing a single step and reading/writingjhb2001-05-161-28/+16
| | | | | | registers better. Hold sched_lock not only for checking the flag but also while performing the actual operation to ensure the process doesn't get swapped out by another CPU while we the operation is being performed.
* Trim lots of stuff that is now in MI code along with MD alpha code.jhb2001-05-101-324/+7
|
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-4/+5
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Overhaul of the SMP code. Several portions of the SMP kernel support havejhb2001-04-273-15/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | been made machine independent and various other adjustments have been made to support Alpha SMP. - It splits the per-process portions of hardclock() and statclock() off into hardclock_process() and statclock_process() respectively. hardclock() and statclock() call the *_process() functions for the current process so that UP systems will run as before. For SMP systems, it is simply necessary to ensure that all other processors execute the *_process() functions when the main clock functions are triggered on one CPU by an interrupt. For the alpha 4100, clock interrupts are delievered in a staggered broadcast fashion, so we simply call hardclock/statclock on the boot CPU and call the *_process() functions on the secondaries. For x86, we call statclock and hardclock as usual and then call forward_hardclock/statclock in the MD code to send an IPI to cause the AP's to execute forwared_hardclock/statclock which then call the *_process() functions. - forward_signal() and forward_roundrobin() have been reworked to be MI and to involve less hackery. Now the cpu doing the forward sets any flags, etc. and sends a very simple IPI_AST to the other cpu(s). AST IPIs now just basically return so that they can execute ast() and don't bother with setting the astpending or needresched flags themselves. This also removes the loop in forward_signal() as sched_lock closes the race condition that the loop worked around. - need_resched(), resched_wanted() and clear_resched() have been changed to take a process to act on rather than assuming curproc so that they can be used to implement forward_roundrobin() as described above. - Various other SMP variables have been moved to a MI subr_smp.c and a new header sys/smp.h declares MI SMP variables and API's. The IPI API's from machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h. - The globaldata_register() and globaldata_find() functions as well as the SLIST of globaldata structures has become MI and moved into subr_smp.c. Also, the globaldata list is only available if SMP support is compiled in. Reviewed by: jake, peter Looked over by: eivind
* Initialize p_md.md_kernnest to 1 for newly fork'd processes since theyjhb2001-04-262-0/+12
| | | | start off in the kernel.
* Add a new field 'md_kernnest' to the alpha machine dependent processjhb2001-04-241-0/+3
| | | | | | | | | | | | | | | | | | | | | structure. This field keeps track of how many levels deep we are nested into the kernel. The nesting level is bumped at the start of a trap, interrupt, syscall, or exception and is decremented on return. This is used to detect the case when the kernel is returning back to a kernel context in exception_return(). If we are returning to the kernel we need to update the globaldata pointer register saved in the stack frame in case we have switched CPU's between taking the initial interrupt that saved the frame and returning. If we don't do this fixup it is possible for a CPU to use the wrong per-cpu data. On UP systems this is not a problem, so the code is conditional on SMP. A count was used instead of simply checking the process status register in the frame during exception_return() since there are critical sections at the very start and end of a trap, exception, or interrupt from userland in which we could trash the t7 register being used in userland. The counter is incremented after adn before these critical sections respectively so that we will not overwrite the saved t7 register if we are interrupted during one of these critical sections.
* Fix includes so it compiles again.mjacob2001-04-231-1/+2
|
* Convert the protection of hte i8254 from critical_enter/exit like it isjhb2001-04-181-0/+3
| | | | on the x86.
* Blow away the panic mutex in favor of using a single atomic_cmpset() on ajhb2001-04-171-4/+0
| | | | | | panic_cpu shared variable. I used a simple atomic operation here instead of a spin lock as it seemed to be excessive overhead. Also, this can avoid recursive panics if, for example, witness is broken.
* Rework the witness code to work with sx locks as well as mutexes.jhb2001-03-282-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Introduce lock classes and lock objects. Each lock class specifies a name and set of flags (or properties) shared by all locks of a given type. Currently there are three lock classes: spin mutexes, sleep mutexes, and sx locks. A lock object specifies properties of an additional lock along with a lock name and all of the extra stuff needed to make witness work with a given lock. This abstract lock stuff is defined in sys/lock.h. The lockmgr constants, types, and prototypes have been moved to sys/lockmgr.h. For temporary backwards compatability, sys/lock.h includes sys/lockmgr.h. - Replace proc->p_spinlocks with a per-CPU list, PCPU(spinlocks), of spin locks held. By making this per-cpu, we do not have to jump through magic hoops to deal with sched_lock changing ownership during context switches. - Replace proc->p_heldmtx, formerly a list of held sleep mutexes, with proc->p_sleeplocks, which is a list of held sleep locks including sleep mutexes and sx locks. - Add helper macros for logging lock events via the KTR_LOCK KTR logging level so that the log messages are consistent. - Add some new flags that can be passed to mtx_init(): - MTX_NOWITNESS - specifies that this lock should be ignored by witness. This is used for the mutex that blocks a sx lock for example. - MTX_QUIET - this is not new, but you can pass this to mtx_init() now and no events will be logged for this lock, so that one doesn't have to change all the individual mtx_lock/unlock() operations. - All lock objects maintain an initialized flag. Use this flag to export a mtx_initialized() macro that can be safely called from drivers. Also, we on longer walk the all_mtx list if MUTEX_DEBUG is defined as witness performs the corresponding checks using the initialized flag. - The lock order reversal messages have been improved to output slightly more accurate file and line numbers.
* - Switch from using save/disable/restore_intr to using critical_enter/exitjhb2001-03-281-23/+1
| | | | | | | | | | | | | | | | | and change the u_int mtx_saveintr member of struct mtx to a critical_t mtx_savecrit. - On the alpha we no longer need a custom _get_spin_lock() macro to avoid an extra PAL call, so remove it. - Partially fix using mutexes with WITNESS in modules. Change all the _mtx_{un,}lock_{spin,}_flags() macros to accept explicit file and line parameters and rename them to use a prefix of two underscores. Inside of kern_mutex.c, generate wrapper functions for _mtx_{un,}lock_{spin,}_flags() (only using a prefix of one underscore) that are called from modules. The macros mtx_{un,}lock_{spin,}_flags() are mapped to the __mtx_* macros inside of the kernel to inline the usual case of mutex operations and map to the internal _mtx_* functions in the module case so that modules will use WITNESS and KTR logging if the kernel is compiled with support for it.
* - Include <machine/prom.h> to get the prototype for prom_halt().jhb2001-03-281-1/+1
| | | | | | | | - If there is no gdb device, just return without trying to return any value since gdb_handle_exception() returns void. - When calling prom_halt(), pass in a value telling it to actually halt and not to randomly choose whether or not to halt or reboot depending on whatever value happened to be in a0 when the call was made.
* Unbreak build on alpha.ume2001-03-241-3/+0
| | | | | | | - Move in_port_t to sys/types.h. - Nuke in_addr_t from each endian.h. Reported by: jhb
* Use a generic implementation of the Fowler/Noll/Vo hash (FNV hash).peter2001-03-171-0/+1
| | | | | | | | | | | | | | | | | Make the name cache hash as well as the nfsnode hash use it. As a special tweak, create an unsigned version of register_t. This allows us to use a special tweak for the 64 bit versions that significantly speeds up the i386 version (ie: int64 XOR int64 is slower than int64 XOR int32). The code layout is a little strange for the string function, but I was able to get between 5 to 10% improvement over the original version I started with. The layout affects gcc code generation choices and this way was fastest on x86 and alpha. Note that 'CPUTYPE=p3' etc makes a fair difference to this. It is around 45% faster with -march=pentiumpro on a p6 cpu.
* remove bogus check -- for kernel threads we fork off of proc0, not curprocgallatin2001-03-152-4/+0
| | | | | | | This was causing panics when modules which create kthreads were loaded after boot. pointed out by: jake, jhb
* Fix mtx_legal2block. The only time that it is bad to block on a mutex isjhb2001-03-091-2/+0
| | | | | | | | | | | | | | | | if we hold a spin mutex, since we can trivially get into deadlocks if we start switching out of processes that hold spinlocks. Checking to see if interrupts were disabled was a sort of cheap way of doing this since most of the time interrupts were only disabled when holding a spin lock. At least on the i386. To fix this properly, use a per-process counter p_spinlocks that counts the number of spin locks currently held, and instead of checking to see if interrupts are disabled in the witness code, check to see if we hold any spin locks. Since child processes always start up with the sched lock magically held in fork_exit(), we initialize p_spinlocks to 1 for child processes. Note that proc0 doesn't go through fork_exit(), so it starts with no spin locks held. Consulting from: cp
* Use the proc lock to protect p_pptr when waking up our parent in cpu_exit()jhb2001-03-072-2/+4
| | | | and remove the mpfixme() message that is now fixed.
* Rename switch_trampoline() to fork_trampoline() on the alpha and ia64.jhb2001-02-222-2/+2
| | | | Suggested by: dfr
* GC unused and now obsolete assertion macros.jhb2001-02-221-10/+0
|
* - Don't call clear_resched() in userret(), instead, clear the resched flagjhb2001-02-203-15/+0
| | | | | | | | | | | | in mi_switch() just before calling cpu_switch() so that the first switch after a resched request will satisfy the request. - While I'm at it, move a few things into mi_switch() and out of cpu_switch(), specifically set the p_oncpu and p_lastcpu members of proc in mi_switch(), and handle the sched_lock state change across a context switch in mi_switch(). - Since cpu_switch() no longer handles the sched_lock state change, we have to setup an initial state for sched_lock in fork_exit() before we release it.
* Correct disordering which is corresponding to bde's fix toume2001-02-171-1/+1
| | | | i386/include/ansi.h.
* Correct 2nd argument of getnameinfo(3) to socklen_t.ume2001-02-151-0/+1
| | | | Reviewed by: itojun
* RIP <machine/lock.h>.markm2001-02-112-37/+0
| | | | | | | Some things needed bits of <i386/include/lock.h> - cy.c now has its own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK() has been moved to <i386/include/apic.h> (AKA <machine/apic.h>). Reviewed by: jhb
* - Make astpending and need_resched process attributes rather than CPUjhb2001-02-103-3/+0
| | | | | | | | | | | attributes. This is needed for AST's to be properly posted in a preemptive kernel. They are backed by two new flags in p_sflag: PS_ASTPENDING and PS_NEEDRESCHED. They are still accesssed by their old macros: aston(), astoff(), etc. For completeness, an astpending() macro has been added to check for a pending AST, and clear_resched() has been added to clear need_resched(). - Rename syscall2() on the x86 back to syscall() to be consistent with other architectures.
* Add a macro mtx_intr_enable() to alter a spin lock such that interruptsjhb2001-02-101-0/+1
| | | | will be enabled when it is released.
* Change and clean the mutex lock interface.bmilekic2001-02-095-55/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* * Move exception_return to exception.s which is a more logical home for it.dfr2001-01-311-0/+2
| | | | | | | | | * Optimise the return path for syscalls so that they only restore a minimal set of registers instead of performing a full exception_return. A new flag in the trapframe indicates that the frame only holds partial state. When it is necessary to perform a full state restore (e.g. after an execve or signal), the flag is cleared to force a full restore.
* Update some comments, s0 in the pcb of a child returning from fork1() isjhb2001-01-262-4/+4
| | | | now passed in as a0 to fork_exit() and and s2 is passed in as a1.
* - Change fork_exit() to take a pointer to a trapframe as its 3rd argumentjhb2001-01-242-4/+4
| | | | | | | instead of a trapframe directly. (Requested by bde.) - Convert the alpha switch_trampoline to call fork_exit() and use the MI fork_return() instead of child_return(). - Axe child_return().
* Convert all simplelocks to mutexes and remove the simplelock implementations.jasone2001-01-242-87/+6
|
* - Rename the gd_cpuno member of struct globaldata to gd_cpuid.jhb2001-01-242-8/+12
| | | | - Add a globaldata_register() prototype in the SMP case.
* - Proc locking.jhb2001-01-241-4/+24
| | | | - P_INMEM -> PS_INMEM.
* cpuno -> cpuid.jhb2001-01-241-1/+1
|
* Move most of sys/mutex.h into kern/kern_mutex.c, thereby making the mutexjasone2001-01-211-0/+6
| | | | | | | | | | | inline functions non-inlined. Hide parts of the mutex implementation that should not be exposed. Make sure that WITNESS code is not executed during boot until the mutexes are fully initialized by SI_SUB_MUTEX (the original motivation for this commit). Submitted by: peter
* Make intr_nesting_level per-process, rather than per-cpu. Setupjake2001-01-212-2/+0
| | | | | | | | interrupt threads to run with it always >= 1, so that malloc can detect M_WAITOK from "interrupt" context. This is also necessary in order to context switch from sched_ithd() directly. Reviewed By: peter
* Remove unused per-cpu variables inside_intr and ss_eflags.jake2001-01-122-2/+0
|
* - Remove compatibility macros for accessing per-cpu variables.jake2001-01-111-13/+0
| | | | | | | __FreeBSD_version 500015 can be used to detect their disappearance. - Move the symbols for SMP_prvspace and lapic from globals.s to locore.s. - Remove globals.s with extreme prejudice.
* Remove seconds types we don't use that came in thru the NetBSD heiratage.obrien2001-01-081-1/+0
|
* PowerPC atomic operation functions.benno2001-01-073-56/+544
| | | | | | | Some of these are dependant on an inline function (powerpc_mb()) that is yet to come. Reviewed by: obrien
* PowerPC assembler #defines.benno2001-01-071-0/+95
| | | | | Reviewed by: obrien Obtained from: NetBSD
* Implement accessors for per-cpu variables which don't depend on thejake2001-01-061-0/+1
| | | | | | | | | | | | | | | | | symbols in globals.s. PCPU_GET(name) returns the value of the per-cpu variable PCPU_PTR(name) returns a pointer to the per-cpu variable PCPU_SET(name, val) sets the value of the per-cpu variable In general these are not yet used, compatibility macros remain. Unifdef SMP struct globaldata, this makes variables such as cpuid available for UP as well. Rebuilding modules is probably a good idea, but I believe old modules will still work, as most of the old infrastructure remains.
* PowerPC platform-specific definitions (modeled on sys/i386/include/setjmp.h)obrien2001-01-021-0/+46
|
OpenPOWER on IntegriCloud