summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim/machdep.c
Commit message (Collapse)AuthorAgeFilesLines
* Set the siginfo si_addr field, and also the mysterious 3rd parametergrehan2006-01-071-1/+4
| | | | | | | | to old-style signals, to be the DAR register for DSI miss exceptions. This gives the address of the access rather than the instruction address. The behaviour is now the same as on i386. Found by: libsigsegv tests
* MI changes:netchild2005-12-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | - provide an interface (macros) to the page coloring part of the VM system, this allows to try different coloring algorithms without the need to touch every file [1] - make the page queue tuning values readable: sysctl vm.stats.pagequeue - autotuning of the page coloring values based upon the cache size instead of options in the kernel config (disabling of the page coloring as a kernel option is still possible) MD changes: - detection of the cache size: only IA32 and AMD64 (untested) contains cache size detection code, every other arch just comes with a dummy function (this results in the use of default values like it was the case without the autotuning of the page coloring) - print some more info on Intel CPU's (like we do on AMD and Transmeta CPU's) Note to AMD owners (IA32 and AMD64): please run "sysctl vm.stats.pagequeue" and report if the cache* values are zero (= bug in the cache detection code) or not. Based upon work by: Chad David <davidc@acns.ab.ca> [1] Reviewed by: alc, arch (in 2004) Discussed with: alc, Chad David, arch (in 2004)
* Insert a layer of indirection to the pmap code, using a kobj forgrehan2005-11-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the interface. This allows run-time selection of MMU code, based on CPU-type detection, or tunable-overrides when testing new code. Pre-requisite for G5 support. conf/files.powerpc - remove pmap.c - add mmu_if.h, mmu_oea.c, pmap_dispatch.c powerpc/include/mmuvar.h - definitions for MMU implementations powerpc/include/pmap.h - remove pmap_pte_spill declaration - add pmap_mmu_install declaration - size the phys_avail array - pmap_bootstrapped is now global-scope powerpc/powerpc/machdep.c - call kobj_machdep_init early in the boot sequence to allow kobj usage prior to SI_SUB_LOCK - install the OEA pmap code. This will be moved to CPU-specific init code in the future. powerpc/powerpc/mmu_if.m - Kobj MMU interface definitions powerpc/powerpc/pmap_dispatch.c - central dispatch for pmap calls - contains the global mmu kobj and the routine to locate the the mmu implementation and init the kobj
* 1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, mostdavidxu2005-10-141-22/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code. 2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread. 3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc. 4. Add td_sigqueue to thread structure to hold all signals delivered to thread. 5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed. 6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals. Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64
* Temporary band-aid to fix hang when a process exec's Altivec instructions.grehan2005-07-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | trap_subr.S: declare a stub for the a-unavailable trap that does an absolute jump to the vector-assist trap. This is due to the fact that the vec-unavail trap doesn't start at a 256-byte boundary, so the trick of masking the bottom 8 bits of the link register to identify the interrupt doesn't work, so let the vec-assist case handle Altivec-disabled for the time being. Note that this will be fixed in the future with a much smaller vector code-stub (< 16 bytes) that will allow use of strange vector offsets that are also present in 4xx processors, and also allow smaller differences in vector codepaths on the G5. trap.c: Treat altivec-unavailable/assist process traps as SIGILL. Not quite correct, since altivec-assist should really be a panic, but it is fine for the moment due to the above measure. machdep.c Install the stub code for the altivec-unavailable trap, and the standard trap code at the altivec-assist. Reported by: Andreas Tobler <toa at pop agri ch> MFC after: 3 days
* Change an instance of md_savecrit to md_saved_msr that I missed.jhb2005-04-081-1/+1
|
* Divorce critical sections from spinlocks. Critical sections as denoted byjhb2005-04-041-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | critical_enter() and critical_exit() are now solely a mechanism for deferring kernel preemptions. They no longer have any affect on interrupts. This means that standalone critical sections are now very cheap as they are simply unlocked integer increments and decrements for the common case. Spin mutexes now use a separate KPI implemented in MD code: spinlock_enter() and spinlock_exit(). This KPI is responsible for providing whatever MD guarantees are needed to ensure that a thread holding a spin lock won't be preempted by any other code that will try to lock the same lock. For now all archs continue to block interrupts in a "spinlock section" as they did formerly in all critical sections. Note that I've also taken this opportunity to push a few things into MD code rather than MI. For example, critical_fork_exit() no longer exists. Instead, MD code ensures that new threads have the correct state when they are created. Also, we no longer try to fixup the idlethreads for APs in MI code. Instead, each arch sets the initial curthread and adjusts the state of the idle thread it borrows in order to perform the initial context switch. This change is largely a big NOP, but the cleaner separation it provides will allow for more efficient alternative locking schemes in other parts of the kernel (bare critical sections rather than per-CPU spin mutexes for per-CPU data for example). Reviewed by: grehan, cognet, arch@, others Tested on: i386, alpha, sparc64, powerpc, arm, possibly more
* physmem is a much better indicator for 'real' memory on PPC than Maxmemgrehan2005-03-071-3/+3
| | | | | | since there are often significant holes in the memory map due to the kernel, loader and OFW data structures not being included: Maxmem is the highest available, so can be misleading.
* Catch up with "physical memory" sysctl change.grehan2005-03-011-0/+2
| | | | (MFi386: rev 1.608)
* Catch the case where the idle loop is entered with interrupts disabled,grehan2005-02-281-1/+9
| | | | causing a hard hang.
* - switch pcpu to a struct declaration ala amd64. It may be more efficient togrehan2005-02-281-3/+2
| | | | | | cache-align this struct, but that's a topic for a far-in-the-future commit. - eliminate commented-out reference to a non-existent pcpu field.
* Correctly set kernelname for kern.bootfile sysctlgrehan2005-02-281-0/+10
| | | | | Noticed by: gad Code stolen from: sparc64
* Finish the job of sorting all includes and fix the build by includingnjl2005-02-061-23/+27
| | | | | | malloc.h before proc.h on sparc64. Noticed by das@ Compiled on: alpha, amd64, i386, pc98, sparc64
* Sort includes a little so that bus.h comes before cpu.h (for device_t).njl2005-02-041-4/+4
|
* Add an implementation of cpu_est_clockrate(9). This function estimates thenjl2005-02-041-0/+9
| | | | current clock frequency for the given CPU id in units of Hz.
* /* -> /*- for license, minor formatting changesimp2005-01-071-2/+2
|
* Don't include sys/user.h merely for its side-effect of recursivelydas2004-11-271-1/+1
| | | | including other headers.
* U areas are going away, so don't allocate one for process 0.das2004-11-201-3/+0
| | | | Reviewed by: arch@
* Refactor a bunch of scheduler code to give basically the same behaviourjulian2004-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | but with slightly cleaned up interfaces. The KSE structure has become the same as the "per thread scheduler private data" structure. In order to not make the diffs too great one is #defined as the other at this time. The KSE (or td_sched) structure is now allocated per thread and has no allocation code of its own. Concurrency for a KSEGRP is now kept track of via a simple pair of counters rather than using KSE structures as tokens. Since the KSE structure is different in each scheduler, kern_switch.c is now included at the end of each scheduler. Nothing outside the scheduler knows the contents of the KSE (aka td_sched) structure. The fields in the ksegrp structure that are to do with the scheduler's queueing mechanisms are now moved to the kg_sched structure. (per ksegrp scheduler private data structure). In other words how the scheduler queues and keeps track of threads is no-one's business except the scheduler's. This should allow people to write experimental schedulers with completely different internal structuring. A scheduler call sched_set_concurrency(kg, N) has been added that notifies teh scheduler that no more than N threads from that ksegrp should be allowed to be on concurrently scheduled. This is also used to enforce 'fainess' at this time so that a ksegrp with 10000 threads can not swamp a the run queue and force out a process with 1 thread, since the current code will not set the concurrency above NCPU, and both schedulers will not allow more than that many onto the system run queue at a time. Each scheduler should eventualy develop their own methods to do this now that they are effectively separated. Rejig libthr's kernel interface to follow the same code paths as linkse for scope system threads. This has slightly hurt libthr's performance but I will work to recover as much of it as I can. Thread exit code has been cleaned up greatly. exit and exec code now transitions a process back to 'standard non-threaded mode' before taking the next step. Reviewed by: scottl, peter MFC after: 1 week
* Implement MD parts of ptrace.ssouhlal2004-07-291-13/+43
| | | | Approved by: grehan (mentor)
* Improve boot-time debugging with DDB by extracting the ksym start/endgrehan2004-07-271-0/+9
| | | | values from the loader.
* Allow DSI exceptions to invoke DDB.grehan2004-07-231-1/+2
|
* Properly obey PPC context synchronization rules when modifyinggrehan2004-07-201-0/+2
| | | | | the address translation bits of the MSR. This fixes the boot-time panic reported by Drew Gallatin.
* Add ptrace_clear_single_step(), alpha already has it for years, the functiondavidxu2004-07-131-0/+8
| | | | will be used by ptrace to clear a thread's single step state.
* - DDB -> KDB, with kdb routinesgrehan2004-07-121-23/+54
| | | | | | | - ddb -> db for low-level trapcode - implement makectx. I think it only matters that the stack is setup correctly. - bring over ddb_trap_glue and rename to db_trap_glue
* Kernel changes for libthr (and probably libpthread).grehan2004-03-021-60/+127
| | | | | | | | | | | | | | | | | | | | | | | | | include/ucontext.h - remove trapframe and switch over to 'generic' description of machine state. Include version field to help with future modifications. Include floating point and altivec state, and hopefully align correctly powerpc/copyinout.c - fill out casuptr() sync primitive, required by kern_umtx.c powerpc/machdep.c - shifted proc0/thread0/pcpu setup to before cninit, since syscons -> make_dev -> devlock requires a valid curthread - implemented get_mcontext/set_mcontext - recast sendsig/sigreturn to use get/set_mcontext and new ucontext struct. floating point now saved - TODO: save/restore altivec state powerpc/vm_machdep.c - implemented cpu_thread_setup/cpu_set_upcall/cpu_set_upcall_kse - eliminated trailing whitespace Submitted by: Suleiman Souhlal <refugee@segfaulted.com>, ucontext by grehan
* Cleaned up param.h:grehan2004-02-111-0/+1
| | | | | | | | | | | - culled long-dead #define's - segment register defs moved to sr.h - NPMAPS moved to pmap.h - KERNBASE moved to vmparam.h - removed include of <machine/cpu.h> and fixed src files that relied on this. Modifying segment register code no longer causes gcc rebuilds :-)
* - remove unused trap definitionsgrehan2004-02-041-6/+11
| | | | | | - ISI traps are now handled by the generic trap routine - direct diagnostic traps to DDB if defined - remove unused asngen pcpu init
* - Catch up with panic __LINE__/__FILE__ changes by moving panic callsgrehan2004-01-211-11/+7
| | | | | out of asm. - remove some long-dead code from machdep.c
* Make sigaltstack as per-threaded, because per-process sigaltstack statedavidxu2004-01-031-5/+5
| | | | | | | | | | | | | is useless for threaded programs, multiple threads can not share same stack. The alternative signal stack is private for thread, no lock is needed, the orignal P_ALTSTACK is now moved into td_pflags and renamed to TDP_ALTSTACK. For single thread or Linux clone() based threaded program, there is no semantic changed, because those programs only have one kernel thread in every process. Reviewed by: deischen, dfr
* Use the "shut-down" and "reset-all" Forth procedures to halt andgallatin2003-12-091-1/+2
| | | | | | | | | reboot, as calling OF_exit() just hangs a mac. FreeBSD on my G4 800Mhz mac behaves identically to OSX for halt and reboot now. Reviewed by: grehan (who also supplied the concept and sample code)
* Change the clear_ret argument of get_mcontext() to be a flags argument.marcel2003-11-091-1/+1
| | | | | | | | | | Since all callers either passed 0 or 1 for clear_ret, define bit 0 in the flags for use as clear_ret. Reserve bits 1, 2 and 3 for use by MI code for possible (but unlikely) future use. The remaining bits are for use by MD code. This change is triggered by a need on ia64 to have another knob for get_mcontext().
* Add a stub cpu_idle() function for sparc64, alpha, powerpc. This is apeter2003-10-191-0/+6
| | | | MI declared function so it should be everywhere.
* Deal with 'options KSTACK_PAGES' being a global option.peter2003-07-311-0/+1
|
* Rename thread_siginfo to cpu_thread_siginfo.davidxu2003-07-151-1/+1
| | | | Suggested by: jhb
* Add a machine depended function thread_siginfo, SA signal codedavidxu2003-06-281-0/+19
| | | | | | | will use the function to construct a siginfo structure and use the result to export to userland. Reviewed by: julian
* Remove unused bootpath[] variable. It conflicted with a declarationgrehan2003-06-251-2/+0
| | | | in the sunlabel utility, causing build problems.
* - Merge struct procsig with struct sigacts.jhb2003-05-131-4/+5
| | | | | | | | | | | | | | | | | - Move struct sigacts out of the u-area and malloc() it using the M_SUBPROC malloc bucket. - Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(), sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared(). - Remove the p_sigignore, p_sigacts, and p_sigcatch macros. - Add a mutex to struct sigacts that protects all the members of the struct. - Add sigacts locking. - Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now that sigacts is locked. - Several in-kernel functions such as psignal(), tdsignal(), trapsignal(), and thread_stopped() are now MP safe. Reviewed by: arch@ Approved by: re (rwatson)
* Back out last commits. The elf64/elf32 kernel name thing was more painpeter2003-05-011-3/+1
| | | | than it was worth.
* Fix transcription error. Use == NULL, not != NULL. Fortunately thispeter2003-04-301-1/+1
| | | | was harmless.
* Look for an elf32 kernel (powerpc) and elf64 kernel (sparc64) as wellpeter2003-04-301-1/+3
| | | | as a plain "elf kernel".
* Add an argument to get_mcontext() which specified whether thedeischen2003-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | syscall return values should be cleared. The system calls getcontext() and swapcontext() want to return 0 on success but these contexts can be switched to at a later time so the return values need to be cleared in the saved register sets. Other callers of get_mcontext() would normally want the context without clearing the return values. Remove the i386-specific context saving from the KSE code. get_mcontext() is not i386-specific any more. Fix a bad pointer in the alpha get_mcontext() code. The context was being bcopy()'d from &td->tf_frame, but tf_frame is itself a pointer, so the thread was being copied instead. Spotted by jake. Glanced at by: jake Reviewed by: bde (months ago)
* Use __FBSDID rather than rcsid[].obrien2003-04-031-4/+2
|
* - Define a new md function 'casuptr'. This atomically compares and setsjeff2003-04-011-0/+8
| | | | | | | | | | a pointer that is in user space. It will be used as the basic primitive for a kernel supported user space lock implementation. - Implement this function in x86's support.s - Provide stubs that return -1 in all other architectures. Implementations will follow along shortly. Reviewed by: jake
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-3/+3
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
* Add machine check handler. While generally useful, it's required whengrehan2003-03-191-1/+1
| | | | | issuing PCI config cycles on MPC106-based PowerMacs, which cause machine checks when accessing non-existent/empty slots.
* GC an unused variable.benno2003-02-051-2/+0
|
* - Use cpu_setup() instead of identifycpu().benno2003-02-051-80/+1
| | | | - Remove identifycpu().
* - Rename the "powerpc" timecounter to the "decrementer" timecounter.benno2003-02-051-0/+5
| | | | - Initialise it earlier.
* Sync the i-cache after copying down the interrupt codegrehan2003-01-081-0/+1
| | | | Approved by: benno
OpenPOWER on IntegriCloud